fix: 订单详情支付凭证, 退款
All checks were successful
构建并部署前端到测试环境 / build-and-deploy (push) Successful in 6m34s
All checks were successful
构建并部署前端到测试环境 / build-and-deploy (push) Successful in 6m34s
This commit is contained in:
@@ -1357,7 +1357,8 @@
|
||||
{
|
||||
prop: 'series_name',
|
||||
label: '套餐系列',
|
||||
minWidth: 120
|
||||
minWidth: 180,
|
||||
showOverflowTooltip: true
|
||||
},
|
||||
{
|
||||
prop: 'device_model',
|
||||
|
||||
@@ -176,7 +176,7 @@
|
||||
RejectRefundRequest,
|
||||
ResubmitRefundRequest
|
||||
} from '@/types/api'
|
||||
import { formatDateTime } from '@/utils/business/format'
|
||||
import { formatDateTime, yuanToFen } from '@/utils/business/format'
|
||||
import { RoutesAlias } from '@/router/routesAlias'
|
||||
|
||||
defineOptions({ name: 'RefundDetail' })
|
||||
@@ -400,9 +400,7 @@
|
||||
approveLoading.value = true
|
||||
try {
|
||||
const data: ApproveRefundRequest = {
|
||||
approved_refund_amount: approveForm.approved_refund_amount
|
||||
? approveForm.approved_refund_amount * 100
|
||||
: undefined,
|
||||
approved_refund_amount: yuanToFen(approveForm.approved_refund_amount),
|
||||
remark: approveForm.remark || undefined
|
||||
}
|
||||
|
||||
@@ -447,12 +445,8 @@
|
||||
resubmitLoading.value = true
|
||||
try {
|
||||
const data: ResubmitRefundRequest = {
|
||||
requested_refund_amount: resubmitForm.requested_refund_amount
|
||||
? resubmitForm.requested_refund_amount * 100
|
||||
: undefined,
|
||||
actual_received_amount: resubmitForm.actual_received_amount
|
||||
? resubmitForm.actual_received_amount * 100
|
||||
: undefined,
|
||||
requested_refund_amount: yuanToFen(resubmitForm.requested_refund_amount),
|
||||
actual_received_amount: yuanToFen(resubmitForm.actual_received_amount),
|
||||
refund_reason: resubmitForm.refund_reason || undefined
|
||||
}
|
||||
|
||||
|
||||
@@ -246,7 +246,7 @@
|
||||
} from '@/types/api'
|
||||
import type { SearchFormItem } from '@/types'
|
||||
import { useCheckedColumns } from '@/composables/useCheckedColumns'
|
||||
import { formatDateTime } from '@/utils/business/format'
|
||||
import { fenToYuan, formatDateTime, yuanToFen } from '@/utils/business/format'
|
||||
import { RoutesAlias } from '@/router/routesAlias'
|
||||
|
||||
import { useAuth } from '@/composables/useAuth'
|
||||
@@ -699,9 +699,7 @@
|
||||
approveLoading.value = true
|
||||
try {
|
||||
const data: ApproveRefundRequest = {
|
||||
approved_refund_amount: approveForm.approved_refund_amount
|
||||
? approveForm.approved_refund_amount * 100
|
||||
: undefined,
|
||||
approved_refund_amount: yuanToFen(approveForm.approved_refund_amount),
|
||||
remark: approveForm.remark || undefined
|
||||
}
|
||||
const refundId = currentRefund.value?.id
|
||||
@@ -796,7 +794,7 @@
|
||||
currentRefund.value = row
|
||||
// 预填充原有数据
|
||||
resubmitForm.requested_refund_amount = row.requested_refund_amount / 100
|
||||
resubmitForm.actual_received_amount = row.actual_received_amount / 100
|
||||
resubmitForm.actual_received_amount = fenToYuan(row.actual_received_amount)
|
||||
resubmitForm.refund_reason = row.refund_reason
|
||||
resubmitDialogVisible.value = true
|
||||
}
|
||||
@@ -821,12 +819,8 @@
|
||||
const refundId = currentRefund.value?.id
|
||||
if (!refundId) return
|
||||
const data: ResubmitRefundRequest = {
|
||||
requested_refund_amount: resubmitForm.requested_refund_amount
|
||||
? resubmitForm.requested_refund_amount * 100
|
||||
: undefined,
|
||||
actual_received_amount: resubmitForm.actual_received_amount
|
||||
? resubmitForm.actual_received_amount * 100
|
||||
: undefined,
|
||||
requested_refund_amount: yuanToFen(resubmitForm.requested_refund_amount),
|
||||
actual_received_amount: yuanToFen(resubmitForm.actual_received_amount),
|
||||
refund_reason: resubmitForm.refund_reason || undefined
|
||||
}
|
||||
|
||||
|
||||
@@ -60,13 +60,13 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref, onMounted } from 'vue'
|
||||
import { h, onMounted, ref } from 'vue'
|
||||
import { useRoute, useRouter } from 'vue-router'
|
||||
import { ElCard, ElButton, ElIcon, ElMessage, ElTable, ElTableColumn } from 'element-plus'
|
||||
import { ElButton, ElCard, ElIcon, ElImage, ElMessage, ElTable, ElTableColumn } from 'element-plus'
|
||||
import { ArrowLeft, Loading } from '@element-plus/icons-vue'
|
||||
import DetailPage from '@/components/common/DetailPage.vue'
|
||||
import type { DetailSection } from '@/components/common/DetailPage.vue'
|
||||
import { OrderService } from '@/api/modules'
|
||||
import { OrderService, StorageService } from '@/api/modules'
|
||||
import type {
|
||||
Order,
|
||||
OrderCommissionResult,
|
||||
@@ -74,15 +74,18 @@
|
||||
OrderOperatorType,
|
||||
OrderPaymentMethod
|
||||
} from '@/types/api'
|
||||
import { useAuth } from '@/composables/useAuth'
|
||||
import { formatDateTime } from '@/utils/business/format'
|
||||
|
||||
defineOptions({ name: 'OrderDetail' })
|
||||
|
||||
const route = useRoute()
|
||||
const router = useRouter()
|
||||
const { hasAuth } = useAuth()
|
||||
|
||||
const loading = ref(false)
|
||||
const detailData = ref<Order | null>(null)
|
||||
const paymentVoucherUrl = ref('')
|
||||
|
||||
// 格式化货币 - 将分转换为元
|
||||
const formatCurrency = (amount: number): string => {
|
||||
@@ -160,6 +163,17 @@
|
||||
return roleMap[role] || role
|
||||
}
|
||||
|
||||
const loadPaymentVoucherUrl = async (fileKey?: string) => {
|
||||
paymentVoucherUrl.value = ''
|
||||
if (!fileKey || !hasAuth('orders:view_payment_voucher')) return
|
||||
|
||||
try {
|
||||
paymentVoucherUrl.value = await StorageService.getDownloadUrl(fileKey)
|
||||
} catch (error) {
|
||||
console.error('Get payment voucher failed:', error)
|
||||
}
|
||||
}
|
||||
|
||||
// 详情页配置
|
||||
const detailSections: DetailSection[] = [
|
||||
{
|
||||
@@ -185,6 +199,31 @@
|
||||
formatter: (value) =>
|
||||
value !== undefined && value !== null ? formatCurrency(value) : '-'
|
||||
},
|
||||
{
|
||||
label: '支付凭证',
|
||||
fullWidth: true,
|
||||
render: (data) => {
|
||||
if (!data.payment_voucher_key || !hasAuth('orders:view_payment_voucher')) {
|
||||
return h('span', '-')
|
||||
}
|
||||
|
||||
if (!paymentVoucherUrl.value) {
|
||||
return h('span', '加载中...')
|
||||
}
|
||||
|
||||
return h(ElImage, {
|
||||
src: paymentVoucherUrl.value,
|
||||
previewSrcList: [paymentVoucherUrl.value],
|
||||
fit: 'cover',
|
||||
style: {
|
||||
width: '120px',
|
||||
height: '120px',
|
||||
borderRadius: '8px',
|
||||
border: '1px solid var(--el-border-color-light)'
|
||||
}
|
||||
})
|
||||
}
|
||||
},
|
||||
{
|
||||
label: '买家类型',
|
||||
formatter: (_, data) => (data.buyer_type ? getBuyerTypeText(data.buyer_type) : '-')
|
||||
@@ -311,6 +350,7 @@
|
||||
const res = await OrderService.getOrderById(id)
|
||||
if (res.code === 0) {
|
||||
detailData.value = res.data
|
||||
await loadPaymentVoucherUrl(res.data.payment_voucher_key)
|
||||
}
|
||||
} catch (error) {
|
||||
console.error(error)
|
||||
|
||||
Reference in New Issue
Block a user