收敛前端金额表单命名

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
@@ -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: [],
})