2026-01-08 16:35:06 +08:00
|
|
|
import {
|
|
|
|
|
MyButtons,
|
|
|
|
|
MyColumns,
|
2026-04-22 17:45:00 +08:00
|
|
|
MyImportModal,
|
2026-01-08 16:35:06 +08:00
|
|
|
MyPageContainer,
|
|
|
|
|
MyProTableProps,
|
2026-04-22 17:45:00 +08:00
|
|
|
MyTableActions,
|
|
|
|
|
MyToolBarActions,
|
2026-01-08 16:35:06 +08:00
|
|
|
} from '@/common';
|
2026-04-22 17:45:00 +08:00
|
|
|
|
|
|
|
|
import { MyExport } from '@/components/MyExport';
|
|
|
|
|
import { Selects } from '@/components/Select';
|
2026-01-08 16:35:06 +08:00
|
|
|
import { Apis } from '@/gen/Apis';
|
2026-04-22 17:45:00 +08:00
|
|
|
import {
|
|
|
|
|
ApprovalTemplatesTypeEnum,
|
|
|
|
|
HouseBillsBillStatusEnum,
|
|
|
|
|
HouseBillsTypeEnum,
|
|
|
|
|
RefundsTypeEnum,
|
|
|
|
|
} from '@/gen/Enums';
|
2026-01-08 16:35:06 +08:00
|
|
|
import { ProTable } from '@ant-design/pro-components';
|
|
|
|
|
import { useNavigate } from '@umijs/max';
|
2026-04-22 17:45:00 +08:00
|
|
|
import { useState } from 'react';
|
2026-01-08 16:35:06 +08:00
|
|
|
import BillCreate from './modals/BillCreate';
|
|
|
|
|
import BIllInfo from './modals/BIllInfo';
|
|
|
|
|
import BillRefund from './modals/BillRefund';
|
|
|
|
|
import BillUpdate from './modals/BillUpdate';
|
2026-04-22 17:45:00 +08:00
|
|
|
import PayCreate from './modals/Pay';
|
|
|
|
|
import ShowQrCode from './modals/QrCode';
|
|
|
|
|
import RefundComplete from './modals/RefundComplete';
|
2026-01-08 16:35:06 +08:00
|
|
|
|
|
|
|
|
export default function Index({ title = '账单明细' }) {
|
|
|
|
|
const navigate = useNavigate();
|
2026-04-22 17:45:00 +08:00
|
|
|
const [getParams, setParams] = useState({});
|
2026-01-08 16:35:06 +08:00
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<MyPageContainer
|
|
|
|
|
title={title}
|
|
|
|
|
enableTabs={true}
|
|
|
|
|
tabKey="house_bills"
|
|
|
|
|
tabLabel={title}
|
|
|
|
|
>
|
|
|
|
|
<ProTable
|
|
|
|
|
{...MyProTableProps.props}
|
|
|
|
|
headerTitle={title}
|
2026-04-22 17:45:00 +08:00
|
|
|
request={async (params, sort) => {
|
|
|
|
|
setParams(params);
|
|
|
|
|
return MyProTableProps.request(
|
|
|
|
|
params,
|
|
|
|
|
sort,
|
|
|
|
|
Apis.Bill.HouseBills.List,
|
|
|
|
|
);
|
|
|
|
|
}}
|
|
|
|
|
toolBarRender={(action: any) => [
|
|
|
|
|
<MyToolBarActions
|
|
|
|
|
key="toolbar"
|
|
|
|
|
actions={{
|
|
|
|
|
import: (
|
|
|
|
|
<MyImportModal
|
|
|
|
|
key="ImportHouse"
|
|
|
|
|
title="应收导入"
|
|
|
|
|
type="default"
|
|
|
|
|
size="middle"
|
|
|
|
|
templateApi={Apis.Bill.HouseBills.DownloadTemplate}
|
|
|
|
|
importApi={Apis.Bill.HouseBills.Import}
|
|
|
|
|
reload={action?.reload}
|
|
|
|
|
/>
|
|
|
|
|
),
|
|
|
|
|
import2: (
|
|
|
|
|
<MyImportModal
|
|
|
|
|
key="import"
|
|
|
|
|
title="收款单导入"
|
|
|
|
|
type="default"
|
|
|
|
|
size="middle"
|
|
|
|
|
templateApi={
|
|
|
|
|
Apis.HouseOrder.HouseOrders.DownloadOfflinePaymentTemplate
|
|
|
|
|
}
|
|
|
|
|
importApi={Apis.HouseOrder.HouseOrders.ImportOfflinePayment}
|
|
|
|
|
reload={action?.reload}
|
|
|
|
|
/>
|
|
|
|
|
),
|
|
|
|
|
export: (
|
|
|
|
|
<MyExport
|
|
|
|
|
key="export"
|
|
|
|
|
title="账单导出"
|
|
|
|
|
item={getParams}
|
|
|
|
|
download={Apis.Bill.HouseBills}
|
|
|
|
|
/>
|
|
|
|
|
),
|
|
|
|
|
add: <BillCreate key="Create" reload={action?.reload} title={title} />,
|
|
|
|
|
}}
|
|
|
|
|
/>,
|
2026-01-08 16:35:06 +08:00
|
|
|
]}
|
|
|
|
|
columns={[
|
|
|
|
|
MyColumns.ID({ search: false }),
|
2026-04-22 17:45:00 +08:00
|
|
|
Selects?.AssetProjects({
|
|
|
|
|
title: '选择项目',
|
|
|
|
|
key: 'asset_projects_id',
|
|
|
|
|
hidden: true,
|
|
|
|
|
}),
|
2026-01-08 16:35:06 +08:00
|
|
|
{
|
2026-04-22 17:45:00 +08:00
|
|
|
key: 'year',
|
|
|
|
|
title: '账单年',
|
|
|
|
|
valueType: 'date',
|
|
|
|
|
fieldProps: {
|
|
|
|
|
picker: 'year',
|
|
|
|
|
format: 'YYYY',
|
|
|
|
|
valueFormat: 'YYYY',
|
|
|
|
|
style: {
|
|
|
|
|
width: '100%',
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
hidden: true,
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
key: 'month',
|
|
|
|
|
title: '账单月',
|
|
|
|
|
valueType: 'date',
|
|
|
|
|
fieldProps: {
|
|
|
|
|
picker: 'month',
|
|
|
|
|
format: 'YYYY-MM',
|
|
|
|
|
valueFormat: 'YYYY/MM',
|
|
|
|
|
style: {
|
|
|
|
|
width: '100%',
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
search: {
|
|
|
|
|
transform: (value) => {
|
|
|
|
|
let month = value.split('-');
|
|
|
|
|
return { year: month[0], month: month[1] };
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
hidden: true,
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
title: '关联房屋',
|
2026-01-08 16:35:06 +08:00
|
|
|
dataIndex: ['asset_house', 'full_name'],
|
|
|
|
|
search: {
|
|
|
|
|
transform: (value) => {
|
|
|
|
|
return { full_name: value };
|
|
|
|
|
},
|
|
|
|
|
},
|
2026-04-22 17:45:00 +08:00
|
|
|
render: (_, record) => {
|
|
|
|
|
return record.asset_houses_id ? (
|
2026-01-08 16:35:06 +08:00
|
|
|
<MyButtons.View
|
2026-04-22 17:45:00 +08:00
|
|
|
title={`${record?.asset_house?.full_name || '-'}`}
|
2026-01-08 16:35:06 +08:00
|
|
|
type="link"
|
|
|
|
|
onClick={() => {
|
2026-04-22 17:45:00 +08:00
|
|
|
navigate(`/bills/summary/show/${record.asset_houses_id}`);
|
2026-01-08 16:35:06 +08:00
|
|
|
}}
|
|
|
|
|
/>
|
2026-01-18 20:05:19 +08:00
|
|
|
) : (
|
2026-04-22 17:45:00 +08:00
|
|
|
'车位| ' + record.asset_car_port.full_name
|
2026-01-08 16:35:06 +08:00
|
|
|
);
|
|
|
|
|
},
|
|
|
|
|
},
|
2026-04-22 17:45:00 +08:00
|
|
|
|
2026-01-08 16:35:06 +08:00
|
|
|
{
|
|
|
|
|
title: '账单月份',
|
|
|
|
|
render: (_, record) => {
|
|
|
|
|
return `${record.year}-${String(record.month).padStart(2, '0')}`;
|
|
|
|
|
},
|
|
|
|
|
search: false,
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
MyColumns.EnumTag({
|
|
|
|
|
title: '类型',
|
|
|
|
|
dataIndex: 'type',
|
|
|
|
|
valueEnum: HouseBillsTypeEnum,
|
|
|
|
|
}),
|
|
|
|
|
MyColumns.EnumTag({
|
|
|
|
|
title: '状态',
|
|
|
|
|
dataIndex: 'bill_status',
|
|
|
|
|
valueEnum: HouseBillsBillStatusEnum,
|
|
|
|
|
search: {
|
|
|
|
|
transform: (value) => {
|
|
|
|
|
return { bill_status: [value] };
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
}),
|
|
|
|
|
{
|
|
|
|
|
title: '账单金额',
|
|
|
|
|
dataIndex: 'amount',
|
|
|
|
|
search: false,
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
title: '优惠金额',
|
|
|
|
|
dataIndex: 'discount_amount',
|
|
|
|
|
search: false,
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
title: '滞纳金',
|
|
|
|
|
dataIndex: 'late_fee',
|
|
|
|
|
search: false,
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
title: '应收金额',
|
|
|
|
|
dataIndex: 'total_payable_amount',
|
|
|
|
|
search: false,
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
title: '已收金额',
|
|
|
|
|
dataIndex: 'total_paid_amount',
|
|
|
|
|
search: false,
|
|
|
|
|
},
|
2026-04-22 17:45:00 +08:00
|
|
|
MyColumns.Boolean({
|
|
|
|
|
title: '退款申请',
|
|
|
|
|
dataIndex: 'has_refunding',
|
|
|
|
|
}),
|
2026-01-08 16:35:06 +08:00
|
|
|
{
|
|
|
|
|
title: '计费周期',
|
|
|
|
|
dataIndex: 'start_date',
|
|
|
|
|
render: (_, record) => {
|
|
|
|
|
return `${record.start_date} 至 ${record.end_date}`;
|
|
|
|
|
},
|
|
|
|
|
search: false,
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
MyColumns.Option({
|
2026-04-22 17:45:00 +08:00
|
|
|
render: (_, item: any, _index, action) => (
|
|
|
|
|
<MyTableActions
|
|
|
|
|
actions={{
|
|
|
|
|
show: (
|
|
|
|
|
<BIllInfo
|
|
|
|
|
item={{ ...item, type: 'primary' }}
|
|
|
|
|
reload={action?.reload}
|
|
|
|
|
title="查看"
|
|
|
|
|
/>
|
|
|
|
|
),
|
|
|
|
|
qrcode: <ShowQrCode key="ShowQrCode" item={item} title="收款码" />,
|
|
|
|
|
pay: (
|
|
|
|
|
<PayCreate
|
|
|
|
|
item={{ ...item, size: 'small' }}
|
|
|
|
|
reload={action?.reload}
|
|
|
|
|
title={title}
|
|
|
|
|
/>
|
|
|
|
|
),
|
|
|
|
|
update: <BillUpdate item={item} reload={action?.reload} title={title} />,
|
|
|
|
|
complete: (
|
|
|
|
|
<RefundComplete
|
|
|
|
|
item={{ ...item, id: item?.refunds[0]?.id }}
|
|
|
|
|
reload={action?.reload}
|
|
|
|
|
title={title}
|
|
|
|
|
/>
|
|
|
|
|
),
|
|
|
|
|
refund: (
|
|
|
|
|
<BillRefund
|
|
|
|
|
item={{
|
|
|
|
|
...item,
|
|
|
|
|
type: RefundsTypeEnum.HouseBill.value,
|
|
|
|
|
approval_type: ApprovalTemplatesTypeEnum.Refund.value,
|
|
|
|
|
total_paid_amount: item.total_paid_amount,
|
|
|
|
|
}}
|
|
|
|
|
reload={action?.reload}
|
|
|
|
|
title={title}
|
|
|
|
|
/>
|
|
|
|
|
),
|
|
|
|
|
delete: (
|
|
|
|
|
<MyButtons.Delete
|
|
|
|
|
disabled={
|
|
|
|
|
item.bill_status !==
|
|
|
|
|
HouseBillsBillStatusEnum.PartiallyPaid.value &&
|
|
|
|
|
item.bill_status !== HouseBillsBillStatusEnum.Paid.value
|
|
|
|
|
}
|
|
|
|
|
onConfirm={() =>
|
|
|
|
|
Apis.Bill.HouseBills.Delete({ id: item.id }).then(() =>
|
|
|
|
|
action?.reload(),
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
/>
|
|
|
|
|
),
|
|
|
|
|
}}
|
|
|
|
|
/>
|
2026-01-08 16:35:06 +08:00
|
|
|
),
|
|
|
|
|
}),
|
|
|
|
|
]}
|
|
|
|
|
/>
|
|
|
|
|
</MyPageContainer>
|
|
|
|
|
);
|
|
|
|
|
}
|