fix(order): complete checkout details and deposit warning
This commit is contained in:
@@ -231,6 +231,10 @@ const paidOrderPayment = computed(() =>
|
|||||||
)
|
)
|
||||||
const currentSnapshot = computed(() => readSnapshot(order.value))
|
const currentSnapshot = computed(() => readSnapshot(order.value))
|
||||||
const snapshotHafCoinM = computed(() => getSnapshotHafCoinM(order.value))
|
const snapshotHafCoinM = computed(() => getSnapshotHafCoinM(order.value))
|
||||||
|
const checkoutRemainingHafCoinM = computed(() => {
|
||||||
|
if (!order.value?.checkout) return 0
|
||||||
|
return Number(snapshotHafCoinM.value || 0) - Number(order.value.checkout.coin_consumed_m || 0)
|
||||||
|
})
|
||||||
const snapshotResources = computed(() => readSnapshotResources(order.value).slice(0, 6))
|
const snapshotResources = computed(() => readSnapshotResources(order.value).slice(0, 6))
|
||||||
const assetSummary = computed(() => {
|
const assetSummary = computed(() => {
|
||||||
const snapshot = order.value?.account_snapshot
|
const snapshot = order.value?.account_snapshot
|
||||||
@@ -1218,6 +1222,15 @@ function paymentPaidAt(record: AdminPayment) {
|
|||||||
<dt>哈夫币消耗</dt>
|
<dt>哈夫币消耗</dt>
|
||||||
<dd>{{ quantity(order.checkout.coin_consumed_m) }}M</dd>
|
<dd>{{ quantity(order.checkout.coin_consumed_m) }}M</dd>
|
||||||
</div>
|
</div>
|
||||||
|
<div>
|
||||||
|
<dt>哈夫币预计剩余</dt>
|
||||||
|
<dd v-if="checkoutRemainingHafCoinM >= 0">
|
||||||
|
{{ quantity(checkoutRemainingHafCoinM) }}M
|
||||||
|
</dd>
|
||||||
|
<dd v-else class="danger-text">
|
||||||
|
打超 {{ quantity(-checkoutRemainingHafCoinM) }}M(按比例从押金扣)
|
||||||
|
</dd>
|
||||||
|
</div>
|
||||||
<div v-if="order.status === 'completed'">
|
<div v-if="order.status === 'completed'">
|
||||||
<dt>积分计算基数</dt>
|
<dt>积分计算基数</dt>
|
||||||
<dd>{{ moneyCent(order.growth_points_basis_cent) }}</dd>
|
<dd>{{ moneyCent(order.growth_points_basis_cent) }}</dd>
|
||||||
|
|||||||
@@ -108,7 +108,9 @@ function updateNumberField(field: 'coin_consumed_m' | 'otherAmountYuan', event:
|
|||||||
<template v-if="props.remainingHafCoinM >= 0">
|
<template v-if="props.remainingHafCoinM >= 0">
|
||||||
,预计剩余 {{ quantity(props.remainingHafCoinM) }}M
|
,预计剩余 {{ quantity(props.remainingHafCoinM) }}M
|
||||||
</template>
|
</template>
|
||||||
<template v-else>,打超 {{ quantity(-props.remainingHafCoinM) }}M(超额从押金结算)</template>
|
<template v-else
|
||||||
|
>,打超 {{ quantity(-props.remainingHafCoinM) }}M(超额从押金结算)</template
|
||||||
|
>
|
||||||
</div>
|
</div>
|
||||||
<van-field label="押金赔付扣除" label-width="100px">
|
<van-field label="押金赔付扣除" label-width="100px">
|
||||||
<template #input>
|
<template #input>
|
||||||
@@ -125,6 +127,14 @@ function updateNumberField(field: 'coin_consumed_m' | 'otherAmountYuan', event:
|
|||||||
</template>
|
</template>
|
||||||
</van-field>
|
</van-field>
|
||||||
<div class="deposit-deduct-hint">仅填写封禁、违规、资产损坏等需要从押金赔付的费用。</div>
|
<div class="deposit-deduct-hint">仅填写封禁、违规、资产损坏等需要从押金赔付的费用。</div>
|
||||||
|
<div
|
||||||
|
v-if="Number(props.checkoutForm.otherAmountYuan || 0) > 0"
|
||||||
|
class="deposit-deduct-warning"
|
||||||
|
>
|
||||||
|
注意:提交后将直接从预收押金中扣除 ¥{{
|
||||||
|
money(props.checkoutForm.otherAmountYuan)
|
||||||
|
}},并计入号主赔付。
|
||||||
|
</div>
|
||||||
</van-cell-group>
|
</van-cell-group>
|
||||||
|
|
||||||
<div class="checkout-fee-preview">
|
<div class="checkout-fee-preview">
|
||||||
@@ -250,6 +260,14 @@ function updateNumberField(field: 'coin_consumed_m' | 'otherAmountYuan', event:
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div
|
||||||
|
v-if="Number(props.checkoutForm.otherAmountYuan || 0) > 0"
|
||||||
|
class="deposit-deduct-warning"
|
||||||
|
>
|
||||||
|
注意:提交后将直接从预收押金中扣除 ¥{{
|
||||||
|
money(props.checkoutForm.otherAmountYuan)
|
||||||
|
}},并计入号主赔付。
|
||||||
|
</div>
|
||||||
<div class="checkout-deduct-preview">
|
<div class="checkout-deduct-preview">
|
||||||
<div>
|
<div>
|
||||||
<span>额外消耗品已用</span>
|
<span>额外消耗品已用</span>
|
||||||
@@ -659,6 +677,16 @@ function updateNumberField(field: 'coin_consumed_m' | 'otherAmountYuan', event:
|
|||||||
line-height: 1.5;
|
line-height: 1.5;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.deposit-deduct-warning {
|
||||||
|
padding: 8px 10px;
|
||||||
|
border: 1px solid #fed7aa;
|
||||||
|
border-radius: 6px;
|
||||||
|
background: #fff7ed;
|
||||||
|
color: #c2410c;
|
||||||
|
font-size: 12px;
|
||||||
|
line-height: 1.5;
|
||||||
|
}
|
||||||
|
|
||||||
.checkout-fee-preview {
|
.checkout-fee-preview {
|
||||||
margin: 0 16px 12px;
|
margin: 0 16px 12px;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -367,11 +367,17 @@ export function useOrderActions(options: UseOrderActionsOptions) {
|
|||||||
|
|
||||||
async function handleSubmitCheckout() {
|
async function handleSubmitCheckout() {
|
||||||
if (!order.value) return
|
if (!order.value) return
|
||||||
|
const depositDeductAmountYuan = Number(checkoutForm.value.otherAmountYuan || 0)
|
||||||
if (needsConfirm('submitCheckout')) {
|
if (needsConfirm('submitCheckout')) {
|
||||||
|
const depositWarning =
|
||||||
|
depositDeductAmountYuan > 0
|
||||||
|
? `\n\n注意:押金赔付扣除 ¥${depositDeductAmountYuan.toFixed(2)} 将直接从预收押金中扣除,并计入号主赔付。`
|
||||||
|
: ''
|
||||||
const ok = await options.confirm({
|
const ok = await options.confirm({
|
||||||
title: '确认提交结账',
|
title: '确认提交结账',
|
||||||
message:
|
message:
|
||||||
'结账数据会影响租金、押金赔付和双方结算金额。请确认哈夫币消耗、额外消耗品、押金赔付和证据链接已认真核对,提交后将发送给号主确认。',
|
'结账数据会影响租金、押金赔付和双方结算金额。请确认哈夫币消耗、额外消耗品、押金赔付和证据链接已认真核对,提交后将发送给号主确认。' +
|
||||||
|
depositWarning,
|
||||||
})
|
})
|
||||||
if (!ok) return
|
if (!ok) return
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import type { Checkout, Order } from '../api/orders'
|
|||||||
export interface CheckoutFormSnapshot {
|
export interface CheckoutFormSnapshot {
|
||||||
content: string
|
content: string
|
||||||
coin_consumed_m: number
|
coin_consumed_m: number
|
||||||
|
otherAmountYuan?: number
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface CounterFormSnapshot {
|
export interface CounterFormSnapshot {
|
||||||
@@ -37,9 +38,7 @@ export function useOrderCheckoutSnapshot(options: {
|
|||||||
const snapshotHafCoinM = computed(() => getSnapshotHafCoinM(options.order.value))
|
const snapshotHafCoinM = computed(() => getSnapshotHafCoinM(options.order.value))
|
||||||
// 允许为负:表示打超(实际消耗 > 发布量)
|
// 允许为负:表示打超(实际消耗 > 发布量)
|
||||||
const remainingHafCoinM = computed(() =>
|
const remainingHafCoinM = computed(() =>
|
||||||
roundQuantity(
|
roundQuantity(snapshotHafCoinM.value - Number(options.checkoutForm.value.coin_consumed_m || 0))
|
||||||
snapshotHafCoinM.value - Number(options.checkoutForm.value.coin_consumed_m || 0)
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
|
|
||||||
function hydrateResourceUsage() {
|
function hydrateResourceUsage() {
|
||||||
@@ -61,6 +60,7 @@ export function useOrderCheckoutSnapshot(options: {
|
|||||||
return buildCheckoutContentWithSummary({
|
return buildCheckoutContentWithSummary({
|
||||||
content: options.checkoutForm.value.content,
|
content: options.checkoutForm.value.content,
|
||||||
coinConsumedM: options.checkoutForm.value.coin_consumed_m,
|
coinConsumedM: options.checkoutForm.value.coin_consumed_m,
|
||||||
|
depositDeductAmountYuan: options.checkoutForm.value.otherAmountYuan,
|
||||||
checkoutResources: checkoutResources.value,
|
checkoutResources: checkoutResources.value,
|
||||||
resourceUsage: options.resourceUsage.value,
|
resourceUsage: options.resourceUsage.value,
|
||||||
remainingHafCoinM: remainingHafCoinM.value,
|
remainingHafCoinM: remainingHafCoinM.value,
|
||||||
@@ -146,6 +146,7 @@ export function calculateResourceChargeAmount(
|
|||||||
export function buildCheckoutContentWithSummary(options: {
|
export function buildCheckoutContentWithSummary(options: {
|
||||||
content: string
|
content: string
|
||||||
coinConsumedM: number
|
coinConsumedM: number
|
||||||
|
depositDeductAmountYuan?: number
|
||||||
checkoutResources: CheckoutResource[]
|
checkoutResources: CheckoutResource[]
|
||||||
resourceUsage: Record<string, number>
|
resourceUsage: Record<string, number>
|
||||||
remainingHafCoinM: number
|
remainingHafCoinM: number
|
||||||
@@ -170,13 +171,19 @@ export function buildCheckoutContentWithSummary(options: {
|
|||||||
if (Number(options.coinConsumedM || 0) > 0) {
|
if (Number(options.coinConsumedM || 0) > 0) {
|
||||||
const remain = Number(options.remainingHafCoinM || 0)
|
const remain = Number(options.remainingHafCoinM || 0)
|
||||||
if (remain >= 0) {
|
if (remain >= 0) {
|
||||||
lines.push(`哈夫币实际消耗:${quantity(options.coinConsumedM)}M,预计剩余${quantity(remain)}M`)
|
lines.push(
|
||||||
|
`哈夫币实际消耗:${quantity(options.coinConsumedM)}M,预计剩余${quantity(remain)}M`
|
||||||
|
)
|
||||||
} else {
|
} else {
|
||||||
lines.push(
|
lines.push(
|
||||||
`哈夫币实际消耗:${quantity(options.coinConsumedM)}M,打超${quantity(-remain)}M(超额按比例从押金结算)`
|
`哈夫币实际消耗:${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) {
|
if (lines.length === 0) {
|
||||||
lines.push('租客发起结账。')
|
lines.push('租客发起结账。')
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user