feat: some
All checks were successful
构建并部署前端到测试环境 / deploy (push) Successful in 55s

This commit is contained in:
luo
2026-09-22 12:14:47 +08:00
parent c136f68ab8
commit 0a28b7d8ef
19 changed files with 608 additions and 117 deletions

View File

@@ -23,8 +23,20 @@
</ElSelect>
<ElInput v-else :model-value="props.initialOrderNo" disabled style="width: 100%" />
</ElFormItem>
<ElFormItem v-if="selectedOrder" label="支付方式">
<ElInput :model-value="paymentMethodLabel" disabled style="width: 100%" />
</ElFormItem>
<ElFormItem v-if="selectedOrder" label="买家类型">
<ElInput :model-value="buyerTypeLabel" disabled style="width: 100%" />
</ElFormItem>
<ElFormItem label="退款方式" prop="method">
<ElRadioGroup v-model="formData.method">
<ElInput
v-if="walletRefundFixed"
:model-value="refundMethodLabel"
disabled
style="width: 100%"
/>
<ElRadioGroup v-else v-model="formData.method">
<ElRadio v-for="opt in RefundMethodOptions" :key="opt.value" :label="opt.value">
{{ opt.label }}
</ElRadio>
@@ -84,7 +96,7 @@
@change="formRef?.validateField('refund_voucher_key')"
/>
<div v-if="formData.method === RefundMethod.CUSTOMER_ACCOUNT" class="voucher-tip">
客户收款信息方式下须同时提供客户收款信息与至少 1 个退款凭证
线下退款方式下须同时提供收款信息与至少 1 个退款凭证
</div>
</ElFormItem>
</ElForm>
@@ -112,7 +124,6 @@
import { RefundMethod, type CreateRefundRequest, type Order } from '@/types/api'
import { RefundMethodOptions } from '@/config/constants/refund'
import { formatMoney, yuanToFen } from '@/utils/business/format'
import { getErrorMessage } from '@/utils/business'
import VoucherUpload from '@/components/business/VoucherUpload.vue'
interface Props {
@@ -222,6 +233,35 @@
return formatMoney(selectedOrder?.actual_paid_amount ?? 0, false)
})
const refundMethodLabel = computed(
() => RefundMethodOptions.find((option) => option.value === formData.method)?.label || '-'
)
const selectedOrder = computed(() =>
orderSearchOptions.value.find((order) => order.id === formData.order_id)
)
const paymentMethodLabel = computed(() => {
const labels = {
wallet: '钱包支付',
wechat: '微信支付',
alipay: '支付宝支付',
offline: '线下支付'
}
return selectedOrder.value ? labels[selectedOrder.value.payment_method] : '-'
})
const buyerTypeLabel = computed(() =>
selectedOrder.value?.buyer_type === 'agent' ? '代理商' : selectedOrder.value ? '个人客户' : '-'
)
const walletRefundFixed = computed(() => selectedOrder.value?.payment_method === 'wallet')
const resolveRefundMethod = (order: Order): RefundMethod => {
if (order.payment_method === 'wallet') {
return order.buyer_type === 'agent' ? RefundMethod.AGENT_WALLET : RefundMethod.ASSET_WALLET
}
if (order.payment_method === 'offline') return RefundMethod.CUSTOMER_ACCOUNT
return RefundMethod.ORIGINAL_ROUTE
}
const searchOrders = async (query: string) => {
orderSearchLoading.value = true
try {
@@ -238,6 +278,11 @@
orderSearchOptions.value = res.data.items || []
if (hasInitialOrder.value && props.initialOrderId) {
formData.order_id = props.initialOrderId
const initialOrder = orderSearchOptions.value.find((o) => o.id === props.initialOrderId)
if (initialOrder) {
formData.actual_received_amount = initialOrder.actual_paid_amount ?? 0
formData.method = resolveRefundMethod(initialOrder)
}
}
if (hasInitialOrder.value && props.initialOrderNo) {
const matchedOrder = orderSearchOptions.value.find(
@@ -246,6 +291,7 @@
if (matchedOrder) {
formData.order_id = matchedOrder.id
formData.actual_received_amount = matchedOrder.actual_paid_amount ?? 0
formData.method = resolveRefundMethod(matchedOrder)
}
}
}
@@ -264,6 +310,8 @@
const selectedOrder = orderSearchOptions.value.find((o) => o.id === orderId)
if (selectedOrder) {
formData.actual_received_amount = selectedOrder.actual_paid_amount ?? 0
formData.method = resolveRefundMethod(selectedOrder)
formRef.value?.validateField('method')
}
}