diff --git a/src/router/index.ts b/src/router/index.ts index 7e1b75d..1fcb3ab 100644 --- a/src/router/index.ts +++ b/src/router/index.ts @@ -112,6 +112,21 @@ export const constantRoutes: RouteRecordRaw[] = [ meta: { title: '用户详情', activeMenu: '/userManage/appUser', noCache: true } } ] + }, + { + // 商户详情:从多商户列表跳转,不进侧边栏 + path: '/merchant', + component: Layout, + hidden: true, + redirect: 'noredirect', + children: [ + { + path: 'detail', + component: () => import('@/views/biz/merchant/detail.vue'), + name: 'MerchantDetail', + meta: { title: '多商户详情', activeMenu: '/merchantManage/merchant', noCache: true } + } + ] } ]; diff --git a/src/store/modules/permission.ts b/src/store/modules/permission.ts index caeb3fe..87784d1 100644 --- a/src/store/modules/permission.ts +++ b/src/store/modules/permission.ts @@ -1,6 +1,6 @@ import type { RouteRecordRaw } from 'vue-router'; import { defineStore } from 'pinia'; -import { ref } from 'vue'; +import { defineComponent, h, ref } from 'vue'; import { getRouters } from '@/api/menu'; import ParentView from '@/components/ParentView/index.vue'; import InnerLink from '@/layout/components/InnerLink/index.vue'; @@ -156,12 +156,41 @@ export const filterDynamicRoutes = (routes: RouteRecordRaw[]) => { return res; }; +/** + * 菜单组件路径对不上时显示的兜底页面。 + * 路由照样注册、页面原本只会一片空白,无从排查,这里把缺失路径和相近的可用路径画出来。 + */ +const createMissingView = (view: string) => { + const keyword = view.split('/').pop()?.toLowerCase() ?? ''; + const suggestions = [...viewModuleMap.keys()] + .filter(key => keyword && key.toLowerCase().includes(keyword)) + .slice(0, 8); + + return defineComponent({ + name: 'MissingView', + setup() { + return () => + h('div', { style: 'padding: 32px; line-height: 2; font-size: 14px; color: var(--el-text-color-regular)' }, [ + h('h2', { style: 'margin: 0 0 12px; font-size: 18px; color: var(--el-text-color-primary)' }, '页面组件未找到'), + h('p', {}, `后台菜单返回的组件路径:${view}`), + h('p', {}, `前端查找的是 src/views/${view}.vue`), + h('p', {}, suggestions.length ? `相近的已存在路径:${suggestions.join('、')}` : '没有相近的已存在路径') + ]); + } + }); +}; + export const loadView = (view: any, name: string) => { const loader = viewModuleMap.get(view); if (loader) { return createCustomNameComponent(loader, { name }); } - return undefined; + // 目录型菜单可能没有组件路径,保持原样返回 undefined + if (!view) { + return undefined; + } + console.warn(`[路由] 未找到视图组件「${view}」,请确认 src/views/${view}.vue 是否存在`); + return createMissingView(String(view)); }; // 非setup diff --git a/src/views/biz/appUser/index.vue b/src/views/biz/appUser/index.vue index e108348..9b54612 100644 --- a/src/views/biz/appUser/index.vue +++ b/src/views/biz/appUser/index.vue @@ -11,8 +11,8 @@ - - + + @@ -117,8 +117,7 @@ const queryParams = ref({ pageNum: 1, pageSize: 10, phoneNumber: undefined, - // 后端 keyword 同时匹配手机号、昵称、实名姓名 - keyword: undefined, + nickName: undefined, status: undefined }); diff --git a/src/views/biz/income/index.vue b/src/views/biz/income/index.vue index de25bc4..7833acb 100644 --- a/src/views/biz/income/index.vue +++ b/src/views/biz/income/index.vue @@ -4,35 +4,24 @@ - - Search Filters - 筛选条件 - + 筛选条件 - - - - - - - - - - - - + + + + + + 搜索 重置 @@ -45,31 +34,28 @@ - Income Dataset - 收入明细 - 共 {{ total }} 条记录,支持按商户、支付方式和收入时间筛选。 + 收入明细列表 - - 导出 - - - - - - - + + + + + + + + {{ getChargeTypeLabel(scope.row.chargeType) }} + + - + {{ formatAmount(scope.row.amount) }} - - import { useLoading } from '@/hooks/async/useLoading'; -import { useDateRangeQuery } from '@/hooks/form/useDateRangeQuery'; import { useSearchReset } from '@/hooks/form/useSearchReset'; import { useSearchToggle } from '@/hooks/form/useSearchToggle'; -import modal from '@/plugins/modal'; -/** 充值收入流水明细(只读台账) */ +/** 收入明细流水(只读台账) */ interface IncomeVO { /** 收入ID */ incomeId?: string; - /** 充值流水号 */ - orderNo?: string; + /** 交易日期 */ + incomeTime?: string; /** 商户名称 */ merchantName?: string; + /** 房间号 */ + roomNo?: string; /** 设备编号 */ deviceNo?: string; - /** 用户名称 */ - userName?: string; - /** 充值金额(元) */ + /** 充值类型(0电费 1水费) */ + chargeType?: string; + /** 金额(元) */ amount?: number; - /** 支付方式(1微信 2支付宝 3现金 4余额) */ - payType?: string; - /** 收入时间 */ - incomeTime?: string; - /** 备注 */ - remark?: string; } interface IncomeQuery extends PageQuery { - orderNo?: string; - merchantName?: string; - payType?: string; + /** 开始日期(YYYY-MM-DD) */ + beginDate?: string; + /** 收入类型(0电费 1水费) */ + chargeType?: string; } -// 支付方式字典后端尚未建立,先用本地兜底选项 -const payTypeOptions: DictDataOption[] = [ - { label: '微信', value: '1', elTagType: 'success' }, - { label: '支付宝', value: '2', elTagType: 'primary' }, - { label: '现金', value: '3', elTagType: 'warning' }, - { label: '余额', value: '4', elTagType: 'info' } +/** 收入类型选项:与设备类型取值保持一致(0电表/电费,1水表/水费) */ +const chargeTypeOptions: DictDataOption[] = [ + { label: '电费', value: '0' }, + { label: '水费', value: '1' } ]; +const getChargeTypeLabel = (value?: string) => + chargeTypeOptions.find(item => item.value === String(value))?.label || (value ? String(value) : '—'); + +const formatAmount = (value?: number | null) => + value == null ? '—' : `¥${Number(value).toLocaleString('zh-CN', { minimumFractionDigits: 2, maximumFractionDigits: 2 })}`; + const incomeList = ref([]); const total = ref(0); const queryFormRef = ref(); const { showSearch } = useSearchToggle(); const { loading, withLoading } = useLoading(true); -const { - dateRange: dateRangeIncomeTime, - applyDateRange: applyIncomeTimeDateRange, - resetDateRange: resetIncomeTimeDateRange -} = useDateRangeQuery('IncomeTime'); const queryParams = ref({ pageNum: 1, pageSize: 10, - orderNo: '', - merchantName: '', - payType: '' + beginDate: undefined, + chargeType: undefined }); /** 查询收入明细列表 */ const getList = async () => { - // 把「收入时间」区间写进 queryParams.params(beginIncomeTime / endIncomeTime) - applyIncomeTimeDateRange(queryParams.value); await withLoading(async () => { // TODO: 收入接口就绪后替换为真实请求,例如 listIncome(queryParams.value) 取 res.data.rows / res.data.total incomeList.value = []; @@ -166,17 +143,13 @@ const { resetQuery } = useSearchReset({ queryFormRef, queryParams, pageNumKey: 'pageNum', - resetExtras: () => { - resetIncomeTimeDateRange(); - }, + pageSizeKey: 'pageSize', + initialPageSize: 10, afterReset: () => { handleQuery(); } }); -/** 尚未接入的写操作统一提示,避免静默失败 */ -const notImplemented = () => modal.msgWarning('收入接口待接入,暂不支持该操作'); - onMounted(() => { getList(); }); @@ -186,4 +159,11 @@ onMounted(() => { @use '@/assets/styles/components/page-shell' as pageShell; @include pageShell.table-crud-page; + +.data-table { + .amount-text { + color: var(--el-color-primary); + font-variant-numeric: tabular-nums; + } +} diff --git a/src/views/biz/merchant/index.vue b/src/views/biz/merchant/index.vue index c7000e5..38e96b2 100644 --- a/src/views/biz/merchant/index.vue +++ b/src/views/biz/merchant/index.vue @@ -1,34 +1,29 @@ - + - - Search Filters - 筛选条件 - + 筛选条件 - - - - - - - - - - - - - - - - 搜索 - 重置 - + + + + + + + + + + + + + + 搜索 + 重置 + @@ -37,127 +32,144 @@ - Merchant Dataset - 商户列表 - 共 {{ total }} 条记录,支持按联系人和状态筛选。 + 多商户列表 - - 新增 - 修改 - 删除 + 删除 - - - - - - - - - + + + + + + + - + {{ scope.row.bindingDeviceCount }}台 - - - - - - - - - - - - - + + + {{ scope.row.userCount }} + + + + + {{ formatIncome(scope.row.monthIncome) }} + + + + + + {{ getStatusLabel(scope.row.status) }} + + + + + + + 详情 + + + 禁用 + + + 启用 + + 删除 + - +
共 {{ total }} 条记录,支持按商户、支付方式和收入时间筛选。
共 {{ total }} 条记录,支持按联系人和状态筛选。