对接收入管理、提现管理

This commit is contained in:
zhouyanli
2026-11-03 17:24:31 +08:00
parent 33e33484ec
commit 0bfbc2aaa9
3 changed files with 296 additions and 174 deletions

View File

@@ -1,27 +1,40 @@
<template>
<div class="p-2 app-container help-user-index-page">
<div class="p-2 page-shell helpManage-helpArticle-page">
<el-card shadow="hover" class="tabs-panel">
<div class="segmented" role="tablist" aria-label="帮助类型">
<button
v-for="tab in helpTabs"
:key="tab.value"
type="button"
role="tab"
class="segmented-item"
:class="{ 'is-active': activeTab === tab.value }"
:aria-selected="activeTab === tab.value"
@click="handleTabChange(tab.value)"
>
{{ tab.label }}
</button>
</div>
</el-card>
<div class="search-wrap">
<el-card shadow="hover" class="search-panel" :class="{ 'is-collapsed': !showSearch }">
<template #header>
<div class="panel-heading search-panel-toggle" @click.stop="showSearch = !showSearch">
<div>
<span class="panel-kicker">Search Filters</span>
<h3>筛选条件</h3>
</div>
<div><h3>筛选条件</h3></div>
</div>
</template>
<el-form ref="queryFormRef" :model="queryParams" :inline="true" class="query-form">
<el-form-item label="帮助标题" prop="title">
<el-input v-model="queryParams.title" placeholder="请输入帮助标题" clearable @keyup.enter="handleQuery" />
</el-form-item>
<el-form-item label="分类" prop="category">
<el-select v-model="queryParams.category" placeholder="请选择分类" clearable>
<el-option v-for="item in categoryOptions" :key="item.value" :label="item.label" :value="item.value" />
</el-select>
<el-form-item label="文章标题" prop="title">
<el-input v-model="queryParams.title" placeholder="请输入文章标题" clearable @keyup.enter="handleQuery" />
</el-form-item>
<el-form-item label="状态" prop="status">
<el-select v-model="queryParams.status" placeholder="请选择状态" clearable>
<el-option v-for="item in statusOptions" :key="item.value" :label="item.label" :value="item.value" />
<el-select v-model="queryParams.status" placeholder="请选择状态" clearable >
<el-option
v-for="dict in ur_help_article_status"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
<el-form-item>
@@ -36,154 +49,309 @@
<template #header>
<div class="toolbar-shell">
<div class="table-heading">
<span class="panel-kicker">Help Dataset</span>
<h3>用户帮助</h3>
<p>共 {{ total }} 条记录,支持按分类和状态筛选。</p>
<h3>帮助文章列表</h3>
</div>
<div class="toolbar-actions">
<!-- 帮助模块的接口与菜单尚未建立,权限标识待后端约定后再补 v-hasPermi -->
<el-button type="primary" plain icon="Plus" @click="notImplemented">新增</el-button>
<el-button type="success" plain icon="Edit" :disabled="single" @click="notImplemented">修改</el-button>
<el-button type="danger" plain icon="Delete" :disabled="multiple" @click="notImplemented">删除</el-button>
<el-button type="primary" plain icon="Plus" @click="handleAdd" v-hasPermi="['helpManage:helpArticle:add']">新增</el-button>
<el-button type="success" plain icon="Edit" :disabled="single" @click="handleUpdate()" v-hasPermi="['helpManage:helpArticle:edit']">修改</el-button>
<el-button type="danger" plain icon="Delete" :disabled="multiple" @click="handleDelete()" v-hasPermi="['helpManage:helpArticle:remove']">删除</el-button>
<el-button type="warning" plain icon="Download" @click="handleExport" v-hasPermi="['helpManage:helpArticle:export']">导出</el-button>
<right-toolbar v-model:show-search="showSearch" :search="false" @query-table="getList"></right-toolbar>
</div>
</div>
</template>
<el-table v-loading="loading" :data="helpList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="50" align="center" />
<el-table-column label="帮助标题" prop="title" align="center" min-width="220" show-overflow-tooltip />
<el-table-column label="分类" prop="category" align="center" width="120">
<el-table v-loading="loading" border class="data-table" :data="helpArticleList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="文章标题" align="center" prop="title" min-width="180" show-overflow-tooltip />
<el-table-column label="更新时间" align="center" prop="updateTime" width="180">
<template #default="scope">
<dict-tag :options="categoryOptions" :value="scope.row.category" />
<span>{{ parseTime(scope.row.updateTime) || '-' }}</span>
</template>
</el-table-column>
<el-table-column label="排序" prop="sortNo" align="center" width="90" />
<el-table-column label="状态" prop="status" align="center" width="100">
<el-table-column label="状态" align="center" prop="status" width="100">
<template #default="scope">
<dict-tag :options="statusOptions" :value="scope.row.status" />
<dict-tag :options="ur_help_article_status" :value="scope.row.status" />
</template>
</el-table-column>
<el-table-column label="更新时间" prop="updateTime" align="center" width="170" />
<el-table-column label="备注" prop="remark" align="center" min-width="140" show-overflow-tooltip />
<el-table-column label="操作" align="center" width="150" fixed="right">
<template #default>
<el-tooltip content="详情" placement="top">
<el-button link type="primary" icon="View" @click="notImplemented"></el-button>
</el-tooltip>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template #default="scope">
<el-tooltip content="修改" placement="top">
<el-button link type="primary" icon="Edit" @click="notImplemented"></el-button>
<el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)" v-hasPermi="['helpManage:helpArticle:edit']"></el-button>
</el-tooltip>
<el-tooltip content="删除" placement="top">
<el-button link type="primary" icon="Delete" @click="notImplemented"></el-button>
<el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)" v-hasPermi="['helpManage:helpArticle:remove']"></el-button>
</el-tooltip>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total > 0"
v-model:page="queryParams.pageNum"
v-model:limit="queryParams.pageSize"
:total="total"
@pagination="getList"
/>
<pagination v-show="total > 0" :total="total" v-model:page="queryParams.pageNum" v-model:limit="queryParams.pageSize" @pagination="getList" />
</el-card>
<!-- 添加或修改帮助文章对话框 -->
<el-dialog :title="dialog.title" v-model="dialog.visible" width="800px" append-to-body>
<el-form ref="helpArticleFormRef" :model="form" :rules="rules" label-width="80px">
<el-form-item label="文章标题" prop="title">
<el-input v-model="form.title" placeholder="请输入文章标题" />
</el-form-item>
<el-form-item label="文章内容" prop="content">
<editor v-model="form.content" :min-height="192"/>
</el-form-item>
<el-form-item label="立即上架">
<el-switch v-model="publishNow" />
</el-form-item>
</el-form>
<template #footer>
<div class="dialog-footer">
<el-button :loading="buttonLoading" type="primary" @click="submitForm">确 定</el-button>
<el-button @click="cancel">取 消</el-button>
</div>
</template>
</el-dialog>
</div>
</template>
<script setup name="HelpUser" lang="ts">
<script setup name="HelpArticle" lang="ts">
import {
addHelpArticle,
delHelpArticle,
getHelpArticle,
listHelpArticle,
updateHelpArticle
} from '@/api/helpArticle/index';
import { HelpArticleForm, HelpArticleQuery, HelpArticleVO } from '@/api/helpArticle/types';
import { useLoading } from '@/hooks/async/useLoading';
import { useFormDialog } from '@/hooks/dialog/useFormDialog';
import { useSearchReset } from '@/hooks/form/useSearchReset';
import { useSearchToggle } from '@/hooks/form/useSearchToggle';
import { useTableSelection } from '@/hooks/table/useTableSelection';
import { parseTime } from '@/utils/ruoyi';
import { useDict } from '@/utils/dict';
import modal from '@/plugins/modal';
import { download as requestDownload } from '@/utils/request';
/** 用户帮助(面向住户端的说明文档) */
interface HelpVO {
/** 帮助ID */
helpId?: string;
/** 帮助标题 */
title?: string;
/** 分类(1充值说明 2故障报修 3水费电价 4其他) */
category?: string;
/** 排序 */
sortNo?: number;
/** 状态(0发布 1停用) */
status?: string;
/** 更新时间 */
updateTime?: string;
/** 备注 */
remark?: string;
}
interface HelpQuery extends PageQuery {
title?: string;
category?: string;
status?: string;
}
// 帮助字典后端尚未建立,先用本地兜底选项
const categoryOptions: DictDataOption[] = [
{ label: '充值说明', value: '1', elTagType: 'primary' },
{ label: '故障报修', value: '2', elTagType: 'warning' },
{ label: '水费电价', value: '3', elTagType: 'success' },
{ label: '其他', value: '4', elTagType: 'info' }
/** 状态字典 */
const { ur_help_article_status } = toRefs<any>(useDict('ur_help_article_status'));
/** 适用端:0 租客(用户帮助) 1 房东(房东帮助) */
const helpTabs = [
{ label: '用户帮助', value: '0' },
{ label: '房东帮助', value: '1' }
];
const statusOptions: DictDataOption[] = [
{ label: '发布', value: '0', elTagType: 'success' },
{ label: '停用', value: '1', elTagType: 'danger' }
];
const helpList = ref<HelpVO[]>([]);
const total = ref(0);
const queryFormRef = ref<ElFormInstance>();
const { showSearch } = useSearchToggle();
const activeTab = ref('0');
const helpArticleList = ref<HelpArticleVO[]>([]);
const buttonLoading = ref(false);
const { loading, withLoading } = useLoading(true);
const { single, multiple, handleSelectionChange } = useTableSelection<HelpVO>(item => item.helpId);
const { showSearch } = useSearchToggle();
const total = ref(0);
const queryParams = ref<HelpQuery>({
pageNum: 1,
pageSize: 10,
title: '',
category: '',
status: ''
const queryFormRef = ref<ElFormInstance>();
const helpArticleFormRef = ref<ElFormInstance>();
const initFormData: HelpArticleForm = {
articleId: undefined,
categoryId: undefined,
audience: undefined,
title: undefined,
content: undefined,
status: undefined,
publishedAt: undefined,
createDept: undefined,
createBy: undefined,
createTime: undefined,
updateBy: undefined,
updateTime: undefined,
}
const data = reactive<PageData<HelpArticleForm, HelpArticleQuery>>({
form: { ...initFormData },
queryParams: {
pageNum: 1,
pageSize: 10,
// 适用端必传:0 租客 / 1 房东,与页签保持一致
audience: '0',
title: undefined,
status: undefined
},
rules: {
title: [
{ required: true, message: "文章标题不能为空", trigger: "blur" }
],
content: [
{ required: true, message: "文章内容不能为空", trigger: "blur" }
],
}
});
/** 查询用户帮助列表 */
const { queryParams, form, rules } = toRefs(data);
/** 弹窗「立即上架」开关:开 → 状态置为已上架并记录上架时间;关 → 草稿(已下架保持原状态) */
const publishNow = ref(false);
const applyPublishState = () => {
if (publishNow.value) {
// 从未上架转为上架时,记录本次上架时间
if (form.value.status !== '1') {
form.value.publishedAt = parseTime(new Date()) ?? undefined;
}
form.value.status = '1';
} else if (form.value.status !== '2') {
form.value.status = '0';
}
};
const { ids, single, multiple, handleSelectionChange } = useTableSelection<HelpArticleVO>(item => item.articleId);
const { dialog, resetForm: reset, openDialog, showDialog, closeDialog } = useFormDialog({
form,
formRef: helpArticleFormRef,
initialFormData: initFormData
});
/** 查询帮助文章列表 */
const getList = async () => {
// TODO: 帮助接口就绪后替换为真实请求,例如 listHelp(queryParams.value) 取 res.data.rows / res.data.total
await withLoading(async () => {
helpList.value = [];
total.value = 0;
const res = await listHelpArticle(queryParams.value);
helpArticleList.value = res.data?.rows;
total.value = res.data?.total;
});
};
/** 取消按钮 */
const cancel = () => {
reset();
closeDialog();
};
/** 搜索按钮操作 */
const handleQuery = () => {
queryParams.value.pageNum = 1;
getList();
};
/** 用户帮助 / 房东帮助切换 */
const handleTabChange = (audience: string) => {
if (activeTab.value === audience) return;
activeTab.value = audience;
queryParams.value.audience = audience;
handleQuery();
};
const { resetQuery } = useSearchReset({
queryFormRef,
queryParams,
pageNumKey: 'pageNum',
pageSizeKey: 'pageSize',
initialPageSize: 10,
afterReset: () => {
handleQuery();
}
});
/** 尚未接入的写操作统一提示,避免静默失败 */
const notImplemented = () => modal.msgWarning('帮助接口待接入,暂不支持该操作');
/** 新增按钮操作 */
const handleAdd = () => {
publishNow.value = false;
openDialog('添加帮助文章');
// 适用端不在弹窗里编辑,默认归属当前页签
form.value.audience = activeTab.value;
};
/** 修改按钮操作 */
const handleUpdate = async (row?: Partial<HelpArticleVO>) => {
reset();
const _articleId = row?.articleId || ids.value[0];
const res = await getHelpArticle(_articleId);
Object.assign(form.value, res.data);
publishNow.value = form.value.status === '1';
showDialog('修改帮助文章');
};
/** 提交按钮 */
const submitForm = () => {
helpArticleFormRef.value?.validate(async (valid: boolean) => {
if (valid) {
applyPublishState();
buttonLoading.value = true;
if (form.value.articleId) {
await updateHelpArticle(form.value).finally(() => (buttonLoading.value = false));
} else {
await addHelpArticle(form.value).finally(() => (buttonLoading.value = false));
}
modal.msgSuccess('操作成功');
closeDialog();
await getList();
}
});
};
/** 删除按钮操作 */
const handleDelete = async (row?: Partial<HelpArticleVO>) => {
const _articleIds = row?.articleId || ids.value;
await modal.confirm('是否确认删除帮助文章编号为"' + _articleIds + '"的数据项?');
await delHelpArticle(_articleIds);
modal.msgSuccess('删除成功');
await getList();
};
/** 导出按钮操作 */
const handleExport = () => {
requestDownload(
'helpManage/helpArticle/export',
{
...queryParams.value
},
`helpArticle_${new Date().getTime()}.xlsx`
);
};
onMounted(() => {
getList();
});
</script>
<style lang="scss" scoped>
@use '@/assets/styles/components/page-shell' as pageShell;
<style scoped lang="scss">
.tabs-panel {
:deep(.el-card__body) {
padding: 10px 16px;
}
}
@include pageShell.table-crud-page;
/* 分段式切换:整条灰底,选中项为白色圆角浮起 */
.segmented {
display: flex;
gap: 4px;
padding: 4px;
border-radius: 10px;
background: var(--el-fill-color-light);
}
.segmented-item {
flex: 1;
padding: 8px 0;
border: 0;
border-radius: 8px;
background: transparent;
color: var(--el-text-color-secondary);
font-size: 14px;
line-height: 22px;
cursor: pointer;
transition:
background-color 0.2s,
color 0.2s;
&:hover {
color: var(--el-text-color-primary);
}
&.is-active {
background: var(--el-color-primary);
color: #fff;
// background: var(--app-surface-bg);
// color: var(--el-text-color-primary);
font-weight: 600;
box-shadow: 0 1px 3px rgb(0 0 0 / 8%);
}
}
</style>

View File

@@ -52,13 +52,15 @@
<el-table v-loading="loading" :data="withdrawalList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="50" align="center" />
<el-table-column label="申请编号" prop="orderNo" align="center" min-width="180" show-overflow-tooltip />
<el-table-column label="申请时间" prop="applyTime" align="center" min-width="170" />
<el-table-column label="提现金额(元)" align="center" min-width="140">
<template #default="scope">{{ formatAmount(scope.row.amount) }}</template>
</el-table-column>
<el-table-column label="收款账户" prop="account" align="center" min-width="180" show-overflow-tooltip />
<el-table-column label="申请编号" prop="applyNo" align="center" min-width="140" show-overflow-tooltip />
<el-table-column label="申请人" prop="applicantName" align="center" min-width="120" show-overflow-tooltip />
<el-table-column label="提现金额(元)" prop="amount" align="center" min-width="140" />
<el-table-column label="收款账户" align="center" min-width="180" show-overflow-tooltip>
<template #default="scope">{{ formatAccount(scope.row) }}</template>
</el-table-column>
<el-table-column label="申请时间" prop="createTime" align="center" min-width="170">
<template #default="scope">{{ parseTime(scope.row.createTime) || '-' }}</template>
</el-table-column>
</el-table>
<pagination
@@ -73,56 +75,19 @@
</template>
<script setup name="Withdrawal" lang="ts">
import { listWithdrawal } from '@/api/withdrawal/index';
import type { WithdrawalQuery, WithdrawalVO } from '@/api/withdrawal/types';
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 { useTableSelection } from '@/hooks/table/useTableSelection';
import modal from '@/plugins/modal';
import { parseTime } from '@/utils/ruoyi';
/** 商户提现申请(审核台账) */
interface WithdrawalVO {
/** 提现ID */
withdrawalId?: string;
/** 提现单号 */
orderNo?: string;
/** 商户名称 */
merchantName?: string;
/** 申请人 */
applicantName?: string;
/** 提现金额(元) */
amount?: number;
/** 手续费(元) */
fee?: number;
/** 到账金额(元) */
actualAmount?: number;
/** 收款账户 */
account?: string;
/** 审核状态(0待审核 1已通过 2已驳回 3已打款) */
auditStatus?: string;
/** 申请时间 */
applyTime?: string;
/** 审核时间 */
auditTime?: string;
/** 备注 */
remark?: string;
}
interface WithdrawalQuery extends PageQuery {
orderNo?: string;
merchantName?: string;
auditStatus?: string;
/** 申请人 */
applicantName?: string;
}
/** 金额展示:保留两位小数,单位已写在列名里;无值时不展示 */
const formatAmount = (value?: number | string | null) => {
if (value == null || value === '') return '';
const amount = Number(value);
return Number.isNaN(amount)
? `${value}`
: amount.toLocaleString('zh-CN', { minimumFractionDigits: 2, maximumFractionDigits: 2 });
/** 收款账户:优先后端拼好的展示文案,缺失时用「银行 + 脱敏卡号」兜底 */
const formatAccount = (row: Pick<WithdrawalVO, 'receiveAccount' | 'bankName' | 'cardNoMasked'>) => {
if (row.receiveAccount) return row.receiveAccount;
return [row.bankName, row.cardNoMasked].filter(Boolean).join(' ') || '-';
};
const withdrawalList = ref<WithdrawalVO[]>([]);
@@ -130,30 +95,30 @@ const total = ref(0);
const queryFormRef = ref<ElFormInstance>();
const { showSearch } = useSearchToggle();
const { loading, withLoading } = useLoading(true);
const { multiple, handleSelectionChange } = useTableSelection<WithdrawalVO>(item => item.withdrawalId);
const { handleSelectionChange } = useTableSelection<WithdrawalVO>(item => item.withdrawalId);
const {
dateRange: dateRangeApplyTime,
applyDateRange: applyApplyTimeDateRange,
resetDateRange: resetApplyTimeDateRange
} = useDateRangeQuery('ApplyTime');
} = useDateRangeQuery();
const queryParams = ref<WithdrawalQuery>({
pageNum: 1,
pageSize: 10,
orderNo: '',
merchantName: '',
auditStatus: '',
applicantName: ''
applyNo: undefined,
applicantName: undefined,
status: undefined,
params: {}
});
/** 查询提现申请列表 */
const getList = async () => {
// 把「申请时间」区间写进 queryParams.params(beginApplyTime / endApplyTime)
// 把「申请时间」区间写进 queryParams.params(beginTime / endTime)
applyApplyTimeDateRange(queryParams.value);
await withLoading(async () => {
// TODO: 提现接口就绪后替换为真实请求,例如 listWithdrawal(queryParams.value) 取 res.data.rows / res.data.total
withdrawalList.value = [];
total.value = 0;
const res = await listWithdrawal(queryParams.value);
withdrawalList.value = res.data?.rows ?? [];
total.value = res.data?.total ?? 0;
});
};
@@ -175,9 +140,6 @@ const { resetQuery } = useSearchReset({
}
});
/** 尚未接入的写操作统一提示,避免静默失败 */
const notImplemented = () => modal.msgWarning('提现接口待接入,暂不支持该操作');
onMounted(() => {
getList();
});

View File

@@ -11,9 +11,6 @@
</div>
</template>
<el-form ref="queryFormRef" :model="queryParams" :inline="true" class="query-form">
<el-form-item label="名称" prop="name">
<el-input v-model="queryParams.name" placeholder="请输入名称" clearable @keyup.enter="handleQuery" />
</el-form-item>
<el-form-item label="电话" prop="phone">
<el-input v-model="queryParams.phone" placeholder="请输入电话" clearable @keyup.enter="handleQuery" />
</el-form-item>
@@ -55,23 +52,18 @@
<el-table v-loading="loading" :data="phoneList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="50" align="center" />
<el-table-column label="名称" prop="name" align="center" min-width="160" show-overflow-tooltip />
<el-table-column label="电话" prop="phone" align="center" width="150" />
<el-table-column label="类型" prop="phoneType" align="center" width="110">
<el-table-column label="电话类型" prop="phoneType" align="center" >
<template #default="scope">
<dict-tag :options="phoneTypeOptions" :value="scope.row.phoneType" />
</template>
</el-table-column>
<el-table-column label="服务时间" prop="serviceTime" align="center" min-width="160" show-overflow-tooltip />
<el-table-column label="排序" prop="sortNo" align="center" width="90" />
<el-table-column label="状态" prop="status" align="center" width="100">
<el-table-column label="电话号码" prop="phone" align="center" />
<el-table-column label="状态" prop="status" align="center" >
<template #default="scope">
<dict-tag :options="statusOptions" :value="scope.row.status" />
</template>
</el-table-column>
<el-table-column label="创建时间" prop="createTime" align="center" width="170" />
<el-table-column label="备注" prop="remark" align="center" min-width="140" show-overflow-tooltip />
<el-table-column label="操作" align="center" width="150" fixed="right">
<el-table-column label="操作" align="center" fixed="right">
<template #default>
<el-tooltip content="详情" placement="top">
<el-button link type="primary" icon="View" @click="notImplemented"></el-button>