fix:充值订单和业务订单bug修复

This commit is contained in:
old burden 2026-04-21 15:38:53 +08:00
parent fd2ed863b3
commit 4800af812d
4 changed files with 113 additions and 25 deletions

View File

@ -36,7 +36,8 @@
<el-table v-loading="loading" :data="orderList"> <el-table v-loading="loading" :data="orderList">
<el-table-column label="ID" align="center" prop="id" width="72" /> <el-table-column label="ID" align="center" prop="id" width="72" />
<el-table-column label="团队名称" align="center" prop="deptName" min-width="120" show-overflow-tooltip /> <el-table-column label="团队名称" align="center" prop="deptName" min-width="140" show-overflow-tooltip />
<el-table-column label="用户ID" align="center" prop="userId" width="100" />
<el-table-column label="类型" align="center" width="100"> <el-table-column label="类型" align="center" width="100">
<template slot-scope="scope"> <template slot-scope="scope">
<span>{{ orderTypeLabel(scope.row.orderType) }}</span> <span>{{ orderTypeLabel(scope.row.orderType) }}</span>
@ -44,12 +45,30 @@
</el-table-column> </el-table-column>
<el-table-column label="金额(元)" align="center" prop="money" width="100" /> <el-table-column label="金额(元)" align="center" prop="money" width="100" />
<el-table-column label="积分" align="center" prop="amount" width="100" /> <el-table-column label="积分" align="center" prop="amount" width="100" />
<el-table-column label="结果预览" min-width="220">
<template slot-scope="scope">
<div v-if="extractVideoUrl(scope.row.result)">
<video
:src="extractVideoUrl(scope.row.result)"
controls
preload="metadata"
style="width: 180px; max-height: 100px; border-radius: 4px;"
/>
</div>
<span v-else>-</span>
</template>
</el-table-column>
<el-table-column label="时间" align="center" prop="createTime" width="160"> <el-table-column label="时间" align="center" prop="createTime" width="160">
<template slot-scope="scope"> <template slot-scope="scope">
<span>{{ parseTime(scope.row.createTime) }}</span> <span>{{ parseTime(scope.row.createTime) }}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="备注" align="center" prop="remark" min-width="140" show-overflow-tooltip /> <el-table-column label="备注" align="center" prop="remark" min-width="140" show-overflow-tooltip />
<el-table-column label="操作" width="90" fixed="right">
<template slot-scope="scope">
<el-button type="text" size="mini" @click="handleDetail(scope.row)">详情</el-button>
</template>
</el-table-column>
</el-table> </el-table>
<pagination <pagination
@ -59,6 +78,18 @@
:limit.sync="queryParams.pageSize" :limit.sync="queryParams.pageSize"
@pagination="getList" @pagination="getList"
/> />
<el-dialog title="订单详情" :visible.sync="detailVisible" width="720px" append-to-body>
<el-descriptions :column="1" border size="small">
<el-descriptions-item v-for="(value, key) in detailData" :key="key" :label="key">
<pre v-if="isObjectValue(value)" style="margin: 0; white-space: pre-wrap;">{{ formatJson(value) }}</pre>
<span v-else>{{ value === null || value === undefined || value === "" ? "-" : value }}</span>
</el-descriptions-item>
</el-descriptions>
<span slot="footer">
<el-button size="mini" @click="detailVisible = false">关闭</el-button>
</span>
</el-dialog>
</div> </div>
</template> </template>
@ -73,12 +104,11 @@ export default {
showSearch: true, showSearch: true,
total: 0, total: 0,
orderList: [], orderList: [],
detailVisible: false,
detailData: {},
orderTypeOptions: [ orderTypeOptions: [
{ label: "充值", value: 0 }, { label: "充值", value: 0 },
{ label: "退款", value: 1 }, { label: "退款", value: 1 }
{ label: "下发", value: 2 },
{ label: "回收", value: 3 },
{ label: "手动修改", value: 4 }
], ],
queryParams: { queryParams: {
pageNum: 1, pageNum: 1,
@ -97,6 +127,52 @@ export default {
const hit = this.orderTypeOptions.find(o => o.value === n) const hit = this.orderTypeOptions.find(o => o.value === n)
return hit ? hit.label : "—" return hit ? hit.label : "—"
}, },
extractVideoUrl(result) {
if (!result) return ""
if (typeof result === "string") {
const value = result.trim()
if (!value) return ""
if (/^https?:\/\/|^\/\//.test(value)) return value
try {
const parsed = JSON.parse(value)
return this.extractVideoUrl(parsed)
} catch (e) {
return ""
}
}
if (Array.isArray(result)) {
for (let i = 0; i < result.length; i += 1) {
const url = this.extractVideoUrl(result[i])
if (url) return url
}
return ""
}
if (typeof result === "object") {
const directKeys = ["videoUrl", "url", "resultUrl", "playUrl", "output", "fileUrl"]
for (let i = 0; i < directKeys.length; i += 1) {
const key = directKeys[i]
if (result[key]) {
const url = this.extractVideoUrl(result[key])
if (url) return url
}
}
}
return ""
},
handleDetail(row) {
this.detailData = row || {}
this.detailVisible = true
},
isObjectValue(value) {
return value !== null && typeof value === "object"
},
formatJson(value) {
try {
return JSON.stringify(value, null, 2)
} catch (e) {
return String(value)
}
},
getList() { getList() {
this.loading = true this.loading = true
listOrder(this.queryParams).then(response => { listOrder(this.queryParams).then(response => {

View File

@ -17,21 +17,10 @@
@keyup.enter.native="handleQuery" @keyup.enter.native="handleQuery"
/> />
</el-form-item> </el-form-item>
<el-form-item label="变更金额" prop="changeAmount"> <el-form-item label="类型" prop="type">
<el-input <el-select v-model="queryParams.type" clearable placeholder="全部类型" style="width: 180px">
v-model="queryParams.changeAmount" <el-option v-for="item in typeOptions" :key="item.value" :label="item.label" :value="item.value" />
placeholder="请输入变更金额" </el-select>
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="变更后金额" prop="resultAmount">
<el-input
v-model="queryParams.resultAmount"
placeholder="请输入变更后金额"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button> <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
@ -57,7 +46,11 @@
<el-table-column label="ID" align="center" prop="id" /> <el-table-column label="ID" align="center" prop="id" />
<el-table-column label="订单号" align="center" prop="relationOrderNo" /> <el-table-column label="订单号" align="center" prop="relationOrderNo" />
<el-table-column label="部门ID" align="center" prop="deptId" /> <el-table-column label="部门ID" align="center" prop="deptId" />
<el-table-column label="操作类型" align="center" prop="type" /> <el-table-column label="操作类型" align="center" width="120">
<template slot-scope="scope">
<span>{{ typeLabel(scope.row.type) }}</span>
</template>
</el-table-column>
<el-table-column label="变更金额" align="center" prop="changeAmount" /> <el-table-column label="变更金额" align="center" prop="changeAmount" />
<el-table-column label="变更后金额" align="center" prop="resultAmount" /> <el-table-column label="变更后金额" align="center" prop="resultAmount" />
<el-table-column label="备注" align="center" prop="remark" /> <el-table-column label="备注" align="center" prop="remark" />
@ -89,14 +82,19 @@ export default {
showSearch: true, showSearch: true,
total: 0, total: 0,
recordList: [], recordList: [],
typeOptions: [
{ label: "充值", value: 0 },
{ label: "退款", value: 1 },
{ label: "下发", value: 2 },
{ label: "回收", value: 3 },
{ label: "手动修改", value: 4 }
],
queryParams: { queryParams: {
pageNum: 1, pageNum: 1,
pageSize: 10, pageSize: 10,
relationOrderNo: null, relationOrderNo: null,
deptId: null, deptId: null,
type: null, type: null
changeAmount: null,
resultAmount: null
} }
} }
}, },
@ -104,6 +102,11 @@ export default {
this.getList() this.getList()
}, },
methods: { methods: {
typeLabel(type) {
const n = type !== undefined && type !== null ? Number(type) : null
const hit = this.typeOptions.find(item => item.value === n)
return hit ? hit.label : "-"
},
getList() { getList() {
this.loading = true this.loading = true
listRecord(this.queryParams).then(response => { listRecord(this.queryParams).then(response => {

View File

@ -128,5 +128,11 @@ public class AiOrder extends BaseEntity {
@TableField(exist = false) @TableField(exist = false)
private String uuid; private String uuid;
/**
* 部门名称关联sys_dept.dept_name
*/
@TableField(exist = false)
private String deptName;
} }

View File

@ -35,11 +35,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="videoParams" column="video_params" /> <result property="videoParams" column="video_params" />
<result property="isBackfilled" column="is_backfilled" /> <result property="isBackfilled" column="is_backfilled" />
<result property="videoGenRequestId" column="video_gen_request_id" /> <result property="videoGenRequestId" column="video_gen_request_id" />
<result property="deptName" column="dept_name" />
</resultMap> </resultMap>
<sql id="selectAiOrderVo"> <sql id="selectAiOrderVo">
select ao.id, ao.del_flag, ao.create_by, ao.create_time, ao.update_by, ao.update_time, ao.remark, ao.order_num, ao.third_party_order_num, ao.user_id, ao.dept_id, ao.type, ao.pre_deduct_amount, ao.amount, ao.total_usage, ao.result, ao.status, ao.source, ao.text, ao.is_top, ao.img1, ao.img2, ao.mode, ao.duration, ao.resolution, ao.ratio, ao.model, ao.video_params, au.user_id uuid, ao.ext_status, ao.is_backfilled, ao.video_gen_request_id from ai_order ao select ao.id, ao.del_flag, ao.create_by, ao.create_time, ao.update_by, ao.update_time, ao.remark, ao.order_num, ao.third_party_order_num, ao.user_id, ao.dept_id, ao.type, ao.pre_deduct_amount, ao.amount, ao.total_usage, ao.result, ao.status, ao.source, ao.text, ao.is_top, ao.img1, ao.img2, ao.mode, ao.duration, ao.resolution, ao.ratio, ao.model, ao.video_params, au.user_id uuid, ao.ext_status, ao.is_backfilled, ao.video_gen_request_id, sd.dept_name from ai_order ao
left join ai_user au on au.id = ao.user_id left join ai_user au on au.id = ao.user_id
left join sys_dept sd on sd.dept_id = ao.dept_id
</sql> </sql>
<select id="selectAiOrderList" parameterType="AiOrder" resultMap="AiOrderResult"> <select id="selectAiOrderList" parameterType="AiOrder" resultMap="AiOrderResult">
@ -49,6 +51,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="text != null and text != ''"> and ao.text like concat('%', #{text}, '%')</if> <if test="text != null and text != ''"> and ao.text like concat('%', #{text}, '%')</if>
<if test="userId != null "> and ao.user_id = #{userId}</if> <if test="userId != null "> and ao.user_id = #{userId}</if>
<if test="deptId != null "> and ao.dept_id = #{deptId}</if> <if test="deptId != null "> and ao.dept_id = #{deptId}</if>
<if test="deptName != null and deptName != ''"> and sd.dept_name like concat('%', #{deptName}, '%')</if>
<if test="uuid != null "> and au.user_id = #{uuid}</if> <if test="uuid != null "> and au.user_id = #{uuid}</if>
<if test="isTop != null "> and ao.is_top = #{isTop}</if> <if test="isTop != null "> and ao.is_top = #{isTop}</if>
<if test="type != null "> and ao.type = #{type}</if> <if test="type != null "> and ao.type = #{type}</if>