feat:费用

This commit is contained in:
zsqtony 2025-07-04 17:26:52 +08:00
parent e5a723fb84
commit a7727d432b
7 changed files with 505 additions and 1 deletions

44
src/gen/ApiTypes.d.ts vendored
View File

@ -251,6 +251,50 @@ declare namespace ApiTypes {
};
}
}
namespace Bill {
namespace HouseBills {
type List = {
"full_name"?: string; // 模糊搜索:房屋名称
"company_name"?: string; // 模糊搜索:公司名称
};
type Store = {
"asset_houses_id": number; // 资产房屋id,[ref:asset_houses]
"type": string; // 账单类型,[enum:HouseBillsTypeEnum]
"amount": number; // 金额
"discount_amount"?: number; // 优惠金额
"late_fee"?: number; // 滞纳金
"start_date": Date; // 计费开始日期
"end_date": Date; // 计费结束日期
"late_start_date"?: Date; // 滞纳金起算日期
"collected_late_fee_days"?: number; // 已收滞纳金天数
"remark"?: string; // 备注
};
type Update = {
"id": number; // id
"type": string; // 账单类型,[enum:HouseBillsTypeEnum]
"amount": number; // 金额
"discount_amount"?: number; // 优惠金额
"late_fee"?: number; // 滞纳金
"start_date": Date; // 计费开始日期
"end_date": Date; // 计费结束日期
"late_start_date"?: Date; // 滞纳金起算日期
"collected_late_fee_days"?: number; // 已收滞纳金天数
"remark"?: string; // 备注
};
type Show = {
"id": number; // id
};
type SoftDelete = {
"id": number; // id
};
type Restore = {
"id": number; // id
};
type Delete = {
"id": number; // id
};
}
}
namespace Common {
namespace Admins {
type List = {

View File

@ -126,6 +126,31 @@ export const Apis = {
},
},
},
Bill: {
HouseBills: {
List(data?: ApiTypes.Bill.HouseBills.List): Promise<MyResponseType> {
return request('admin/bill/house_bills/list', { data });
},
Store(data: ApiTypes.Bill.HouseBills.Store): Promise<MyResponseType> {
return request('admin/bill/house_bills/store', { data });
},
Update(data: ApiTypes.Bill.HouseBills.Update): Promise<MyResponseType> {
return request('admin/bill/house_bills/update', { data });
},
Show(data: ApiTypes.Bill.HouseBills.Show): Promise<MyResponseType> {
return request('admin/bill/house_bills/show', { data });
},
SoftDelete(data: ApiTypes.Bill.HouseBills.SoftDelete): Promise<MyResponseType> {
return request('admin/bill/house_bills/soft_delete', { data });
},
Restore(data: ApiTypes.Bill.HouseBills.Restore): Promise<MyResponseType> {
return request('admin/bill/house_bills/restore', { data });
},
Delete(data: ApiTypes.Bill.HouseBills.Delete): Promise<MyResponseType> {
return request('admin/bill/house_bills/delete', { data });
},
},
},
Common: {
Admins: {
List(data?: ApiTypes.Common.Admins.List): Promise<MyResponseType> {

View File

@ -108,6 +108,25 @@ export const CompanyReceiptAccountsPayChannelEnum= {
'TongLian': {"text":"通联支付","color":"#ff9f0a","value":"TongLian"},
};
// 账单状态枚举
export const HouseBillsBillStatusEnum= {
'PendingPayment': {"text":"待支付","color":"#facc15","value":"PendingPayment"},
'PartiallyPaid': {"text":"部分支付","color":"#60a5fa","value":"PartiallyPaid"},
'Paid': {"text":"已支付","color":"#10b981","value":"Paid"},
'Overdue': {"text":"已逾期","color":"#ef4444","value":"Overdue"},
'Cancelled': {"text":"已取消","color":"#9ca3af","value":"Cancelled"},
};
// 房屋账单类型枚举
export const HouseBillsTypeEnum= {
'PropertyFee': {"text":"物业费","color":"#3b82f6","value":"PropertyFee"},
'MaintenanceFund': {"text":"维修基金","color":"#10b981","value":"MaintenanceFund"},
'WaterFee': {"text":"水费","color":"#06b6d4","value":"WaterFee"},
'ElectricityFee': {"text":"电费","color":"#f59e0b","value":"ElectricityFee"},
'SharedWaterFee': {"text":"公摊水费","color":"#8b5cf6","value":"SharedWaterFee"},
'SharedElectricityFee': {"text":"公摊电费","color":"#ec4899","value":"SharedElectricityFee"},
};
// HouseOccupantsCardTypeEnum
export const HouseOccupantsCardTypeEnum= {
'MainlandID': {"text":"中国大陆居民身份证","color":"#2db7f5","value":"MainlandID"},
@ -141,6 +160,22 @@ export const HouseOccupantsStatusEnum= {
'Unbound': {"text":"已解除","color":"#f5222d","value":"Unbound"},
};
// 订单状态枚举
export const HouseOrdersOrderStatusEnum= {
'Pending': {"text":"待支付","color":"#facc15","value":"Pending"},
'Paid': {"text":"已支付","color":"#10b981","value":"Paid"},
'Refunded': {"text":"已退款","color":"#60a5fa","value":"Refunded"},
'Cancelled': {"text":"已取消","color":"#9ca3af","value":"Cancelled"},
};
// HouseOrdersPaymentMethodEnum
export const HouseOrdersPaymentMethodEnum= {
'WeChat': {"text":"微信","color":"#07c160","value":"WeChat"},
'Alipay': {"text":"支付宝","color":"#1677ff","value":"Alipay"},
'BankTransfer': {"text":"银行转账","color":"#6c757d","value":"BankTransfer"},
'TongLian': {"text":"通联支付","color":"#ff9f0a","value":"TongLian"},
};
// HouseRegistersCustomerTypeEnum
export const HouseRegistersCustomerTypeEnum= {
'Individual': {"text":"个人客户","color":"#2db7f5","value":"Individual"},

View File

@ -0,0 +1,90 @@
import {
MyButtons,
MyColumns,
MyPageContainer,
MyProTableProps,
} from '@/common';
import { Apis } from '@/gen/Apis';
import { HouseBillsTypeEnum } from '@/gen/Enums';
import { ProTable } from '@ant-design/pro-components';
import { Space } from 'antd';
import Create from './modals/Create';
import Update from './modals/Update';
export default function Index({ title = '账单' }) {
return (
<MyPageContainer title={title}>
<ProTable
{...MyProTableProps.props}
request={async (params, sort) =>
MyProTableProps.request(params, sort, Apis.Bill.HouseBills.List)
}
toolBarRender={(action) => [
<Create key="Create" reload={action?.reload} title={title} />,
]}
columns={[
MyColumns.ID(),
{
title: '金额',
dataIndex: 'amount',
},
{
title: '优惠金额',
dataIndex: 'discount_amount',
search: false,
},
{
title: '滞纳金',
dataIndex: 'late_fee',
search: false,
},
MyColumns.EnumTag({
title: '类型',
dataIndex: 'type',
valueEnum: HouseBillsTypeEnum,
}),
{
title: '计费开始日期',
dataIndex: 'start_date',
search: false,
},
{
title: '计费结束日期',
dataIndex: 'end_date',
search: false,
},
{
title: '滞纳金起算日期',
dataIndex: 'late_start_date',
search: false,
},
{
title: '已收滞纳金天数',
dataIndex: 'collected_late_fee_days',
search: false,
},
{
title: '备注',
dataIndex: 'remark',
search: false,
},
MyColumns.CreatedAt(),
MyColumns.Option({
render: (_, item: any, index, action) => (
<Space key={index}>
<Update item={item} reload={action?.reload} title={title} />
<MyButtons.Delete
onConfirm={() =>
Apis.Common.Admins.Delete({ id: item.id }).then(() =>
action?.reload(),
)
}
/>
</Space>
),
}),
]}
/>
</MyPageContainer>
);
}

View File

@ -0,0 +1,155 @@
import {
MyBetaModalFormProps,
MyButtons,
MyFormItems,
MyModalFormProps,
rulesHelper,
} from '@/common';
import { Selects } from '@/components/Select';
import { Apis } from '@/gen/Apis';
import { HouseBillsTypeEnum } from '@/gen/Enums';
import { BetaSchemaForm } from '@ant-design/pro-components';
import { Form, message } from 'antd';
export default function Create(props: MyBetaModalFormProps) {
const [form] = Form.useForm();
return (
<BetaSchemaForm<ApiTypes.Bill.HouseBills.Store>
{...MyModalFormProps.props}
title={`添加${props.title}`}
wrapperCol={{ span: 24 }}
width="600px"
trigger={<MyButtons.Create title={`添加${props.title}`} />}
onOpenChange={(open: any) => {
if (open) {
form.resetFields(); // 清空表单数据
}
}}
onFinish={async (values) =>
Apis.Bill.HouseBills.Store(values)
.then(() => {
props.reload?.();
message.success(props.title + '成功');
return true;
})
.catch(() => false)
}
columns={[
Selects?.AssetProjects({
title: '选择项目',
key: 'asset_projects_id',
colProps: { span: 12 },
formItemProps: { ...rulesHelper.text },
}),
{
valueType: 'dependency',
name: ['asset_projects_id'],
columns: ({ asset_projects_id }) => [
Selects?.AssetHouses({
title: '选择房屋',
key: 'asset_houses_id',
params: { asset_projects_id: asset_projects_id },
formItemProps: { ...rulesHelper.text },
colProps: { span: 12 },
}),
],
},
{
key: 'amount',
title: '金额',
valueType: 'digit',
colProps: { span: 8 },
fieldProps: {
style: {
width: '100%',
},
},
formItemProps: { ...rulesHelper.number },
},
{
key: 'discount_amount',
title: '优惠金额',
valueType: 'digit',
fieldProps: {
style: {
width: '100%',
},
},
colProps: { span: 8 },
},
{
key: 'late_fee',
title: '滞纳金',
valueType: 'digit',
fieldProps: {
style: {
width: '100%',
},
},
colProps: { span: 8 },
},
MyFormItems.EnumRadio({
key: 'type',
title: '类型',
colProps: { span: 24 },
valueEnum: HouseBillsTypeEnum,
required: true,
}),
{
key: 'start_date',
title: '计费开始日期',
valueType: 'date',
colProps: { span: 8 },
fieldProps: {
style: {
width: '100%',
},
},
formItemProps: { ...rulesHelper.text },
},
{
key: 'end_date',
title: '计费结束日期',
valueType: 'date',
colProps: { span: 8 },
fieldProps: {
style: {
width: '100%',
},
},
formItemProps: { ...rulesHelper.text },
},
{
key: 'late_start_date',
title: '滞纳金起算日期',
valueType: 'date',
fieldProps: {
style: {
width: '100%',
},
},
colProps: { span: 8 },
},
{
key: 'collected_late_fee_days',
title: '已收滞纳金天数',
valueType: 'digit',
fieldProps: {
addonAfter: '天',
style: {
width: '100%',
},
},
colProps: { span: 8 },
},
{
title: '备注',
key: 'remark',
valueType: 'textarea',
colProps: { span: 24 },
},
]}
/>
);
}

View File

@ -0,0 +1,156 @@
import {
MyBetaModalFormProps,
MyButtons,
MyFormItems,
MyModalFormProps,
rulesHelper,
} from '@/common';
import { Selects } from '@/components/Select';
import { Apis } from '@/gen/Apis';
import { HouseBillsTypeEnum } from '@/gen/Enums';
import { BetaSchemaForm } from '@ant-design/pro-components';
import { Form, message } from 'antd';
export default function Update(props: MyBetaModalFormProps) {
const [form] = Form.useForm();
return (
<BetaSchemaForm<ApiTypes.Bill.HouseBills.Update>
{...MyModalFormProps.props}
title={`编辑${props.title}`}
trigger={<MyButtons.Edit />}
wrapperCol={{ span: 24 }}
width="600px"
form={form}
onOpenChange={(open: any) => {
if (open && props.item) {
form.setFieldsValue(props.item);
}
}}
onFinish={async (values) =>
Apis.Bill.HouseBills.Update({ ...values, id: props.item?.id ?? 0 })
.then(() => {
props.reload?.();
message.success(props.title + '成功');
return true;
})
.catch(() => false)
}
columns={[
Selects?.AssetProjects({
title: '选择项目',
key: 'asset_projects_id',
colProps: { span: 12 },
formItemProps: { ...rulesHelper.text },
}),
{
valueType: 'dependency',
name: ['asset_projects_id'],
columns: ({ asset_projects_id }) => [
Selects?.AssetHouses({
title: '选择房屋',
key: 'asset_houses_id',
params: { asset_projects_id: asset_projects_id },
formItemProps: { ...rulesHelper.text },
colProps: { span: 12 },
}),
],
},
{
key: 'amount',
title: '金额',
valueType: 'digit',
colProps: { span: 8 },
fieldProps: {
style: {
width: '100%',
},
},
formItemProps: { ...rulesHelper.number },
},
{
key: 'discount_amount',
title: '优惠金额',
valueType: 'digit',
fieldProps: {
style: {
width: '100%',
},
},
colProps: { span: 8 },
},
{
key: 'late_fee',
title: '滞纳金',
valueType: 'digit',
fieldProps: {
style: {
width: '100%',
},
},
colProps: { span: 8 },
},
MyFormItems.EnumRadio({
key: 'type',
title: '类型',
colProps: { span: 24 },
valueEnum: HouseBillsTypeEnum,
required: true,
}),
{
key: 'start_date',
title: '计费开始日期',
valueType: 'date',
colProps: { span: 8 },
fieldProps: {
style: {
width: '100%',
},
},
formItemProps: { ...rulesHelper.text },
},
{
key: 'end_date',
title: '计费结束日期',
valueType: 'date',
colProps: { span: 8 },
fieldProps: {
style: {
width: '100%',
},
},
formItemProps: { ...rulesHelper.text },
},
{
key: 'late_start_date',
title: '滞纳金起算日期',
valueType: 'date',
fieldProps: {
style: {
width: '100%',
},
},
colProps: { span: 8 },
},
{
key: 'collected_late_fee_days',
title: '已收滞纳金天数',
valueType: 'digit',
fieldProps: {
addonAfter: '天',
style: {
width: '100%',
},
},
colProps: { span: 8 },
},
{
title: '备注',
key: 'remark',
valueType: 'textarea',
colProps: { span: 24 },
},
]}
/>
);
}

View File

@ -50,7 +50,6 @@ export default function Create(props: MyBetaModalFormProps) {
colProps: { span: 8 },
formItemProps: { ...rulesHelper.text },
}),
{
valueType: 'dependency',
name: ['asset_projects_id'],