fix(用户详情): 消费记录改绑订单中台字段,修复订单号/收货人空白与时间戳

This commit is contained in:
From-wh 2026-10-24 18:06:01 +08:00 committed by 吴昊天
parent c57f3fa811
commit c47b11928b
2 changed files with 28 additions and 6 deletions

View File

@ -2927,13 +2927,20 @@ class OrderCenterServices extends BaseService implements OrderCenterSyncInterfac
public function getUserList(int $uid, array $where = [], int $page = 1, int $limit = 20): array
{
$where['uid'] = $uid;
$count = $this->dao->count($where, false);
$list = $this->dao->selectList($where, '*', $page, $limit, 'id desc', [], false);
// 已删除订单不进用户消费记录(与订单中台列表口径一致)
$where['is_del'] = 0;
$where['is_system_del'] = 0;
// uid/is_del/is_system_del 无搜索器,须走字段过滤:search=false 时 count 会丢弃非搜索器条件导致总数虚高
$count = $this->dao->count($where, true);
$list = $this->dao->selectList($where, '*', $page, $limit, 'id desc', [], true);
foreach ($list as &$item) {
$item['pay_type_name'] = $this->getPayTypeName($item['pay_type'] ?? '');
$item['status_text'] = \app\model\order\OrderCenter::$statusMap[$item['status_code'] ?? ''] ?? '未知';
$item['pay_status_text'] = \app\model\order\OrderCenter::$payStatusMap[$item['pay_status'] ?? 0] ?? '未知';
$item['refund_status_text'] = \app\model\order\OrderCenter::$refundStatusMap[$item['refund_status'] ?? 0] ?? '未知';
// 解析扩展信息并提取收货人,供用户消费记录展示(与订单中台列表口径一致)
$item['extra_info'] = $this->parseExtraInfo($item['extra_info']);
$item['contact_name'] = $item['extra_info']['contact']['name'] ?? '';
}
return compact('list', 'count');
}

View File

@ -37,7 +37,12 @@
>
<el-table-column :label="item.title" min-width="120" v-for="(item, index) in columns" :key="index">
<template #default="scope">
<template v-if="item.key">
<template v-if="item.format === 'time'">
<div>
<span>{{ scope.row[item.key] ? timeFormat(scope.row[item.key]) : '--' }}</span>
</div>
</template>
<template v-else-if="item.key">
<div>
<span>{{ scope.row[item.key] }}</span>
</div>
@ -75,11 +80,20 @@
import { nextTick, ref } from 'vue';
import { ElMessage } from 'element-plus';
import { detailsApi, infoApi } from '@/api/user';
import { formatDate } from '@/utils/validate';
import userInfo from './userInfo';
import userEditForm from './userEditForm';
defineOptions({ name: 'userDetails' });
// 秒级时间戳转 yyyy-MM-dd hh:mm(与用户模块 tableExpand 口径一致)
function timeFormat(time) {
if (time) {
return formatDate(new Date(time * 1000), 'yyyy-MM-dd hh:mm');
}
return '--';
}
const isEdit = ref(false);
const theme2 = ref('light');
const list = [
@ -170,13 +184,13 @@ function changeType() {
case 'order':
columns.value = [
{
title: '订单ID',
key: 'order_id',
title: '订单号',
key: 'order_no',
minWidth: 160,
},
{
title: '收货人',
key: 'real_name',
key: 'contact_name',
minWidth: 100,
},
{
@ -192,6 +206,7 @@ function changeType() {
{
title: '交易完成时间',
key: 'pay_time',
format: 'time',
minWidth: 120,
},
];