收敛前端金额表单命名

This commit is contained in:
yml
2026-06-09 20:59:50 +08:00
parent 60324765c5
commit 9cc959afc4
19 changed files with 103 additions and 232 deletions
+6 -6
View File
@@ -111,10 +111,10 @@ export interface PostRentalNotice {
export interface SubmitCheckoutPayload {
content: string
consumable_amount?: number
consumableAmountYuan?: number
coin_consumed_m: number
other_amount?: number
deposit_deduct_amount?: number
otherAmountYuan?: number
depositDeductAmountYuan?: number
evidence_urls: string[]
reason?: string
}
@@ -145,10 +145,10 @@ export interface RefundStatus {
function toCheckoutRequest(payload: SubmitCheckoutPayload): SubmitCheckoutRequest {
return {
content: payload.content,
consumable_amount_cent: yuanToCent(payload.consumable_amount),
consumable_amount_cent: yuanToCent(payload.consumableAmountYuan),
coin_consumed_m: payload.coin_consumed_m,
other_amount_cent: yuanToCent(payload.other_amount),
deposit_deduct_amount_cent: yuanToCent(payload.deposit_deduct_amount),
other_amount_cent: yuanToCent(payload.otherAmountYuan),
deposit_deduct_amount_cent: yuanToCent(payload.depositDeductAmountYuan),
evidence_urls: payload.evidence_urls,
reason: payload.reason,
}
@@ -78,16 +78,16 @@ export function calculateCheckoutTotal(
}
export function calculateCounterTotal(counterForm: {
consumable_amount: number
consumableAmountYuan: number
coin_consumed_m: number
other_amount: number
deposit_deduct_amount: number
otherAmountYuan: number
depositDeductAmountYuan: number
}): number {
return roundMoney(
counterForm.consumable_amount +
counterForm.consumableAmountYuan +
counterForm.coin_consumed_m +
counterForm.other_amount +
counterForm.deposit_deduct_amount
counterForm.otherAmountYuan +
counterForm.depositDeductAmountYuan
)
}
@@ -127,10 +127,10 @@ export function hydrateCounterFormFromOrder(order: Order | null) {
try {
const info = JSON.parse(order.counter_info) as Record<string, any>
return {
consumable_amount: readNumber(info.consumable_amount),
consumableAmountYuan: readNumber(info.consumableAmountYuan),
coin_consumed_m: readNumber(info.coin_consumed_m),
other_amount: readNumber(info.other_amount),
deposit_deduct_amount: readNumber(info.deposit_deduct_amount),
otherAmountYuan: readNumber(info.otherAmountYuan),
depositDeductAmountYuan: readNumber(info.depositDeductAmountYuan),
reason: String(info.reason || ''),
evidenceText: String(info.evidence || ''),
}
@@ -4,17 +4,17 @@ import type { Order } from '../api/orders'
export interface CheckoutForm {
content: string
consumable_amount: number
consumableAmountYuan: number
coin_consumed_m: number
other_amount: number
otherAmountYuan: number
evidenceText: string
}
export interface CounterForm {
consumable_amount: number
consumableAmountYuan: number
coin_consumed_m: number
other_amount: number
deposit_deduct_amount: number
otherAmountYuan: number
depositDeductAmountYuan: number
reason: string
evidenceText: string
}
@@ -32,17 +32,17 @@ export function useSettlement(order: Ref<Order | null>) {
const checkoutForm = ref<CheckoutForm>({
content: '',
consumable_amount: 0,
consumableAmountYuan: 0,
coin_consumed_m: 0,
other_amount: 0,
otherAmountYuan: 0,
evidenceText: '',
})
const counterForm = ref<CounterForm>({
consumable_amount: 0,
consumableAmountYuan: 0,
coin_consumed_m: 0,
other_amount: 0,
deposit_deduct_amount: 0,
otherAmountYuan: 0,
depositDeductAmountYuan: 0,
reason: '',
evidenceText: '',
})
@@ -58,9 +58,9 @@ export function useSettlement(order: Ref<Order | null>) {
try {
await submitCheckout(order.value.id, {
content: checkoutForm.value.content.trim(),
consumable_amount: checkoutForm.value.consumable_amount,
consumableAmountYuan: checkoutForm.value.consumableAmountYuan,
coin_consumed_m: checkoutForm.value.coin_consumed_m,
other_amount: checkoutForm.value.other_amount,
otherAmountYuan: checkoutForm.value.otherAmountYuan,
evidence_urls: linesToList(checkoutForm.value.evidenceText),
})
onSuccess?.()
@@ -95,10 +95,10 @@ export function useSettlement(order: Ref<Order | null>) {
const reasonText = counterForm.value.reason.trim()
await counterCheckout(order.value.id, {
content: reasonText,
consumable_amount: counterForm.value.consumable_amount,
consumableAmountYuan: counterForm.value.consumableAmountYuan,
coin_consumed_m: counterForm.value.coin_consumed_m,
other_amount: counterForm.value.other_amount,
deposit_deduct_amount: counterForm.value.deposit_deduct_amount,
otherAmountYuan: counterForm.value.otherAmountYuan,
depositDeductAmountYuan: counterForm.value.depositDeductAmountYuan,
reason: reasonText,
evidence_urls: linesToList(counterForm.value.evidenceText),
})
@@ -119,10 +119,10 @@ export function useSettlement(order: Ref<Order | null>) {
const reasonText = reason.trim()
await counterCheckout(order.value.id, {
content: reasonText,
consumable_amount: 0,
consumableAmountYuan: 0,
coin_consumed_m: 0,
other_amount: 0,
deposit_deduct_amount: 0,
otherAmountYuan: 0,
depositDeductAmountYuan: 0,
reason: reasonText,
evidence_urls: [],
})
@@ -51,17 +51,17 @@ const listingCode = computed(() =>
const handoffContent = ref('')
const checkoutForm = ref({
content: '',
consumable_amount: 0,
consumableAmountYuan: 0,
coin_consumed_m: 0,
other_amount: 0,
otherAmountYuan: 0,
evidenceText: '',
})
const resourceUsage = ref<Record<string, number>>({})
const counterForm = ref({
consumable_amount: 0,
consumableAmountYuan: 0,
coin_consumed_m: 0,
other_amount: 0,
deposit_deduct_amount: 0,
otherAmountYuan: 0,
depositDeductAmountYuan: 0,
reason: '',
evidenceText: '',
})
@@ -231,19 +231,19 @@ async function handleSubmitCheckout() {
returning.value = true
try {
const consumableAmount = resourceChargeAmount.value
checkoutForm.value.consumable_amount = consumableAmount
checkoutForm.value.consumableAmountYuan = consumableAmount
await submitCheckout(order.value.id, {
content: checkoutContentWithSummary(),
consumable_amount: consumableAmount,
consumableAmountYuan: consumableAmount,
coin_consumed_m: checkoutForm.value.coin_consumed_m,
other_amount: checkoutForm.value.other_amount,
otherAmountYuan: checkoutForm.value.otherAmountYuan,
evidence_urls: linesToList(checkoutForm.value.evidenceText),
})
checkoutForm.value = {
content: '',
consumable_amount: 0,
consumableAmountYuan: 0,
coin_consumed_m: 0,
other_amount: 0,
otherAmountYuan: 0,
evidenceText: '',
}
resourceUsage.value = {}
@@ -283,10 +283,10 @@ async function handleCounterCheckout() {
const reasonText = counterForm.value.reason.trim()
await counterCheckout(order.value.id, {
content: reasonText,
consumable_amount: counterForm.value.consumable_amount,
consumableAmountYuan: counterForm.value.consumableAmountYuan,
coin_consumed_m: counterForm.value.coin_consumed_m,
other_amount: counterForm.value.other_amount,
deposit_deduct_amount: counterForm.value.deposit_deduct_amount,
otherAmountYuan: counterForm.value.otherAmountYuan,
depositDeductAmountYuan: counterForm.value.depositDeductAmountYuan,
reason: reasonText,
evidence_urls: linesToList(counterForm.value.evidenceText),
})
@@ -592,10 +592,10 @@ function isRecord(value: unknown): value is Record<string, unknown> {
function hydrateCounterForm() {
if (!order.value?.checkout) return
const checkout = order.value.checkout
counterForm.value.consumable_amount = amountYuan(checkout.consumable_amount_cent)
counterForm.value.consumableAmountYuan = amountYuan(checkout.consumable_amount_cent)
counterForm.value.coin_consumed_m = checkout.coin_consumed_m
counterForm.value.other_amount = amountYuan(checkout.other_amount_cent)
counterForm.value.deposit_deduct_amount = amountYuan(checkout.deposit_deduct_amount_cent)
counterForm.value.otherAmountYuan = amountYuan(checkout.other_amount_cent)
counterForm.value.depositDeductAmountYuan = amountYuan(checkout.deposit_deduct_amount_cent)
}
function linesToList(value: string) {
@@ -882,7 +882,7 @@ async function copyListingCode() {
<template #input>
<div class="coin-input-wrap">
<input
v-model.number="checkoutForm.other_amount"
v-model.number="checkoutForm.otherAmountYuan"
type="number"
placeholder="不含上方额外物资"
class="custom-inline-input"
@@ -901,7 +901,7 @@ async function copyListingCode() {
</div>
<div>
<span>其他押金赔付</span>
<strong>¥{{ money(checkoutForm.other_amount) }}</strong>
<strong>¥{{ money(checkoutForm.otherAmountYuan) }}</strong>
<em>从押金赔付扣除</em>
</div>
</div>
@@ -1090,7 +1090,7 @@ async function copyListingCode() {
<van-field label="额外消耗品已用">
<template #input>
<input
v-model.number="counterForm.consumable_amount"
v-model.number="counterForm.consumableAmountYuan"
type="number"
class="custom-inline-input"
/>
@@ -1108,7 +1108,7 @@ async function copyListingCode() {
<van-field label="其他押金扣款">
<template #input>
<input
v-model.number="counterForm.other_amount"
v-model.number="counterForm.otherAmountYuan"
type="number"
class="custom-inline-input"
/>
@@ -1117,7 +1117,7 @@ async function copyListingCode() {
<van-field label="押金赔付扣除" required>
<template #input>
<input
v-model.number="counterForm.deposit_deduct_amount"
v-model.number="counterForm.depositDeductAmountYuan"
type="number"
class="custom-inline-input"
/>
@@ -60,17 +60,17 @@ const checkingPayment = ref(false)
let paymentPollingTimer: number | undefined
const checkoutForm = ref({
content: '',
consumable_amount: 0,
consumableAmountYuan: 0,
coin_consumed_m: 0,
other_amount: 0,
otherAmountYuan: 0,
evidenceText: '',
})
const resourceUsage = ref<Record<string, number>>({})
const counterForm = ref({
consumable_amount: 0,
consumableAmountYuan: 0,
coin_consumed_m: 0,
other_amount: 0,
deposit_deduct_amount: 0,
otherAmountYuan: 0,
depositDeductAmountYuan: 0,
reason: '',
evidenceText: '',
})
@@ -321,19 +321,19 @@ async function handleSubmitCheckout() {
returning.value = true
try {
const consumableAmount = resourceChargeAmount.value
checkoutForm.value.consumable_amount = consumableAmount
checkoutForm.value.consumableAmountYuan = consumableAmount
await submitCheckout(order.value.id, {
content: checkoutContentWithSummary(),
consumable_amount: consumableAmount,
consumableAmountYuan: consumableAmount,
coin_consumed_m: checkoutForm.value.coin_consumed_m,
other_amount: checkoutForm.value.other_amount,
otherAmountYuan: checkoutForm.value.otherAmountYuan,
evidence_urls: linesToList(checkoutForm.value.evidenceText),
})
checkoutForm.value = {
content: '',
consumable_amount: 0,
consumableAmountYuan: 0,
coin_consumed_m: 0,
other_amount: 0,
otherAmountYuan: 0,
evidenceText: '',
}
resourceUsage.value = {}
@@ -367,10 +367,10 @@ async function handleCounterCheckout() {
const reasonText = counterForm.value.reason.trim()
await counterCheckout(order.value.id, {
content: reasonText,
consumable_amount: counterForm.value.consumable_amount,
consumableAmountYuan: counterForm.value.consumableAmountYuan,
coin_consumed_m: counterForm.value.coin_consumed_m,
other_amount: counterForm.value.other_amount,
deposit_deduct_amount: counterForm.value.deposit_deduct_amount,
otherAmountYuan: counterForm.value.otherAmountYuan,
depositDeductAmountYuan: counterForm.value.depositDeductAmountYuan,
reason: reasonText,
evidence_urls: linesToList(counterForm.value.evidenceText),
})
@@ -641,10 +641,10 @@ function isRecord(value: unknown): value is Record<string, unknown> {
function hydrateCounterForm() {
if (!order.value?.checkout) return
const checkout = order.value.checkout
counterForm.value.consumable_amount = amountYuan(checkout.consumable_amount_cent)
counterForm.value.consumableAmountYuan = amountYuan(checkout.consumable_amount_cent)
counterForm.value.coin_consumed_m = checkout.coin_consumed_m
counterForm.value.other_amount = amountYuan(checkout.other_amount_cent)
counterForm.value.deposit_deduct_amount = amountYuan(checkout.deposit_deduct_amount_cent)
counterForm.value.otherAmountYuan = amountYuan(checkout.other_amount_cent)
counterForm.value.depositDeductAmountYuan = amountYuan(checkout.deposit_deduct_amount_cent)
}
function linesToList(value: string) {
@@ -911,7 +911,7 @@ async function copyListingCode() {
</el-form-item>
<el-form-item label="其他押金赔付(元)">
<el-input-number
v-model="checkoutForm.other_amount"
v-model="checkoutForm.otherAmountYuan"
class="full-control"
:min="0"
:precision="0"
@@ -930,7 +930,7 @@ async function copyListingCode() {
</div>
<div>
<span>其他押金赔付</span>
<strong>¥{{ money(checkoutForm.other_amount) }}</strong>
<strong>¥{{ money(checkoutForm.otherAmountYuan) }}</strong>
<em>作为押金赔付扣除,和额外消耗品分开展示</em>
</div>
</div>
@@ -1022,7 +1022,7 @@ async function copyListingCode() {
<el-form class="form-grid" label-position="top">
<el-form-item label="额外消耗品已用金额">
<el-input-number
v-model="counterForm.consumable_amount"
v-model="counterForm.consumableAmountYuan"
class="full-control"
:min="0"
:precision="0"
@@ -1040,7 +1040,7 @@ async function copyListingCode() {
</el-form-item>
<el-form-item label="其他押金扣款(元)">
<el-input-number
v-model="counterForm.other_amount"
v-model="counterForm.otherAmountYuan"
class="full-control"
:min="0"
:precision="0"
@@ -1049,7 +1049,7 @@ async function copyListingCode() {
</el-form-item>
<el-form-item label="押金扣除(元)">
<el-input-number
v-model="counterForm.deposit_deduct_amount"
v-model="counterForm.depositDeductAmountYuan"
class="full-control"
:min="0"
:max="amountYuan(order.deposit_amount_cent)"