fix: 杂项修改

This commit is contained in:
ZhuRui
2026-08-07 14:30:54 +08:00
parent 117a7f408f
commit ba71b504e7
10 changed files with 74 additions and 36 deletions
+2
View File
@@ -84,6 +84,8 @@ export interface WalletTransactionVO {
orderNo: string;
/** 时间 */
createDate: string;
/** 状态;1=已解冻,2=冻结中,3=正常 */
status: number;
}
/** 交易明细查询参数 */
+3 -3
View File
@@ -79,7 +79,7 @@ export default defineComponent({
const { menuItems } = useMenuStore();
const { phone, nickname } = useUserStore();
const displayName = computed(() => nickname.value || phone.value);
const displayName = computed(() => phone.value || nickname.value);
const {
tabs,
cachedViews,
@@ -108,8 +108,8 @@ export default defineComponent({
/** ===== 退出登录 ===== */
const handleLogout = () => {
Modal.confirm({
title: '提示',
content: '是否退出登录',
title: '确认退出',
content: '确认要退出当前账号吗',
okText: '确认',
cancelText: '取消',
onOk: () => {
@@ -1,4 +1,5 @@
import { computed, reactive, nextTick } from 'vue';
import { computed, reactive, nextTick, h } from 'vue';
import { StatusTag, type StatusTagTone } from '@/components';
import { useThrottleFn, useRequest, usePagination, useEffect, syncPaginationTotal } from '@/hooks';
import { getPaymentFlowList, type PaymentFlowVO, type PaymentFlowQueryParams } from './services';
import dayjs from 'dayjs';
@@ -13,11 +14,20 @@ export const PAYMENT_TYPE_OPTIONS = [
{ value: '2', label: '取消报名' },
] as const;
export const PAYMENT_TYPE_MAP: Record<number, string> = {
1: '报名',
2: '取消报名',
export const PAYMENT_TYPE_MAP: Record<number, { label: string; tone: StatusTagTone }> = {
1: { label: '报名', tone: 'success' },
2: { label: '取消报名', tone: 'default' },
};
/** 渲染交易类型 StatusTag */
export function renderPaymentType(type: number) {
const info = PAYMENT_TYPE_MAP[type] || {
label: String(type ?? '--'),
tone: 'default' as const,
};
return h(StatusTag, { label: info.label, tone: info.tone });
}
// ============================================================
// Model
// ============================================================
@@ -90,7 +100,7 @@ export function usePaymentsModel() {
dataIndex: 'type',
key: 'type',
width: 110,
customRender: ({ text }: { text: number }) => PAYMENT_TYPE_MAP[text] || text || '--',
customRender: ({ text }: { text: number }) => renderPaymentType(text),
},
{ title: '用户昵称', dataIndex: 'nickname', key: 'nickname', width: 120 },
{ title: '手机号', dataIndex: 'phone', key: 'phone', width: 140 },
@@ -12,6 +12,7 @@ import {
TRANSACTION_STATUS_OPTIONS,
TRANSACTION_TYPE_MAP,
TRANSACTION_STATUS_LABEL_MAP,
renderTransactionStatus,
} from '../model/useWalletModel';
import styles from './WalletDetailModal.module.less';
@@ -151,6 +152,13 @@ export default defineComponent({
align: 'left' as const,
customRender: ({ text }: { text: string }) => `¥${text || '0.00'}`,
},
{
title: '状态',
dataIndex: 'status',
key: 'status',
width: 90,
customRender: ({ text }: { text: number }) => renderTransactionStatus(text),
},
{
title: '冻结时间',
dataIndex: 'freezeTime',
@@ -1,4 +1,5 @@
import { computed, reactive, nextTick } from 'vue';
import { computed, reactive, nextTick, h } from 'vue';
import { StatusTag, type StatusTagTone } from '@/components';
import {
useState,
useThrottleFn,
@@ -36,13 +37,29 @@ export const TRANSACTION_TYPE_MAP: Record<number, string> = {
3: '取消报名退款',
};
/** 交易状态文案映射(弹窗内表格渲染用 */
/** 交易状态文案映射(筛选下拉用,对应请求参数,值与接口返回一致 */
export const TRANSACTION_STATUS_LABEL_MAP: Record<number, string> = {
1: '已解冻',
2: '冻结中',
3: '正常',
};
/** 交易状态色调映射(表格 StatusTag 显示用,对应接口返回的 status 值:1=已解冻,2=冻结中,3=正常) */
const TRANSACTION_STATUS_MAP: Record<number, { label: string; tone: StatusTagTone }> = {
1: { label: '已解冻', tone: 'success' },
2: { label: '冻结中', tone: 'warning' },
3: { label: '正常', tone: 'default' },
};
/** 渲染交易状态 StatusTag(表格列用) */
export function renderTransactionStatus(status: number) {
const info = TRANSACTION_STATUS_MAP[status] || {
label: String(status ?? '--'),
tone: 'default' as const,
};
return h(StatusTag, { label: info.label, tone: info.tone });
}
// ============================================================
// Model
// ============================================================
@@ -5,7 +5,7 @@
.bottom {
display: flex;
justify-content: space-between;
justify-content: flex-end;
align-items: center;
margin-top: 16px;
padding-top: 12px;
@@ -19,7 +19,8 @@
.paginationRow {
display: flex;
justify-content: flex-end;
align-items: center;
justify-content: space-between;
margin-top: 12px;
}
}
@@ -152,25 +152,22 @@ export default defineComponent({
rowKey="phone"
/>
{/* 底部 */}
<div class={styles.bottom}>
<div class={styles.total}> {pagination.value.total} </div>
<Button onClick={props.onClose}></Button>
</div>
{/* 分页 */}
{pagination.value.total > pagination.value.pageSize && (
<div class={styles.paginationRow}>
<div class={styles.total}> {pagination.value.total} </div>
<Pagination
current={pagination.value.current}
pageSize={pagination.value.pageSize}
total={pagination.value.total}
size="small"
showTotal={(total: number) => `${total}`}
onChange={handlePageChange}
/>
</div>
)}
{/* 底部 */}
<div class={styles.bottom}>
<Button onClick={props.onClose}></Button>
</div>
</Modal>
);
},
+7 -4
View File
@@ -52,7 +52,7 @@ function renderBodyCell({
)}
{canToggleStatus && (
<Button type="link" size="small" onClick={() => onToggleStatus(record)}>
{isActive ? '用' : '启用'}
{isActive ? '用' : '启用'}
</Button>
)}
</Space>
@@ -92,17 +92,20 @@ export default defineComponent({
const [editingRecord, setEditingRecord] = useState<any>(null);
const [formSubmitting, setFormSubmitting] = useState<boolean>(false);
// ===== 启用/禁用(使用真实 API =====
// ===== 启用/禁用 =====
const handleToggleStatus = useThrottleFn(async (record: any) => {
const isActive = record.status === '1';
const actionText = isActive ? '用' : '启用';
const actionText = isActive ? '用' : '启用';
Modal.confirm({
title: `${actionText}确认`,
title: `确认${actionText}`,
content: (
<div class={pageStyles.confirmContent}>
<span>{actionText}</span>
<strong>{record.realName}</strong>
<span></span>
<div class={pageStyles.confirmTip}>
{isActive ? '禁用后该用户将无法登录后台。' : '启用后该用户将恢复登录权限。'}
</div>
</div>
),
okText: '确认',
+1 -1
View File
@@ -41,7 +41,7 @@ const userUpdatePwd = '/admin/sys/user/updatepwd';
/**
* 用户列表分页
* 接口: GET /admin/sys/user/page
* 参数: page, limit, text(姓名/手机号), roleId(角色ID), status(0=用,1=正常)
* 参数: page, limit, text(姓名/手机号), roleId(角色ID), status(0=用,1=正常)
*/
export function getUserList(
params: UserListQueryParams,
+3 -3
View File
@@ -21,14 +21,14 @@ import { getRoleList, type TournamentAdminRolePageVO } from '../../roles/model/s
/** 状态选项(筛选) */
export const USER_STATUS_OPTIONS = [
{ value: '', label: '全部' },
{ value: '0', label: '用' },
{ value: '0', label: '用' },
{ value: '1', label: '正常' },
] as const;
/** 状态文本/色调映射(表格渲染),对应 API status 字段:0=用、1=正常 */
/** 状态文本/色调映射(表格渲染),对应 API status 字段:0=用、1=正常 */
const STATUS_MAP: Record<string, { label: string; tone: StatusTagTone }> = {
'1': { label: '正常', tone: 'success' },
'0': { label: '用', tone: 'danger' },
'0': { label: '用', tone: 'danger' },
};
// ============================================================