金额使用整数, 不再扣押金, 价格每个人看到自己的-1
This commit is contained in:
@@ -64,6 +64,7 @@ const disputeEvidenceText = ref('')
|
||||
|
||||
const isOwner = computed(() => order.value?.owner_id === session.userId)
|
||||
const isRenter = computed(() => order.value?.renter_id === session.userId)
|
||||
const orderAmountLabel = computed(() => (isOwner.value ? '我的租金' : '订单金额'))
|
||||
const canOpenDispute = computed(() => {
|
||||
if (!order.value || (!isOwner.value && !isRenter.value)) return false
|
||||
return !['completed', 'cancelled', 'closed', 'disputing', 'checkout_disputing', 'abnormal'].includes(order.value.status)
|
||||
@@ -86,10 +87,10 @@ const resourceChargeAmount = computed(() => {
|
||||
})
|
||||
const snapshotHafCoinM = computed(() => {
|
||||
const snapshot = readSnapshot()
|
||||
return roundMoney(readNumber(snapshot?.haf_coin_amount) / 1000000)
|
||||
return roundQuantity(readNumber(snapshot?.haf_coin_amount) / 1000000)
|
||||
})
|
||||
const remainingHafCoinM = computed(() => {
|
||||
return roundMoney(Math.max(snapshotHafCoinM.value - Number(checkoutForm.value.coin_consumed_m || 0), 0))
|
||||
return roundQuantity(Math.max(snapshotHafCoinM.value - Number(checkoutForm.value.coin_consumed_m || 0), 0))
|
||||
})
|
||||
|
||||
onMounted(loadOrder)
|
||||
@@ -387,12 +388,12 @@ function checkoutContentWithSummary() {
|
||||
if (usedResources.length) {
|
||||
lines.push(
|
||||
`额外消耗品:${usedResources
|
||||
.map((item) => `${item.label} ${readResourceUsage(item.key)}/${item.quantity}${isChargedResource(item) ? `,扣款¥${resourceLineAmount(item).toFixed(2)}` : ',赠送不扣款'}`)
|
||||
.map((item) => `${item.label} ${readResourceUsage(item.key)}/${item.quantity}${isChargedResource(item) ? `,金额¥${money(resourceLineAmount(item))}` : ',赠送不扣款'}`)
|
||||
.join(';')}`,
|
||||
)
|
||||
}
|
||||
if (Number(checkoutForm.value.coin_consumed_m || 0) > 0) {
|
||||
lines.push(`哈夫币消耗:${Number(checkoutForm.value.coin_consumed_m).toFixed(2)}M,预计剩余${remainingHafCoinM.value.toFixed(2)}M`)
|
||||
lines.push(`哈夫币消耗:${quantity(Number(checkoutForm.value.coin_consumed_m))}M,预计剩余${quantity(remainingHafCoinM.value)}M`)
|
||||
}
|
||||
if (lines.length === 0) {
|
||||
lines.push('租客发起结账。')
|
||||
@@ -415,9 +416,22 @@ function readUnitPrice(priceText: string) {
|
||||
}
|
||||
|
||||
function roundMoney(value: number) {
|
||||
return Math.round(value)
|
||||
}
|
||||
|
||||
function roundQuantity(value: number) {
|
||||
return Math.round(value * 100) / 100
|
||||
}
|
||||
|
||||
function money(value: unknown) {
|
||||
return `${roundMoney(readNumber(value))}`
|
||||
}
|
||||
|
||||
function quantity(value: unknown) {
|
||||
const rounded = roundQuantity(readNumber(value))
|
||||
return Number.isInteger(rounded) ? `${rounded}` : rounded.toFixed(2)
|
||||
}
|
||||
|
||||
function readNumber(value: unknown) {
|
||||
const number = Number(value || 0)
|
||||
return Number.isFinite(number) ? number : 0
|
||||
@@ -462,16 +476,12 @@ function linesToList(value: string) {
|
||||
<strong>{{ handoffStatusLabel(order.handoff_status) }}</strong>
|
||||
</div>
|
||||
<div class="metric-card">
|
||||
<span>订单金额</span>
|
||||
<strong>¥{{ order.rent_amount }}</strong>
|
||||
</div>
|
||||
<div class="metric-card">
|
||||
<span>平台费用</span>
|
||||
<strong>¥{{ order.platform_fee }}</strong>
|
||||
<span>{{ orderAmountLabel }}</span>
|
||||
<strong>¥{{ money(order.display_amount) }}</strong>
|
||||
</div>
|
||||
<div class="metric-card">
|
||||
<span>押金</span>
|
||||
<strong>¥{{ order.deposit_amount }}</strong>
|
||||
<strong>¥{{ money(order.deposit_amount) }}</strong>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -518,7 +528,7 @@ function linesToList(value: string) {
|
||||
<div class="checkout-resource-panel panel-action">
|
||||
<div class="checkout-resource-head">
|
||||
<strong>额外消耗品</strong>
|
||||
<span>扣款合计:¥{{ resourceChargeAmount.toFixed(2) }}</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">
|
||||
@@ -533,16 +543,16 @@ function linesToList(value: string) {
|
||||
:precision="0"
|
||||
controls-position="right"
|
||||
/>
|
||||
<span class="checkout-resource-amount">¥{{ resourceLineAmount(item).toFixed(2) }}</span>
|
||||
<span class="checkout-resource-amount">¥{{ money(resourceLineAmount(item)) }}</span>
|
||||
</div>
|
||||
</div>
|
||||
<el-form class="form-grid panel-action" label-position="top">
|
||||
<el-form-item label="消耗哈夫币(M)">
|
||||
<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">订单快照 {{ snapshotHafCoinM.toFixed(2) }}M,预计剩余 {{ remainingHafCoinM.toFixed(2) }}M</span>
|
||||
<span class="field-hint">订单快照 {{ quantity(snapshotHafCoinM) }}M,预计剩余 {{ quantity(remainingHafCoinM) }}M</span>
|
||||
</el-form-item>
|
||||
<el-form-item label="其他扣款(元)">
|
||||
<el-input-number v-model="checkoutForm.other_amount" class="full-control" :min="0" :precision="2" controls-position="right" />
|
||||
<el-input-number v-model="checkoutForm.other_amount" class="full-control" :min="0" :precision="0" controls-position="right" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<el-input
|
||||
@@ -557,9 +567,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>买家租金:¥{{ order.checkout.rent_amount }},号主租金:¥{{ order.checkout.owner_rent_amount }},平台费用:¥{{ order.checkout.platform_fee }}</p>
|
||||
<p>押金:¥{{ order.checkout.deposit_amount }}</p>
|
||||
<p>扣除:¥{{ order.checkout.deposit_deduct_amount }},退还租客:¥{{ order.checkout.renter_refund_amount }},号主收入:¥{{ order.checkout.owner_income_amount }}</p>
|
||||
<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 v-if="order.checkout.content">说明:{{ order.checkout.content }}</p>
|
||||
<p v-if="order.checkout.owner_adjustment_reason">修正原因:{{ order.checkout.owner_adjustment_reason }}</p>
|
||||
</div>
|
||||
@@ -571,17 +582,17 @@ function linesToList(value: string) {
|
||||
|
||||
<h2 class="panel-action">修改结账</h2>
|
||||
<el-form class="form-grid" label-position="top">
|
||||
<el-form-item label="消耗扣款(元)">
|
||||
<el-input-number v-model="counterForm.consumable_amount" class="full-control" :min="0" :precision="2" controls-position="right" />
|
||||
<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-input-number v-model="counterForm.other_amount" class="full-control" :min="0" :precision="2" controls-position="right" />
|
||||
<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="押金扣除(元)">
|
||||
<el-input-number v-model="counterForm.deposit_deduct_amount" class="full-control" :min="0" :max="order.deposit_amount" :precision="2" controls-position="right" />
|
||||
<el-input-number v-model="counterForm.deposit_deduct_amount" class="full-control" :min="0" :max="order.deposit_amount" :precision="0" controls-position="right" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<el-input v-model="counterForm.reason" class="panel-action" type="textarea" :rows="3" placeholder="填写修改原因" />
|
||||
|
||||
Reference in New Issue
Block a user