物业催缴接口完成(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 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: '物业催缴', title: '物业催缴',
type: 'call' type: 'call'
}, },
{ // {
image: uni.$globalData?.RESOURCE_URL + 'home/grid/tousu.png', // image: uni.$globalData?.RESOURCE_URL + 'home/grid/tousu.png',
title: '投诉管理', // title: '',
type: 'complaint' // type: 'complaint'
}, // },
// { // {
// image: uni.$globalData?.RESOURCE_URL + 'home/grid/fangke.png', // image: uni.$globalData?.RESOURCE_URL + 'home/grid/fangke.png',
// title: '访', // title: '访',
@ -216,11 +216,11 @@
title: '商品核销', title: '商品核销',
type: 'verification' type: 'verification'
}, },
{ // {
image: uni.$globalData?.RESOURCE_URL + 'home/grid/gongdan.png', // image: uni.$globalData?.RESOURCE_URL + 'home/grid/gongdan.png',
title: '员工权限', // title: '',
type: 'permissions' // 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 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 @click="toPages({type:'userInfo'})" class="li-flex li-items-center">
<view class="li-flex li-items-end li-mr-20"> <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> </image>
</view> </view>
<view class="li-flex li-flex-col"> <view class="li-flex li-flex-col">
@ -84,16 +85,11 @@
import { onShow, onReachBottom, Uni } from "@dcloudio/uni-app" import { onShow, onReachBottom, Uni } from "@dcloudio/uni-app"
import { ref } from "vue" import { ref } from "vue"
import { useToast } from '@/uni_modules/wot-design-uni' import { useToast } from '@/uni_modules/wot-design-uni'
import { userInfo } from '@/api/login'
const Toast = useToast() const Toast = useToast()
declare const uni : Uni declare const uni : Uni
const user_info = ref({ const user_info = ref({})
"realname": "里派",
"avatar": "/static/m_avatar.png",
"owner": {
"name": "里派(杭州)网络科技有限公司"
}
})
const mine_back = uni.$globalData?.RESOURCE_URL + 'mine/mine-back1.png' const mine_back = uni.$globalData?.RESOURCE_URL + 'mine/mine-back1.png'
const card_back = uni.$globalData?.RESOURCE_URL + 'mine/card-back.png' const card_back = uni.$globalData?.RESOURCE_URL + 'mine/card-back.png'
@ -151,12 +147,12 @@
// number: 0, // number: 0,
// icon: uni.$globalData?.RESOURCE_URL + 'mine/icon/menjin.png' // icon: uni.$globalData?.RESOURCE_URL + 'mine/icon/menjin.png'
// }, // },
{ // {
title: '用户协议', // title: '',
number: 0, // number: 0,
icon: uni.$globalData?.RESOURCE_URL + 'mine/icon/pandian.png', // icon: uni.$globalData?.RESOURCE_URL + 'mine/icon/pandian.png',
type: 'protocol' // type: 'protocol'
}, // },
{ {
title: '隐私政策', title: '隐私政策',
number: 0, number: 0,
@ -240,12 +236,19 @@
} }
} }
const getUserInfo = async () => {
const res = await userInfo()
user_info.value = res.data
}
onShow(async () => { onShow(async () => {
const userInfo = await uni.$store.state.userInfos // const userInfo = await uni.$store.state.userInfos
userInfo.realname && (user_info.value.realname = userInfo.realname) // userInfo.realname && (user_info.value.realname = userInfo.realname)
userInfo.avatar && (user_info.value.avatar = userInfo.avatar) // userInfo.avatar && (user_info.value.avatar = userInfo.avatar)
userInfo.owner.name && (user_info.value.owner.name = userInfo.owner.name) // userInfo.owner.name && (user_info.value.owner.name = userInfo.owner.name)
getUserInfo()
}) })
</script> </script>

View File

@ -25,6 +25,7 @@
import { onLoad } from '@dcloudio/uni-app'; import { onLoad } from '@dcloudio/uni-app';
import { useNavigation } from '@/hooks/useNavigation'; import { useNavigation } from '@/hooks/useNavigation';
import { useToast } from '@/uni_modules/wot-design-uni'; import { useToast } from '@/uni_modules/wot-design-uni';
import { configGet } from '@/api/login'
const Toast = useToast(); const Toast = useToast();
@ -36,7 +37,13 @@
} = useNavigation(); } = useNavigation();
const paramsType = ref('1') 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) => { onLoad((options) => {
checkRouteStack(); checkRouteStack();
getConfigGet()
paramsType.value = options.type paramsType.value = options.type
}); });
</script> </script>

View File

@ -1,4 +1,5 @@
<template> <template>
<page-meta :page-style="`overflow:${showHouseDetail ? 'hidden' : 'visible'};`"></page-meta>
<view class="call-page"> <view class="call-page">
<!-- 自定义导航栏 --> <!-- 自定义导航栏 -->
<wd-navbar :bordered="false" <wd-navbar :bordered="false"
@ -14,24 +15,24 @@
</view> </view>
</template> </template>
<!-- #ifdef MP-WEIXIN --> <!-- #ifdef MP-WEIXIN -->
<template #right> <!-- <template #right>
<view class="li-mr-180 li-flex li-items-center"> <view class="li-mr-180 li-flex li-items-center">
<view class="community-switcher" @click="showCommunityPicker = true"> <view class="community-switcher" @click="showCommunityPicker = true">
<text class="community-name">{{activeCommunity.name}}</text> <text class="community-name">{{activeCommunity.name}}</text>
<text class="arrow-icon ri-arrow-down-s-line"></text> <text class="arrow-icon ri-arrow-down-s-line"></text>
</view> </view>
</view> </view>
</template> </template> -->
<!-- #endif --> <!-- #endif -->
<!-- #ifndef MP-WEIXIN --> <!-- #ifndef MP-WEIXIN -->
<template #right> <!-- <template #right>
<view class="li-mr-25 li-flex li-items-center"> <view class="li-mr-25 li-flex li-items-center">
<view class="community-switcher" @click="showCommunityPicker = true"> <view class="community-switcher" @click="showCommunityPicker = true">
<text class="community-name">{{activeCommunity.name}}</text> <text class="community-name">{{activeCommunity.name}}</text>
<text class="arrow-icon ri-arrow-down-s-line"></text> <text class="arrow-icon ri-arrow-down-s-line"></text>
</view> </view>
</view> </view>
</template> </template> -->
<!-- #endif --> <!-- #endif -->
</wd-navbar> </wd-navbar>
<!-- 导航栏背景 --> <!-- 导航栏背景 -->
@ -45,16 +46,16 @@
<view class="li-flex li-justify-between li-items-center"> <view class="li-flex li-justify-between li-items-center">
<text <text
class="community-name li-text-42 li-font-bold li-text-white">{{activeCommunity.name}}</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"> <button class="refresh-btn" @tap.stop="handleRefreshClick">
<text class="li-text-28 li-text-white">刷新数据</text> <text class="li-text-24 li-text-white">刷新数据</text>
</view> </button>
</view> </view>
<view class="li-flex li-items-center li-mt-20"> <view class="li-flex li-items-center li-mt-20">
<text class="li-text-28 li-text-white li-opacity-80">{{activeCommunity.address}}</text> <text class="li-text-28 li-text-white li-opacity-80">{{activeCommunity.address}}</text>
</view> </view>
<view class="li-flex li-items-center li-mt-10"> <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-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> </view>
<view class="community-footer li-p-30 li-bg-white"> <view class="community-footer li-p-30 li-bg-white">
@ -71,7 +72,7 @@
<!-- 左侧楼栋侧边导航 --> <!-- 左侧楼栋侧边导航 -->
<view class="sidebar-container"> <view class="sidebar-container">
<wd-sidebar v-model="activeBuilding" custom-class="building-sidebar"> <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)" :label="item.name" :badge="getBuildingUnpaidCount(item.id)"
:badge-props="{ type: 'primary', bgColor: '#ff4d4f' }" /> :badge-props="{ type: 'primary', bgColor: '#ff4d4f' }" />
</wd-sidebar> </wd-sidebar>
@ -86,10 +87,9 @@
<text class="li-text-24 li-text-#3e9bff">单元数量: {{unitList.length}}</text> <text class="li-text-24 li-text-#3e9bff">单元数量: {{unitList.length}}</text>
</view> </view>
<view class="unit-grid"> <view class="unit-grid">
<view v-for="unit in unitList" :key="unit.value" <view v-for="unit in unitList" :key="unit.value" class="unit-item li-mr-15 li-mb-15"
class="unit-item li-mr-15 li-mb-15"
:class="activeUnitId === String(unit.value) ? 'unit-item-active' : ''" :class="activeUnitId === String(unit.value) ? 'unit-item-active' : ''"
@click="activeUnitId = String(unit.value)"> @click="handleUnitSelect(unit.value)">
<text class="unit-text" <text class="unit-text"
:class="activeUnitId === String(unit.value) ? 'unit-text-active' : ''">{{unit.label}}</text> :class="activeUnitId === String(unit.value) ? 'unit-text-active' : ''">{{unit.label}}</text>
<view v-if="getUnitUnpaidCount(unit.value) > 0" class="unit-badge"> <view v-if="getUnitUnpaidCount(unit.value) > 0" class="unit-badge">
@ -131,8 +131,7 @@
<!-- 空状态 --> <!-- 空状态 -->
<view v-if="floorHouseList.length === 0" <view v-if="floorHouseList.length === 0"
class="empty-state li-py-100 li-flex-center li-flex-col"> 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> <wd-status-tip image="search" tip="该单元暂无数据" />
<text class="li-text-30 li-text-#999 li-mt-20">该单元暂无数据</text>
</view> </view>
<!-- 添加底部安全间距 --> <!-- 添加底部安全间距 -->
@ -144,7 +143,7 @@
</view> </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="house-detail" :style="{ height: '60vh' }">
<view class="detail-header li-p-30 li-bottom-border"> <view class="detail-header li-p-30 li-bottom-border">
<view class="li-flex li-justify-between li-items-center"> <view class="li-flex li-justify-between li-items-center">
@ -153,7 +152,7 @@
</view> </view>
<view class="li-flex li-items-center li-mt-10"> <view class="li-flex li-items-center li-mt-10">
<text class="li-text-28 li-text-#666">{{activeCommunity.name}} {{getActiveBuilding().name}} <text class="li-text-28 li-text-#666">{{activeCommunity.name}} {{getActiveBuilding().name}}
{{activeUnit}}单元</text> {{activeUnit}}</text>
</view> </view>
</view> </view>
<scroll-view scroll-y class="detail-content-scroll"> <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-#999">逾期时间</text>
<text class="li-text-26 li-text-#666">{{bill.overdueTime}}</text> <text class="li-text-26 li-text-#666">{{bill.overdueTime}}</text>
</view> </view>
<view class="li-flex li-justify-between li-items-center li-mt-20"> <view class="li-flex li-justify-between li-items-center li-flex-row-reverse li-mt-20">
<wd-button size="small" type="info" plain
@click="callOwner(selectedHouse)">电话催缴</wd-button>
<wd-button size="small" type="primary" <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>
</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="ri-check-double-line li-text-100 li-text-#52c41a"></text>
<text class="li-text-30 li-text-#666 li-mt-20">该住户暂无欠费</text> <text class="li-text-30 li-text-#666 li-mt-20">该住户暂无欠费</text>
</view> </view>
@ -216,6 +215,9 @@
useToast useToast
} from '@/uni_modules/wot-design-uni'; } from '@/uni_modules/wot-design-uni';
import CommunitySelector from '@/components/community-selector/community-selector.vue'; import CommunitySelector from '@/components/community-selector/community-selector.vue';
import {
feeInfo
} from '/api/fee'
const Toast = useToast(); const Toast = useToast();
@ -226,427 +228,182 @@
checkRouteStack checkRouteStack
} = useNavigation(); } = useNavigation();
const selectedVillage = ref('1'); //
const communityList = ref([ const village = 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 buildingList = 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 activeBuilding = ref('1'); const activeBuilding = ref('');
//
const unitList = ref([]);
// (使) // (使)
const activeUnitId = ref('1'); const activeUnitId = ref('');
// ID // ID
const activeUnit = computed(() => parseInt(activeUnitId.value)); const activeUnit = computed(() => {
//
// activeUnitfloorHouseList if (!activeUnitId.value || !unitList.value.length) return '';
watch(activeUnit, (newVal) => { const unit = unitList.value.find(u => String(u.value) === String(activeUnitId.value));
console.log('activeUnit changed to', newVal); return unit ? unit.label : '';
}); });
// //
const houseData = reactive({ const activeCommunity = computed(() => {
// 1 1 return {
'1-1': [{ id: '1',
floor: '1', name: village.value.village_name || '暂无数据',
houses: [{ address: `${village.value.province_name || ''}-${village.value.city_name || ''}-${village.value.area_name || ''}`,
id: '1-1-101', managementAddress: village.value.address || '暂无地址',
number: '1-1001', totalUnpaid: calculateTotalUnpaid()
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 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 floorHouseList = computed(() => {
const key = `${activeBuilding.value}-${activeUnit.value}`; if (!activeBuilding.value || !activeUnitId.value) return [];
return houseData[key] || [];
//
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 = () => { 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: '', id: '',
name: '' name: ''
}; };
}; };
// //
const getUnitUnpaidCount = (unit) => { const getBuildingUnpaidCount = (buildingId) => {
const key = `${activeBuilding.value}-${unit}`; if (!village.value.regions) return '';
if (!houseData[key]) return 0;
return houseData[key].reduce((total, floor) => { const region = village.value.regions.find(r => String(r.region_id) === buildingId);
return total + floor.houses.filter(house => house.unpaid > 0).length; if (!region) return '';
}, 0);
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) => { const callOwner = (house) => {
console.log(house);
if (!house.phone) {
Toast.fail('没有可用的联系电话');
return;
}
uni.makePhoneCall({ uni.makePhoneCall({
phoneNumber: house.phone, phoneNumber: house.phone,
success: () => { success: () => {
@ -687,15 +450,10 @@
}, 1500); }, 1500);
}; };
// //
const handleCommunityConfirm = (selected) => { let isRefreshing = false;
console.log(selected, 'selected'); const handleRefreshClick = async () => {
selectedCommunity.value = selected.value; getFeeInfo();
};
//
const handleRefresh = () => {
Toast.success('数据已刷新');
}; };
// //
@ -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(() => { onLoad(() => {
checkRouteStack(); checkRouteStack();
initData();
}); });
// //
const getBuildingUnpaidCount = (buildingId) => { const handleCommunityConfirm = (selected) => {
let count = 0; console.log(selected, 'selected');
// //
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 formattedCommunityList = computed(() => { const formattedCommunityList = computed(() => {
// //
const flatList = communityList.value[0] || []; const flatList = buildingList.value || [];
return flatList.map(item => ({ return flatList.map(item => ({
value: item.value, value: item.id,
label: item.label label: item.name
})); }));
}); });
// showCommunityPicker // showCommunityPicker
const showCommunityPicker = ref(false); const showCommunityPicker = ref(false);
// handleUnitSelect
const handleUnitSelect = (value) => {
activeUnitId.value = String(value);
console.log('选中单元:', activeUnitId.value);
};
</script> </script>
<style lang="scss"> <style lang="scss">
@ -1183,7 +1035,7 @@
} }
.empty-bills { .empty-bills {
padding: 60rpx 0; padding-top: 150rpx;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
align-items: center; align-items: center;
@ -1192,15 +1044,16 @@
.house-detail { .house-detail {
height: 100%; height: 100%;
border-radius: 24rpx 24rpx 0 0; border-radius: 24rpx 24rpx 0 0 !important;
overflow: hidden; overflow: hidden;
background-color: #fff; background-color: #fff;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
.detail-header { .detail-header {
padding-top: constant(safe-area-inset-top); // padding-top: constant(safe-area-inset-top);
padding-top: env(safe-area-inset-top); // padding-top: env(safe-area-inset-top);
flex-shrink: 0; flex-shrink: 0;
} }
@ -1231,4 +1084,44 @@
padding-top: env(safe-area-inset-top) !important; 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> </style>

View File

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

View File

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

View File

@ -61,68 +61,10 @@
.li-w-100{width:100rpx} .li-w-100{width:100rpx}
.li-w-full-80{width:80%} .li-w-full-80{width:80%}
.bg-0070F0{background-color:rgb(0,112,240)} .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-FFFFFF{background-color:rgb(255,255,255)}
.bg-f9f9f9{background-color:rgb(249,249,249)} .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-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-240{height:240rpx}
.li-h-250{height:250rpx} .li-h-250{height:250rpx}
.li-h-50{height:50rpx} .li-h-50{height:50rpx}
@ -141,11 +83,16 @@
.li-pb-10{padding-bottom:10rpx} .li-pb-10{padding-bottom:10rpx}
.li-pb-14{padding-bottom:14rpx} .li-pb-14{padding-bottom:14rpx}
.li-pb-20{padding-bottom:20rpx} .li-pb-20{padding-bottom:20rpx}
.li-pt-20{padding-top:20rpx}
.li-pt-8{padding-top:8rpx} .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-tl-30-important{border-top-left-radius:30rpx !important}
.li-rd-tr-30-important{border-top-right-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-19171B-color{color:rgb(25,23,27)}
.li-text-20{font-size:20rpx} .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-706e70-color{color:rgb(112,110,112)}
.li-text-B2B2B2-color{color:rgb(178,178,178)} .li-text-B2B2B2-color{color:rgb(178,178,178)}
.li-text-BBBDDA-color{color:rgb(187,189,218)} .li-text-BBBDDA-color{color:rgb(187,189,218)}
@ -157,10 +104,63 @@
.li-w-50{width:50rpx} .li-w-50{width:50rpx}
.li-w-60{width:60rpx} .li-w-60{width:60rpx}
.li-w-full-94{width:94%} .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-font-400{font-weight:400}
.li-m-30{margin:30rpx} .li-m-30{margin:30rpx}
.li-text-595959-color{color:rgb(89,89,89)} .li-text-595959-color{color:rgb(89,89,89)}
.li-mb-25{margin-bottom:25rpx}
.li-mb-30{margin-bottom:30rpx} .li-mb-30{margin-bottom:30rpx}
.li-ml-10{margin-left:10rpx} .li-ml-10{margin-left:10rpx}
.li-mr-200{margin-right:200rpx} .li-mr-200{margin-right:200rpx}
@ -190,46 +190,43 @@
.li-h-90{height:90rpx} .li-h-90{height:90rpx}
.li-text-47{font-size:47rpx} .li-text-47{font-size:47rpx}
.li-w-90{width:90rpx} .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-block{display:block}
.li-items-baseline{align-items:baseline} .li-items-baseline{align-items:baseline}
.li-mr-15{margin-right:15rpx} .li-mr-15{margin-right:15rpx}
.li-mt-5{margin-top:5rpx}
.li-opacity-100{undefined:1} .li-opacity-100{undefined:1}
.li-rd-12{border-radius:12rpx} .li-rd-12{border-radius:12rpx}
.li-rd-16{border-radius:16rpx} .li-rd-16{border-radius:16rpx}
.li-text-0a4696-color{color:rgb(10,70,150)} .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-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-w-full-96{width:96%}
.li-mt-200{margin-top:200rpx} .li-mt-200{margin-top:200rpx}
.li-pt-6{padding-top:6rpx} .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-opacity-80{undefined:0.8}
.li-pb-40{padding-bottom:40rpx} .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-100{padding-top:100rpx;padding-bottom:100rpx}
.li-py-60{padding-top:60rpx;padding-bottom:60rpx}
.li-rd-30{border-radius:30rpx} .li-rd-30{border-radius:30rpx}
.li-text-100{font-size:100rpx} .li-text-100{font-size:100rpx}
.li-text-3e9bff-color{color:rgb(62,155,255)} .li-text-3e9bff-color{color:rgb(62,155,255)}
.li-text-50{font-size:50rpx} .li-text-50{font-size:50rpx}
.li-text-52c41a-color{color:rgb(82,196,26)} .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-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 CryptoJS from 'crypto-js';
import { Uni } from '@dcloudio/uni-app'
declare const uni : Uni
/** /**
* 2 * 2
@ -147,15 +149,15 @@ export const VersionUpdate = () => {
if (uni.canIUse('getUpdateManager')) { if (uni.canIUse('getUpdateManager')) {
const updateManager = uni.getUpdateManager() const updateManager = uni.getUpdateManager()
// 向小程序后台请求完新版本信息 // 向小程序后台请求完新版本信息
updateManager.onCheckForUpdate(function(res) { updateManager.onCheckForUpdate(function (res) {
if (res.hasUpdate) { if (res.hasUpdate) {
//小程序有新版本,静默下载新版本,新版本下载完成 //小程序有新版本,静默下载新版本,新版本下载完成
updateManager.onUpdateReady(function() { updateManager.onUpdateReady(function () {
//模态弹窗(确认、取消) //模态弹窗(确认、取消)
uni.showModal({ uni.showModal({
title: '更新提示', title: '更新提示',
content: '小程序已发布新版本,是否重启?', content: '小程序已发布新版本,是否重启?',
success: function(res) { success: function (res) {
//用户点击确定 //用户点击确定
if (res.confirm) { if (res.confirm) {
//当新版本下载完成,调用该方法会强制当前小程序应用上新版本并重启 //当新版本下载完成,调用该方法会强制当前小程序应用上新版本并重启
@ -168,7 +170,7 @@ export const VersionUpdate = () => {
title: '提示', title: '提示',
content: '小程序已发布新版本,是否重启', content: '小程序已发布新版本,是否重启',
showCancel: false, //隐藏取消按钮 showCancel: false, //隐藏取消按钮
success: function(res) { success: function (res) {
//第二次提示后,强制更新 //第二次提示后,强制更新
if (res.confirm) { if (res.confirm) {
// 当新版本下载完成,调用该方法会强制当前小程序应用上新版本并重启 // 当新版本下载完成,调用该方法会强制当前小程序应用上新版本并重启
@ -184,7 +186,7 @@ export const VersionUpdate = () => {
}) })
}) })
// 当新版本下载失败 // 当新版本下载失败
updateManager.onUpdateFailed(function() { updateManager.onUpdateFailed(function () {
uni.showModal({ uni.showModal({
title: '提示', title: '提示',
content: '请您删除当前小程序,重新打开小程序', content: '请您删除当前小程序,重新打开小程序',
@ -204,21 +206,21 @@ export const VersionUpdate = () => {
/* /*
base64编码 base64编码
*/ */
export const base64_encrypt = (data: String) => { export const base64_encrypt = (data : String) => {
return CryptoJS.enc.Base64.stringify(CryptoJS.enc.Utf8.parse(data)) return CryptoJS.enc.Base64.stringify(CryptoJS.enc.Utf8.parse(data))
} }
/* /*
base64解码 base64解码
*/ */
export const base64_decrypt = (cipher: any) => { export const base64_decrypt = (cipher : any) => {
return CryptoJS.enc.Base64.parse(cipher).toString(CryptoJS.enc.Utf8) return CryptoJS.enc.Base64.parse(cipher).toString(CryptoJS.enc.Utf8)
} }
/* /*
md5加密 md5加密
*/ */
export const md5 = (data: String) => { export const md5 = (data : String) => {
return CryptoJS.MD5(data).toString() return CryptoJS.MD5(data).toString()
} }
@ -233,37 +235,37 @@ import { throttle } from '@/utils/common'
// 在setup中使用 // 在setup中使用
const handleClick = throttle(() => { const handleClick = throttle(() => {
// 你的业务逻辑 // 你的业务逻辑
console.log('点击事件被触发') console.log('点击事件被触发')
}, 500) }, 500)
// 在模板中使用 // 在模板中使用
<button @click="handleClick"></button> <button @click="handleClick"></button>
*/ */
export const throttle = (fn: Function, delay: number = 500): Function => { export const throttle = (fn : Function, delay : number = 500) : Function => {
let timer: number | null = null; let timer : number | null = null;
let lastTime: number = 0; let lastTime : number = 0;
return function (this: any, ...args: any[]) { return function (this : any, ...args : any[]) {
const currentTime = Date.now(); const currentTime = Date.now();
if (!lastTime) { if (!lastTime) {
lastTime = currentTime; lastTime = currentTime;
} }
if (currentTime - lastTime >= delay) { if (currentTime - lastTime >= delay) {
fn.apply(this, args); fn.apply(this, args);
lastTime = currentTime; lastTime = currentTime;
} else { } else {
if (timer) { if (timer) {
clearTimeout(timer); clearTimeout(timer);
} }
timer = setTimeout(() => { timer = setTimeout(() => {
fn.apply(this, args); fn.apply(this, args);
lastTime = Date.now(); lastTime = Date.now();
}, delay - (currentTime - lastTime)); }, delay - (currentTime - lastTime));
} }
}; };
}; };
/** /**
@ -277,22 +279,52 @@ import { debounce } from '@/utils/common'
// 在setup中使用 // 在setup中使用
const handleSearch = debounce((value: string) => { const handleSearch = debounce((value: string) => {
// 你的搜索逻辑 // 你的搜索逻辑
console.log('搜索:', value) console.log('搜索:', value)
}, 300) }, 300)
// 在模板中使用 // 在模板中使用
<input @input="handleSearch" /> <input @input="handleSearch" />
*/ */
export const debounce = (fn: Function, delay: number = 500): Function => { export const debounce = (fn : Function, delay : number = 500) : Function => {
let timer: number | null = null; let timer : number | null = null;
return function (this: any, ...args: any[]) { return function (this : any, ...args : any[]) {
if (timer) { if (timer) {
clearTimeout(timer); clearTimeout(timer);
} }
timer = setTimeout(() => { timer = setTimeout(() => {
fn.apply(this, args); fn.apply(this, args);
}, delay); }, 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()
}
});
})
}