1、房屋收费退费
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run

This commit is contained in:
dev_ljl 2025-07-19 14:43:45 +08:00
parent 2684133491
commit 89b1c527fa
7 changed files with 291 additions and 38 deletions

View File

@ -1,4 +1,6 @@
import type {PageQuery, BaseEntity} from '#/api/common'; import type {PageQuery, BaseEntity} from '#/api/common';
import type {RoomVO} from "#/api/property/room/model";
import type {CostItemSettingVO} from "#/api/property/costManagement/costItemSetting/model";
export interface HouseChargeVO { export interface HouseChargeVO {
/** /**
@ -46,7 +48,16 @@ export interface HouseChargeVO {
* *
*/ */
chargeCycle: number; chargeCycle: number;
/**
*
*/
payType: string;
roomVo: RoomVO;
costItemsVo: CostItemSettingVO;
chargeStatus: string;
} }
export interface HouseChargeForm extends BaseEntity { export interface HouseChargeForm extends BaseEntity {
@ -90,6 +101,10 @@ export interface HouseChargeForm extends BaseEntity {
*/ */
remark?: string; remark?: string;
/**
*
*/
chargeStatus?: string;
} }
export interface HouseChargeQuery extends PageQuery { export interface HouseChargeQuery extends PageQuery {

View File

@ -25,10 +25,10 @@ export const querySchema: FormSchemaGetter = () => [
}, },
{ {
component: 'Select', component: 'Select',
fieldName: 'state', fieldName: 'chargeStatus',
label: '状态', label: '缴费状态',
componentProps: { componentProps: {
options: getDictOptions('wy_fysfzt') options: getDictOptions('wy_fyshzt')
}, },
}, },
]; ];
@ -60,15 +60,25 @@ export const columns: VxeGridProps['columns'] = [
width: 150, width: 150,
}, },
{ {
title: '状态', title: '缴费状态',
field: 'state', field: 'chargeStatus',
width: 150, width: 150,
slots: { slots: {
default: ({row}) => { default: ({row}) => {
return renderDict(row.state, 'wy_fysfzt') return renderDict(row.chargeStatus, 'wy_fyshzt')
} }
} }
}, },
// {
// title: '状态',
// field: 'state',
// width: 150,
// slots: {
// default: ({row}) => {
// return renderDict(row.state, 'wy_fysfzt')
// }
// }
// },
{ {
title: '说明', title: '说明',
field: 'remark', field: 'remark',
@ -101,6 +111,14 @@ export const modalSchema: FormSchemaGetter = () => [
}, },
rules: 'selectRequired', rules: 'selectRequired',
}, },
{
label: '业主',
fieldName: 'personId',
component: 'ApiSelect',
componentProps: {
},
rules: 'selectRequired',
},
{ {
label: '费用类型', label: '费用类型',
fieldName: 'costType', fieldName: 'costType',
@ -179,3 +197,20 @@ export const modalSchemaUpdate: FormSchemaGetter = () => [
rules: 'selectRequired', rules: 'selectRequired',
}, },
] ]
export const modalSchemaRefund: FormSchemaGetter = () => [
{
label: '主键',
fieldName: 'id',
component: 'Input',
dependencies: {
show: () => false,
triggerFields: [''],
},
},
{
label: '退费原因',
fieldName: 'reason',
component: 'Textarea',
formItemClass: 'col-span-2'
},
]

View File

@ -25,6 +25,7 @@ const [BasicModal, modalApi] = useVbenModal({
const houseChargeDetail = shallowRef<null | HouseChargeVO>(null); const houseChargeDetail = shallowRef<null | HouseChargeVO>(null);
const room = ref<RoomVO>(); const room = ref<RoomVO>();
const costItem = ref<CostItemSettingVO>(); const costItem = ref<CostItemSettingVO>();
async function handleOpenChange(open: boolean) { async function handleOpenChange(open: boolean) {
if (!open) { if (!open) {
return null; return null;
@ -71,9 +72,16 @@ async function handleOpenChange(open: boolean) {
{{ costItem?.surcharge }} {{ costItem?.surcharge }}
</DescriptionsItem> </DescriptionsItem>
<DescriptionsItem label="应收金额"> <DescriptionsItem label="应收金额">
<span style="font-size: 16px;font-weight: 600;color: red" v-if="houseChargeDetail.amountReceivable"> <div v-if="houseChargeDetail.amountReceivable">
<span style="font-size: 16px;font-weight: 600;color: red;margin-right: 10px">
{{ houseChargeDetail.amountReceivable }} {{ houseChargeDetail.amountReceivable }}
</span> </span>
</div>
</DescriptionsItem>
<DescriptionsItem label="缴费状态" v-if="houseChargeDetail.chargeStatus">
<component
:is="renderDict(houseChargeDetail.chargeStatus,'wy_fyshzt')"
/>
</DescriptionsItem> </DescriptionsItem>
<DescriptionsItem label="支付方式" v-if="houseChargeDetail.payType"> <DescriptionsItem label="支付方式" v-if="houseChargeDetail.payType">
<component <component

View File

@ -0,0 +1,147 @@
<script setup lang="ts">
import {ref} from 'vue';
import {useVbenModal} from '@vben/common-ui';
import {cloneDeep} from '@vben/utils';
import {useVbenForm} from '#/adapter/form';
import {
houseChargeAdd,
houseChargeInfo,
houseChargeUpdate
} from '#/api/property/costManagement/houseCharge';
import {defaultFormValueGetter, useBeforeCloseDiff} from '#/utils/popup';
import {modalSchemaRefund, modalSchemaUpdate} from './data';
import {renderDict} from "#/utils/render";
import {Descriptions, DescriptionsItem, Divider} from "ant-design-vue";
import type {HouseChargeVO} from "#/api/property/costManagement/houseCharge/model";
import type {RoomVO} from "#/api/property/room/model";
import type {CostItemSettingVO} from "#/api/property/costManagement/costItemSetting/model";
const emit = defineEmits<{ reload: [] }>();
const isUpdate = ref(false);
const record = ref<HouseChargeVO>();
const room = ref<RoomVO>();
const costItem = ref<CostItemSettingVO>();
const [BasicForm, formApi] = useVbenForm({
commonConfig: {
//
formItemClass: 'col-span-2',
// label px
labelWidth: 80,
//
componentProps: {
class: 'w-full',
}
},
schema: modalSchemaRefund(),
showDefaultActions: false,
wrapperClass: 'grid-cols-2',
});
const {onBeforeClose, markInitialized, resetInitialized} = useBeforeCloseDiff(
{
initializedGetter: defaultFormValueGetter(formApi),
currentGetter: defaultFormValueGetter(formApi),
},
);
const [BasicModal, modalApi] = useVbenModal({
//
class: 'w-[550px]',
fullscreenButton: false,
onBeforeClose,
onClosed: handleClosed,
onConfirm: handleConfirm,
onOpenChange: async (isOpen) => {
if (!isOpen) {
return null;
}
modalApi.modalLoading(true);
const {id} = modalApi.getData() as { id?: number | string };
isUpdate.value = !!id;
record.value = await houseChargeInfo(id);
if (record.value) {
room.value = record.value.roomVo
costItem.value = record.value.costItemsVo
}
await formApi.setValues(record.value);
await markInitialized();
modalApi.modalLoading(false);
},
});
async function handleConfirm() {
try {
modalApi.lock(true);
const {valid} = await formApi.validate();
if (!valid) {
return;
}
// getValuesreadonly
const data = cloneDeep(await formApi.getValues());
record.value.reason=data.reason
record.value.chargeStatus = '5'
await houseChargeUpdate(record.value) ;
resetInitialized();
emit('reload');
modalApi.close();
} catch (error) {
console.error(error);
} finally {
modalApi.lock(false);
}
}
async function handleClosed() {
await formApi.resetForm();
resetInitialized();
}
</script>
<template>
<BasicModal title="缴费">
<Descriptions v-if="record" size="small" :column="2"
:labelStyle="{width:'80px'}">
<DescriptionsItem label="费用编号">
{{ costItem?.id }}
</DescriptionsItem>
<DescriptionsItem label="费用项目">
{{ costItem?.chargeItem }}
</DescriptionsItem>
<DescriptionsItem label="费用类型">
<component
v-if="costItem"
:is="renderDict(costItem?.costType,'pro_expense_type')"
/>
</DescriptionsItem>
<DescriptionsItem label="计费起始">
{{ record.startTime }}
</DescriptionsItem>
<DescriptionsItem label="房间">
{{ room.roomNumber }}
</DescriptionsItem>
<DescriptionsItem label="面积(㎡)">
{{ `${room?.area} (套内面积:${room?.insideInArea}` }}
</DescriptionsItem>
<DescriptionsItem label="单价">
{{ costItem?.unitPrice }}
</DescriptionsItem>
<DescriptionsItem label="附加费">
{{ costItem?.surcharge }}
</DescriptionsItem>
<DescriptionsItem label="退费金额" :span="2">
<span style="font-size: 16px;font-weight: 600;color: red" v-if="record.amountReceivable">
{{ record.amountReceivable }}
</span>
</DescriptionsItem>
</Descriptions>
<Divider/>
<BasicForm/>
</BasicModal>
</template>

View File

@ -18,6 +18,8 @@ import {communityTree} from "#/api/property/community";
import {costItemSettingList} from "#/api/property/costManagement/costItemSetting"; import {costItemSettingList} from "#/api/property/costManagement/costItemSetting";
import type {CostItemSettingVO} from "#/api/property/costManagement/costItemSetting/model"; import type {CostItemSettingVO} from "#/api/property/costManagement/costItemSetting/model";
import {getDictOptions} from "#/utils/dict"; import {getDictOptions} from "#/utils/dict";
import {personList} from "#/api/property/resident/person";
import {renderDictValue} from "#/utils/render";
const emit = defineEmits<{ reload: [] }>(); const emit = defineEmits<{ reload: [] }>();
@ -65,6 +67,7 @@ const [BasicModal, modalApi] = useVbenModal({
await initRoomOptions() await initRoomOptions()
await queryCostItemOptions() await queryCostItemOptions()
await initCostTypeOptions() await initCostTypeOptions()
await queryPersonData()
const {id} = modalApi.getData() as { id?: number | string }; const {id} = modalApi.getData() as { id?: number | string };
isUpdate.value = !!id; isUpdate.value = !!id;
@ -191,6 +194,28 @@ async function initCostTypeOptions(){
fieldName: 'costType' fieldName: 'costType'
}]) }])
} }
async function queryPersonData() {
let params = {
pageSize: 1000,
pageNum: 1,
}
const res = await personList(params);
const options = res.rows.map((user) => ({
label: user.userName + '-' + renderDictValue(user.gender, 'sys_user_sex')
+ '-' + user.phone + '-' + user.unitName,
value: user.id,
}));
formApi.updateSchema([{
componentProps: () => ({
options: options,
showSearch: true,
optionFilterProp: 'label',
optionLabelProp: 'label',
}),
fieldName: 'personId',
}])
}
</script> </script>
<template> <template>

View File

@ -85,6 +85,7 @@ async function handleConfirm() {
const data = cloneDeep(await formApi.getValues()); const data = cloneDeep(await formApi.getValues());
record.value.payType = data.payType record.value.payType = data.payType
record.value.chargeCycle = data.chargeCycle record.value.chargeCycle = data.chargeCycle
record.value.chargeStatus = '4'
await houseChargeUpdate(record.value); await houseChargeUpdate(record.value);
resetInitialized(); resetInitialized();
emit('reload'); emit('reload');
@ -123,7 +124,7 @@ async function handleClosed() {
{{ record.startTime }} {{ record.startTime }}
</DescriptionsItem> </DescriptionsItem>
<DescriptionsItem label="房间"> <DescriptionsItem label="房间">
{{ room.roomNumber }} {{ room?.roomNumber }}
</DescriptionsItem> </DescriptionsItem>
<DescriptionsItem label="面积(㎡)"> <DescriptionsItem label="面积(㎡)">
{{ `${room?.area} (套内面积:${room?.insideInArea}` }} {{ `${room?.area} (套内面积:${room?.insideInArea}` }}
@ -134,7 +135,7 @@ async function handleClosed() {
<DescriptionsItem label="附加费"> <DescriptionsItem label="附加费">
{{ costItem?.surcharge }} {{ costItem?.surcharge }}
</DescriptionsItem> </DescriptionsItem>
<DescriptionsItem label="应收金额" :span="2"> <DescriptionsItem label="缴费金额" :span="2">
<span style="font-size: 16px;font-weight: 600;color: red" v-if="record.amountReceivable"> <span style="font-size: 16px;font-weight: 600;color: red" v-if="record.amountReceivable">
{{ record.amountReceivable }} {{ record.amountReceivable }}
</span> </span>

View File

@ -22,6 +22,7 @@ import { commonDownloadExcel } from '#/utils/file/download';
import houseChargeAdd from './houseCharge-add.vue'; import houseChargeAdd from './houseCharge-add.vue';
import houseChargeUpdate from './houseCharge-update.vue'; import houseChargeUpdate from './houseCharge-update.vue';
import houseChargeDetail from './house-charge-detail.vue'; import houseChargeDetail from './house-charge-detail.vue';
import houseChargeRefund from './house-charge-refund.vue';
import {columns, querySchema} from './data'; import {columns, querySchema} from './data';
const formOptions: VbenFormProps = { const formOptions: VbenFormProps = {
@ -82,6 +83,9 @@ const [HouseChargeUpdate, updateApi] = useVbenModal({
const [HouseChargeDetail, detailApi] = useVbenModal({ const [HouseChargeDetail, detailApi] = useVbenModal({
connectedComponent: houseChargeDetail, connectedComponent: houseChargeDetail,
}); });
const [HouseChargeRefund, refundApi] = useVbenModal({
connectedComponent: houseChargeRefund,
});
function handleAdd() { function handleAdd() {
modalApi.setData({}); modalApi.setData({});
@ -92,6 +96,7 @@ async function handleEdit(row: Required<HouseChargeForm>) {
updateApi.setData({id: row.id}); updateApi.setData({id: row.id});
updateApi.open(); updateApi.open();
} }
async function handleInfo(row: Required<HouseChargeForm>) { async function handleInfo(row: Required<HouseChargeForm>) {
detailApi.setData({id: row.id}); detailApi.setData({id: row.id});
detailApi.open(); detailApi.open();
@ -102,6 +107,11 @@ async function handleDelete(row: Required<HouseChargeForm>) {
await tableApi.query(); await tableApi.query();
} }
async function handleRefund(row: Required<HouseChargeForm>) {
refundApi.setData({id: row.id});
refundApi.open();
}
function handleMultiDelete() { function handleMultiDelete() {
const rows = tableApi.grid.getCheckboxRecords(); const rows = tableApi.grid.getCheckboxRecords();
const ids = rows.map((row: Required<HouseChargeForm>) => row.id); const ids = rows.map((row: Required<HouseChargeForm>) => row.id);
@ -160,12 +170,22 @@ function handleDownloadExcel() {
{{ $t('pages.common.info') }} {{ $t('pages.common.info') }}
</ghost-button> </ghost-button>
<ghost-button <ghost-button
v-if="row.chargeStatus=='2'"
v-access:code="['property:houseCharge:edit']" v-access:code="['property:houseCharge:edit']"
@click.stop="handleEdit(row)" @click.stop="handleEdit(row)"
> >
缴费 缴费
</ghost-button> </ghost-button>
<ghost-button
v-else-if="row.chargeStatus=='4'"
danger
v-access:code="['property:houseCharge:edit']"
@click.stop="handleRefund(row)"
>
退费
</ghost-button>
<Popconfirm <Popconfirm
v-else
:get-popup-container="getVxePopupContainer" :get-popup-container="getVxePopupContainer"
placement="left" placement="left"
title="确认取消?" title="确认取消?"
@ -175,6 +195,7 @@ function handleDownloadExcel() {
danger danger
v-access:code="['property:houseCharge:remove']" v-access:code="['property:houseCharge:remove']"
@click.stop="" @click.stop=""
:disabled="row.chargeStatus!='1'"
> >
取消 取消
</ghost-button> </ghost-button>
@ -184,6 +205,7 @@ function handleDownloadExcel() {
</BasicTable> </BasicTable>
<HouseChargeAdd @reload="tableApi.query()"/> <HouseChargeAdd @reload="tableApi.query()"/>
<HouseChargeUpdate @reload="tableApi.query()"/> <HouseChargeUpdate @reload="tableApi.query()"/>
<HouseChargeRefund @reload="tableApi.query()"/>
<HouseChargeDetail/> <HouseChargeDetail/>
</Page> </Page>
</template> </template>