diff --git a/src/api/modules/storage.ts b/src/api/modules/storage.ts index c5abff1..055d295 100644 --- a/src/api/modules/storage.ts +++ b/src/api/modules/storage.ts @@ -34,6 +34,24 @@ export interface GetUploadUrlResponse { expires_in: number } +/** + * 批量获取文件下载预签名 URL 请求 + */ +export interface BatchDownloadUrlsRequest { + /** 文件路径标识列表,最多 50 个 */ + file_keys: string[] +} + +/** + * 批量获取文件下载预签名 URL 响应 + */ +export interface BatchDownloadUrlsResponse { + /** 文件下载地址映射,key 为 file_key */ + urls: Record + /** URL 有效期(秒) */ + expires_in: number +} + export class StorageService extends BaseService { /** * 获取文件上传预签名 URL @@ -100,4 +118,18 @@ export class StorageService extends BaseService { throw error } } + + /** + * 批量获取文件下载预签名 URL + * 用于获取私有文件的临时下载地址 + * @param data 请求参数 + */ + static batchDownloadUrls( + data: BatchDownloadUrlsRequest + ): Promise> { + return this.post>( + '/api/admin/storage/batch-download-urls', + data + ) + } } diff --git a/src/components/business/PaymentVoucherDialog.vue b/src/components/business/PaymentVoucherDialog.vue new file mode 100644 index 0000000..8b0c32b --- /dev/null +++ b/src/components/business/PaymentVoucherDialog.vue @@ -0,0 +1,55 @@ + + + diff --git a/src/types/api/order.ts b/src/types/api/order.ts index c9a6810..c1060eb 100644 --- a/src/types/api/order.ts +++ b/src/types/api/order.ts @@ -63,6 +63,7 @@ export interface Order { purchase_remark?: string // 购买备注 operator_name?: string // 操作者 items: OrderItem[] | null + payment_voucher_key?: string // 支付凭证(线下支付时才有值) created_at: string updated_at: string } diff --git a/src/types/components.d.ts b/src/types/components.d.ts index 3c82991..c29a624 100644 --- a/src/types/components.d.ts +++ b/src/types/components.d.ts @@ -139,6 +139,7 @@ declare module 'vue' { MenuStyleSettings: typeof import('./../components/core/layouts/art-settings-panel/widget/MenuStyleSettings.vue')['default'] OperatorSelect: typeof import('./../components/business/OperatorSelect.vue')['default'] PackageSelector: typeof import('./../components/business/PackageSelector.vue')['default'] + PaymentVoucherDialog: typeof import('./../components/business/PaymentVoucherDialog.vue')['default'] RealnamePolicyDialog: typeof import('./../components/device/RealnamePolicyDialog.vue')['default'] RouterLink: typeof import('vue-router')['RouterLink'] RouterView: typeof import('vue-router')['RouterView'] diff --git a/src/views/finance/agent-recharge/index.vue b/src/views/finance/agent-recharge/index.vue index dbb3442..ffde815 100644 --- a/src/views/finance/agent-recharge/index.vue +++ b/src/views/finance/agent-recharge/index.vue @@ -159,6 +159,12 @@ + + + @@ -196,6 +202,7 @@ import { formatDateTime } from '@/utils/business/format' import { RoutesAlias } from '@/router/routesAlias' import { useAuth } from '@/composables/useAuth' + import PaymentVoucherDialog from '@/components/business/PaymentVoucherDialog.vue' defineOptions({ name: 'AgentRechargeList' }) @@ -210,6 +217,7 @@ const createDialogVisible = ref(false) const confirmPayDialogVisible = ref(false) const currentRecharge = ref(null) + const paymentVoucherFileKey = ref('') // 搜索表单初始值 const initialSearchState: AgentRechargeQueryParams = { @@ -751,6 +759,19 @@ const getActions = (row: AgentRecharge) => { const actions: any[] = [] + // 线下支付且有凭证可以查看 + if ( + row.payment_method === 'offline' && + row.payment_voucher_key && + hasAuth('agent_recharge:view_payment_voucher') + ) { + actions.push({ + label: '查看支付凭证', + handler: () => handleViewPaymentVoucher(row), + type: 'primary' + }) + } + // 待支付且线下转账的订单可以确认支付 if ( row.status === 1 && @@ -766,6 +787,12 @@ return actions } + + // 查看支付凭证 + const handleViewPaymentVoucher = (row: AgentRecharge) => { + if (!row.payment_voucher_key) return + paymentVoucherFileKey.value = row.payment_voucher_key + }