|
@@ -1,5 +1,5 @@
|
|
|
<script setup>
|
|
<script setup>
|
|
|
-import { onMounted, reactive, ref } from 'vue'
|
|
|
|
|
|
|
+import { onMounted, onUnmounted, reactive, ref } from 'vue'
|
|
|
import { ElMessage, ElMessageBox } from 'element-plus'
|
|
import { ElMessage, ElMessageBox } from 'element-plus'
|
|
|
import http from '../api/http'
|
|
import http from '../api/http'
|
|
|
|
|
|
|
@@ -19,6 +19,8 @@ const query = reactive({
|
|
|
orderNumber: '',
|
|
orderNumber: '',
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
|
|
+const refreshTimer = ref(null)
|
|
|
|
|
+
|
|
|
async function fetchList() {
|
|
async function fetchList() {
|
|
|
loading.value = true
|
|
loading.value = true
|
|
|
try {
|
|
try {
|
|
@@ -31,6 +33,17 @@ async function fetchList() {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+function formatCreateTime(val) {
|
|
|
|
|
+ if (!val) return '-'
|
|
|
|
|
+ const d = new Date(val)
|
|
|
|
|
+ if (Number.isNaN(d.getTime())) return String(val)
|
|
|
|
|
+ const mm = String(d.getMonth() + 1).padStart(2, '0')
|
|
|
|
|
+ const dd = String(d.getDate()).padStart(2, '0')
|
|
|
|
|
+ const hh = String(d.getHours()).padStart(2, '0')
|
|
|
|
|
+ const mi = String(d.getMinutes()).padStart(2, '0')
|
|
|
|
|
+ return `${mm}月${dd}日 ${hh}:${mi}`
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
function onSearch() {
|
|
function onSearch() {
|
|
|
query.pageNum = 1
|
|
query.pageNum = 1
|
|
|
fetchList()
|
|
fetchList()
|
|
@@ -77,7 +90,20 @@ async function onConfirmStatusChange() {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-onMounted(fetchList)
|
|
|
|
|
|
|
+onMounted(async () => {
|
|
|
|
|
+ await fetchList()
|
|
|
|
|
+ // 轮询实时刷新(可按需调整间隔)
|
|
|
|
|
+ refreshTimer.value = setInterval(() => {
|
|
|
|
|
+ fetchList()
|
|
|
|
|
+ }, 5000)
|
|
|
|
|
+})
|
|
|
|
|
+
|
|
|
|
|
+onUnmounted(() => {
|
|
|
|
|
+ if (refreshTimer.value) {
|
|
|
|
|
+ clearInterval(refreshTimer.value)
|
|
|
|
|
+ refreshTimer.value = null
|
|
|
|
|
+ }
|
|
|
|
|
+})
|
|
|
</script>
|
|
</script>
|
|
|
|
|
|
|
|
<template>
|
|
<template>
|
|
@@ -109,7 +135,12 @@ onMounted(fetchList)
|
|
|
</el-table-column>
|
|
</el-table-column>
|
|
|
<el-table-column prop="totalAmount" label="商品总价" width="120" />
|
|
<el-table-column prop="totalAmount" label="商品总价" width="120" />
|
|
|
<el-table-column prop="finalAmount" label="订单总额" width="120" />
|
|
<el-table-column prop="finalAmount" label="订单总额" width="120" />
|
|
|
- <el-table-column prop="createTime" label="创建时间" min-width="180" />
|
|
|
|
|
|
|
+ <el-table-column prop="remark" label="备注" min-width="160" show-overflow-tooltip />
|
|
|
|
|
+ <el-table-column label="创建时间" min-width="160">
|
|
|
|
|
+ <template #default="scope">
|
|
|
|
|
+ {{ formatCreateTime(scope.row.createTime) }}
|
|
|
|
|
+ </template>
|
|
|
|
|
+ </el-table-column>
|
|
|
<el-table-column label="操作" width="120" fixed="right">
|
|
<el-table-column label="操作" width="120" fixed="right">
|
|
|
<template #default="scope">
|
|
<template #default="scope">
|
|
|
<el-button size="small" type="primary" @click="onChangeStatus(scope.row)">修改状态</el-button>
|
|
<el-button size="small" type="primary" @click="onChangeStatus(scope.row)">修改状态</el-button>
|