房产相关问题修复

hmxc
小赖 4 years ago
parent 857e0c011d
commit 5de81e360a

@ -5,6 +5,8 @@ class HouseModel {
int id; int id;
String roomName; String roomName;
int estateId;
///1.3.4. ///1.3.4.
int status; int status;
@ -87,6 +89,7 @@ class HouseModel {
this.type, this.type,
this.effectiveTimeStart, this.effectiveTimeStart,
this.effectiveTimeEnd, this.effectiveTimeEnd,
this.estateId,
}); });
HouseModel.fromJson(Map<String, dynamic> json) { HouseModel.fromJson(Map<String, dynamic> json) {
@ -96,6 +99,7 @@ class HouseModel {
type = json['type']; type = json['type'];
effectiveTimeStart = json['effectiveTimeStart']; effectiveTimeStart = json['effectiveTimeStart'];
effectiveTimeEnd = json['effectiveTimeEnd']; effectiveTimeEnd = json['effectiveTimeEnd'];
estateId = json['estateId'];
} }
Map<String, dynamic> toJson() { Map<String, dynamic> toJson() {

@ -69,6 +69,7 @@ class _LifePayPageState extends State<LifePayPage> {
GestureDetector( GestureDetector(
onTap: () { onTap: () {
Get.to(() => PickMyHousePage()); Get.to(() => PickMyHousePage());
_controller.callRefresh();
}, },
child: Row( child: Row(
children: [ children: [
@ -216,6 +217,7 @@ class _LifePayPageState extends State<LifePayPage> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
UserProvider userProvider = Provider.of<UserProvider>(context); UserProvider userProvider = Provider.of<UserProvider>(context);
final appProvider = Provider.of<AppProvider>(context);
return BeeScaffold( return BeeScaffold(
title: '生活缴费', title: '生活缴费',
actions: [ actions: [
@ -234,9 +236,7 @@ class _LifePayPageState extends State<LifePayPage> {
body: BeeListView( body: BeeListView(
path: API.manager.dailyPaymentList, path: API.manager.dailyPaymentList,
controller: _controller, controller: _controller,
extraParams: { extraParams: {'estateId': appProvider.selectedHouse.estateId},
'estateId': userProvider.currentHouseId,
},
convert: (model) { convert: (model) {
_selectPay = List.generate(model.tableList.length, _selectPay = List.generate(model.tableList.length,
(index) => SelectPay(payCount: 0, payTotal: 0.0)); (index) => SelectPay(payCount: 0, payTotal: 0.0));

@ -1,4 +1,5 @@
import 'package:akuCommunity/constants/app_values.dart'; import 'package:akuCommunity/constants/app_values.dart';
import 'package:akuCommunity/provider/app_provider.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
@ -86,6 +87,7 @@ class _LifePayDetailPageState extends State<LifePayDetailPage> {
Widget _buildCard(DailyPaymentTypeVos model) { Widget _buildCard(DailyPaymentTypeVos model) {
UserProvider userProvider = Provider.of<UserProvider>(context); UserProvider userProvider = Provider.of<UserProvider>(context);
final appProvider = Provider.of<AppProvider>(context);
return Container( return Container(
padding: EdgeInsets.symmetric(horizontal: 32.w, vertical: 20.w), padding: EdgeInsets.symmetric(horizontal: 32.w, vertical: 20.w),
child: Column( child: Column(
@ -94,7 +96,7 @@ class _LifePayDetailPageState extends State<LifePayDetailPage> {
children: [ children: [
model.name.text.black.size(30.sp).bold.make(), model.name.text.black.size(30.sp).bold.make(),
Spacer(), Spacer(),
'${S.of(context).tempPlotName} ${userProvider.currentHouse}' '${S.of(context).tempPlotName} ${appProvider.selectedHouse.estateId}'
.text .text
.color(ktextSubColor) .color(ktextSubColor)
.size(24.sp) .size(24.sp)

@ -1,4 +1,3 @@
import 'package:akuCommunity/constants/app_values.dart';
import 'package:akuCommunity/provider/app_provider.dart'; import 'package:akuCommunity/provider/app_provider.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
@ -72,14 +71,13 @@ class _MyHousePageState extends State<MyHousePage> {
padding: EdgeInsets.symmetric(horizontal: 32.w, vertical: 32.w), padding: EdgeInsets.symmetric(horizontal: 32.w, vertical: 32.w),
child: GestureDetector( child: GestureDetector(
onTap: () { onTap: () {
userProvider.setCurrentHouse(estateName);
setState(() {}); setState(() {});
}, },
child: Row( child: Row(
children: [ children: [
CommonRadio( CommonRadio(
value: BeeParse.getEstateNameId(estateName), value: BeeParse.getEstateNameId(estateName),
groupValue: userProvider.currentHouseId, groupValue: 0,
size: 32.w, size: 32.w,
), ),
24.w.widthBox, 24.w.widthBox,
@ -125,8 +123,8 @@ class _MyHousePageState extends State<MyHousePage> {
...userProvider.userDetailModel.estateNames.isEmpty ...userProvider.userDetailModel.estateNames.isEmpty
? [SizedBox()] ? [SizedBox()]
: userProvider.userDetailModel.estateNames : userProvider.userDetailModel.estateNames
.map((e) => _buildCard(userProvider.currentHouseId, e, .map((e) => _buildCard(
userProvider.userDetailModel.estateNames.indexOf(e), 0, e, userProvider.userDetailModel.estateNames.indexOf(e),
paid: widget.needFindPayTag paid: widget.needFindPayTag
? false ? false
: _unPaidList : _unPaidList

@ -237,7 +237,7 @@ class _AddFixedSubmitPageState extends State<AddFixedSubmitPage> {
List<String> urls = await NetUtil() List<String> urls = await NetUtil()
.uploadFiles(_files, API.upload.uploadRepair); .uploadFiles(_files, API.upload.uploadRepair);
BaseModel baseModel = await ManagerFunc.reportRepairInsert( BaseModel baseModel = await ManagerFunc.reportRepairInsert(
appProvider.selectedHouse.id, appProvider.selectedHouse.estateId,
_selectType + 1, _selectType + 1,
_textEditingController.text, _textEditingController.text,
urls); urls);

@ -315,7 +315,7 @@ class _VisitorAccessPageState extends State<VisitorAccessPage> {
_selectTime(), _selectTime(),
SizedBox(height: 64.w), SizedBox(height: 64.w),
_create( _create(
appProvider.selectedHouse.id, appProvider.selectedHouse.estateId,
userProvider.userDetailModel.type, userProvider.userDetailModel.type,
userProvider.userDetailModel.tel, userProvider.userDetailModel.tel,
), ),

@ -186,6 +186,10 @@ class AppProvider extends ChangeNotifier {
updateHouses(List<HouseModel> items) { updateHouses(List<HouseModel> items) {
if (items == null) return; if (items == null) return;
if (items.isEmpty) return; if (items.isEmpty) return;
_selectedHouse = items.firstWhere(
(element) => element.id == (_selectedHouse?.id ?? -1),
orElse: () => null,
);
_houses = items; _houses = items;
notifyListeners(); notifyListeners();
} }

@ -8,7 +8,6 @@ import 'package:akuCommunity/constants/api.dart';
import 'package:akuCommunity/model/user/user_detail_model.dart'; import 'package:akuCommunity/model/user/user_detail_model.dart';
import 'package:akuCommunity/model/user/user_info_model.dart'; import 'package:akuCommunity/model/user/user_info_model.dart';
import 'package:akuCommunity/pages/sign/sign_func.dart'; import 'package:akuCommunity/pages/sign/sign_func.dart';
import 'package:akuCommunity/utils/bee_parse.dart';
import 'package:akuCommunity/utils/hive_store.dart'; import 'package:akuCommunity/utils/hive_store.dart';
import 'package:akuCommunity/utils/network/base_model.dart'; import 'package:akuCommunity/utils/network/base_model.dart';
import 'package:akuCommunity/utils/network/net_util.dart'; import 'package:akuCommunity/utils/network/net_util.dart';
@ -20,21 +19,20 @@ class UserProvider extends ChangeNotifier {
bool get isLogin => _isLogin; bool get isLogin => _isLogin;
bool get isNotLogin => !_isLogin; bool get isNotLogin => !_isLogin;
Future setLogin(int token) async { Future setLogin(int token) async {
final appProvider = Provider.of<AppProvider>(Get.context,listen: false); final appProvider = Provider.of<AppProvider>(Get.context, listen: false);
_isLogin = true; _isLogin = true;
NetUtil().dio.options.headers.putIfAbsent('App-Admin-Token', () => token); NetUtil().dio.options.headers.putIfAbsent('App-Admin-Token', () => token);
HiveStore.appBox.put('token', token); HiveStore.appBox.put('token', token);
HiveStore.appBox.put('login', true); HiveStore.appBox.put('login', true);
await updateProfile(); await updateProfile();
await updateUserDetail(); await updateUserDetail();
await setCurrentHouse((_userDetailModel?.estateNames?.isEmpty ?? true)
? ''
: _userDetailModel?.estateNames?.first);
await appProvider.updateHouses(await HouseFunc.houses); await appProvider.updateHouses(await HouseFunc.houses);
notifyListeners(); notifyListeners();
} }
logout() { logout() {
final appProvider = Provider.of<AppProvider>(Get.context, listen: false);
appProvider.setCurrentHouse(null);
_isLogin = false; _isLogin = false;
_token = null; _token = null;
_userInfoModel = null; _userInfoModel = null;
@ -133,13 +131,4 @@ class UserProvider extends ChangeNotifier {
await updateProfile(); await updateProfile();
} }
} }
///
String _currentHouse;
int get currentHouseId => BeeParse.getEstateNameId(_currentHouse);
String get currentHouse => BeeParse.getEstateName(_currentHouse);
setCurrentHouse(String house) {
_currentHouse = house;
notifyListeners();
}
} }

@ -49,7 +49,10 @@ class _PickMyHousePageState extends State<PickMyHousePage> {
return SliverList( return SliverList(
delegate: SliverChildListDelegate( delegate: SliverChildListDelegate(
housesWithoutSelected housesWithoutSelected
.map((e) => _HouseCard(model: e)) .map((e) => _HouseCard(
model: e,
controller: _refreshController,
))
.toList() .toList()
.sepWidget( .sepWidget(
separate: Divider( separate: Divider(
@ -82,6 +85,7 @@ class _PickMyHousePageState extends State<PickMyHousePage> {
child: _HouseCard( child: _HouseCard(
model: appProvider.selectedHouse, model: appProvider.selectedHouse,
highlight: true, highlight: true,
controller: _refreshController,
), ),
), ),
_renderSep, _renderSep,
@ -108,8 +112,13 @@ class _PickMyHousePageState extends State<PickMyHousePage> {
class _HouseCard extends StatelessWidget { class _HouseCard extends StatelessWidget {
final HouseModel model; final HouseModel model;
final bool highlight; final bool highlight;
const _HouseCard({Key key, @required this.model, this.highlight = false}) final EasyRefreshController controller;
: super(key: key); const _HouseCard({
Key key,
@required this.model,
this.highlight = false,
@required this.controller,
}) : super(key: key);
bool get canTapSlide { bool get canTapSlide {
if (model == null) return false; if (model == null) return false;
return model.status == 4 || model.status == 3 && !highlight; return model.status == 4 || model.status == 3 && !highlight;
@ -147,6 +156,8 @@ class _HouseCard extends StatelessWidget {
'ids': [model.id] 'ids': [model.id]
}, },
); );
// if(controller.)
controller.callRefresh();
cancel(); cancel();
} }
} }

Loading…
Cancel
Save