830 lines
26 KiB
Vue
830 lines
26 KiB
Vue
<script setup lang="ts">
|
||
import { computed, onBeforeUnmount, onMounted, ref } from 'vue'
|
||
import { useRoute } from 'vue-router'
|
||
import { ElMessage } from 'element-plus'
|
||
import { payApi } from '@/api/pay'
|
||
import type { PayCreatePayload, PayPreviewQuery, PayStatus } from '@/api/pay'
|
||
import type { OrderStatus, PayOrder, PayPreview } from '@/types'
|
||
import { ORDER_STATUS, ORDER_TYPE_LABEL, APP_TITLE } from '@/constants'
|
||
import { ApiError, userMessage } from '@/utils/http'
|
||
import { confirmAction } from '@/utils/confirm'
|
||
import { formatCent, formatPoints, yuanInputToCent } from '@/utils/money'
|
||
import { formatDateTime, remainText } from '@/utils/format'
|
||
import { isSafeRedirectHost, newIdempotencyKey } from '@/utils/validate'
|
||
|
||
interface DemoApp {
|
||
appCode: string
|
||
appName: string
|
||
}
|
||
|
||
const route = useRoute()
|
||
|
||
function queryText(value: unknown): string {
|
||
if (Array.isArray(value)) return typeof value[0] === 'string' ? value[0] : ''
|
||
return typeof value === 'string' ? value : ''
|
||
}
|
||
|
||
const appCode = ref(queryText(route.query.appCode))
|
||
const ticket = ref(queryText(route.query.ticket))
|
||
const redirectUri = ref(queryText(route.query.redirectUri))
|
||
/** 无凭证进入时为演示模式 */
|
||
const demoMode = ref(!appCode.value || !ticket.value)
|
||
|
||
const preview = ref<PayPreview | null>(null)
|
||
const previewLoading = ref(false)
|
||
const previewError = ref('')
|
||
const ticketInvalid = ref(false)
|
||
const remainTick = ref(Date.now())
|
||
|
||
const order = ref<PayOrder | null>(null)
|
||
const orderLoading = ref(false)
|
||
const orderError = ref('')
|
||
|
||
const statusInfo = ref<PayStatus | null>(null)
|
||
const statusLoading = ref(false)
|
||
const pollCount = ref(0)
|
||
const POLL_LIMIT = 20
|
||
|
||
const amountYuan = ref('')
|
||
const QUICK_AMOUNTS: number[] = [100, 500, 1000, 5000]
|
||
const MAX_AMOUNT_CENT = 50000 * 100
|
||
|
||
const DEMO_APPS: DemoApp[] = [
|
||
{ appCode: 'litho-sim', appName: '光刻仿真平台' },
|
||
{ appCode: 'libs-platform', appName: 'LIBS 显微检测数据中台' },
|
||
]
|
||
const demoAppCode = ref('litho-sim')
|
||
const demoLoading = ref(false)
|
||
const demoError = ref('')
|
||
|
||
let remainTimer = 0
|
||
let pollTimer = 0
|
||
let pollInFlight = false
|
||
|
||
const ticketRemain = computed(() => {
|
||
// 依赖 remainTick,保证剩余时间每 30 秒重新计算
|
||
void remainTick.value
|
||
return preview.value ? remainText(preview.value.ticketExpiresAt) : '—'
|
||
})
|
||
const ticketExpired = computed(() => ticketRemain.value === '已过期')
|
||
|
||
const minAmountCent = computed(() => preview.value?.minAmountCent || 100)
|
||
const rechargeCent = computed(() => yuanInputToCent(amountYuan.value))
|
||
const expectedPoints = computed(() => {
|
||
const cent = rechargeCent.value
|
||
if (!cent || !preview.value) return 0
|
||
return Math.floor((cent / 100) * preview.value.pointsPerYuan)
|
||
})
|
||
const amountError = computed(() => {
|
||
const text = amountYuan.value.trim()
|
||
if (!text) return ''
|
||
const cent = rechargeCent.value
|
||
if (!cent) return '金额格式不正确,仅支持最多两位小数的正数'
|
||
if (cent < minAmountCent.value) return `最低充值 ${formatCent(minAmountCent.value, false)} 元`
|
||
if (cent > MAX_AMOUNT_CENT) return '单次充值金额不得超过 50000 元'
|
||
return ''
|
||
})
|
||
|
||
const vipPlans = computed(() => preview.value?.plans ?? [])
|
||
|
||
const orderStatus = computed<OrderStatus>(() => statusInfo.value?.status || order.value?.status || 'PENDING')
|
||
const statusMeta = computed(() => ORDER_STATUS[orderStatus.value])
|
||
const isPaid = computed(() => orderStatus.value === 'PAID')
|
||
const isClosed = computed(() => orderStatus.value === 'CANCELLED' || orderStatus.value === 'REFUNDED')
|
||
const pollExhausted = computed(() => pollCount.value >= POLL_LIMIT && !isPaid.value && !isClosed.value)
|
||
|
||
/** 返回业务系统:仅接受后端下发的 http/https 地址,且主机必须是合法域名,防止协议注入与 IP 直连 */
|
||
const payRedirectUri = computed(() => {
|
||
const uri = order.value?.redirectUri || redirectUri.value
|
||
if (!uri) return ''
|
||
try {
|
||
const parsed = new URL(uri)
|
||
const protocolOk = parsed.protocol === 'https:' || parsed.protocol === 'http:'
|
||
return protocolOk && isSafeRedirectHost(parsed.hostname) ? uri : ''
|
||
} catch {
|
||
return ''
|
||
}
|
||
})
|
||
|
||
/**
|
||
* 下单幂等键:同一次下单的重试必须复用同一个键,服务端据此返回首次结果;
|
||
* 下单参数变化或下单成功后重新生成,避免把上一笔订单结果错误复用。
|
||
*/
|
||
let idempotencyKey = ''
|
||
let idempotencySignature = ''
|
||
|
||
function ensureIdempotencyKey(signature: string): string {
|
||
if (!idempotencyKey || idempotencySignature !== signature) {
|
||
idempotencyKey = newIdempotencyKey('pay')
|
||
idempotencySignature = signature
|
||
}
|
||
return idempotencyKey
|
||
}
|
||
|
||
function resetIdempotencyKey(): void {
|
||
idempotencyKey = ''
|
||
idempotencySignature = ''
|
||
}
|
||
|
||
function stopPolling(): void {
|
||
if (pollTimer) {
|
||
window.clearInterval(pollTimer)
|
||
pollTimer = 0
|
||
}
|
||
}
|
||
|
||
function markTicketInvalid(): void {
|
||
ticketInvalid.value = true
|
||
preview.value = null
|
||
previewError.value = '凭证无效、已过期或已被使用,请返回业务系统重新发起。'
|
||
stopPolling()
|
||
}
|
||
|
||
function handleFailure(error: unknown, scope: 'preview' | 'order' | 'demo'): void {
|
||
const err = error as ApiError
|
||
const message = userMessage(err)
|
||
if (err.code === 7001) {
|
||
markTicketInvalid()
|
||
ElMessage.error(message)
|
||
return
|
||
}
|
||
if (scope === 'preview') {
|
||
preview.value = null
|
||
previewError.value = message
|
||
}
|
||
if (scope === 'order') orderError.value = message
|
||
if (scope === 'demo') demoError.value = message
|
||
ElMessage.error(message)
|
||
}
|
||
|
||
async function loadPreview(): Promise<void> {
|
||
if (!appCode.value || !ticket.value) return
|
||
previewLoading.value = true
|
||
previewError.value = ''
|
||
ticketInvalid.value = false
|
||
try {
|
||
const query: PayPreviewQuery = { appCode: appCode.value, ticket: ticket.value }
|
||
if (redirectUri.value) query.redirectUri = redirectUri.value
|
||
preview.value = await payApi.preview(query)
|
||
amountYuan.value = ''
|
||
orderError.value = ''
|
||
} catch (error) {
|
||
handleFailure(error, 'preview')
|
||
} finally {
|
||
previewLoading.value = false
|
||
}
|
||
}
|
||
|
||
async function generateDemoTicket(): Promise<void> {
|
||
if (demoLoading.value) return
|
||
demoLoading.value = true
|
||
demoError.value = ''
|
||
try {
|
||
const data = await payApi.demoTicket(demoAppCode.value)
|
||
appCode.value = data.appCode
|
||
ticket.value = data.ticket
|
||
redirectUri.value = data.redirectUri
|
||
demoMode.value = true
|
||
order.value = null
|
||
statusInfo.value = null
|
||
pollCount.value = 0
|
||
stopPolling()
|
||
await loadPreview()
|
||
} catch (error) {
|
||
handleFailure(error, 'demo')
|
||
} finally {
|
||
demoLoading.value = false
|
||
}
|
||
}
|
||
|
||
function pickAmount(value: number): void {
|
||
amountYuan.value = String(value)
|
||
}
|
||
|
||
async function submitRecharge(): Promise<void> {
|
||
if (!preview.value || orderLoading.value || order.value) return
|
||
const cent = rechargeCent.value
|
||
if (!cent) {
|
||
ElMessage.error('请输入充值金额')
|
||
return
|
||
}
|
||
if (amountError.value) {
|
||
ElMessage.error(amountError.value)
|
||
return
|
||
}
|
||
|
||
const confirmed = await confirmAction({
|
||
title: '确认充值下单',
|
||
message: `应用「${preview.value.appName}」,业务用户「${preview.value.usernameSnapshot}」,充值金额 ${formatCent(cent)},预计到账 ${formatPoints(expectedPoints.value)} 点。下单后凭证立即失效,请按收款信息线下转账。`,
|
||
confirmText: '确认下单',
|
||
type: 'warning',
|
||
})
|
||
if (!confirmed) return
|
||
|
||
orderLoading.value = true
|
||
orderError.value = ''
|
||
try {
|
||
const payload: PayCreatePayload = {
|
||
appCode: appCode.value,
|
||
ticket: ticket.value,
|
||
orderType: 'recharge',
|
||
amountCent: cent,
|
||
idempotencyKey: ensureIdempotencyKey(`${appCode.value}|${ticket.value}|recharge|${cent}`),
|
||
}
|
||
if (redirectUri.value) payload.redirectUri = redirectUri.value
|
||
order.value = await payApi.createOrder(payload)
|
||
resetIdempotencyKey()
|
||
statusInfo.value = null
|
||
pollCount.value = 0
|
||
startPolling()
|
||
} catch (error) {
|
||
handleFailure(error, 'order')
|
||
} finally {
|
||
orderLoading.value = false
|
||
}
|
||
}
|
||
|
||
async function submitVip(plan: PayPreview['plans'][number]): Promise<void> {
|
||
if (!preview.value || orderLoading.value || order.value) return
|
||
|
||
const confirmed = await confirmAction({
|
||
title: '确认开通 VIP',
|
||
message: `确认为「${preview.value.usernameSnapshot}」开通「${plan.planName}」,金额 ${formatCent(plan.priceCent)},有效期 ${plan.durationDays} 天。下单后凭证立即失效。`,
|
||
confirmText: '确认下单',
|
||
type: 'warning',
|
||
})
|
||
if (!confirmed) return
|
||
|
||
orderLoading.value = true
|
||
orderError.value = ''
|
||
try {
|
||
const payload: PayCreatePayload = {
|
||
appCode: appCode.value,
|
||
ticket: ticket.value,
|
||
orderType: 'vip',
|
||
planCode: plan.planCode,
|
||
idempotencyKey: ensureIdempotencyKey(`${appCode.value}|${ticket.value}|vip|${plan.planCode}`),
|
||
}
|
||
if (redirectUri.value) payload.redirectUri = redirectUri.value
|
||
order.value = await payApi.createOrder(payload)
|
||
resetIdempotencyKey()
|
||
statusInfo.value = null
|
||
pollCount.value = 0
|
||
startPolling()
|
||
} catch (error) {
|
||
handleFailure(error, 'order')
|
||
} finally {
|
||
orderLoading.value = false
|
||
}
|
||
}
|
||
|
||
async function refreshStatus(auto = false, force = false): Promise<void> {
|
||
if (!order.value || pollInFlight || isPaid.value || isClosed.value) return
|
||
if (!force && pollCount.value >= POLL_LIMIT) {
|
||
stopPolling()
|
||
return
|
||
}
|
||
|
||
pollInFlight = true
|
||
statusLoading.value = true
|
||
pollCount.value = Math.min(pollCount.value + 1, POLL_LIMIT)
|
||
try {
|
||
const result = await payApi.status(order.value.outTradeNo)
|
||
statusInfo.value = result
|
||
if (order.value) {
|
||
order.value.status = result.status
|
||
order.value.expiresAt = result.expiresAt
|
||
order.value.amountCent = result.amountCent
|
||
order.value.pointsGained = result.pointsGained
|
||
}
|
||
if (result.status === 'PAID' || result.status === 'CANCELLED' || result.status === 'REFUNDED') {
|
||
stopPolling()
|
||
} else if (pollCount.value >= POLL_LIMIT) {
|
||
stopPolling()
|
||
}
|
||
} catch (error) {
|
||
if (auto) {
|
||
if (pollCount.value >= POLL_LIMIT) stopPolling()
|
||
} else {
|
||
const message = userMessage(error as ApiError)
|
||
orderError.value = message
|
||
ElMessage.error(message)
|
||
}
|
||
} finally {
|
||
statusLoading.value = false
|
||
pollInFlight = false
|
||
}
|
||
}
|
||
|
||
function startPolling(): void {
|
||
stopPolling()
|
||
void refreshStatus()
|
||
pollTimer = window.setInterval(() => {
|
||
void refreshStatus(true)
|
||
}, 15000)
|
||
}
|
||
|
||
function manualRefresh(): void {
|
||
void refreshStatus(false, true)
|
||
}
|
||
|
||
onMounted(() => {
|
||
if (appCode.value && ticket.value) {
|
||
void loadPreview()
|
||
}
|
||
remainTimer = window.setInterval(() => {
|
||
remainTick.value = Date.now()
|
||
}, 30000)
|
||
})
|
||
|
||
onBeforeUnmount(() => {
|
||
if (remainTimer) {
|
||
window.clearInterval(remainTimer)
|
||
remainTimer = 0
|
||
}
|
||
stopPolling()
|
||
})
|
||
</script>
|
||
|
||
<template>
|
||
<div class="pay-page">
|
||
<header class="pay-top">
|
||
<div class="brand">
|
||
<span class="logo">F</span>
|
||
<div>
|
||
<div class="brand-name">{{ APP_TITLE }} · 中央计费平台</div>
|
||
<div class="brand-sub">自助收银台</div>
|
||
</div>
|
||
</div>
|
||
<div class="top-tags">
|
||
<el-tag effect="dark" type="warning" round>一次性凭证</el-tag>
|
||
<el-tag effect="plain" round>内网部署</el-tag>
|
||
</div>
|
||
</header>
|
||
|
||
<main class="pay-main">
|
||
<div class="card intro">
|
||
<div class="card-title">收银台</div>
|
||
<p class="muted small intro-desc">
|
||
请核对应用与业务用户信息后完成点数充值或 VIP 开通。下单后凭证立即失效,转账请以订单页展示的收款信息为准。
|
||
</p>
|
||
</div>
|
||
|
||
<el-skeleton v-if="previewLoading" class="card" :rows="6" animated />
|
||
|
||
<template v-else>
|
||
<div v-if="!preview && demoMode && !previewError" class="card demo-card">
|
||
<div class="card-title">
|
||
<span>演示入口</span>
|
||
<el-tag size="small" type="info" effect="plain">仅演示环境</el-tag>
|
||
</div>
|
||
<p class="muted small demo-desc">
|
||
演示环境可直接签发一次性凭证;生产环境由业务系统签发 ticket,有效期 5 分钟且只能使用一次。
|
||
</p>
|
||
<div class="filter-bar">
|
||
<el-select v-model="demoAppCode" placeholder="选择应用" style="width: 280px">
|
||
<el-option
|
||
v-for="app in DEMO_APPS"
|
||
:key="app.appCode"
|
||
:label="`${app.appName}(${app.appCode})`"
|
||
:value="app.appCode"
|
||
/>
|
||
</el-select>
|
||
<el-button type="primary" :loading="demoLoading" @click="generateDemoTicket">
|
||
生成演示凭证并继续
|
||
</el-button>
|
||
</div>
|
||
<div v-if="demoError" class="notice danger small demo-notice">{{ demoError }}</div>
|
||
<div class="notice info small">
|
||
演示凭证会随机绑定所选应用下的一位业务用户,便于体验充值、VIP 开通与支付状态查询。
|
||
</div>
|
||
</div>
|
||
|
||
<div v-if="previewError" class="notice danger error-box">
|
||
<el-icon><CircleClose /></el-icon>
|
||
<div class="error-body">
|
||
<div>{{ previewError }}</div>
|
||
<div class="small error-sub">凭证为一次性使用,请勿刷新页面或重复提交。</div>
|
||
</div>
|
||
<div class="spacer" />
|
||
<el-button v-if="ticketInvalid" type="primary" plain :loading="demoLoading" @click="generateDemoTicket">
|
||
重新生成演示凭证
|
||
</el-button>
|
||
<el-button v-else @click="loadPreview">重试</el-button>
|
||
</div>
|
||
|
||
<el-empty
|
||
v-if="!preview && !previewError && !demoMode"
|
||
class="card"
|
||
description="缺少收银凭证,请从业务系统重新发起"
|
||
/>
|
||
|
||
<template v-if="preview">
|
||
<div class="card preview-card">
|
||
<div class="card-title">
|
||
<span>{{ preview.appName }}</span>
|
||
<el-tag v-if="preview.vip" type="warning" effect="light">VIP</el-tag>
|
||
<el-tag v-else type="info" effect="plain">普通用户</el-tag>
|
||
</div>
|
||
|
||
<el-descriptions :column="2" border>
|
||
<el-descriptions-item label="业务用户">{{ preview.usernameSnapshot }}</el-descriptions-item>
|
||
<el-descriptions-item label="业务用户 ID">
|
||
<span class="mono">{{ preview.businessUserId }}</span>
|
||
</el-descriptions-item>
|
||
<el-descriptions-item label="当前点数余额">
|
||
<span class="num money">{{ formatPoints(preview.balance) }}</span> 点
|
||
</el-descriptions-item>
|
||
<el-descriptions-item label="兑率">1 元 = {{ preview.pointsPerYuan }} 点</el-descriptions-item>
|
||
<el-descriptions-item label="VIP 状态">
|
||
<template v-if="preview.vip">
|
||
{{ preview.vip.planName }} · 至 {{ formatDateTime(preview.vip.vipUntil) }}
|
||
<span class="muted small">
|
||
(免扣权益:{{ preview.vip.freeDeduction === 1 ? '包含' : '不包含' }})
|
||
</span>
|
||
</template>
|
||
<span v-else class="muted">未开通</span>
|
||
</el-descriptions-item>
|
||
<el-descriptions-item label="凭证剩余有效期">
|
||
<el-tag :type="ticketExpired ? 'danger' : 'success'" effect="plain">{{ ticketRemain }}</el-tag>
|
||
</el-descriptions-item>
|
||
</el-descriptions>
|
||
|
||
<div class="small muted ticket-note">
|
||
凭证已通过校验,仅本次使用有效,凭证内容不在页面中展示;剩余时间每 30 秒刷新。
|
||
</div>
|
||
</div>
|
||
|
||
<div v-if="ticketExpired" class="notice danger expired-box">
|
||
<el-icon><WarningFilled /></el-icon>
|
||
<span>凭证已过期,无法继续下单,请返回业务系统重新发起。</span>
|
||
</div>
|
||
|
||
<template v-if="!order">
|
||
<div class="card">
|
||
<div class="card-title">点数充值</div>
|
||
<div class="recharge-row">
|
||
<el-input v-model="amountYuan" class="amount-input" placeholder="输入充值金额" :maxlength="12">
|
||
<template #append>元</template>
|
||
</el-input>
|
||
<el-button
|
||
v-for="item in QUICK_AMOUNTS"
|
||
:key="item"
|
||
size="small"
|
||
@click="pickAmount(item)"
|
||
>
|
||
¥ {{ item }}
|
||
</el-button>
|
||
</div>
|
||
<div class="small muted hint">
|
||
最低 {{ formatCent(minAmountCent, false) }} 元,最高 50000 元,金额最多两位小数。
|
||
</div>
|
||
<div v-if="amountError" class="small amount-error">{{ amountError }}</div>
|
||
<div class="amount-summary">
|
||
预计到账
|
||
<span class="num money">{{ formatPoints(expectedPoints) }}</span> 点
|
||
<span class="muted small">(按 1 元 = {{ preview.pointsPerYuan }} 点计算,向下取整)</span>
|
||
</div>
|
||
<el-button
|
||
type="primary"
|
||
size="large"
|
||
:loading="orderLoading"
|
||
:disabled="!rechargeCent || Boolean(amountError) || ticketExpired"
|
||
@click="submitRecharge"
|
||
>
|
||
确认充值并生成订单
|
||
</el-button>
|
||
</div>
|
||
|
||
<div class="card">
|
||
<div class="card-title">VIP 开通 / 续费</div>
|
||
<el-table v-if="vipPlans.length" :data="vipPlans" size="small" border>
|
||
<el-table-column prop="planName" label="档位" min-width="170" />
|
||
<el-table-column label="时长" width="110">
|
||
<template #default="{ row }">{{ row.durationDays }} 天</template>
|
||
</el-table-column>
|
||
<el-table-column label="价格" width="130" align="right">
|
||
<template #default="{ row }">
|
||
<span class="num money">{{ formatCent(row.priceCent) }}</span>
|
||
</template>
|
||
</el-table-column>
|
||
<el-table-column label="免扣权益" width="110" align="center">
|
||
<template #default="{ row }">{{ row.freeDeduction === 1 ? '包含' : '不包含' }}</template>
|
||
</el-table-column>
|
||
<el-table-column label="操作" width="140" align="center">
|
||
<template #default="{ row }">
|
||
<el-button
|
||
type="primary"
|
||
link
|
||
:loading="orderLoading"
|
||
:disabled="ticketExpired"
|
||
@click="submitVip(row)"
|
||
>
|
||
选择并下单
|
||
</el-button>
|
||
</template>
|
||
</el-table-column>
|
||
</el-table>
|
||
<el-empty v-else description="该应用暂无可用的 VIP 档位" :image-size="80" />
|
||
<div class="small muted vip-note">
|
||
VIP 订单金额以档位定价为准,开通后按应用策略享受免扣权益。
|
||
</div>
|
||
</div>
|
||
</template>
|
||
|
||
<div v-if="order" class="card order-card">
|
||
<div class="card-title">
|
||
<span>订单已创建</span>
|
||
<el-tag :type="statusMeta.tag" effect="light">{{ statusMeta.label }}</el-tag>
|
||
</div>
|
||
|
||
<el-result
|
||
v-if="isPaid"
|
||
icon="success"
|
||
title="支付已确认,点数已到账"
|
||
:sub-title="`订单号 ${order.outTradeNo}`"
|
||
/>
|
||
|
||
<el-descriptions :column="2" border>
|
||
<el-descriptions-item label="订单号">
|
||
<span class="mono">{{ order.outTradeNo }}</span>
|
||
</el-descriptions-item>
|
||
<el-descriptions-item label="订单类型">{{ ORDER_TYPE_LABEL[order.orderType] }}</el-descriptions-item>
|
||
<el-descriptions-item label="订单金额">
|
||
<span class="num money">{{ formatCent(order.amountCent) }}</span>
|
||
</el-descriptions-item>
|
||
<el-descriptions-item label="到账点数">
|
||
<span v-if="order.pointsGained > 0" class="num money">
|
||
{{ formatPoints(order.pointsGained) }} 点
|
||
</span>
|
||
<span v-else class="muted">—</span>
|
||
</el-descriptions-item>
|
||
<el-descriptions-item label="有效期至">{{ formatDateTime(order.expiresAt) }}</el-descriptions-item>
|
||
<el-descriptions-item label="下单时间">{{ formatDateTime(order.createTime) }}</el-descriptions-item>
|
||
<el-descriptions-item label="支付确认时间">
|
||
{{ formatDateTime(statusInfo?.paidAt) }}
|
||
</el-descriptions-item>
|
||
<el-descriptions-item label="自动查询进度">{{ pollCount }} / {{ POLL_LIMIT }} 次</el-descriptions-item>
|
||
</el-descriptions>
|
||
|
||
<div class="payee">
|
||
<div class="payee-title">收款账户信息</div>
|
||
<div class="payee-grid">
|
||
<div>
|
||
<div class="muted small">户名</div>
|
||
<div>{{ order.payee.accountName }}</div>
|
||
</div>
|
||
<div>
|
||
<div class="muted small">开户行</div>
|
||
<div>{{ order.payee.bankName }}</div>
|
||
</div>
|
||
<div>
|
||
<div class="muted small">账号</div>
|
||
<div class="mono">{{ order.payee.accountNo }}</div>
|
||
</div>
|
||
</div>
|
||
<div class="small muted payee-note">
|
||
收款信息仅用于本次转账展示,请勿记录、截图外传;线下转账后由财务确认到账。
|
||
</div>
|
||
</div>
|
||
|
||
<div v-if="orderError" class="notice danger small order-error">{{ orderError }}</div>
|
||
|
||
<div v-if="isClosed" class="notice warn small order-notice">
|
||
订单已{{ statusMeta.label }},请返回业务系统重新发起。
|
||
</div>
|
||
<div v-else-if="pollExhausted" class="notice warn small order-notice">
|
||
已达到自动查询上限(20 次),可点击「刷新支付状态」手动查询。
|
||
</div>
|
||
|
||
<div class="order-actions">
|
||
<el-button
|
||
:loading="statusLoading"
|
||
:disabled="isPaid || isClosed"
|
||
@click="manualRefresh"
|
||
>
|
||
<el-icon><Refresh /></el-icon>
|
||
刷新支付状态
|
||
</el-button>
|
||
<a v-if="payRedirectUri" :href="payRedirectUri" target="_self" class="back-link">
|
||
<el-button type="primary" plain>返回业务系统</el-button>
|
||
</a>
|
||
</div>
|
||
<div v-if="payRedirectUri" class="small muted redirect-note">
|
||
跳转地址由业务系统下单时下发,并经过域名格式校验;不合法或非域名的地址不会展示。
|
||
</div>
|
||
</div>
|
||
</template>
|
||
|
||
<div class="notice info security-note">
|
||
<el-icon><Lock /></el-icon>
|
||
<div>
|
||
<div>本页不收集银行卡号、支付密码与短信验证码;ticket 为一次性凭证,只能使用一次。</div>
|
||
<div>凭证仅在进入本页时从业务系统携带的链接读取,不写入浏览器本地存储;请勿转发当前页面链接。</div>
|
||
<div>返回业务系统的跳转地址会做域名格式校验,非合法域名不会渲染为可点击链接。</div>
|
||
</div>
|
||
</div>
|
||
</template>
|
||
</main>
|
||
</div>
|
||
</template>
|
||
|
||
<style scoped>
|
||
.pay-page {
|
||
min-height: 100vh;
|
||
background: var(--fin-bg);
|
||
}
|
||
|
||
.pay-top {
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: space-between;
|
||
gap: 16px;
|
||
padding: 18px 28px;
|
||
background: radial-gradient(circle at 15% 0, #1b2b4a 0, #0d1728 60%, #0a1220 100%);
|
||
color: #e6edf9;
|
||
}
|
||
|
||
.brand {
|
||
display: flex;
|
||
align-items: center;
|
||
gap: 12px;
|
||
}
|
||
|
||
.logo {
|
||
width: 38px;
|
||
height: 38px;
|
||
border-radius: 10px;
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: center;
|
||
font-size: 19px;
|
||
font-weight: 800;
|
||
color: #101828;
|
||
background: linear-gradient(135deg, #c8a45c, #a8813c);
|
||
}
|
||
|
||
.brand-name {
|
||
font-size: 15px;
|
||
font-weight: 600;
|
||
letter-spacing: 0.5px;
|
||
}
|
||
|
||
.brand-sub {
|
||
margin-top: 2px;
|
||
font-size: 11px;
|
||
letter-spacing: 2px;
|
||
color: var(--fin-sidebar-text);
|
||
}
|
||
|
||
.top-tags {
|
||
display: flex;
|
||
align-items: center;
|
||
gap: 8px;
|
||
flex-wrap: wrap;
|
||
}
|
||
|
||
.pay-main {
|
||
width: 100%;
|
||
max-width: 1000px;
|
||
margin: 0 auto;
|
||
padding: 22px 16px 44px;
|
||
}
|
||
|
||
.intro-desc {
|
||
margin: 0;
|
||
line-height: 1.7;
|
||
}
|
||
|
||
.demo-desc {
|
||
margin: 0 0 14px;
|
||
line-height: 1.7;
|
||
}
|
||
|
||
.demo-notice {
|
||
margin-bottom: 10px;
|
||
}
|
||
|
||
.error-box {
|
||
margin-top: 16px;
|
||
align-items: center;
|
||
flex-wrap: wrap;
|
||
}
|
||
|
||
.error-body {
|
||
flex: 1;
|
||
min-width: 180px;
|
||
}
|
||
|
||
.error-box .spacer {
|
||
flex: 1;
|
||
}
|
||
|
||
.error-sub {
|
||
margin-top: 4px;
|
||
opacity: 0.85;
|
||
}
|
||
|
||
.ticket-note {
|
||
margin-top: 10px;
|
||
line-height: 1.7;
|
||
}
|
||
|
||
.expired-box {
|
||
margin-top: 16px;
|
||
}
|
||
|
||
.recharge-row {
|
||
display: flex;
|
||
align-items: center;
|
||
gap: 8px;
|
||
flex-wrap: wrap;
|
||
}
|
||
|
||
.amount-input {
|
||
width: 230px;
|
||
}
|
||
|
||
.hint {
|
||
margin-top: 8px;
|
||
}
|
||
|
||
.amount-error {
|
||
margin-top: 6px;
|
||
color: var(--el-color-danger);
|
||
}
|
||
|
||
.amount-summary {
|
||
margin: 14px 0;
|
||
font-size: 14px;
|
||
}
|
||
|
||
.vip-note {
|
||
margin-top: 10px;
|
||
}
|
||
|
||
.payee {
|
||
margin-top: 16px;
|
||
padding: 14px 16px;
|
||
border: 1px dashed var(--fin-border-strong);
|
||
border-radius: 8px;
|
||
background: #f8fafc;
|
||
}
|
||
|
||
.payee-title {
|
||
margin-bottom: 10px;
|
||
font-size: 13px;
|
||
font-weight: 600;
|
||
}
|
||
|
||
.payee-grid {
|
||
display: grid;
|
||
grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
|
||
gap: 10px 16px;
|
||
font-size: 13px;
|
||
}
|
||
|
||
.payee-note {
|
||
margin-top: 10px;
|
||
}
|
||
|
||
.order-error,
|
||
.order-notice {
|
||
margin-top: 12px;
|
||
}
|
||
|
||
.order-actions {
|
||
display: flex;
|
||
align-items: center;
|
||
gap: 12px;
|
||
flex-wrap: wrap;
|
||
margin-top: 16px;
|
||
}
|
||
|
||
.back-link {
|
||
display: inline-flex;
|
||
}
|
||
|
||
.redirect-note {
|
||
margin-top: 8px;
|
||
}
|
||
|
||
.security-note {
|
||
margin-top: 16px;
|
||
}
|
||
|
||
@media (max-width: 640px) {
|
||
.pay-top {
|
||
padding: 14px 16px;
|
||
}
|
||
|
||
.pay-main {
|
||
padding: 16px 12px 32px;
|
||
}
|
||
|
||
.payee-grid {
|
||
grid-template-columns: 1fr;
|
||
}
|
||
}
|
||
</style>
|