物业催缴接口完成(home)

This commit is contained in:
张文涛 2025-05-07 21:42:04 +08:00
parent 9a9c57acb6
commit 32a2258ac8
10 changed files with 640 additions and 725 deletions

4
api/fee.ts Normal file
View File

@ -0,0 +1,4 @@
import { get, post, put, del } from '../utils/request';
export const feeInfo = (data : any = {}) => get('v1/fee/info', data);

View File

@ -22,3 +22,9 @@ export const logout = (data : any) => get('v1/logout', data);
// 获取权限
export const menu = (data : any) => get('v1/menu', data);
// 修改用户信息
export const changeInfo = (data : any) => post('v2/change/info', data)
// 用户协议隐私政策
export const configGet = (data : any) => get('v2/config/get', data);

View File

@ -186,11 +186,11 @@
title: '物业催缴',
type: 'call'
},
{
image: uni.$globalData?.RESOURCE_URL + 'home/grid/tousu.png',
title: '投诉管理',
type: 'complaint'
},
// {
// image: uni.$globalData?.RESOURCE_URL + 'home/grid/tousu.png',
// title: '',
// type: 'complaint'
// },
// {
// image: uni.$globalData?.RESOURCE_URL + 'home/grid/fangke.png',
// title: '访',
@ -216,11 +216,11 @@
title: '商品核销',
type: 'verification'
},
{
image: uni.$globalData?.RESOURCE_URL + 'home/grid/gongdan.png',
title: '员工权限',
type: 'permissions'
}
// {
// image: uni.$globalData?.RESOURCE_URL + 'home/grid/gongdan.png',
// title: '',
// type: 'permissions'
// }
])

View File

@ -4,7 +4,8 @@
<view class="li-flex li-justify-between li-items-center li-w-94% li-mx-auto li-mt-60">
<view @click="toPages({type:'userInfo'})" class="li-flex li-items-center">
<view class="li-flex li-items-end li-mr-20">
<image class="li-w-100 li-h-100 li-rd-50% border-4-white" :src="user_info.avatar" mode="">
<image class="li-w-100 li-h-100 li-rd-50% border-4-white"
:src="user_info?.avatar?user_info?.avatar:'/static/m_avatar.png'" mode="">
</image>
</view>
<view class="li-flex li-flex-col">
@ -84,16 +85,11 @@
import { onShow, onReachBottom, Uni } from "@dcloudio/uni-app"
import { ref } from "vue"
import { useToast } from '@/uni_modules/wot-design-uni'
import { userInfo } from '@/api/login'
const Toast = useToast()
declare const uni : Uni
const user_info = ref({
"realname": "里派",
"avatar": "/static/m_avatar.png",
"owner": {
"name": "里派(杭州)网络科技有限公司"
}
})
const user_info = ref({})
const mine_back = uni.$globalData?.RESOURCE_URL + 'mine/mine-back1.png'
const card_back = uni.$globalData?.RESOURCE_URL + 'mine/card-back.png'
@ -151,12 +147,12 @@
// number: 0,
// icon: uni.$globalData?.RESOURCE_URL + 'mine/icon/menjin.png'
// },
{
title: '用户协议',
number: 0,
icon: uni.$globalData?.RESOURCE_URL + 'mine/icon/pandian.png',
type: 'protocol'
},
// {
// title: '',
// number: 0,
// icon: uni.$globalData?.RESOURCE_URL + 'mine/icon/pandian.png',
// type: 'protocol'
// },
{
title: '隐私政策',
number: 0,
@ -240,12 +236,19 @@
}
}
const getUserInfo = async () => {
const res = await userInfo()
user_info.value = res.data
}
onShow(async () => {
const userInfo = await uni.$store.state.userInfos
userInfo.realname && (user_info.value.realname = userInfo.realname)
userInfo.avatar && (user_info.value.avatar = userInfo.avatar)
userInfo.owner.name && (user_info.value.owner.name = userInfo.owner.name)
// const userInfo = await uni.$store.state.userInfos
// userInfo.realname && (user_info.value.realname = userInfo.realname)
// userInfo.avatar && (user_info.value.avatar = userInfo.avatar)
// userInfo.owner.name && (user_info.value.owner.name = userInfo.owner.name)
getUserInfo()
})
</script>

View File

@ -25,6 +25,7 @@
import { onLoad } from '@dcloudio/uni-app';
import { useNavigation } from '@/hooks/useNavigation';
import { useToast } from '@/uni_modules/wot-design-uni';
import { configGet } from '@/api/login'
const Toast = useToast();
@ -36,7 +37,13 @@
} = useNavigation();
const paramsType = ref('1')
const rawHtml = ref('<div style="text-align:center;background-color: #007AFF;"><div >我是内容</div><img src="https://qiniu-web-assets.dcloud.net.cn/unidoc/zh/uni@2x.png"/></div>')
const rawHtml = ref('')
const getConfigGet = async () => {
const res = await configGet({group_id:29})
rawHtml.value = res.data.emp_privacy_agreement
}
//
@ -62,6 +69,7 @@
//
onLoad((options) => {
checkRouteStack();
getConfigGet()
paramsType.value = options.type
});
</script>

View File

@ -1,4 +1,5 @@
<template>
<page-meta :page-style="`overflow:${showHouseDetail ? 'hidden' : 'visible'};`"></page-meta>
<view class="call-page">
<!-- 自定义导航栏 -->
<wd-navbar :bordered="false"
@ -14,24 +15,24 @@
</view>
</template>
<!-- #ifdef MP-WEIXIN -->
<template #right>
<!-- <template #right>
<view class="li-mr-180 li-flex li-items-center">
<view class="community-switcher" @click="showCommunityPicker = true">
<text class="community-name">{{activeCommunity.name}}</text>
<text class="arrow-icon ri-arrow-down-s-line"></text>
</view>
</view>
</template>
</template> -->
<!-- #endif -->
<!-- #ifndef MP-WEIXIN -->
<template #right>
<!-- <template #right>
<view class="li-mr-25 li-flex li-items-center">
<view class="community-switcher" @click="showCommunityPicker = true">
<text class="community-name">{{activeCommunity.name}}</text>
<text class="arrow-icon ri-arrow-down-s-line"></text>
</view>
</view>
</template>
</template> -->
<!-- #endif -->
</wd-navbar>
<!-- 导航栏背景 -->
@ -45,16 +46,16 @@
<view class="li-flex li-justify-between li-items-center">
<text
class="community-name li-text-42 li-font-bold li-text-white">{{activeCommunity.name}}</text>
<view class="li-px-20 li-py-10 li-bg-rgba(255,255,255,0.3) li-rd-30" @click="handleRefresh">
<text class="li-text-28 li-text-white">刷新数据</text>
</view>
<button class="refresh-btn" @tap.stop="handleRefreshClick">
<text class="li-text-24 li-text-white">刷新数据</text>
</button>
</view>
<view class="li-flex li-items-center li-mt-20">
<text class="li-text-28 li-text-white li-opacity-80">{{activeCommunity.address}}</text>
</view>
<view class="li-flex li-items-center li-mt-10">
<text class="li-text-28 li-text-white li-opacity-80">欠费总量</text>
<text class="li-text-32 li-text-white li-font-bold">{{activeCommunity.totalUnpaid}}</text>
<text class="li-text-32 li-text-white li-font-bold">{{activeCommunity.totalUnpaid}}</text>
</view>
</view>
<view class="community-footer li-p-30 li-bg-white">
@ -71,7 +72,7 @@
<!-- 左侧楼栋侧边导航 -->
<view class="sidebar-container">
<wd-sidebar v-model="activeBuilding" custom-class="building-sidebar">
<wd-sidebar-item v-for="item in buildingList" :key="item.id" :value="item.id"
<wd-sidebar-item v-for="item in buildingList" :key="item.id" :value="String(item.id)"
:label="item.name" :badge="getBuildingUnpaidCount(item.id)"
:badge-props="{ type: 'primary', bgColor: '#ff4d4f' }" />
</wd-sidebar>
@ -86,10 +87,9 @@
<text class="li-text-24 li-text-#3e9bff">单元数量: {{unitList.length}}</text>
</view>
<view class="unit-grid">
<view v-for="unit in unitList" :key="unit.value"
class="unit-item li-mr-15 li-mb-15"
<view v-for="unit in unitList" :key="unit.value" class="unit-item li-mr-15 li-mb-15"
:class="activeUnitId === String(unit.value) ? 'unit-item-active' : ''"
@click="activeUnitId = String(unit.value)">
@click="handleUnitSelect(unit.value)">
<text class="unit-text"
:class="activeUnitId === String(unit.value) ? 'unit-text-active' : ''">{{unit.label}}</text>
<view v-if="getUnitUnpaidCount(unit.value) > 0" class="unit-badge">
@ -131,8 +131,7 @@
<!-- 空状态 -->
<view v-if="floorHouseList.length === 0"
class="empty-state li-py-100 li-flex-center li-flex-col">
<text class="ri-file-list-3-line li-text-100 li-text-#ccc"></text>
<text class="li-text-30 li-text-#999 li-mt-20">该单元暂无数据</text>
<wd-status-tip image="search" tip="该单元暂无数据" />
</view>
<!-- 添加底部安全间距 -->
@ -144,7 +143,7 @@
</view>
<!-- 房屋详情弹窗 -->
<wd-popup v-model="showHouseDetail" position="bottom">
<wd-popup v-model="showHouseDetail" position="bottom" custom-class="custom-class-popup">
<view class="house-detail" :style="{ height: '60vh' }">
<view class="detail-header li-p-30 li-bottom-border">
<view class="li-flex li-justify-between li-items-center">
@ -153,7 +152,7 @@
</view>
<view class="li-flex li-items-center li-mt-10">
<text class="li-text-28 li-text-#666">{{activeCommunity.name}} {{getActiveBuilding().name}}
{{activeUnit}}单元</text>
{{activeUnit}}</text>
</view>
</view>
<scroll-view scroll-y class="detail-content-scroll">
@ -177,15 +176,15 @@
<text class="li-text-26 li-text-#999">逾期时间</text>
<text class="li-text-26 li-text-#666">{{bill.overdueTime}}</text>
</view>
<view class="li-flex li-justify-between li-items-center li-mt-20">
<wd-button size="small" type="info" plain
@click="callOwner(selectedHouse)">电话催缴</wd-button>
<view class="li-flex li-justify-between li-items-center li-flex-row-reverse li-mt-20">
<wd-button size="small" type="primary"
@click="sendReminder(selectedHouse)">发送通知</wd-button>
@click="callOwner(selectedHouse)">电话催缴</wd-button>
<!-- <wd-button size="small" type="primary"
@click="sendReminder(selectedHouse)">发送通知</wd-button> -->
</view>
</view>
</view>
<view v-else class="empty-bills li-py-60 li-flex-center li-flex-col">
<view v-else class="empty-bills li-flex-center li-flex-col">
<text class="ri-check-double-line li-text-100 li-text-#52c41a"></text>
<text class="li-text-30 li-text-#666 li-mt-20">该住户暂无欠费</text>
</view>
@ -216,6 +215,9 @@
useToast
} from '@/uni_modules/wot-design-uni';
import CommunitySelector from '@/components/community-selector/community-selector.vue';
import {
feeInfo
} from '/api/fee'
const Toast = useToast();
@ -226,427 +228,182 @@
checkRouteStack
} = useNavigation();
const selectedVillage = ref('1');
const communityList = ref([
[{
value: '1',
label: '阳光花园小区'
},
{
value: '2',
label: '翠湖庭院'
},
{
value: '3',
label: '金色家园'
}
]
]);
//
const selectedCommunity = ref('1');
//
const activeCommunity = computed(() => {
const communityData = {
'1': {
id: '1',
name: '九仙花苑',
address: '福建省-福州市-鼓楼区',
managementAddress: '东街道33号社区中心',
totalUnpaid: 3624
},
'2': {
id: '2',
name: '阳光花园小区',
address: '福建省-福州市-台江区',
managementAddress: '茶亭街道15号物业中心',
totalUnpaid: 1856
},
'3': {
id: '3',
name: '翠湖庭院',
address: '福建省-福州市-晋安区',
managementAddress: '王庄街道8号物业中心',
totalUnpaid: 2145
},
'4': {
id: '4',
name: '金色家园',
address: '福建省-福州市-仓山区',
managementAddress: '城门镇1号物业中心',
totalUnpaid: 1023
}
};
return communityData[selectedCommunity.value];
});
//
const village = ref({});
//
const buildingList = ref([{
id: '1',
name: '1号楼'
},
{
id: '2',
name: '2号楼'
},
{
id: '3',
name: '3号楼'
},
{
id: '5',
name: '5号楼'
},
{
id: '6',
name: '6号楼'
},
{
id: '7',
name: '7号楼'
},
{
id: '8',
name: '8号楼'
},
{
id: '9',
name: '9号楼'
},
{
id: '10',
name: '10号楼'
},
{
id: '11',
name: '11号楼'
},
{
id: '12',
name: '12号楼'
}
]);
//
const unitList = ref([{
value: 1,
label: '1单元'
},
{
value: 2,
label: '2单元'
},
{
value: 3,
label: '3单元'
},
{
value: 4,
label: '4单元'
},
{
value: 5,
label: '5单元'
},
{
value: 6,
label: '6单元'
}
]);
const buildingList = ref([]);
//
const activeBuilding = ref('1');
const activeBuilding = ref('');
//
const unitList = ref([]);
// (使)
const activeUnitId = ref('1');
const activeUnitId = ref('');
// ID
const activeUnit = computed(() => parseInt(activeUnitId.value));
// activeUnitfloorHouseList
watch(activeUnit, (newVal) => {
console.log('activeUnit changed to', newVal);
const activeUnit = computed(() => {
//
if (!activeUnitId.value || !unitList.value.length) return '';
const unit = unitList.value.find(u => String(u.value) === String(activeUnitId.value));
return unit ? unit.label : '';
});
//
const houseData = reactive({
// 1 1
'1-1': [{
floor: '1',
houses: [{
id: '1-1-101',
number: '1-1001',
unpaid: 0,
owner: '张先生',
phone: '13812345678',
bills: []
},
{
id: '1-1-102',
number: '1-1002',
unpaid: 3,
owner: '刘女士',
phone: '13812345679',
bills: [{
type: '物业费',
amount: '568.00',
period: '2023-07-01 至 2023-12-31',
overdueTime: '2024-01-15'
},
{
type: '水费',
amount: '124.50',
period: '2023-12-01 至 2023-12-31',
overdueTime: '2024-01-15'
}
]
},
{
id: '1-1-103',
number: '1-1003',
unpaid: 2,
owner: '陈先生',
phone: '13812345680',
bills: [{
type: '电费',
amount: '356.80',
period: '2023-12-01 至 2023-12-31',
overdueTime: '2024-01-15'
}]
},
{
id: '1-1-104',
number: '1-1004',
unpaid: 0,
owner: '林女士',
phone: '13812345681',
bills: []
},
{
id: '1-1-105',
number: '1-1005',
unpaid: 4,
owner: '黄先生',
phone: '13812345682',
bills: [{
type: '物业费',
amount: '568.00',
period: '2023-07-01 至 2023-12-31',
overdueTime: '2024-01-15'
},
{
type: '水费',
amount: '124.50',
period: '2023-12-01 至 2023-12-31',
overdueTime: '2024-01-15'
},
{
type: '电费',
amount: '356.80',
period: '2023-12-01 至 2023-12-31',
overdueTime: '2024-01-15'
}
]
},
{
id: '1-1-106',
number: '1-1006',
unpaid: 1,
owner: '张先生',
phone: '13812345683',
bills: [{
type: '物业费',
amount: '568.00',
period: '2023-07-01 至 2023-12-31',
overdueTime: '2024-01-15'
}]
}
]
},
{
floor: '2',
houses: [{
id: '1-1-201',
number: '2-1002',
unpaid: 0,
owner: '李女士',
phone: '13812345679',
bills: []
}]
},
{
floor: '3',
houses: [{
id: '1-1-301',
number: '3-1003',
unpaid: 0,
owner: '王先生',
phone: '13812345680',
bills: []
}]
},
{
floor: '4',
houses: [{
id: '1-1-401',
number: '4-1004',
unpaid: 6,
owner: '赵女士',
phone: '13812345681',
bills: [{
type: '物业费',
amount: '568.00',
period: '2023-07-01 至 2023-12-31',
overdueTime: '2024-01-15'
},
{
type: '水费',
amount: '124.50',
period: '2023-12-01 至 2023-12-31',
overdueTime: '2024-01-15'
},
{
type: '电费',
amount: '356.80',
period: '2023-12-01 至 2023-12-31',
overdueTime: '2024-01-15'
},
{
type: '停车费',
amount: '300.00',
period: '2023-11-01 至 2023-12-31',
overdueTime: '2024-01-15'
},
{
type: '垃圾处理费',
amount: '45.00',
period: '2023-10-01 至 2023-12-31',
overdueTime: '2024-01-15'
},
{
type: '维修基金',
amount: '120.00',
period: '2023-07-01 至 2023-12-31',
overdueTime: '2024-01-15'
}
]
}]
},
{
floor: '5',
houses: [{
id: '1-1-501',
number: '5-1005',
unpaid: 0,
owner: '钱先生',
phone: '13812345682',
bills: []
}]
},
{
floor: '6',
houses: [{
id: '1-1-601',
number: '6-1006',
unpaid: 6,
owner: '孙女士',
phone: '13812345683',
bills: [{
type: '物业费',
amount: '568.00',
period: '2023-07-01 至 2023-12-31',
overdueTime: '2024-01-15'
},
{
type: '水费',
amount: '124.50',
period: '2023-12-01 至 2023-12-31',
overdueTime: '2024-01-15'
},
{
type: '电费',
amount: '356.80',
period: '2023-12-01 至 2023-12-31',
overdueTime: '2024-01-15'
},
{
type: '停车费',
amount: '300.00',
period: '2023-11-01 至 2023-12-31',
overdueTime: '2024-01-15'
},
{
type: '垃圾处理费',
amount: '45.00',
period: '2023-10-01 至 2023-12-31',
overdueTime: '2024-01-15'
},
{
type: '维修基金',
amount: '120.00',
period: '2023-07-01 至 2023-12-31',
overdueTime: '2024-01-15'
}
]
}]
}
],
// 1 2
'1-2': [{
floor: '1',
houses: [{
id: '1-2-101',
number: '1-2001',
unpaid: 3,
owner: '周先生',
phone: '13812345684',
bills: [{
type: '物业费',
amount: '568.00',
period: '2023-07-01 至 2023-12-31',
overdueTime: '2024-01-15'
}]
}]
},
{
floor: '2',
houses: [{
id: '1-2-201',
number: '2-2002',
unpaid: 0,
owner: '吴女士',
phone: '13812345685',
bills: []
}]
}
],
// 56
'1-4': [],
'1-5': [],
'1-6': []
//
const activeCommunity = computed(() => {
return {
id: '1',
name: village.value.village_name || '暂无数据',
address: `${village.value.province_name || ''}-${village.value.city_name || ''}-${village.value.area_name || ''}`,
managementAddress: village.value.address || '暂无地址',
totalUnpaid: calculateTotalUnpaid()
};
});
//
//
const calculateTotalUnpaid = () => {
let total = 0;
if (!village.value.regions) return total;
village.value.regions.forEach(region => {
region.cells.forEach(cell => {
cell.houses.forEach(house => {
//
if (house.estate && house.estate.length > 0) {
house.estate.forEach(item => {
//
total += parseFloat(item.total_money || 0);
});
}
if (house.meter && house.meter.length > 0) {
house.meter.forEach(item => {
//
total += parseFloat(item.total_money || 0);
});
}
});
});
});
//
return total.toFixed(2);
};
//
const floorHouseList = computed(() => {
const key = `${activeBuilding.value}-${activeUnit.value}`;
return houseData[key] || [];
if (!activeBuilding.value || !activeUnitId.value) return [];
//
const region = village.value.regions?.find(r => String(r.region_id) === activeBuilding.value);
if (!region) return [];
const cell = region.cells?.find(c => String(c.cell_id) === activeUnitId.value);
if (!cell) return [];
//
const floorGroups = {};
cell.houses.forEach(house => {
const floor = house.floor;
if (!floorGroups[floor]) {
floorGroups[floor] = {
floor: `${floor}`,
houses: []
};
}
floorGroups[floor].houses.push({
id: house.house_id,
number: house.house_name,
unpaid: (house.estate || []).length + (house.meter || []).length,
owner: house.owner && house.owner.length > 0 ? house.owner[0].owner_name : '未知',
phone: house.owner && house.owner.length > 0 ? house.owner[0].mobile : '',
bills: formatBills(house)
});
});
//
return Object.values(floorGroups).sort((a, b) => parseInt(a.floor) - parseInt(b.floor));
});
//
const formatBills = (house) => {
const bills = [];
//
if (house.estate && house.estate.length > 0) {
house.estate.forEach(item => {
bills.push({
type: item.fee_name || '物业费',
amount: item.total_money,
period: `${item.begin_date}${item.end_date}`,
overdueTime: item.create_time
});
});
}
//
if (house.meter && house.meter.length > 0) {
house.meter.forEach(item => {
bills.push({
type: item.fee_name || '抄表费',
amount: item.total_money,
period: `${item.create_time}`,
overdueTime: item.create_time
});
});
}
return bills;
};
//
const getActiveBuilding = () => {
return buildingList.value.find(item => item.id === activeBuilding.value) || {
if (!activeBuilding.value || !village.value.regions) return {
id: '',
name: ''
};
const region = village.value.regions.find(r => String(r.region_id) === activeBuilding.value);
return region ? {
id: String(region.region_id),
name: region.region_name
} : {
id: '',
name: ''
};
};
//
const getUnitUnpaidCount = (unit) => {
const key = `${activeBuilding.value}-${unit}`;
if (!houseData[key]) return 0;
//
const getBuildingUnpaidCount = (buildingId) => {
if (!village.value.regions) return '';
return houseData[key].reduce((total, floor) => {
return total + floor.houses.filter(house => house.unpaid > 0).length;
}, 0);
const region = village.value.regions.find(r => String(r.region_id) === buildingId);
if (!region) return '';
let count = 0;
region.cells.forEach(cell => {
cell.houses.forEach(house => {
const unpaidCount = (house.estate || []).length + (house.meter || []).length;
if (unpaidCount > 0) count++;
});
});
return count > 0 ? count : '';
};
//
const getUnitUnpaidCount = (unitId) => {
if (!village.value.regions || !activeBuilding.value) return 0;
const region = village.value.regions.find(r => String(r.region_id) === activeBuilding.value);
if (!region) return 0;
const cell = region.cells.find(c => String(c.cell_id) === unitId);
if (!cell) return 0;
let count = 0;
cell.houses.forEach(house => {
const unpaidCount = (house.estate || []).length + (house.meter || []).length;
if (unpaidCount > 0) count++;
});
return count;
};
//
@ -668,6 +425,12 @@
//
const callOwner = (house) => {
console.log(house);
if (!house.phone) {
Toast.fail('没有可用的联系电话');
return;
}
uni.makePhoneCall({
phoneNumber: house.phone,
success: () => {
@ -687,15 +450,10 @@
}, 1500);
};
//
const handleCommunityConfirm = (selected) => {
console.log(selected, 'selected');
selectedCommunity.value = selected.value;
};
//
const handleRefresh = () => {
Toast.success('数据已刷新');
//
let isRefreshing = false;
const handleRefreshClick = async () => {
getFeeInfo();
};
//
@ -716,39 +474,133 @@
}
};
//
const getFeeInfo = async () => {
try {
uni.showLoading({
title: '加载中...'
});
const res = await feeInfo();
console.log('API返回数据:', res);
if (res.code === 200 && res.data) {
//
village.value = res.data.village || {};
console.log('小区信息:', village.value);
//
if (village.value.regions && village.value.regions.length > 0) {
buildingList.value = village.value.regions.map(region => ({
id: String(region.region_id), // ID
name: region.region_name
}));
console.log('楼栋列表:', buildingList.value);
//
if (buildingList.value.length > 0) {
// ID
activeBuilding.value = buildingList.value[0].id;
console.log('默认选中楼栋:', activeBuilding.value);
//
updateUnitList();
}
} else {
console.log('没有找到楼栋数据');
}
} else {
Toast.fail('获取数据失败');
console.error('API返回错误:', res);
}
} catch (error) {
console.error('获取数据出错:', error);
Toast.fail('网络异常,请重试');
} finally {
uni.hideLoading();
}
};
//
const updateUnitList = () => {
unitList.value = [];
if (!activeBuilding.value || !village.value.regions) return;
const region = village.value.regions.find(r => String(r.region_id) === activeBuilding.value);
if (region && region.cells) {
unitList.value = region.cells.map(cell => ({
value: String(cell.cell_id), // ID
label: cell.cell_name
}));
//
if (unitList.value.length > 0) {
activeUnitId.value = unitList.value[0].value;
console.log('默认选中单元:', activeUnitId.value);
}
} else {
console.log('未找到对应楼栋或单元数据');
}
};
//
watch(activeBuilding, () => {
updateUnitList();
});
//
const initData = async () => {
await getFeeInfo();
//
if (unitList.value.length > 0 && !activeUnitId.value) {
//
activeUnitId.value = unitList.value[0].value;
console.log('强制设置默认单元:', activeUnitId.value);
}
//
setTimeout(() => {
console.log('当前状态 - 楼栋:', activeBuilding.value, '单元:', activeUnitId.value);
//
if (buildingList.value.length > 0 && !activeBuilding.value) {
console.log('检测到楼栋未选中,强制选中第一个楼栋');
activeBuilding.value = buildingList.value[0].id;
updateUnitList();
}
}, 500);
};
//
onLoad(() => {
checkRouteStack();
initData();
});
//
const getBuildingUnpaidCount = (buildingId) => {
let count = 0;
//
unitList.value.forEach(unit => {
const key = `${buildingId}-${unit.value}`;
if (!houseData[key]) return;
count += houseData[key].reduce((total, floor) => {
return total + floor.houses.filter(house => house.unpaid > 0).length;
}, 0);
});
return count > 0 ? count : '';
//
const handleCommunityConfirm = (selected) => {
console.log(selected, 'selected');
//
};
//
const formattedCommunityList = computed(() => {
//
const flatList = communityList.value[0] || [];
const flatList = buildingList.value || [];
return flatList.map(item => ({
value: item.value,
label: item.label
value: item.id,
label: item.name
}));
});
// showCommunityPicker
const showCommunityPicker = ref(false);
// handleUnitSelect
const handleUnitSelect = (value) => {
activeUnitId.value = String(value);
console.log('选中单元:', activeUnitId.value);
};
</script>
<style lang="scss">
@ -1183,7 +1035,7 @@
}
.empty-bills {
padding: 60rpx 0;
padding-top: 150rpx;
display: flex;
flex-direction: column;
align-items: center;
@ -1192,15 +1044,16 @@
.house-detail {
height: 100%;
border-radius: 24rpx 24rpx 0 0;
border-radius: 24rpx 24rpx 0 0 !important;
overflow: hidden;
background-color: #fff;
display: flex;
flex-direction: column;
.detail-header {
padding-top: constant(safe-area-inset-top);
padding-top: env(safe-area-inset-top);
// padding-top: constant(safe-area-inset-top);
// padding-top: env(safe-area-inset-top);
flex-shrink: 0;
}
@ -1231,4 +1084,44 @@
padding-top: env(safe-area-inset-top) !important;
}
.custom-class-popup {
border-radius: 24rpx 24rpx 0 0 !important;
}
.refresh-btn {
background-color: rgba(255, 255, 255, 0.3);
border-radius: 30rpx;
padding: 8rpx 20rpx;
display: flex;
align-items: center;
justify-content: center;
position: relative;
z-index: 5;
/* 确保在最上层 */
transition: all 0.2s;
border: none;
margin: 0;
font-size: inherit;
color: #fff;
line-height: normal;
/* 清除按钮在小程序中的默认样式 */
&::after {
display: none;
border: none;
}
&:active {
opacity: 0.7;
transform: scale(0.95);
}
}
</style>
<style scoped>
::-webkit-scrollbar {
width: 0 !important;
height: 0 !important;
display: none;
}
</style>

View File

@ -30,8 +30,9 @@
</view>
<view class="section-right">
<view class="user-avatar">
<image v-if="userInfo.avatar" :src="userInfo.avatar" mode="aspectFill"></image>
<view v-else class="default-avatar">{{ userInfo.nickname.substring(0, 1) }}</view>
<image :src="user_info.avatar?user_info.avatar:'/static/m_avatar.png'" mode="aspectFill">
</image>
<!-- <view v-else class="default-avatar">{{ userInfo.realname.substring(0, 1) }}</view> -->
</view>
<text class="ri-arrow-right-s-line arrow-icon"></text>
</view>
@ -44,7 +45,7 @@
</view>
<view class="section-right">
<view class="input-wrapper">
<input class="form-input" type="text" v-model="userInfo.nickname" placeholder="请输入昵称"
<input class="form-input" type="text" v-model="user_info.realname" placeholder="请输入昵称"
@blur="validateNickname" />
</view>
<text class="ri-arrow-right-s-line arrow-icon"></text>
@ -57,7 +58,7 @@
<text class="form-label">手机号</text>
</view>
<view class="section-right">
<text class="phone-text">{{ formatPhone(userInfo.phone) }}</text>
<text class="phone-text">{{ formatPhone(user_info.username) }}</text>
</view>
</view>
</view>
@ -69,22 +70,8 @@
</view>
<!-- 头像选择弹窗 -->
<wd-popup v-model="showAvatarPopup" position="bottom">
<view class="avatar-popup">
<view class="popup-title">修改头像</view>
<view class="avatar-options">
<view class="option-item" @click="handleSelectAlbum">
<text class="ri-image-2-line option-icon"></text>
<text class="option-text">从相册选择</text>
</view>
<view class="option-item" @click="handleTakePhoto">
<text class="ri-camera-line option-icon"></text>
<text class="option-text">拍照</text>
</view>
</view>
<view class="cancel-btn" @click="showAvatarPopup = false">取消</view>
</view>
</wd-popup>
<wd-action-sheet v-model="showAvatarPopup" :actions="avatarActions" @select="handleAvatarSelect" />
<wd-toast />
</view>
</template>
@ -100,6 +87,17 @@
import {
onLoad
} from '@dcloudio/uni-app'
import {
useToast
} from '@/uni_modules/wot-design-uni';
import {
fileUpload
} from '@/utils/common'
import {
changeInfo,
userInfo
} from '@/api/login';
const Toast = useToast();
// 使 composable
const {
@ -110,15 +108,31 @@
//
const userInfo = reactive({
nickname: '里派用户',
phone: '13800138000',
avatar: ''
});
const user_info = ref({})
//
const showAvatarPopup = ref(false);
//
const avatarActions = [{
name: '从相册选择',
},
{
name: '拍照',
}
];
/**
* 处理头像选择
*/
const handleAvatarSelect = (action) => {
if (action.index === 0) {
handleSelectAlbum();
} else if (action.index === 1) {
handleTakePhoto();
}
};
/**
* 格式化手机号码为带星号格式
*/
@ -131,12 +145,8 @@
* 校验昵称
*/
const validateNickname = () => {
if (!userInfo.nickname.trim()) {
uni.showToast({
title: '昵称不能为空',
icon: 'none'
});
userInfo.nickname = '里派用户';
if (!user_info.value.realname.trim()) {
Toast.error('昵称不能为空')
}
};
@ -155,27 +165,17 @@
count: 1,
sizeType: ['compressed'],
sourceType: ['album'],
success: (res) => {
success: async (res) => {
//
showAvatarPopup.value = false;
//
const tempFilePath = res.tempFilePaths[0];
// URL
//
uni.showLoading({
title: '上传中...'
});
setTimeout(() => {
uni.hideLoading();
userInfo.avatar = tempFilePath;
uni.showToast({
title: '头像已更新',
icon: 'success'
});
}, 1000);
//
const fileUrl = await fileUpload(tempFilePath)
Toast.success('上传成功')
user_info.value.avatar = fileUrl
}
});
};
@ -188,27 +188,17 @@
count: 1,
sizeType: ['compressed'],
sourceType: ['camera'],
success: (res) => {
success: async (res) => {
//
showAvatarPopup.value = false;
//
const tempFilePath = res.tempFilePaths[0];
// URL
//
uni.showLoading({
title: '上传中...'
});
setTimeout(() => {
uni.hideLoading();
userInfo.avatar = tempFilePath;
uni.showToast({
title: '头像已更新',
icon: 'success'
});
}, 1000);
//
const fileUrl = await fileUpload(tempFilePath)
Toast.success('上传成功')
user_info.value.avatar = fileUrl
}
});
};
@ -229,13 +219,10 @@
/**
* 保存用户信息
*/
const saveUserInfo = () => {
const saveUserInfo = async () => {
//
if (!userInfo.nickname.trim()) {
uni.showToast({
title: '昵称不能为空',
icon: 'none'
});
if (!user_info.value.realname.trim()) {
Toast.error('昵称不能为空')
return;
}
@ -244,44 +231,29 @@
title: '保存中...'
});
//
const res = await changeInfo({
real_name: user_info.value.realname,
avatar: user_info.value.avatar
})
uni.hideLoading()
if (res.code == 200) {
Toast.success('保存成功')
setTimeout(() => {
//
uni.hideLoading();
//
uni.setStorageSync('userInfo', JSON.stringify(userInfo));
//
uni.showToast({
title: '保存成功',
icon: 'success'
});
//
setTimeout(() => {
goBack();
}, 1500);
}, 1000);
};
/**
* 返回上一页
*/
const goBack = () => {
uni.navigateBack();
}, 500)
}
};
const getUserInfo = async () => {
const res = await userInfo()
user_info.value = res.data
}
onMounted(() => {
checkRouteStack()
//
const userInfoStorage = uni.getStorageSync('userInfo');
if (userInfoStorage) {
Object.assign(userInfo, JSON.parse(userInfoStorage));
}
getUserInfo()
});
</script>

View File

@ -42,13 +42,13 @@
<text class="ri-arrow-right-s-line arrow"></text>
</view>
<view class="setting-item" @click="handleUserAgreement">
<!-- <view class="setting-item" @click="handleUserAgreement">
<view class="left">
<text class="ri-file-list-3-line icon"></text>
<text class="title">用户协议</text>
</view>
<text class="ri-arrow-right-s-line arrow"></text>
</view>
</view> -->
<view class="setting-item" @click="checkUpdate">
<view class="left">

View File

@ -61,68 +61,10 @@
.li-w-100{width:100rpx}
.li-w-full-80{width:80%}
.bg-0070F0{background-color:rgb(0,112,240)}
.border-4-white{border-style:solid;border-color:rgb(255,255,255);border-width:4rpx}
.bg-FFFFFF{background-color:rgb(255,255,255)}
.bg-f9f9f9{background-color:rgb(249,249,249)}
.border-4-white{border-style:solid;border-color:rgb(255,255,255);border-width:4rpx}
.li-font-bold{font-weight:bold}
.li-mb-8{margin-bottom:8rpx}
.li-ml-15{margin-left:15rpx}
.li-ml-6{margin-left:6rpx}
.li-mr-6{margin-right:6rpx}
.li-p-15{padding:15rpx}
.li-pb-15{padding-bottom:15rpx}
.li-pb-30{padding-bottom:30rpx}
.li-pt-25{padding-top:25rpx}
.li-pt-4{padding-top:4rpx}
.li-text-009aff-color{color:rgb(0,154,255)}
.li-text-24{font-size:24rpx}
.li-text-32{font-size:32rpx}
.li-text-333333-color{color:rgb(51,51,51)}
.li-text-36{font-size:36rpx}
.li-text-55{font-size:55rpx}
.li-text-70{font-size:70rpx}
.li-text-9a9a9a-color{color:rgb(154,154,154)}
.li-text-ff0000-color{color:rgb(255,0,0)}
.li-w-full-100{width:100%}
.li-w-full-92{width:92%}
.li-font-550{font-weight:550}
.li-h-68{height:68rpx}
.li-mt-100{margin-top:100rpx}
.li-mt-28{margin-top:28rpx}
.li-mt-32{margin-top:32rpx}
.li-mt-90{margin-top:90rpx}
.li-mx-10{margin-left:10rpx;margin-right:10rpx}
.li-pt-270{padding-top:270rpx}
.li-rd-40{border-radius:40rpx}
.li-text-000000-color{color:rgb(0,0,0)}
.li-text-2EA1EA-color{color:rgb(46,161,234)}
.li-text-a5a5a5-color{color:rgb(165,165,165)}
.li-w-150{width:150rpx}
.li-w-420{width:420rpx}
.li-w-full-85{width:85%}
.li-w-full-90{width:90%}
.li-h-110{height:110rpx}
.li-items-start{align-items:start}
.li-mb-12{margin-bottom:12rpx}
.li-mb-20{margin-bottom:20rpx}
.li-mr-12{margin-right:12rpx}
.li-mr-3{margin-right:3rpx}
.li-mt-40{margin-top:40rpx}
.li-pb-25{padding-bottom:25rpx}
.li-pl-20{padding-left:20rpx}
.li-pl-30{padding-left:30rpx}
.li-pr-30{padding-right:30rpx}
.li-pt-20{padding-top:20rpx}
.li-pt-30{padding-top:30rpx}
.li-py-6{padding-top:6rpx;padding-bottom:6rpx}
.li-rd-20{border-radius:20rpx}
.li-text-40{font-size:40rpx}
.li-text-5f5f5f-color{color:rgb(95,95,95)}
.li-text-666-color{color:rgb(102,102,102)}
.li-text-right{text-align:right}
.li-w-110{width:110rpx}
.li-w-400{width:400rpx}
.overflow-hidden{overflow:hidden}
.li-h-240{height:240rpx}
.li-h-250{height:250rpx}
.li-h-50{height:50rpx}
@ -141,11 +83,16 @@
.li-pb-10{padding-bottom:10rpx}
.li-pb-14{padding-bottom:14rpx}
.li-pb-20{padding-bottom:20rpx}
.li-pt-20{padding-top:20rpx}
.li-pt-8{padding-top:8rpx}
.li-rd-20{border-radius:20rpx}
.li-rd-tl-30-important{border-top-left-radius:30rpx !important}
.li-rd-tr-30-important{border-top-right-radius:30rpx !important}
.li-text-000000-color{color:rgb(0,0,0)}
.li-text-19171B-color{color:rgb(25,23,27)}
.li-text-20{font-size:20rpx}
.li-text-24{font-size:24rpx}
.li-text-32{font-size:32rpx}
.li-text-706e70-color{color:rgb(112,110,112)}
.li-text-B2B2B2-color{color:rgb(178,178,178)}
.li-text-BBBDDA-color{color:rgb(187,189,218)}
@ -157,10 +104,63 @@
.li-w-50{width:50rpx}
.li-w-60{width:60rpx}
.li-w-full-94{width:94%}
.li-font-550{font-weight:550}
.li-h-68{height:68rpx}
.li-mt-100{margin-top:100rpx}
.li-mt-28{margin-top:28rpx}
.li-mt-32{margin-top:32rpx}
.li-mt-90{margin-top:90rpx}
.li-mx-10{margin-left:10rpx;margin-right:10rpx}
.li-pt-270{padding-top:270rpx}
.li-rd-40{border-radius:40rpx}
.li-text-2EA1EA-color{color:rgb(46,161,234)}
.li-text-a5a5a5-color{color:rgb(165,165,165)}
.li-w-150{width:150rpx}
.li-w-420{width:420rpx}
.li-w-full-85{width:85%}
.li-w-full-90{width:90%}
.li-mb-8{margin-bottom:8rpx}
.li-ml-15{margin-left:15rpx}
.li-ml-6{margin-left:6rpx}
.li-mr-6{margin-right:6rpx}
.li-p-15{padding:15rpx}
.li-pb-15{padding-bottom:15rpx}
.li-pb-30{padding-bottom:30rpx}
.li-pt-25{padding-top:25rpx}
.li-pt-4{padding-top:4rpx}
.li-text-009aff-color{color:rgb(0,154,255)}
.li-text-333333-color{color:rgb(51,51,51)}
.li-text-36{font-size:36rpx}
.li-text-55{font-size:55rpx}
.li-text-70{font-size:70rpx}
.li-text-9a9a9a-color{color:rgb(154,154,154)}
.li-text-ff0000-color{color:rgb(255,0,0)}
.li-w-full-100{width:100%}
.li-w-full-92{width:92%}
.li-h-110{height:110rpx}
.li-items-start{align-items:start}
.li-mb-12{margin-bottom:12rpx}
.li-mb-20{margin-bottom:20rpx}
.li-mr-12{margin-right:12rpx}
.li-mr-3{margin-right:3rpx}
.li-mt-40{margin-top:40rpx}
.li-pb-25{padding-bottom:25rpx}
.li-pl-20{padding-left:20rpx}
.li-pl-30{padding-left:30rpx}
.li-pr-30{padding-right:30rpx}
.li-pt-30{padding-top:30rpx}
.li-py-6{padding-top:6rpx;padding-bottom:6rpx}
.li-text-40{font-size:40rpx}
.li-text-5f5f5f-color{color:rgb(95,95,95)}
.li-text-666-color{color:rgb(102,102,102)}
.li-text-right{text-align:right}
.li-w-110{width:110rpx}
.li-w-400{width:400rpx}
.overflow-hidden{overflow:hidden}
.li-mb-25{margin-bottom:25rpx}
.li-font-400{font-weight:400}
.li-m-30{margin:30rpx}
.li-text-595959-color{color:rgb(89,89,89)}
.li-mb-25{margin-bottom:25rpx}
.li-mb-30{margin-bottom:30rpx}
.li-ml-10{margin-left:10rpx}
.li-mr-200{margin-right:200rpx}
@ -190,46 +190,43 @@
.li-h-90{height:90rpx}
.li-text-47{font-size:47rpx}
.li-w-90{width:90rpx}
.li-flex-1{flex:1}
.li-flex-wrap{flex-wrap:wrap}
.li-mt-25{margin-top:25rpx}
.li-mt-5{margin-top:5rpx}
.li-text-999999-color{color:rgb(153,153,153)}
.li-w-160{width:160rpx}
.li-block{display:block}
.li-items-baseline{align-items:baseline}
.li-mr-15{margin-right:15rpx}
.li-mt-5{margin-top:5rpx}
.li-opacity-100{undefined:1}
.li-rd-12{border-radius:12rpx}
.li-rd-16{border-radius:16rpx}
.li-text-0a4696-color{color:rgb(10,70,150)}
.li-flex-1{flex:1}
.li-flex-wrap{flex-wrap:wrap}
.li-mt-25{margin-top:25rpx}
.li-text-999999-color{color:rgb(153,153,153)}
.li-w-160{width:160rpx}
.li-line-clamp-2{overflow:hidden;display:-webkit-box;line-clamp:2;-webkit-box-orient:vertical;-webkit-line-clamp:2}
.li-w-full-96{width:96%}
.li-mt-200{margin-top:200rpx}
.li-pt-6{padding-top:6rpx}
.li-my-10{margin-top:10rpx;margin-bottom:10rpx}
.li-p-20{padding:20rpx}
.li-px-20{padding-left:20rpx;padding-right:20rpx}
.li-py-10{padding-top:10rpx;padding-bottom:10rpx}
.li-py-60{padding-top:60rpx;padding-bottom:60rpx}
.li-rd-8{border-radius:8rpx}
.li-text-dddddd-color{color:rgb(221,221,221)}
.li-text-ff9900-color{color:rgb(255,153,0)}
.li-mr-180{margin-right:180rpx}
.li-opacity-80{undefined:0.8}
.li-pb-40{padding-bottom:40rpx}
.li-px-20{padding-left:20rpx;padding-right:20rpx}
.li-py-10{padding-top:10rpx;padding-bottom:10rpx}
.li-py-100{padding-top:100rpx;padding-bottom:100rpx}
.li-py-60{padding-top:60rpx;padding-bottom:60rpx}
.li-rd-30{border-radius:30rpx}
.li-text-100{font-size:100rpx}
.li-text-3e9bff-color{color:rgb(62,155,255)}
.li-text-50{font-size:50rpx}
.li-text-52c41a-color{color:rgb(82,196,26)}
.li-text-ccc-color{color:rgb(204,204,204)}
.li-text-ff4d4f-color{color:rgb(255,77,79)}
.li-my-10{margin-top:10rpx;margin-bottom:10rpx}
.li-p-20{padding:20rpx}
.li-rd-8{border-radius:8rpx}
.li-text-dddddd-color{color:rgb(221,221,221)}
.li-text-ff9900-color{color:rgb(255,153,0)}

View File

@ -1,4 +1,6 @@
import CryptoJS from 'crypto-js';
import { Uni } from '@dcloudio/uni-app'
declare const uni : Uni
/**
* 2
@ -296,3 +298,33 @@ export const debounce = (fn: Function, delay: number = 500): Function => {
}, delay);
};
};
function getBaseUrl() {
// @ts-ignore
return uni.$globalData?.BASE_URL + 'v1/upload'
}
export const fileUpload = (data : any) => {
uni.showLoading({
title: '上传中...'
})
return new Promise((resolve, reject) => {
uni.uploadFile({
url: getBaseUrl(),
filePath: data,
name: 'file',
method: 'POST',
header: {
'Authorization': 'Bearer ' + uni.$store.state.token
},
success: (res) => {
resolve(JSON.parse(res.data).data.filePath);
},
complete:() =>{
uni.hideLoading()
}
});
})
}