From a7727d432b13f23e53d8143f9dbb19ac6416385d Mon Sep 17 00:00:00 2001 From: zsqtony <450952271@qq.com> Date: Fri, 4 Jul 2025 17:26:52 +0800 Subject: [PATCH] =?UTF-8?q?feat=EF=BC=9A=E8=B4=B9=E7=94=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/gen/ApiTypes.d.ts | 44 +++++ src/gen/Apis.ts | 25 +++ src/gen/Enums.ts | 35 ++++ src/pages/archive/house_bills/index.tsx | 90 ++++++++++ .../archive/house_bills/modals/Create.tsx | 155 +++++++++++++++++ .../archive/house_bills/modals/Update.tsx | 156 ++++++++++++++++++ .../modals/OccupantsCreate.tsx | 1 - 7 files changed, 505 insertions(+), 1 deletion(-) create mode 100644 src/pages/archive/house_bills/index.tsx create mode 100644 src/pages/archive/house_bills/modals/Create.tsx create mode 100644 src/pages/archive/house_bills/modals/Update.tsx diff --git a/src/gen/ApiTypes.d.ts b/src/gen/ApiTypes.d.ts index 9015d59..56c9a04 100644 --- a/src/gen/ApiTypes.d.ts +++ b/src/gen/ApiTypes.d.ts @@ -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 = { diff --git a/src/gen/Apis.ts b/src/gen/Apis.ts index 92b0ab0..1545535 100644 --- a/src/gen/Apis.ts +++ b/src/gen/Apis.ts @@ -126,6 +126,31 @@ export const Apis = { }, }, }, + Bill: { + HouseBills: { + List(data?: ApiTypes.Bill.HouseBills.List): Promise { + return request('admin/bill/house_bills/list', { data }); + }, + Store(data: ApiTypes.Bill.HouseBills.Store): Promise { + return request('admin/bill/house_bills/store', { data }); + }, + Update(data: ApiTypes.Bill.HouseBills.Update): Promise { + return request('admin/bill/house_bills/update', { data }); + }, + Show(data: ApiTypes.Bill.HouseBills.Show): Promise { + return request('admin/bill/house_bills/show', { data }); + }, + SoftDelete(data: ApiTypes.Bill.HouseBills.SoftDelete): Promise { + return request('admin/bill/house_bills/soft_delete', { data }); + }, + Restore(data: ApiTypes.Bill.HouseBills.Restore): Promise { + return request('admin/bill/house_bills/restore', { data }); + }, + Delete(data: ApiTypes.Bill.HouseBills.Delete): Promise { + return request('admin/bill/house_bills/delete', { data }); + }, + }, + }, Common: { Admins: { List(data?: ApiTypes.Common.Admins.List): Promise { diff --git a/src/gen/Enums.ts b/src/gen/Enums.ts index fcdc916..a1836a6 100644 --- a/src/gen/Enums.ts +++ b/src/gen/Enums.ts @@ -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"}, diff --git a/src/pages/archive/house_bills/index.tsx b/src/pages/archive/house_bills/index.tsx new file mode 100644 index 0000000..49c6dae --- /dev/null +++ b/src/pages/archive/house_bills/index.tsx @@ -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 ( + + + MyProTableProps.request(params, sort, Apis.Bill.HouseBills.List) + } + toolBarRender={(action) => [ + , + ]} + 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) => ( + + + + Apis.Common.Admins.Delete({ id: item.id }).then(() => + action?.reload(), + ) + } + /> + + ), + }), + ]} + /> + + ); +} diff --git a/src/pages/archive/house_bills/modals/Create.tsx b/src/pages/archive/house_bills/modals/Create.tsx new file mode 100644 index 0000000..536d4dc --- /dev/null +++ b/src/pages/archive/house_bills/modals/Create.tsx @@ -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 ( + + {...MyModalFormProps.props} + title={`添加${props.title}`} + wrapperCol={{ span: 24 }} + width="600px" + trigger={} + 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 }, + }, + ]} + /> + ); +} diff --git a/src/pages/archive/house_bills/modals/Update.tsx b/src/pages/archive/house_bills/modals/Update.tsx new file mode 100644 index 0000000..bfdea43 --- /dev/null +++ b/src/pages/archive/house_bills/modals/Update.tsx @@ -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 ( + + {...MyModalFormProps.props} + title={`编辑${props.title}`} + trigger={} + 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 }, + }, + ]} + /> + ); +} diff --git a/src/pages/archive/house_registers/modals/OccupantsCreate.tsx b/src/pages/archive/house_registers/modals/OccupantsCreate.tsx index 04fdee9..0d43791 100644 --- a/src/pages/archive/house_registers/modals/OccupantsCreate.tsx +++ b/src/pages/archive/house_registers/modals/OccupantsCreate.tsx @@ -50,7 +50,6 @@ export default function Create(props: MyBetaModalFormProps) { colProps: { span: 8 }, formItemProps: { ...rulesHelper.text }, }), - { valueType: 'dependency', name: ['asset_projects_id'],