修改我的房屋逻辑 登陆获取用户房屋列表一定为已通过认证,未通过认证只可在我的房屋-审核记录查看

添加 我的房屋-审核记录页面
对接 我的房屋-审核记录接口
修改 我的房屋列表相关接口
hmxc
张萌 4 years ago
parent 614c66483a
commit f910d38daa

@ -75,7 +75,10 @@ class _User {
String get authHouse => '/user/myHouse/authentication';
///
String get houseList => '/user/myHouse/list';
String get examineHouseList => '/user/myHouse/examineList';
///
String get passedHouseList => '/user/myHouse/houseList';
///
String get deleteHouse => '/user/myHouse/falseDelete';

@ -28,7 +28,7 @@ class HouseModel {
case 2:
return '租客';
case 3:
return '情书';
return '亲属';
}
return '';
}

@ -28,7 +28,8 @@ NewRenovationListModel _$NewRenovationListModelFromJson(
createName: json['createName'] as String,
createDate: json['createDate'] as String,
checkVoList: (json['checkVoList'] as List<dynamic>)
.map((e) => CheckVoList.fromJson(e as Map<String, dynamic>))
.map((e) =>
e == null ? null : CheckVoList.fromJson(e as Map<String, dynamic>))
.toList(),
);
}

@ -0,0 +1,84 @@
import 'package:equatable/equatable.dart';
import 'package:flutter/material.dart';
import 'package:json_annotation/json_annotation.dart';
part 'passed_house_list_model.g.dart';
@JsonSerializable()
class PassedHouseListModel extends Equatable {
final int id;
final int estateId;
final String roomName;
final int type;
final String? effectiveTimeStart;
final String? effectiveTimeEnd;
PassedHouseListModel({
required this.id,
required this.estateId,
required this.roomName,
required this.type,
this.effectiveTimeStart,
this.effectiveTimeEnd,
});
@override
List<Object?> get props {
return [
id,
estateId,
roomName,
type,
effectiveTimeStart,
effectiveTimeEnd,
];
}
factory PassedHouseListModel.fromJson(Map<String, dynamic> json) =>
_$PassedHouseListModelFromJson(json);
String get houseStatus {
if (type == 1) return '业主';
if (type == 2) return '亲属';
if (type == 3) return '租客';
return '';
}
Color get houseStatusColor {
// if (status != 4) return Color(0xFF666666);
if (type == 1) return Color(0xFF333333);
return Colors.white;
}
///
///
List<Color> get backgroundColor {
//TODO
// if (status != 4)
// return [
// Color(0xFFF5F5F5),
// Color(0xFFEFEEEE),
// Color(0xFFE8E8E8),
// ];
if (type == 1)
return [
Color(0xFFFFDF7D),
Color(0xFFFFD654),
Color(0xFFFFC40C),
];
if (type == 2)
return [
Color(0xFFFFA446),
Color(0xFFFFA547),
Color(0xFFFF8200),
];
if (type == 3)
return [
Color(0xFF9ADE79),
Color(0xFF91DE6B),
Color(0xFF6ECB41),
];
return [
Color(0xFFF5F5F5),
Color(0xFFEFEEEE),
Color(0xFFE8E8E8),
];
}
}

@ -0,0 +1,18 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'passed_house_list_model.dart';
// **************************************************************************
// JsonSerializableGenerator
// **************************************************************************
PassedHouseListModel _$PassedHouseListModelFromJson(Map<String, dynamic> json) {
return PassedHouseListModel(
id: json['id'] as int,
estateId: json['estateId'] as int,
roomName: json['roomName'] as String,
type: json['type'] as int,
effectiveTimeStart: json['effectiveTimeStart'] as String?,
effectiveTimeEnd: json['effectiveTimeEnd'] as String?,
);
}

@ -152,7 +152,7 @@ class DetoCodePage extends StatelessWidget {
Column(
children: [
SizedBox(height: 192.w - kToolbarHeight),
_header(appProvider.selectedHouse!.roomName!),
_header(appProvider.selectedHouse!.roomName),
SizedBox(height: 32.w),
_card(model!.appArticleOutQRCodeVo!.applicantName,
model!.appArticleOutQRCodeVo!.effectiveTime),

@ -408,7 +408,7 @@ class _DetoCreatePageState extends State<DetoCreatePage> {
body: ListView(
padding: EdgeInsets.all(32.w),
children: [
_houseAddress(appProvider.selectedHouse!.roomName!),
_houseAddress(appProvider.selectedHouse!.roomName),
_getWeight(),
_itemPicker('出户时间', datetime, () async {
_date = await BeeDatePicker.timePicker(DateTime.now());

@ -98,7 +98,7 @@ class _LifePayPageState extends State<LifePayPage> {
.bold
.make(),
10.w.heightBox,
appProvider.selectedHouse!.roomName!.text.black
appProvider.selectedHouse!.roomName.text.black
.size(32.sp)
.bold
.make()

@ -226,11 +226,11 @@ class _AlarmPageState extends State<AlarmPage> {
_makephonenum('tel:110');
});
if (appProvider.selectedHouse?.status == 4) {
if (appProvider.selectedHouse!=null) {
await NetUtil()
.post(API.manager.recordAlarmInfo, params: {
"estateId":
appProvider.selectedHouse?.estateId,
appProvider.selectedHouse!.estateId,
});
}
},

@ -59,7 +59,7 @@ class _NewRenovationAddPageState extends State<NewRenovationAddPage> {
),
bottomNavi: BottomButton(
onPressed: () async {
if (UserTool.appProveider.selectedHouse?.status == 4) {
if (UserTool.appProveider.selectedHouse!=null) {
BaseModel baseModel =
await NetUtil().post(API.manager.insertNewRenovation,
params: {

@ -316,7 +316,7 @@ class _VisitorAccessPageState extends State<VisitorAccessPage> {
children: [
_buildHouseCard(
S.of(context)!.tempPlotName,
appProvider.selectedHouse!.roomName!,
appProvider.selectedHouse!.roomName,
),
_input(
'访客姓名',

@ -1,5 +1,6 @@
import 'dart:io';
import 'package:aku_community/models/user/passed_house_list_model.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
@ -16,7 +17,6 @@ import 'package:aku_community/model/common/real_time_weather_model.dart';
import 'package:aku_community/model/community/hot_topic_model.dart';
import 'package:aku_community/model/message/message_center_model.dart';
import 'package:aku_community/model/user/car_parking_model.dart';
import 'package:aku_community/model/user/house_model.dart';
import 'package:aku_community/utils/hive_store.dart';
import 'package:aku_community/utils/network/base_model.dart';
import 'package:aku_community/utils/network/net_util.dart';
@ -196,13 +196,13 @@ class AppProvider extends ChangeNotifier {
notifyListeners();
}
List<HouseModel> _houses = [];
List<PassedHouseListModel> _houses = [];
///
List<HouseModel> get houses => _houses;
List<PassedHouseListModel> get houses => _houses;
///
updateHouses(List<HouseModel> items) {
updateHouses(List<PassedHouseListModel> items) {
if (items.isEmpty) return;
_selectedHouse = items.firstWhereOrNull(
(element) => element.id == (_selectedHouse?.id ?? -1),
@ -211,17 +211,17 @@ class AppProvider extends ChangeNotifier {
notifyListeners();
}
HouseModel? _selectedHouse;
PassedHouseListModel? _selectedHouse;
///
HouseModel? get selectedHouse {
PassedHouseListModel? get selectedHouse {
if (_houses.isEmpty) return null;
if (_selectedHouse == null) _selectedHouse = _houses.first;
return _selectedHouse;
}
///
setCurrentHouse(HouseModel? model) {
setCurrentHouse(PassedHouseListModel? model) {
_selectedHouse = model;
notifyListeners();
}

@ -30,7 +30,7 @@ class UserProvider extends ChangeNotifier {
HiveStore.appBox!.put('login', true);
await updateProfile();
await updateUserDetail();
await appProvider.updateHouses(await HouseFunc.houses);
await appProvider.updateHouses(await HouseFunc.passedHouses);
notifyListeners();
}

@ -1,9 +1,9 @@
import 'package:aku_community/models/user/passed_house_list_model.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:aku_community/const/resource.dart';
import 'package:aku_community/model/user/house_model.dart';
import 'package:aku_community/ui/profile/house/pick_my_house_page.dart';
import 'package:aku_community/utils/headers.dart';
@ -13,7 +13,7 @@ enum CardAuthType {
}
class HouseCard extends StatelessWidget {
final HouseModel? model;
final PassedHouseListModel? model;
final CardAuthType type;
const HouseCard({
Key? key,
@ -39,7 +39,7 @@ class HouseCard extends StatelessWidget {
case CardAuthType.SUCCESS:
return R.ASSETS_STATIC_HOUSE_AUTH_SUCCESS_WEBP;
}
return '';
// return '';
}
String get _roleName {
@ -74,7 +74,7 @@ class HouseCard extends StatelessWidget {
),
];
}
return [];
// return [];
}
@override
@ -125,7 +125,7 @@ class HouseCard extends StatelessWidget {
),
10.hb,
Text(
model!.roomName!,
model!.roomName,
style: Theme.of(context).textTheme.subtitle1,
),
Spacer(),

@ -1,12 +1,21 @@
import 'package:aku_community/constants/api.dart';
import 'package:aku_community/model/user/house_model.dart';
import 'package:aku_community/models/user/passed_house_list_model.dart';
import 'package:aku_community/utils/network/base_model.dart';
import 'package:aku_community/utils/network/net_util.dart';
class HouseFunc {
static Future<List<HouseModel>> get houses async {
BaseModel model = await NetUtil().get(API.user.houseList);
///
static Future<List<HouseModel>> get examineHouses async {
BaseModel model = await NetUtil().get(API.user.examineHouseList);
if (!model.status!) return [];
return (model.data as List).map((e) => HouseModel.fromJson(e)).toList();
}
}
///
static Future get passedHouses async{
BaseModel model = await NetUtil().get(API.user.passedHouseList);
if (!model.status!) return [];
return (model.data as List).map((e) => PassedHouseListModel.fromJson(e)).toList();
}
}

@ -1,3 +1,6 @@
import 'package:aku_community/base/base_style.dart';
import 'package:aku_community/ui/profile/house/my_house_list.dart';
import 'package:aku_community/widget/buttons/bottom_button.dart';
import 'package:flutter/material.dart';
import 'package:flutter_easyrefresh/easy_refresh.dart';
@ -31,14 +34,15 @@ class _HouseOwnersPageState extends State<HouseOwnersPage> {
///
bool get _haveAuthedHouse {
final appProvider = Provider.of<AppProvider>(context, listen: false);
return (appProvider.selectedHouse?.status ?? 0) == 4;
// return (appProvider.selectedHouse?.status ?? 0) == 4;
return appProvider.selectedHouse != null;
}
Widget get _houseTitle {
final appProvider = Provider.of<AppProvider>(context, listen: false);
// final appProvider = Provider.of<AppProvider>(context, listen: false);
if (_emptyHouse) return Text('还没有绑定房屋');
if (appProvider.selectedHouse!.status == 1) return Text('您的身份正在审核中,请耐心等待');
if (appProvider.selectedHouse!.status == 3) return Text('审核未通过');
// if (appProvider.selectedHouse!.status == 1) return Text('您的身份正在审核中,请耐心等待');
// if (appProvider.selectedHouse!.status == 3) return Text('审核未通过');
return SizedBox();
}
@ -49,8 +53,10 @@ class _HouseOwnersPageState extends State<HouseOwnersPage> {
title: '我的房屋',
actions: [
TextButton(
onPressed: _addHouse,
child: Text('新增房屋'),
onPressed: () {
Get.to(MyHouseList());
},
child: Text('审核记录'),
),
],
body: EasyRefresh(
@ -58,7 +64,7 @@ class _HouseOwnersPageState extends State<HouseOwnersPage> {
controller: _refreshController,
firstRefresh: true,
onRefresh: () async {
appProvider.updateHouses(await HouseFunc.houses);
appProvider.updateHouses(await HouseFunc.passedHouses);
},
child: ListView(
children: [
@ -67,7 +73,7 @@ class _HouseOwnersPageState extends State<HouseOwnersPage> {
: Padding(
padding: EdgeInsets.all(32.w),
child: HouseCard(
type: appProvider.selectedHouse!.reviewed
type: appProvider.selectedHouse!=null
? CardAuthType.SUCCESS
: CardAuthType.FAIL,
model: appProvider.selectedHouse,
@ -99,6 +105,9 @@ class _HouseOwnersPageState extends State<HouseOwnersPage> {
],
),
),
bottomNavi: BottomButton(
onPressed: _addHouse,
child: '新增房屋'.text.size(32.sp).color(ktextPrimary).bold.make()),
);
}

@ -0,0 +1,115 @@
import 'package:aku_community/base/base_style.dart';
import 'package:aku_community/model/user/house_model.dart';
import 'package:aku_community/ui/profile/house/house_func.dart';
import 'package:aku_community/widget/bee_divider.dart';
import 'package:aku_community/widget/bee_scaffold.dart';
import 'package:aku_community/widget/others/bee_row_tile.dart';
import 'package:flustars/flustars.dart';
import 'package:flutter/material.dart';
import 'package:flutter_easyrefresh/easy_refresh.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:velocity_x/velocity_x.dart';
import 'package:aku_community/const/resource.dart';
class MyHouseList extends StatefulWidget {
MyHouseList({Key? key}) : super(key: key);
@override
_MyHouseListState createState() => _MyHouseListState();
}
class _MyHouseListState extends State<MyHouseList> {
late EasyRefreshController _refreshController;
List<HouseModel> models = [];
@override
void initState() {
super.initState();
_refreshController = EasyRefreshController();
}
@override
void dispose() {
_refreshController.dispose();
super.dispose();
}
@override
Widget build(BuildContext context) {
return BeeScaffold(
title: '审核记录',
body: EasyRefresh(
firstRefresh: true,
header: MaterialHeader(),
controller: _refreshController,
onRefresh: () async {
models = await HouseFunc.examineHouses;
print(models);
setState(() {});
},
child: models.isEmpty
? Container()
: ListView.separated(
padding:
EdgeInsets.symmetric(vertical: 24.w, horizontal: 32.w),
itemBuilder: (context, index) {
return _buildCard(models[index]);
},
separatorBuilder: (_, __) {
return 24.w.heightBox;
},
itemCount: models.length)),
);
}
Widget _buildCard(HouseModel model) {
return Container(
padding: EdgeInsets.all(24.w),
width: double.infinity,
decoration: BoxDecoration(
gradient: LinearGradient(
colors: model.backgroundColor,
begin: Alignment.topCenter,
end: Alignment.bottomCenter),
borderRadius: BorderRadius.circular(8.w),
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
children: [
model.roomName!.text.size(32.sp).color(ktextPrimary).bold.make(),
Spacer(),
// model.houseStatus.text
// .size(30.sp)
// .color(model.houseStatusColor)
// .make()
],
),
16.w.heightBox,
BeeDivider.horizontal(),
20.w.heightBox,
BeeRowTile(
assetPath: R.ASSETS_ICONS_APPOINTMENT_CODE_PNG,
titile: '房屋状态',
content: model.houseStatus.text
.size(30.sp)
.color(model.houseStatusColor)
.make()),
12.w.heightBox,
model.effectiveTimeStart == null
? SizedBox()
: BeeRowTile(
assetPath: R.ASSETS_ICONS_APPOINTMENT_CODE_PNG,
titile: '生效时间',
content:
('${DateUtil.formatDate(model.effectiveStartDate, format: 'yyyy-MM-dd HH:mm')}-${DateUtil.formatDate(model.effectiveEndDate, format: 'HH:mm')}')
.text
.size(28.sp)
.color(ktextPrimary)
.make())
],
),
);
}
}

@ -1,3 +1,4 @@
import 'package:aku_community/models/user/passed_house_list_model.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
@ -9,7 +10,6 @@ import 'package:provider/provider.dart';
import 'package:aku_community/constants/api.dart';
import 'package:aku_community/constants/app_theme.dart';
import 'package:aku_community/model/user/house_model.dart';
import 'package:aku_community/provider/app_provider.dart';
import 'package:aku_community/ui/profile/house/add_house_page.dart';
import 'package:aku_community/ui/profile/house/house_func.dart';
@ -37,13 +37,13 @@ class _PickMyHousePageState extends State<PickMyHousePage> {
Widget get _renderSep => SliverToBoxAdapter(child: 24.hb);
List<HouseModel> get housesWithoutSelected {
List<PassedHouseListModel> get housesWithoutSelected {
final appProvider = Provider.of<AppProvider>(context, listen: false);
List<HouseModel> models = List.from(appProvider.houses);
List<PassedHouseListModel> models = List.from(appProvider.houses);
models.removeWhere(
(element) => element.id == (appProvider.selectedHouse?.id ?? -1),
);
if (models == null || models.isEmpty) return [];
if ( models.isEmpty) return [];
return models;
}
@ -77,7 +77,7 @@ class _PickMyHousePageState extends State<PickMyHousePage> {
controller: _refreshController,
onRefresh: () async {
final appProvider = Provider.of<AppProvider>(context, listen: false);
appProvider.updateHouses(await HouseFunc.houses);
appProvider.updateHouses(await HouseFunc.passedHouses);
},
firstRefresh: true,
child: CustomScrollView(
@ -113,7 +113,7 @@ class _PickMyHousePageState extends State<PickMyHousePage> {
}
class _HouseCard extends StatelessWidget {
final HouseModel? model;
final PassedHouseListModel? model;
final bool highlight;
final EasyRefreshController controller;
const _HouseCard({
@ -124,7 +124,8 @@ class _HouseCard extends StatelessWidget {
}) : super(key: key);
bool get canTapSlide {
if (model == null) return false;
return model!.status == 4 || model!.status == 3 && !highlight;
return true;
// return model!.status == 4 || model!.status == 3 && !highlight;
}
@override
@ -219,7 +220,7 @@ class _HouseCard extends StatelessWidget {
),
8.hb,
Text(
model!.roomName!,
model!.roomName,
style: Theme.of(context).textTheme.subtitle2!.copyWith(
color: Color(0xFF999999),
),

@ -40,7 +40,7 @@ class LoginUtil {
Get.to(() => AddHousePage());
return false;
}
if (appProvider.selectedHouse!.status != 4) {
if (appProvider.selectedHouse == null) {
BotToast.showText(text: '房屋审核中或审核失败');
Get.to(() => HouseOwnersPage());
return false;

@ -0,0 +1,33 @@
import 'package:aku_community/base/base_style.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:velocity_x/velocity_x.dart';
class BeeRowTile extends StatelessWidget {
final String assetPath;
final String titile;
final Widget content;
const BeeRowTile(
{Key? key,
required this.assetPath,
required this.titile,
required this.content})
: super(key: key);
@override
Widget build(BuildContext context) {
return Row(
children: [
Image.asset(
assetPath,
width: 40.w,
height: 40.w,
),
12.w.widthBox,
titile.text.size(24.sp).color(ktextSubColor).make(),
Spacer(),
content,
],
);
}
}

@ -34,7 +34,7 @@ class BeeHousePicker extends StatelessWidget {
children: [
S.of(context)!.tempPlotName.text.black.size(32.sp).bold.make(),
10.w.heightBox,
appProvider.selectedHouse!.roomName!.text.black
appProvider.selectedHouse!.roomName.text.black
.size(32.sp)
.bold
.make()

Loading…
Cancel
Save