fix: 杂项修改
This commit is contained in:
@@ -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.paginationRow}>
|
||||
<div class={styles.total}>共 {pagination.value.total} 人</div>
|
||||
<Button onClick={props.onClose}>关闭</Button>
|
||||
<Pagination
|
||||
current={pagination.value.current}
|
||||
pageSize={pagination.value.pageSize}
|
||||
total={pagination.value.total}
|
||||
size="small"
|
||||
onChange={handlePageChange}
|
||||
/>
|
||||
</div>
|
||||
|
||||
{/* 分页 */}
|
||||
{pagination.value.total > pagination.value.pageSize && (
|
||||
<div class={styles.paginationRow}>
|
||||
<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>
|
||||
);
|
||||
},
|
||||
|
||||
@@ -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: '确认',
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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' },
|
||||
};
|
||||
|
||||
// ============================================================
|
||||
|
||||
Reference in New Issue
Block a user