|
|
@@ -3,18 +3,23 @@
|
|
|
<div v-loading="loading">
|
|
|
<!-- 回调信息概览 -->
|
|
|
<el-descriptions :column="2" border class="mb20" v-if="notifyData.id">
|
|
|
- <el-descriptions-item label="订单ID">{{ notifyData.orderId }}</el-descriptions-item>
|
|
|
+ <el-descriptions-item label="订单号">{{ notifyData.orderId || '-' }}</el-descriptions-item>
|
|
|
<el-descriptions-item label="通知状态">
|
|
|
- <el-tag v-if="notifyData.status === 0" type="warning">待通知</el-tag>
|
|
|
- <el-tag v-else-if="notifyData.status === 1" type="success">通知成功</el-tag>
|
|
|
- <el-tag v-else-if="notifyData.status === 2" type="danger">通知失败</el-tag>
|
|
|
- <el-tag v-else>{{ notifyData.status }}</el-tag>
|
|
|
+ <el-tag :type="getStatusType(notifyData.status)" size="default">
|
|
|
+ {{ getStatusLabel(notifyData.status) }}
|
|
|
+ </el-tag>
|
|
|
+ </el-descriptions-item>
|
|
|
+ <el-descriptions-item label="当前通知次数">
|
|
|
+ <el-tag type="info">{{ notifyData.notifyTimes || 0 }}</el-tag>
|
|
|
+ </el-descriptions-item>
|
|
|
+ <el-descriptions-item label="最大通知次数">
|
|
|
+ <el-tag type="info">{{ notifyData.maxNotifyTimes || 0 }}</el-tag>
|
|
|
</el-descriptions-item>
|
|
|
- <el-descriptions-item label="当前通知次数">{{ notifyData.notifyTimes }}</el-descriptions-item>
|
|
|
- <el-descriptions-item label="最大通知次数">{{ notifyData.maxNotifyTimes }}</el-descriptions-item>
|
|
|
- <el-descriptions-item label="通知地址" :span="2">{{ notifyData.notifyUrl }}</el-descriptions-item>
|
|
|
<el-descriptions-item label="最后执行时间" :span="2">{{ notifyData.lastExecuteTime || '-' }}</el-descriptions-item>
|
|
|
<el-descriptions-item label="下次通知时间" :span="2">{{ notifyData.nextNotifyTime || '-' }}</el-descriptions-item>
|
|
|
+ <el-descriptions-item label="通知地址" :span="2">
|
|
|
+ <el-text class="notify-url" truncated>{{ notifyData.notifyUrl || '-' }}</el-text>
|
|
|
+ </el-descriptions-item>
|
|
|
<el-descriptions-item label="失败原因" :span="2">
|
|
|
<span style="color: #f56c6c">{{ notifyData.errorMsg || '-' }}</span>
|
|
|
</el-descriptions-item>
|
|
|
@@ -28,15 +33,15 @@
|
|
|
:key="index"
|
|
|
:timestamp="log.createTime"
|
|
|
placement="top"
|
|
|
- :type="log.status === 1 ? 'success' : 'danger'"
|
|
|
+ :type="getStatusType(log.status)"
|
|
|
>
|
|
|
<el-card shadow="hover">
|
|
|
<div class="log-item">
|
|
|
<div class="log-header">
|
|
|
<span class="log-title">第 {{ log.notifyTimes }} 次通知</span>
|
|
|
- <el-tag v-if="log.status === 0" type="warning" size="small">待通知</el-tag>
|
|
|
- <el-tag v-else-if="log.status === 1" type="success" size="small">通知成功</el-tag>
|
|
|
- <el-tag v-else-if="log.status === 2" type="danger" size="small">通知失败</el-tag>
|
|
|
+ <el-tag :type="getStatusType(log.status)" size="small">
|
|
|
+ {{ getStatusLabel(log.status) }}
|
|
|
+ </el-tag>
|
|
|
</div>
|
|
|
<div class="log-content">
|
|
|
<div class="log-label">响应结果:</div>
|
|
|
@@ -61,19 +66,37 @@
|
|
|
import { fetchPayNotifyLog } from '/@/api/order';
|
|
|
import { useMessage } from '/@/hooks/message';
|
|
|
|
|
|
+// 通知状态映射
|
|
|
+const statusMap: Record<number, { label: string; type: any }> = {
|
|
|
+ 0: { label: '待通知', type: 'info' },
|
|
|
+ 10: { label: '通知成功', type: 'success' },
|
|
|
+ 20: { label: '通知失败', type: 'danger' },
|
|
|
+ 30: { label: '通知中', type: 'warning' },
|
|
|
+};
|
|
|
+
|
|
|
// 定义变量
|
|
|
const visible = ref(false);
|
|
|
const loading = ref(false);
|
|
|
const notifyData = reactive<any>({});
|
|
|
|
|
|
+// 获取状态标签类型
|
|
|
+const getStatusType = (status: number) => {
|
|
|
+ return statusMap[status]?.type || 'info';
|
|
|
+};
|
|
|
+
|
|
|
+// 获取状态标签文本
|
|
|
+const getStatusLabel = (status: number) => {
|
|
|
+ return statusMap[status]?.label || `未知状态(${status})`;
|
|
|
+};
|
|
|
+
|
|
|
// 打开弹窗
|
|
|
const openDialog = async (appId: string, orderId: string) => {
|
|
|
visible.value = true;
|
|
|
loading.value = true;
|
|
|
-
|
|
|
+
|
|
|
// 清空数据
|
|
|
- Object.keys(notifyData).forEach(key => delete notifyData[key]);
|
|
|
-
|
|
|
+ Object.keys(notifyData).forEach((key) => delete notifyData[key]);
|
|
|
+
|
|
|
try {
|
|
|
const res = await fetchPayNotifyLog(appId, orderId);
|
|
|
Object.assign(notifyData, res.data);
|
|
|
@@ -91,6 +114,11 @@ defineExpose({
|
|
|
</script>
|
|
|
|
|
|
<style scoped>
|
|
|
+.notify-url {
|
|
|
+ max-width: 100%;
|
|
|
+ word-break: break-all;
|
|
|
+}
|
|
|
+
|
|
|
.log-item {
|
|
|
padding: 10px 0;
|
|
|
}
|
|
|
@@ -116,11 +144,12 @@ defineExpose({
|
|
|
font-size: 14px;
|
|
|
color: #606266;
|
|
|
margin-bottom: 5px;
|
|
|
+ font-weight: 500;
|
|
|
}
|
|
|
|
|
|
.log-response {
|
|
|
background: #f5f7fa;
|
|
|
- padding: 10px;
|
|
|
+ padding: 12px;
|
|
|
border-radius: 4px;
|
|
|
font-size: 13px;
|
|
|
color: #303133;
|
|
|
@@ -129,5 +158,11 @@ defineExpose({
|
|
|
max-height: 200px;
|
|
|
overflow-y: auto;
|
|
|
margin: 0;
|
|
|
+ border: 1px solid #e4e7ed;
|
|
|
+ font-family: 'Courier New', Courier, monospace;
|
|
|
+}
|
|
|
+
|
|
|
+.mb20 {
|
|
|
+ margin-bottom: 20px;
|
|
|
}
|
|
|
</style>
|