统一结账押金字段为押金赔付扣除

号主修正去掉无效的其他押金扣款,仅保留押金赔付扣除;
前后端与账单文案统一,修正时 other 与 deduct 对齐。
This commit is contained in:
yml2213
2026-07-17 17:17:29 +08:00
parent c492a1cc85
commit 98772867a7
8 changed files with 25 additions and 42 deletions
@@ -337,7 +337,7 @@ func buildArbitrationHandoffContent(req ArbitrateRequest, settlement arbitration
content += "\n结算给号主:" + money.FormatWithSymbol(settlement.OwnerIncomeAmountCent) content += "\n结算给号主:" + money.FormatWithSymbol(settlement.OwnerIncomeAmountCent)
} }
if settlement.DepositDeductAmountCent > 0 { if settlement.DepositDeductAmountCent > 0 {
content += "\n押金扣除:" + money.FormatWithSymbol(settlement.DepositDeductAmountCent) content += "\n押金赔付扣除:" + money.FormatWithSymbol(settlement.DepositDeductAmountCent)
} }
return content return content
} }
+6 -1
View File
@@ -139,7 +139,12 @@ func (r *Repository) CounterCheckout(ctx context.Context, userID uint64, orderID
First(&checkout).Error; err != nil { First(&checkout).Error; err != nil {
return err return err
} }
next, err := buildCheckout(order, checkout.InitiatedBy, checkoutStatusCountered, checkout.Content, req.EvidenceURLS, req.ConsumableAmountCent, req.CoinConsumedM, req.OtherAmountCent, req.DepositDeductAmountCent, true) // 号主修正只认押金赔付扣除;other 与 deduct 对齐,避免双字段语义分裂
depositDeductCent := req.DepositDeductAmountCent
if depositDeductCent <= 0 && req.OtherAmountCent > 0 {
depositDeductCent = req.OtherAmountCent
}
next, err := buildCheckout(order, checkout.InitiatedBy, checkoutStatusCountered, checkout.Content, req.EvidenceURLS, req.ConsumableAmountCent, req.CoinConsumedM, depositDeductCent, depositDeductCent, true)
if err != nil { if err != nil {
return err return err
} }
@@ -821,7 +821,7 @@ function paymentPaidAt(record: AdminPayment) {
<dd>{{ moneyCent(order.checkout.owner_income_amount_cent) }}</dd> <dd>{{ moneyCent(order.checkout.owner_income_amount_cent) }}</dd>
</div> </div>
<div> <div>
<dt>押金扣除</dt> <dt>押金赔付扣除</dt>
<dd>{{ moneyCent(order.checkout.deposit_deduct_amount_cent) }}</dd> <dd>{{ moneyCent(order.checkout.deposit_deduct_amount_cent) }}</dd>
</div> </div>
<div> <div>
@@ -107,7 +107,7 @@ function updateNumberField(field: 'coin_consumed_m' | 'otherAmountYuan', event:
订单快照 {{ quantity(props.snapshotHafCoinM) }}M预计剩余 订单快照 {{ quantity(props.snapshotHafCoinM) }}M预计剩余
{{ quantity(props.remainingHafCoinM) }}M {{ quantity(props.remainingHafCoinM) }}M
</div> </div>
<van-field label="其他押金赔付" label-width="100px"> <van-field label="押金赔付扣除" label-width="100px">
<template #input> <template #input>
<div class="coin-input-wrap"> <div class="coin-input-wrap">
<input <input
@@ -131,9 +131,9 @@ function updateNumberField(field: 'coin_consumed_m' | 'otherAmountYuan', event:
<em>计入实际结算租金</em> <em>计入实际结算租金</em>
</div> </div>
<div> <div>
<span>其他押金赔付</span> <span>押金赔付扣除</span>
<strong>¥{{ money(props.checkoutForm.otherAmountYuan) }}</strong> <strong>¥{{ money(props.checkoutForm.otherAmountYuan) }}</strong>
<em>押金赔付扣除</em> <em>预收押金中扣除</em>
</div> </div>
</div> </div>
@@ -225,7 +225,7 @@ function updateNumberField(field: 'coin_consumed_m' | 'otherAmountYuan', event:
<div class="checkout-number-card deposit"> <div class="checkout-number-card deposit">
<div class="checkout-number-copy"> <div class="checkout-number-copy">
<div class="checkout-number-title"> <div class="checkout-number-title">
<strong>其他押金赔付</strong> <strong>押金赔付扣除</strong>
<span>仅押金扣除项</span> <span>仅押金扣除项</span>
</div> </div>
<p>封禁违规资产损坏等需要从押金赔付的费用不含额外消耗品</p> <p>封禁违规资产损坏等需要从押金赔付的费用不含额外消耗品</p>
@@ -250,9 +250,9 @@ function updateNumberField(field: 'coin_consumed_m' | 'otherAmountYuan', event:
<em>按上方物资数量自动计算计入实际结算租金</em> <em>按上方物资数量自动计算计入实际结算租金</em>
</div> </div>
<div> <div>
<span>其他押金赔付</span> <span>押金赔付扣除</span>
<strong>¥{{ money(props.checkoutForm.otherAmountYuan) }}</strong> <strong>¥{{ money(props.checkoutForm.otherAmountYuan) }}</strong>
<em>作为押金赔付扣除额外消耗品分开展示</em> <em>从预收押金中扣除额外消耗品分开展示</em>
</div> </div>
</div> </div>
<el-input <el-input
@@ -92,7 +92,6 @@ export interface CheckoutFormState {
export interface CounterFormState { export interface CounterFormState {
consumableAmountYuan: number consumableAmountYuan: number
coin_consumed_m: number coin_consumed_m: number
otherAmountYuan: number
depositDeductAmountYuan: number depositDeductAmountYuan: number
reason: string reason: string
evidenceText: string evidenceText: string
@@ -112,7 +111,6 @@ function createCounterForm(): CounterFormState {
return { return {
consumableAmountYuan: 0, consumableAmountYuan: 0,
coin_consumed_m: 0, coin_consumed_m: 0,
otherAmountYuan: 0,
depositDeductAmountYuan: 0, depositDeductAmountYuan: 0,
reason: '', reason: '',
evidenceText: '', evidenceText: '',
@@ -395,7 +393,8 @@ export function useOrderActions(options: UseOrderActionsOptions) {
content: reasonText, content: reasonText,
consumableAmountYuan: counterForm.value.consumableAmountYuan, consumableAmountYuan: counterForm.value.consumableAmountYuan,
coin_consumed_m: counterForm.value.coin_consumed_m, coin_consumed_m: counterForm.value.coin_consumed_m,
otherAmountYuan: counterForm.value.otherAmountYuan, // 号主修正只保留「押金赔付扣除」;与 other 同步写入,兼容旧字段语义
otherAmountYuan: counterForm.value.depositDeductAmountYuan,
depositDeductAmountYuan: counterForm.value.depositDeductAmountYuan, depositDeductAmountYuan: counterForm.value.depositDeductAmountYuan,
reason: reasonText, reason: reasonText,
evidence_urls: linesToList(counterForm.value.evidenceText), evidence_urls: linesToList(counterForm.value.evidenceText),
@@ -11,7 +11,6 @@ export interface CheckoutFormSnapshot {
export interface CounterFormSnapshot { export interface CounterFormSnapshot {
consumableAmountYuan: number consumableAmountYuan: number
coin_consumed_m: number coin_consumed_m: number
otherAmountYuan: number
depositDeductAmountYuan: number depositDeductAmountYuan: number
reason: string reason: string
evidenceText: string evidenceText: string
@@ -181,11 +180,16 @@ export function buildCheckoutContentWithSummary(options: {
} }
export function hydrateCounterFormFromCheckout(checkout: Checkout): CounterFormSnapshot { export function hydrateCounterFormFromCheckout(checkout: Checkout): CounterFormSnapshot {
// 号主修正只暴露押金赔付扣除;优先用结算字段,兼容旧单 only other 的情况
const depositDeductYuan = amountYuan(
checkout.deposit_deduct_amount_cent > 0
? checkout.deposit_deduct_amount_cent
: checkout.other_amount_cent
)
return { return {
consumableAmountYuan: amountYuan(checkout.consumable_amount_cent), consumableAmountYuan: amountYuan(checkout.consumable_amount_cent),
coin_consumed_m: checkout.coin_consumed_m, coin_consumed_m: checkout.coin_consumed_m,
otherAmountYuan: amountYuan(checkout.other_amount_cent), depositDeductAmountYuan: depositDeductYuan,
depositDeductAmountYuan: amountYuan(checkout.deposit_deduct_amount_cent),
reason: '', reason: '',
evidenceText: '', evidenceText: '',
} }
@@ -193,16 +197,9 @@ export function hydrateCounterFormFromCheckout(checkout: Checkout): CounterFormS
export function calculateCounterTotal(counterForm: { export function calculateCounterTotal(counterForm: {
consumableAmountYuan: number consumableAmountYuan: number
coin_consumed_m: number
otherAmountYuan: number
depositDeductAmountYuan: number depositDeductAmountYuan: number
}) { }) {
return roundMoney( return roundMoney(counterForm.consumableAmountYuan + counterForm.depositDeductAmountYuan)
counterForm.consumableAmountYuan +
counterForm.coin_consumed_m +
counterForm.otherAmountYuan +
counterForm.depositDeductAmountYuan
)
} }
export function getSnapshotHafCoinM(order: Order | null) { export function getSnapshotHafCoinM(order: Order | null) {
@@ -465,15 +465,6 @@ async function copyListingCode() {
/> />
</template> </template>
</van-field> </van-field>
<van-field label="其他押金扣款">
<template #input>
<input
v-model.number="counterForm.otherAmountYuan"
type="number"
class="custom-inline-input"
/>
</template>
</van-field>
<van-field label="押金赔付扣除" required> <van-field label="押金赔付扣除" required>
<template #input> <template #input>
<input <input
@@ -508,16 +508,7 @@ watch([() => route.query.focus, order, loading], () => {
controls-position="right" controls-position="right"
/> />
</el-form-item> </el-form-item>
<el-form-item label="其他押金扣款(元)"> <el-form-item label="押金赔付扣除(元)">
<el-input-number
v-model="counterForm.otherAmountYuan"
class="full-control"
:min="0"
:precision="0"
controls-position="right"
/>
</el-form-item>
<el-form-item label="押金扣除(元)">
<el-input-number <el-input-number
v-model="counterForm.depositDeductAmountYuan" v-model="counterForm.depositDeductAmountYuan"
class="full-control" class="full-control"