From 709c178c2a1ff630a5f65631ede2dc4336c7a3fb Mon Sep 17 00:00:00 2001 From: zhangmeng <494089941@qq.com> Date: Fri, 25 Jun 2021 14:46:56 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AF=B9=E6=8E=A5=20=E6=9F=A5=E8=AF=A2?= =?UTF-8?q?=E5=8F=AF=E9=80=89=E6=88=BF=E5=B1=8B=E5=88=97=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/models/house/lease_list_model.dart | 65 +++++++ lib/models/house/lease_list_model.g.dart | 17 ++ .../new_renovation/new_renovation_view.dart | 1 + .../feedback_page/feedback_page.dart | 1 - lib/ui/market/order/my_order_func.dart | 2 +- lib/ui/profile/house/house_func.dart | 1 + .../profile/house/tenant_house_list_page.dart | 170 +++++++++++++++--- lib/ui/profile/house/user_identify_page.dart | 5 +- 8 files changed, 229 insertions(+), 33 deletions(-) create mode 100644 lib/models/house/lease_list_model.dart create mode 100644 lib/models/house/lease_list_model.g.dart diff --git a/lib/models/house/lease_list_model.dart b/lib/models/house/lease_list_model.dart new file mode 100644 index 00000000..fb74bf11 --- /dev/null +++ b/lib/models/house/lease_list_model.dart @@ -0,0 +1,65 @@ +import 'package:equatable/equatable.dart'; +import 'package:json_annotation/json_annotation.dart'; +part 'lease_list_model.g.dart'; + +@JsonSerializable() +class LeaseListModel extends Equatable { + final int id; + final String roomName; + final int type; + final String estateType; + final int status; + LeaseListModel({ + required this.id, + required this.roomName, + required this.type, + required this.estateType, + required this.status, + }); + + factory LeaseListModel.fromJson(Map json) => + _$LeaseListModelFromJson(json); + + @override + List get props { + return [ + id, + roomName, + type, + estateType, + status, + ]; + } + + String get getTypeString { + switch (this.type) { + case 1: + return '一类人才'; + case 2: + return '二类人才'; + case 3: + return '三类人才'; + default: + return '未知'; + } + } + + String get statusString { + switch (this.status) { + case 1: + return '待签署'; + case 2: + return '待提交'; + case 3: + return '审核中'; + case 4: + return '已驳回'; + case 5: + return '待支付'; + case 6: + return '已完成'; + default: + return '未知'; + } + } +} diff --git a/lib/models/house/lease_list_model.g.dart b/lib/models/house/lease_list_model.g.dart new file mode 100644 index 00000000..89c075d7 --- /dev/null +++ b/lib/models/house/lease_list_model.g.dart @@ -0,0 +1,17 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'lease_list_model.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +LeaseListModel _$LeaseListModelFromJson(Map json) { + return LeaseListModel( + id: json['id'] as int, + roomName: json['roomName'] as String, + type: json['type'] as int, + estateType: json['estateType'] as String, + status: json['status'] as int, + ); +} diff --git a/lib/pages/renovation_manage/new_renovation/new_renovation_view.dart b/lib/pages/renovation_manage/new_renovation/new_renovation_view.dart index 5dba2ad4..6f3304f2 100644 --- a/lib/pages/renovation_manage/new_renovation/new_renovation_view.dart +++ b/lib/pages/renovation_manage/new_renovation/new_renovation_view.dart @@ -31,6 +31,7 @@ class _NewRenovationViewState extends State @override Widget build(BuildContext context) { + super.build(context); return BeeListView( path: API.manager.newRenovationList, extraParams: { diff --git a/lib/pages/setting_page/feedback_page/feedback_page.dart b/lib/pages/setting_page/feedback_page/feedback_page.dart index b8966991..fa9c3c34 100644 --- a/lib/pages/setting_page/feedback_page/feedback_page.dart +++ b/lib/pages/setting_page/feedback_page/feedback_page.dart @@ -69,7 +69,6 @@ class _FeedBackPageState extends State { onTap: () async { if (_formKey.currentState!.validate()) { if (_files.isNotEmpty) { - //TODO upload file } var cancelAction = BotToast.showLoading(); await NetUtil().post( diff --git a/lib/ui/market/order/my_order_func.dart b/lib/ui/market/order/my_order_func.dart index 10397bc8..8fea2982 100644 --- a/lib/ui/market/order/my_order_func.dart +++ b/lib/ui/market/order/my_order_func.dart @@ -7,7 +7,7 @@ import 'package:aku_community/utils/network/net_util.dart'; class MyOrderFunc { ///确认收货 static Future confirmReceive(int goodsAppointmentId) async { - BaseModel baseModel = await NetUtil().get(API.market.confirmReceive, + await NetUtil().get(API.market.confirmReceive, params: {"goodsAppointmentId": goodsAppointmentId}, showMessage: true); } diff --git a/lib/ui/profile/house/house_func.dart b/lib/ui/profile/house/house_func.dart index d3828dc5..5a816518 100644 --- a/lib/ui/profile/house/house_func.dart +++ b/lib/ui/profile/house/house_func.dart @@ -54,6 +54,7 @@ class HouseFunc { } } + Map getSex = { '男': 1, '女': 2, diff --git a/lib/ui/profile/house/tenant_house_list_page.dart b/lib/ui/profile/house/tenant_house_list_page.dart index 72b6b86a..3b0a313a 100644 --- a/lib/ui/profile/house/tenant_house_list_page.dart +++ b/lib/ui/profile/house/tenant_house_list_page.dart @@ -1,6 +1,12 @@ import 'package:aku_community/base/base_style.dart'; import 'package:aku_community/const/resource.dart'; +import 'package:aku_community/constants/api.dart'; +import 'package:aku_community/models/house/lease_list_model.dart'; +import 'package:aku_community/pages/things_page/widget/bee_list_view.dart'; +import 'package:aku_community/ui/profile/house/contract_pay_page.dart'; +import 'package:aku_community/ui/profile/house/download_contract_page.dart'; import 'package:aku_community/ui/profile/house/supplement_information_page.dart'; +import 'package:aku_community/ui/profile/house/upload_contracts_page.dart'; import 'package:aku_community/widget/bee_scaffold.dart'; import 'package:aku_community/widget/buttons/card_bottom_button.dart'; import 'package:flutter/material.dart'; @@ -35,21 +41,40 @@ class _TenantHouseListPageState extends State { Widget build(BuildContext context) { return BeeScaffold( title: '可选房屋', - body: EasyRefresh( - firstRefresh: true, - header: MaterialHeader(), - controller: _refreshController, - onRefresh: () async { - _onload = false; - setState(() {}); - }, - child: _onload - ? Container() - : ListView( + // body: EasyRefresh( + // firstRefresh: true, + // header: MaterialHeader(), + // controller: _refreshController, + // onRefresh: () async { + // _onload = false; + // setState(() {}); + // }, + // child: _onload + // ? Container() + // : ListView( + // padding: EdgeInsets.symmetric(vertical: 24.w, horizontal: 32.w), + // children: [houseCard()], + // ), + // ), + body: BeeListView( + path: API.house.leaseList, + controller: _refreshController, + convert: (models) { + return models.tableList! + .map((e) => LeaseListModel.fromJson(e)) + .toList(); + }, + builder: (items) { + return ListView.separated( padding: EdgeInsets.symmetric(vertical: 24.w, horizontal: 32.w), - children: [houseCard()], - ), - ), + itemBuilder: (context, index) { + return houseCard(items[index]); + }, + separatorBuilder: (_, __) { + return 24.w.heightBox; + }, + itemCount: items.length); + }), ); } @@ -65,30 +90,42 @@ class _TenantHouseListPageState extends State { Color(0xFFFFEEBB), Color(0xFFFFF4D2), ]; + case 3: + return [ + Color(0xFFFFEEBB), + Color(0xFFFFF4D2), + ]; + case 4: + return [ + Color(0xFFFFEEBB), + Color(0xFFFFF4D2), + ]; + case 5: + return [ + Color(0xFFFFEEBB), + Color(0xFFFFF4D2), + ]; + case 6: + return [ + Color(0xFFFFEEBB), + Color(0xFFFFF4D2), + ]; default: return [Colors.white, Colors.white]; } } - Widget houseCard() { - var buttons = Row( - children: [ - CardBottomButton.yellow( - text: '填写信息', - onPressed: () { - Get.to(() => SupplementInformationPage()); - }) - ], - ); + Widget houseCard(LeaseListModel model) { + var buttons = getButtons(model.status); var bottom = Row( children: [ Column( crossAxisAlignment: CrossAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.end, children: [ - '二类人才'.text.size(28.sp).color(ktextSubColor).make(), + model.getTypeString.text.size(28.sp).color(ktextSubColor).make(), 8.w.heightBox, - 'B座C1户型'.text.size(28.sp).color(ktextSubColor).make(), + model.estateType.text.size(28.sp).color(ktextSubColor).make(), ], ).expand(), buttons @@ -116,14 +153,17 @@ class _TenantHouseListPageState extends State { ), 16.w.widthBox, '南宁金融人才公寓'.text.size(32.sp).color(ktextPrimary).make().expand(), - '待签署'.text.size(32.sp).color(ktextPrimary).bold.make(), + model.statusString.text + .size(32.sp) + .color(ktextPrimary) + .bold + .make(), ], ), 12.w.heightBox, Row( children: [ - '1幢-1单元-702室' - .text + model.roomName.text .size(40.sp) .color(ktextPrimary) .bold @@ -137,4 +177,76 @@ class _TenantHouseListPageState extends State { ), ); } + + Row getButtons(int status) { + switch (status) { + case 1: + return Row( + children: [ + CardBottomButton.yellow( + text: '填写信息', + onPressed: () { + Get.to(() => SupplementInformationPage()); + }) + ], + ); + case 2: + return Row( + children: [ + CardBottomButton.yellow( + text: '上传合同', + onPressed: () { + Get.to(() => UploadContractsPage()); + }), + CardBottomButton.white( + text: '下载合同', + onPressed: () { + Get.to(() => DownLoadContractPage(firstRoute: false)); + }), + ], + ); + + case 3: + return Row( + children: [], + ); + case 4: + return Row( + children: [ + CardBottomButton.yellow( + text: '重新上传', + onPressed: () { + Get.to(() => UploadContractsPage()); + }), + CardBottomButton.white( + text: '修改信息', + onPressed: () { + Get.to(() => SupplementInformationPage()); + }), + ], + ); + case 5: + return Row( + children: [ + CardBottomButton.yellow( + text: '去支付', + onPressed: () { + Get.to(() => ContractPayPage()); + }) + ], + ); + case 6: + return Row( + children: [ + CardBottomButton.yellow( + text: '租户页面', + onPressed: () { + Get.back(); + }) + ], + ); + default: + return Row(); + } + } } diff --git a/lib/ui/profile/house/user_identify_page.dart b/lib/ui/profile/house/user_identify_page.dart index 75610948..15288be2 100644 --- a/lib/ui/profile/house/user_identify_page.dart +++ b/lib/ui/profile/house/user_identify_page.dart @@ -233,8 +233,9 @@ class _UserIdentifyPageState extends State { '返回'.text.size(34.sp).isIntrinsic.color(ktextPrimary).make()), CupertinoDialogAction( onPressed: () { - Get.back(); - Get.back(); + // Get.back(); + // Get.back(); + Get.to(() => TenantHouseListPage()); }, child: '回到首页' .text