From b9e9cde65890851f4ca2d7b4809b802b88937ddf Mon Sep 17 00:00:00 2001
From: wlzboy <66905212@qq.com>
Date: 星期三, 01 四月 2026 23:05:48 +0800
Subject: [PATCH]  feat:同步状态优化

---
 ruoyi-ui/src/views/payment/order/index.vue |  212 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 212 insertions(+), 0 deletions(-)

diff --git a/ruoyi-ui/src/views/payment/order/index.vue b/ruoyi-ui/src/views/payment/order/index.vue
new file mode 100644
index 0000000..e9a07e3
--- /dev/null
+++ b/ruoyi-ui/src/views/payment/order/index.vue
@@ -0,0 +1,212 @@
+<template>
+  <div class="app-container">
+    <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="120px">
+      <el-form-item label="娓犻亾浜ゆ槗鍙�" prop="channelTradeNo">
+        <el-input v-model="queryParams.channelTradeNo" placeholder="璇疯緭鍏ユ笭閬撲氦鏄撳彿" clearable style="width: 240px" @keyup.enter.native="handleQuery" />
+      </el-form-item>
+      <el-form-item label="涓氬姟璁㈠崟鍙�" prop="bizOrderId">
+        <el-input v-model="queryParams.bizOrderId" placeholder="璇疯緭鍏ヤ笟鍔¤鍗曞彿" clearable style="width: 240px" @keyup.enter.native="handleQuery" />
+      </el-form-item>
+      <el-form-item label="璁㈠崟鏍囬" prop="subject">
+        <el-input v-model="queryParams.subject" placeholder="璇疯緭鍏ヨ鍗曟爣棰�" clearable style="width: 240px" @keyup.enter.native="handleQuery" />
+      </el-form-item>
+      <el-form-item label="鏈�鏂颁氦鏄揑D" prop="latestTransactionId">
+        <el-input v-model="queryParams.latestTransactionId" placeholder="璇疯緭鍏ユ渶鏂颁氦鏄揑D" clearable style="width: 240px" @keyup.enter.native="handleQuery" />
+      </el-form-item>
+      <el-form-item>
+        <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">鎼滅储</el-button>
+        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">閲嶇疆</el-button>
+      </el-form-item>
+    </el-form>
+
+    <el-row :gutter="10" class="mb8">
+      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
+    </el-row>
+
+    <el-table v-loading="loading" :data="orderList">
+      <el-table-column label="璁㈠崟ID" align="center" prop="id" width="160" />
+      <el-table-column label="涓氬姟璁㈠崟鍙�" align="center" prop="bizOrderId" width="180" :show-overflow-tooltip="true" />
+      <el-table-column label="璁㈠崟鏍囬" align="center" prop="subject" width="200" :show-overflow-tooltip="true" />
+      <el-table-column label="閲戦(鍏�)" align="center" width="100">
+        <template slot-scope="scope">
+          <span>{{ formatAmount(scope.row.amount) }}</span>
+        </template>
+      </el-table-column>
+      <el-table-column label="鏀粯娓犻亾" align="center" prop="channel" width="100">
+        <template slot-scope="scope">
+          <el-tag :type="channelType(scope.row.channel)">{{ scope.row.channel }}</el-tag>
+        </template>
+      </el-table-column>
+      <el-table-column label="璁㈠崟鐘舵��" align="center" prop="status" width="100">
+        <template slot-scope="scope">
+          <el-tag :type="statusType(scope.row.status)">{{ scope.row.status }}</el-tag>
+        </template>
+      </el-table-column>
+      <el-table-column label="娓犻亾浜ゆ槗鍙�" align="center" prop="channelTradeNo" width="180" :show-overflow-tooltip="true" />
+      <el-table-column label="鏈�鏂颁氦鏄揑D" align="center" prop="latestTransactionId" width="120" />
+      <el-table-column label="鎻忚堪(鍚玹askId)" align="center" prop="description" width="200" :show-overflow-tooltip="true" />
+      <el-table-column label="鍒涘缓鏃堕棿" align="center" prop="createdAt" width="160">
+        <template slot-scope="scope">
+          <span>{{ parseTime(scope.row.createdAt) }}</span>
+        </template>
+      </el-table-column>
+      <el-table-column label="鏀粯鏃堕棿" align="center" prop="paidAt" width="160">
+        <template slot-scope="scope">
+          <span>{{ scope.row.paidAt ? parseTime(scope.row.paidAt) : '-' }}</span>
+        </template>
+      </el-table-column>
+      <el-table-column label="鎿嶄綔" align="center" width="150" class-name="small-padding fixed-width" fixed="right">
+        <template slot-scope="scope">
+          <el-button size="mini" type="text" icon="el-icon-view" @click="handleView(scope.row)">鏌ョ湅鏄庣粏</el-button>
+          <el-button v-if="extractTaskId(scope.row.description)" size="mini" type="text" icon="el-icon-link" @click="handleViewTask(scope.row)">鏌ョ湅杞繍鍗�</el-button>
+        </template>
+      </el-table-column>
+    </el-table>
+
+    <!-- 璁㈠崟璇︽儏瀵硅瘽妗� -->
+    <el-dialog :title="'璁㈠崟璇︽儏 - ' + form.id" :visible.sync="open" width="700px" append-to-body>
+      <el-descriptions :column="2" border>
+        <el-descriptions-item label="璁㈠崟ID">{{ form.id }}</el-descriptions-item>
+        <el-descriptions-item label="涓氬姟璁㈠崟鍙�">{{ form.bizOrderId }}</el-descriptions-item>
+        <el-descriptions-item label="璁㈠崟鏍囬">{{ form.subject }}</el-descriptions-item>
+        <el-descriptions-item label="閲戦">{{ formatAmount(form.amount) }} 鍏�</el-descriptions-item>
+        <el-descriptions-item label="甯佺">{{ form.currency }}</el-descriptions-item>
+        <el-descriptions-item label="鏀粯娓犻亾">
+          <el-tag :type="channelType(form.channel)">{{ form.channel }}</el-tag>
+        </el-descriptions-item>
+        <el-descriptions-item label="璁㈠崟鐘舵��">
+          <el-tag :type="statusType(form.status)">{{ form.status }}</el-tag>
+        </el-descriptions-item>
+        <el-descriptions-item label="娓犻亾浜ゆ槗鍙�">{{ form.channelTradeNo || '-' }}</el-descriptions-item>
+        <el-descriptions-item label="鏈�鏂颁氦鏄揑D">{{ form.latestTransactionId || '-' }}</el-descriptions-item>
+        <el-descriptions-item label="涔愯閿佺増鏈�">{{ form.version }}</el-descriptions-item>
+        <el-descriptions-item label="鍒涘缓鏃堕棿">{{ parseTime(form.createdAt) }}</el-descriptions-item>
+        <el-descriptions-item label="鏇存柊鏃堕棿">{{ parseTime(form.updatedAt) }}</el-descriptions-item>
+        <el-descriptions-item label="鏀粯鏃堕棿">{{ form.paidAt ? parseTime(form.paidAt) : '-' }}</el-descriptions-item>
+        <el-descriptions-item label="杩囨湡鏃堕棿">{{ parseTime(form.expireAt) }}</el-descriptions-item>
+        <el-descriptions-item label="鍥炶皟鍦板潃" :span="2">{{ form.callbackUrl }}</el-descriptions-item>
+        <el-descriptions-item label="鎻忚堪" :span="2">{{ form.description }}</el-descriptions-item>
+      </el-descriptions>
+      <div slot="footer" class="dialog-footer">
+        <el-button v-if="extractTaskId(form.description)" type="primary" @click="handleViewTask(form)">鏌ョ湅鍏宠仈杞繍鍗�</el-button>
+        <el-button @click="open = false">鍏� 闂�</el-button>
+      </div>
+    </el-dialog>
+  </div>
+</template>
+
+<script>
+import { listPayOrder, getPayOrder } from "@/api/payment/order";
+
+export default {
+  name: "PayOrder",
+  data() {
+    return {
+      // 閬僵灞�
+      loading: false,
+      // 鏄剧ず鎼滅储鏉′欢
+      showSearch: true,
+      // 璁㈠崟琛ㄦ牸鏁版嵁
+      orderList: [],
+      // 鏄惁鏄剧ず寮瑰嚭灞�
+      open: false,
+      // 琛ㄥ崟鍙傛暟
+      form: {},
+      // 鏌ヨ鍙傛暟
+      queryParams: {
+        channelTradeNo: undefined,
+        bizOrderId: undefined,
+        subject: undefined,
+        latestTransactionId: undefined
+      }
+    };
+  },
+  created() {
+    this.getList();
+  },
+  methods: {
+    /** 鏌ヨ鏀粯璁㈠崟鍒楄〃 */
+    getList() {
+      this.loading = true;
+      // 杞崲 latestTransactionId 涓烘暟瀛�
+      const params = { ...this.queryParams };
+      if (params.latestTransactionId) {
+        params.latestTransactionId = Number(params.latestTransactionId);
+      }
+      listPayOrder(params).then(response => {
+        this.orderList = response.data || [];
+        this.loading = false;
+      }).catch(() => {
+        this.loading = false;
+      });
+    },
+    // 鍙栨秷鎸夐挳
+    cancel() {
+      this.open = false;
+    },
+    /** 鎼滅储鎸夐挳鎿嶄綔 */
+    handleQuery() {
+      this.getList();
+    },
+    /** 閲嶇疆鎸夐挳鎿嶄綔 */
+    resetQuery() {
+      this.resetForm("queryForm");
+      this.getList();
+    },
+    /** 鏌ョ湅鎸夐挳鎿嶄綔 */
+    handleView(row) {
+      this.reset();
+      getPayOrder(row.id).then(response => {
+        this.form = response.data;
+        this.open = true;
+      });
+    },
+    // 琛ㄥ崟閲嶇疆
+    reset() {
+      this.form = {};
+    },
+    // 鏍煎紡鍖栭噾棰濓紙鍒嗚浆鍏冿級
+    formatAmount(amount) {
+      if (amount === undefined || amount === null) return '-';
+      return (amount / 100).toFixed(2);
+    },
+    // 娓犻亾鏍囩绫诲瀷
+    channelType(channel) {
+      const map = {
+        'WECHAT': 'success',
+        'ALIPAY': 'primary',
+        'ALIPAY_THIRD': 'warning'
+      };
+      return map[channel] || '';
+    },
+    // 鐘舵�佹爣绛剧被鍨�
+    statusType(status) {
+      const map = {
+        'CREATED': 'info',
+        'PENDING': 'warning',
+        'PAID': 'success',
+        'CLOSED': 'danger',
+        'EXPIRED': 'danger'
+      };
+      return map[status] || '';
+    },
+    // 浠� description 涓彁鍙� taskId
+    extractTaskId(description) {
+      if (!description) return null;
+      // 鍖归厤 taskId:1234 鏍煎紡
+      const match = description.match(/taskId[:锛歖\s*(\d+)/i);
+      return match ? match[1] : null;
+    },
+    // 鏌ョ湅鍏宠仈杞繍鍗�
+    handleViewTask(row) {
+      const taskId = this.extractTaskId(row.description);
+      if (taskId) {
+        // 浣跨敤閫氱敤浠诲姟璇︽儏椤佃矾鐢�
+        this.$router.push('/task/general-detail/index/' + taskId);
+      } else {
+        this.$message.warning('鏈壘鍒板叧鑱旂殑杞繍鍗旾D');
+      }
+    }
+  }
+};
+</script>

--
Gitblit v1.9.1