diff --git a/lib/const/api.dart b/lib/const/api.dart index d4f2886..d8c055d 100644 --- a/lib/const/api.dart +++ b/lib/const/api.dart @@ -80,4 +80,10 @@ class _Manage { ///借还管理:提交检查结果 String get borrowCheck => '/user/borrow/submitCheck'; + + ///物品出户:查询所有的物品出户信息(包含搜索条件) + String get goodsOutList => '/user/articleOut/list'; + + ///物品出户:根据物品出户主键id查询出户详情 + String get goodsOutDetail => '/user/articleOut/findById'; } diff --git a/lib/models/manager/goods_out/goods_out_detail_model.dart b/lib/models/manager/goods_out/goods_out_detail_model.dart new file mode 100644 index 0000000..27a22d9 --- /dev/null +++ b/lib/models/manager/goods_out/goods_out_detail_model.dart @@ -0,0 +1,181 @@ +import 'package:aku_community_manager/models/common/img_model.dart'; +import 'package:common_utils/common_utils.dart'; +import 'package:flutter/material.dart'; + +// * id 物品出户主键id +// * status 状态(1.待出门,2.已出门,3.驳回申请) +// * roomName 详细地址(房产名称) +// * applicantName 出户人(申请人) +// * identity 身份(1业主,2亲属,3租客) +// * applicantTel 联系方式(申请人电话) +// * expectedTime 预计出户时间 +// * articleOutName 出户物品 +// * weight 物品重量(1. <50kg , 2. 50kg-100kg , 3. >100kg) +// * approach 搬运方式(1.自己搬运,2.搬家公司) +// * imgUrls 物品照片 +// * reviewDate 审核时间【status=2:出门时间,status=3:驳回时间】 +// * export 出口(1.东门,2.南门,3.西门,4.北门)【status=2时显示】 +// * remarks 备注(不放行理由,驳回申请时使用)【status=3时显示】 +class GoodsOutDetailModel { + int id; + + ///status 状态(1.待出门,2.已出门,3.驳回申请) + int status; + String roomName; + String applicantName; + + ///identity 身份(1业主,2亲属,3租客) + int identity; + String applicantTel; + String expectedTime; + String articleOutName; + int weight; + + ///approach 搬运方式(1.自己搬运,2.搬家公司) + int approach; + List imgUrls; + String reviewDate; + int export; + String remarks; + + String get exportValue { + switch (export) { + case 1: + return '东门'; + case 2: + return '南门'; + case 3: + return '西门'; + case 4: + return '北门'; + default: + return '未知'; + } + } + + DateTime get review => DateUtil.getDateTime(reviewDate); + DateTime get expected => DateUtil.getDateTime(expectedTime); + + ///approach 搬运方式(1.自己搬运,2.搬家公司) + String get approachValue { + switch (approach) { + case 1: + return '自己搬运'; + case 2: + return '搬家公司'; + + default: + return '未知'; + } + } + + ///status 状态(1.待出门,2.已出门,3.驳回申请) + String get statusValue { + switch (status) { + case 1: + return '待出门'; + case 2: + return '已出门'; + case 3: + return '驳回申请'; + default: + return ' 未知'; + } + } + + Color get statusColor { + switch (status) { + case 2: + return Color(0xFF999999); + default: + return Color(0xFFFF4501); + } + } + + ///identity 身份(1业主,2亲属,3租客) + String get identityValue { + switch (identity) { + case 1: + return '业主'; + case 2: + return '亲属'; + case 3: + return '租客'; + default: + return '未知'; + } + } + + String get weightValue { + switch (weight) { + case 1: + return '<50kg'; + case 2: + return '50kg-100kg'; + case 3: + return '>100kg'; + default: + return '未知'; + } + } + + GoodsOutDetailModel( + {this.id, + this.status, + this.roomName, + this.applicantName, + this.identity, + this.applicantTel, + this.expectedTime, + this.articleOutName, + this.weight, + this.approach, + this.imgUrls, + this.reviewDate, + this.export, + this.remarks}); + + GoodsOutDetailModel.fromJson(Map json) { + id = json['id']; + status = json['status']; + roomName = json['roomName']; + applicantName = json['applicantName']; + identity = json['identity']; + applicantTel = json['applicantTel']; + expectedTime = json['expectedTime']; + articleOutName = json['articleOutName']; + weight = json['weight']; + approach = json['approach']; + if (json['imgUrls'] != null) { + imgUrls = new List(); + json['imgUrls'].forEach((v) { + imgUrls.add(new ImgModel.fromJson(v)); + }); + } else + imgUrls = []; + reviewDate = json['reviewDate']; + export = json['export']; + remarks = json['remarks']; + } + + Map toJson() { + final Map data = new Map(); + data['id'] = this.id; + data['status'] = this.status; + data['roomName'] = this.roomName; + data['applicantName'] = this.applicantName; + data['identity'] = this.identity; + data['applicantTel'] = this.applicantTel; + data['expectedTime'] = this.expectedTime; + data['articleOutName'] = this.articleOutName; + data['weight'] = this.weight; + data['approach'] = this.approach; + if (this.imgUrls != null) { + data['imgUrls'] = this.imgUrls.map((v) => v.toJson()).toList(); + } + data['reviewDate'] = this.reviewDate; + data['export'] = this.export; + data['remarks'] = this.remarks; + return data; + } +} diff --git a/lib/models/manager/goods_out/goods_out_item_model.dart b/lib/models/manager/goods_out/goods_out_item_model.dart new file mode 100644 index 0000000..d5ef1e3 --- /dev/null +++ b/lib/models/manager/goods_out/goods_out_item_model.dart @@ -0,0 +1,93 @@ +import 'package:common_utils/common_utils.dart'; +import 'package:flutter/material.dart'; + +/// * id 物品出户主键id +/// * status 状态(1.待出门,2.已出门,3.驳回申请) +/// * roomName 详细地址(房产名称) +/// * applicantName 出户人(申请人) +/// * identity 身份(1业主,2亲属,3租客) +/// * articleOutName 出户物品 +/// * expectedTime 预计出户时间 +class GoodsOutItemModel { + int id; + + ///状态(1.待出门,2.已出门,3.驳回申请) + int status; + String roomName; + String applicantName; + + /// 身份(1业主,2亲属,3租客) + int identity; + String articleOutName; + String expectedTime; + + DateTime get expected => DateUtil.getDateTime(expectedTime); + + ///状态(1.待出门,2.已出门,3.驳回申请) + String get statusValue { + switch (status) { + case 1: + return '待出门'; + case 2: + return '已出门'; + case 3: + return '驳回申请'; + default: + return '未知'; + } + } + + Color get statusColor { + switch (status) { + case 2: + return Color(0xFF999999); + default: + return Color(0xFFFF4501); + } + } + + /// 身份(1业主,2亲属,3租客) + String get identityValue { + switch (identity) { + case 1: + return '业主'; + case 2: + return '亲属'; + case 3: + return '租客'; + default: + return '未知'; + } + } + + GoodsOutItemModel( + {this.id, + this.status, + this.roomName, + this.applicantName, + this.identity, + this.articleOutName, + this.expectedTime}); + + GoodsOutItemModel.fromJson(Map json) { + id = json['id']; + status = json['status']; + roomName = json['roomName']; + applicantName = json['applicantName']; + identity = json['identity']; + articleOutName = json['articleOutName']; + expectedTime = json['expectedTime']; + } + + Map toJson() { + final Map data = new Map(); + data['id'] = this.id; + data['status'] = this.status; + data['roomName'] = this.roomName; + data['applicantName'] = this.applicantName; + data['identity'] = this.identity; + data['articleOutName'] = this.articleOutName; + data['expectedTime'] = this.expectedTime; + return data; + } +} diff --git a/lib/ui/splash/splash_page.dart b/lib/ui/splash/splash_page.dart index b51b649..6ab86f2 100644 --- a/lib/ui/splash/splash_page.dart +++ b/lib/ui/splash/splash_page.dart @@ -50,6 +50,8 @@ class _SplashPageState extends State { @override Widget build(BuildContext context) { + ScreenUtil.init(context, + designSize: Size(750, 1334), allowFontScaling: true); return Scaffold( body: Center( child: Image.asset(R.ASSETS_PLACEHOLDER_WEBP), diff --git a/lib/ui/sub_pages/items_outdoor/items_outdoor_card.dart b/lib/ui/sub_pages/items_outdoor/items_outdoor_card.dart index f9cb2cc..c52935b 100644 --- a/lib/ui/sub_pages/items_outdoor/items_outdoor_card.dart +++ b/lib/ui/sub_pages/items_outdoor/items_outdoor_card.dart @@ -1,44 +1,27 @@ // Flutter imports: +import 'package:aku_community_manager/models/manager/goods_out/goods_out_item_model.dart'; +import 'package:aku_community_manager/ui/sub_pages/items_outdoor/items_outdoor_details_page.dart'; import 'package:flutter/material.dart'; // Package imports: import 'package:aku_ui/common_widgets/aku_common_widgets.dart'; -import 'package:common_utils/common_utils.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; -import 'package:get/get.dart'; // Project imports: import 'package:aku_community_manager/const/resource.dart'; -import 'package:aku_community_manager/mock_models/outdoor_models/outdoor_model.dart'; import 'package:aku_community_manager/style/app_style.dart'; import 'package:aku_community_manager/tools/widget_tool.dart'; -import 'package:aku_community_manager/ui/sub_pages/items_outdoor/items_outdoor_details_page.dart'; +import 'package:get/get.dart'; class ItemsOutdoorCard extends StatefulWidget { - final ItemsOutdoorModel cardModel; - final bool isdetail; - ItemsOutdoorCard({ - Key key, - @required this.cardModel, - this.isdetail = false, - }) : super(key: key); + final GoodsOutItemModel model; + ItemsOutdoorCard({Key key, @required this.model}) : super(key: key); @override _ItemsOutdoorCardState createState() => _ItemsOutdoorCardState(); } class _ItemsOutdoorCardState extends State { - ItemsOutdoorModel _cardModel; - String _datetime; - - @override - void initState() { - super.initState(); - _cardModel = widget.cardModel; - _datetime = - DateUtil.formatDate(_cardModel.datetime, format: "yyyy/MM/dd HH:mm:ss"); - } - @override Widget build(BuildContext context) { TextStyle _textStyle = @@ -47,250 +30,196 @@ class _ItemsOutdoorCardState extends State { color: Color(0xFFFFFFFF), margin: EdgeInsets.only(top: 16.w), padding: EdgeInsets.only(left: 24.w, right: 24.w), - child: Column(children: [ - widget.isdetail - ? Container( - alignment: Alignment.centerLeft, - height: 90.w, - width: double.infinity, - child: Row( - children: [ - Text( - '出户信息', - style: TextStyle( - color: AppStyle.primaryTextColor, - fontSize: 36.sp, - fontWeight: FontWeight.bold), - ), - Spacer(), - Text( - ItemsOutdoorModel.outdoorStatusMap[_cardModel.status], - style: TextStyle( - color: _cardModel.status == OUTDOORSTATUS.CANCELLATION - ? Color(0xFF999999) - : Color(0xFFFF4501), - fontSize: 24.sp, - fontWeight: FontWeight.bold), - ), - ], - ), - ) - : Container( - alignment: Alignment.centerLeft, - height: 88.w, - width: double.infinity, - child: Row( - children: [ - Container( - alignment: Alignment.center, - width: 112.w, - height: 40.w, - decoration: BoxDecoration( - border: - Border.all(color: Color(0xFF3F8FFE), width: 2.w), - ), - child: Text( - '物品出户', - style: TextStyle( - color: Color(0xFF3F8FFE), - fontSize: 20.sp, - fontWeight: FontWeight.bold), - ), - ), - AkuBox.w(16), - Text( - _datetime, - style: TextStyle( - color: AppStyle.minorTextColor, - fontSize: 22.sp, - ), - ), - Spacer(), - Text( - ItemsOutdoorModel.outdoorStatusMap[_cardModel.status], - style: TextStyle( - color: _cardModel.status == OUTDOORSTATUS.CANCELLATION - ? Color(0xFF999999) - : Color(0xFFFF4501), - fontSize: 24.sp, - fontWeight: FontWeight.bold), - ), - ], - ), - ), - Row( - children: [ - Image.asset( - R.ASSETS_OUTDOOR_IC_HOME_PNG, - width: 40.w, - height: 40.w, - ), - AkuBox.w(4), - Text( - '小区名称', - style: _textStyle, - ), - Spacer(), - Text( - _cardModel.communityname, - style: AppStyle().primaryStyle, - ), - ], - ), - AkuBox.h(12), - Row( - children: [ - Image.asset( - R.ASSETS_OUTDOOR_IC_ADDRESS_PNG, - width: 40.w, - height: 40.w, - ), - AkuBox.w(4), - Text('详细地址', style: _textStyle), - Spacer(), - Text( - _cardModel.adress, - style: AppStyle().primaryStyle, - ), - ], - ), - AkuBox.h(12), - Row( - children: [ - Image.asset( - R.ASSETS_OUTDOOR_IC_GOOUT_PNG, - width: 40.w, - height: 40.w, - ), - AkuBox.w(4), - Text( - '出户人', - style: _textStyle, - ), - Spacer(), - Text( - _cardModel.name, - style: AppStyle().primaryStyle, - ), - ], - ), - AkuBox.h(12), - Row( - children: [ - Image.asset( - R.ASSETS_OUTDOOR_IC_PEOPLE_PNG, - width: 40.w, - height: 40.w, - ), - AkuBox.w(4), - Text( - '身份', - style: _textStyle, - ), - Spacer(), - Text( - _cardModel.identify, - style: AppStyle().primaryStyle, - ), - ], - ), - AkuBox.h(12), - Row( - children: [ - Image.asset( - R.ASSETS_OUTDOOR_IC_CHUHU_PNG, - width: 40.w, - height: 40.w, - ), - Text( - '出户物品', - style: _textStyle, - ), - Spacer(), - Text( - _cardModel.items.itemname, - style: AppStyle().primaryStyle, - ), - ], - ), - AkuBox.h(12), - Row( - children: [ - Image.asset( - R.ASSETS_OUTDOOR_IC_TIME_PNG, - width: 40.w, - height: 40.w, - ), - AkuBox.w(4), - Text( - '出户时间', - style: _textStyle, - ), - Spacer(), - Text( - _cardModel.outtime, - style: AppStyle().primaryStyle, - ), - ], - ), - AkuBox.h(24), - Divider( - height: 1.w, - ), - widget.isdetail - ? AkuButton( - onPressed: () {}, - child: Container( + child: Column( + children: [ + Container( + alignment: Alignment.centerLeft, + height: 88.w, + width: double.infinity, + child: Row( + children: [ + Container( alignment: Alignment.center, - height: 96.w, - child: Row( - mainAxisSize: MainAxisSize.min, - children: [ - Image.asset( - R.ASSETS_OUTDOOR_IC_PHONEBLUE_PNG, - width: 38.w, - height: 39.w, - ), - AkuBox.w(16), - Text('联系业主', - style: TextStyle( - color: Color(0xFF3F8FFE), - fontSize: 28.sp, - fontWeight: FontWeight.bold)), - ], + width: 112.w, + height: 40.w, + decoration: BoxDecoration( + border: Border.all(color: Color(0xFF3F8FFE), width: 2.w), + ), + child: Text( + '物品出户', + style: TextStyle( + color: Color(0xFF3F8FFE), + fontSize: 20.sp, + fontWeight: FontWeight.bold), ), ), - ) - : Container( - height: 112.w, - alignment: Alignment.centerRight, - child: AkuButton( - onPressed: () { - Get.to(ItemsOutdoorDetailsPage( - cardMedel: _cardModel, - )); - }, - child: Container( - alignment: Alignment.center, - width: 160.w, - height: 64.w, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(8.w), - gradient: LinearGradient( - begin: Alignment.topLeft, - end: Alignment.bottomRight, - colors: [ - AppStyle.primaryColor, - AppStyle.minorColor - ])), - child: Text( - '查看详情', - style: AppStyle().primaryStyle, - ), + AkuBox.w(16), + //TODO 创建时间 + // Text( + // widget.model.create, + // style: TextStyle( + // color: AppStyle.minorTextColor, + // fontSize: 22.sp, + // ), + // ), + Spacer(), + Text( + widget.model.statusValue, + style: TextStyle( + color: widget.model.statusColor, + fontSize: 24.sp, + fontWeight: FontWeight.bold, ), ), + ], + ), + ), + Row( + children: [ + Image.asset( + R.ASSETS_OUTDOOR_IC_HOME_PNG, + width: 40.w, + height: 40.w, + ), + AkuBox.w(4), + Text( + '小区名称', + style: _textStyle, + ), + Spacer(), + //TODO 小区名称 + Text( + 'XXXXXX', + style: AppStyle().primaryStyle, + ), + ], + ), + AkuBox.h(12), + Row( + children: [ + Image.asset( + R.ASSETS_OUTDOOR_IC_ADDRESS_PNG, + width: 40.w, + height: 40.w, + ), + AkuBox.w(4), + Text('详细地址', style: _textStyle), + Spacer(), + Text( + widget.model.roomName, + style: AppStyle().primaryStyle, + ), + ], + ), + AkuBox.h(12), + Row( + children: [ + Image.asset( + R.ASSETS_OUTDOOR_IC_GOOUT_PNG, + width: 40.w, + height: 40.w, + ), + AkuBox.w(4), + Text( + '出户人', + style: _textStyle, + ), + Spacer(), + Text( + widget.model.applicantName, + style: AppStyle().primaryStyle, + ), + ], + ), + AkuBox.h(12), + Row( + children: [ + Image.asset( + R.ASSETS_OUTDOOR_IC_PEOPLE_PNG, + width: 40.w, + height: 40.w, + ), + AkuBox.w(4), + Text( + '身份', + style: _textStyle, + ), + Spacer(), + Text( + widget.model.identityValue, + style: AppStyle().primaryStyle, + ), + ], + ), + AkuBox.h(12), + Row( + children: [ + Image.asset( + R.ASSETS_OUTDOOR_IC_CHUHU_PNG, + width: 40.w, + height: 40.w, + ), + Text( + '出户物品', + style: _textStyle, + ), + Spacer(), + Text( + widget.model.articleOutName, + style: AppStyle().primaryStyle, + ), + ], + ), + AkuBox.h(12), + Row( + children: [ + Image.asset( + R.ASSETS_OUTDOOR_IC_TIME_PNG, + width: 40.w, + height: 40.w, + ), + AkuBox.w(4), + Text( + '出户时间', + style: _textStyle, + ), + Spacer(), + Text( + widget.model.expectedTime, + style: AppStyle().primaryStyle, + ), + ], + ), + AkuBox.h(24), + Divider( + height: 1.w, + ), + Container( + height: 112.w, + alignment: Alignment.centerRight, + child: AkuButton( + onPressed: () { + Get.to(ItemsOutdoorDetailsPage(id: widget.model.id)); + }, + child: Container( + alignment: Alignment.center, + width: 160.w, + height: 64.w, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(8.w), + gradient: LinearGradient( + begin: Alignment.topLeft, + end: Alignment.bottomRight, + colors: [AppStyle.primaryColor, AppStyle.minorColor])), + child: Text( + '查看详情', + style: AppStyle().primaryStyle, + ), ), - ]), + ), + ), + ], + ), ); } } diff --git a/lib/ui/sub_pages/items_outdoor/items_outdoor_details_page.dart b/lib/ui/sub_pages/items_outdoor/items_outdoor_details_page.dart index f5eccdd..c64f54b 100644 --- a/lib/ui/sub_pages/items_outdoor/items_outdoor_details_page.dart +++ b/lib/ui/sub_pages/items_outdoor/items_outdoor_details_page.dart @@ -1,9 +1,16 @@ // Flutter imports: +import 'package:aku_community_manager/const/api.dart'; +import 'package:aku_community_manager/models/manager/goods_out/goods_out_detail_model.dart'; +import 'package:aku_community_manager/utils/network/base_model.dart'; +import 'package:aku_community_manager/utils/network/net_util.dart'; +import 'package:common_utils/common_utils.dart'; import 'package:flutter/material.dart'; +import 'package:aku_community_manager/tools/extensions/list_extension_tool.dart'; // Package imports: import 'package:aku_ui/aku_ui.dart'; import 'package:aku_ui/common_widgets/aku_material_button.dart'; +import 'package:flutter_easyrefresh/easy_refresh.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:get/get.dart'; import 'package:provider/provider.dart'; @@ -21,9 +28,8 @@ import 'package:aku_community_manager/ui/sub_pages/items_outdoor/outdoor_pass_pa import 'package:aku_community_manager/ui/widgets/common/aku_scaffold.dart'; class ItemsOutdoorDetailsPage extends StatefulWidget { - final ItemsOutdoorModel cardMedel; - ItemsOutdoorDetailsPage({Key key, @required this.cardMedel}) - : super(key: key); + final int id; + ItemsOutdoorDetailsPage({Key key, @required this.id}) : super(key: key); @override _ItemsOutdoorDetailsPageState createState() => @@ -31,137 +37,246 @@ class ItemsOutdoorDetailsPage extends StatefulWidget { } class _ItemsOutdoorDetailsPageState extends State { + GoodsOutDetailModel _model; + + _buildTile(String path, String title, String subTitle) { + return Row( + children: [ + Image.asset( + path, + width: 40.w, + height: 40.w, + ), + AkuBox.w(4), + Text( + title ?? '', + style: TextStyle(color: AppStyle.minorTextColor, fontSize: 28.sp), + ), + Spacer(), + Text( + subTitle ?? '', + style: AppStyle().primaryStyle, + ), + ], + ); + } + @override Widget build(BuildContext context) { - UserProvider _userprovider = - Provider.of(context, listen: false); - USER_ROLE userRole = _userprovider.userInfoModel.role; return AkuScaffold( title: '出户详情', - body: ListView( - children: [ - ItemsOutdoorCard( - cardModel: widget.cardMedel, - isdetail: true, - ), - Container( - color: Color(0xFFFFFFFF), - margin: EdgeInsets.only(top: 16.w), - padding: EdgeInsets.only( - top: 24.w, left: 32.w, right: 32.w, bottom: 40.w), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - '物品信息', - style: AppStyle().barTitleStyle, - ), - AkuBox.h(16), - Row( - children: [ - Image.asset( - R.ASSETS_OUTDOOR_IC_CHUHU_PNG, - width: 40.w, - height: 40.w, - ), - AkuBox.w(4), - Text( - '出户物品', - style: AppStyle().secondaryTextStyle, - ), - Spacer(), - Text( - widget.cardMedel.items.itemname, - style: AppStyle().primaryStyle, - ), - ], - ), - AkuBox.h(16), - Row( - children: [ - Image.asset( - R.ASSETS_OUTDOOR_IC_WEIGHT_PNG, - width: 40.w, - height: 40.w, - ), - AkuBox.w(4), - Text( - '物品重量', - style: AppStyle().secondaryTextStyle, - ), - Spacer(), - Text( - widget.cardMedel.items.weight < 50.0 - ? '<50kg' - : '${widget.cardMedel.items.weight}kg', - style: AppStyle().primaryStyle, - ), - ], - ), - AkuBox.h(16), - Row( - children: [ - Image.asset( - R.ASSETS_OUTDOOR_IC_TRANSPORT_PNG, - width: 40.w, - height: 40.w, - ), - AkuBox.w(4), - Text( - '搬运方式', - style: AppStyle().secondaryTextStyle, + body: EasyRefresh( + firstRefresh: true, + onRefresh: () async { + BaseModel model = await NetUtil().get( + API.manage.goodsOutDetail, + params: {'articleOutId': widget.id}, + ); + _model = GoodsOutDetailModel.fromJson(model.data); + setState(() {}); + }, + header: MaterialHeader(), + child: _model == null + ? SizedBox() + : ListView( + padding: EdgeInsets.symmetric(vertical: 16.w), + children: [ + Container( + padding: + EdgeInsets.symmetric(horizontal: 32.w, vertical: 24.w), + color: Colors.white, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + children: [ + Text( + '出户信息', + style: AppStyle().barTitleStyle, + ), + Spacer(), + Text( + _model.statusValue, + style: TextStyle( + color: _model.statusColor, + fontSize: 24.sp, + fontWeight: FontWeight.bold, + ), + ), + ], + ), + AkuBox.h(16), + ...[ + _buildTile( + R.ASSETS_OUTDOOR_IC_HOME_PNG, '小区名称', 'XXXX'), + _buildTile( + R.ASSETS_OUTDOOR_IC_ADDRESS_PNG, + '详细地址', + _model.roomName, + ), + _buildTile(R.ASSETS_OUTDOOR_IC_HOME_PNG, '出户人', + _model.applicantName), + _buildTile(R.ASSETS_OUTDOOR_IC_HOME_PNG, '身份', + _model.identityValue), + _buildTile(R.ASSETS_OUTDOOR_IC_HOME_PNG, '联系方式', + _model.applicantTel), + _buildTile( + R.ASSETS_OUTDOOR_IC_HOME_PNG, + '出户时间', + DateUtil.formatDate( + _model.expected, + format: 'yyyy-MM-dd HH:mm', + ), + ), + ].sepWidget(separate: AkuBox.h(12)), + ], ), - Spacer(), - Text( - widget.cardMedel.items.way, - style: AppStyle().primaryStyle, - ) - ], - ), - AkuBox.h(16), - Row( - children: [ - Image.asset( - R.ASSETS_OUTDOOR_IC_IMAGE_PNG, - width: 40.w, - height: 40.w, + ), + Divider(height: 1.w), + MaterialButton( + onPressed: () {}, + elevation: 0, + child: Row( + mainAxisSize: MainAxisSize.min, + children: [ + Image.asset( + R.ASSETS_OUTDOOR_IC_PHONEBLUE_PNG, + width: 30.w, + height: 30.w, + ), + AkuBox.w(16), + Text( + '联系业主', + style: TextStyle( + color: Color(0xFF3F8FFE), + fontSize: 28.sp, + ), + ), + ], ), - AkuBox.w(4), - Text( - '图片信息', - style: AppStyle().secondaryTextStyle, + color: Colors.white, + height: 96.w, + materialTapTargetSize: MaterialTapTargetSize.shrinkWrap, + ), + Container( + color: Color(0xFFFFFFFF), + margin: EdgeInsets.only(top: 16.w), + padding: EdgeInsets.only( + top: 24.w, left: 32.w, right: 32.w, bottom: 40.w), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + '物品信息', + style: AppStyle().barTitleStyle, + ), + AkuBox.h(16), + Row( + children: [ + Image.asset( + R.ASSETS_OUTDOOR_IC_CHUHU_PNG, + width: 40.w, + height: 40.w, + ), + AkuBox.w(4), + Text( + '出户物品', + style: AppStyle().secondaryTextStyle, + ), + Spacer(), + Text( + _model.articleOutName ?? '', + style: AppStyle().primaryStyle, + ), + ], + ), + AkuBox.h(16), + Row( + children: [ + Image.asset( + R.ASSETS_OUTDOOR_IC_WEIGHT_PNG, + width: 40.w, + height: 40.w, + ), + AkuBox.w(4), + Text( + '物品重量', + style: AppStyle().secondaryTextStyle, + ), + Spacer(), + Text( + _model.weightValue, + style: AppStyle().primaryStyle, + ), + ], + ), + AkuBox.h(16), + Row( + children: [ + Image.asset( + R.ASSETS_OUTDOOR_IC_TRANSPORT_PNG, + width: 40.w, + height: 40.w, + ), + AkuBox.w(4), + Text( + '搬运方式', + style: AppStyle().secondaryTextStyle, + ), + Spacer(), + Text( + _model.approachValue, + style: AppStyle().primaryStyle, + ) + ], + ), + AkuBox.h(16), + Row( + children: [ + Image.asset( + R.ASSETS_OUTDOOR_IC_IMAGE_PNG, + width: 40.w, + height: 40.w, + ), + AkuBox.w(4), + Text( + '图片信息', + style: AppStyle().secondaryTextStyle, + ), + Spacer(), + ], + ), + AkuBox.h(16), + Wrap( + spacing: 16.w, + children: _model.imgUrls + .map( + (e) => ClipRRect( + borderRadius: BorderRadius.circular(4.w), + child: FadeInImage.assetNetwork( + placeholder: R.ASSETS_PLACEHOLDER_WEBP, + image: API.image(e?.url ?? ''), + width: 218.w, + height: 218.w, + )), + ) + .toList(), + ), + ], ), - Spacer(), - ], - ), - AkuBox.h(16), - Wrap( - spacing: 16.w, - children: widget.cardMedel.items.imagepath - .map( - (e) => ClipRRect( - borderRadius: BorderRadius.circular(4.w), - child: Image.asset( - e, - width: 218.w, - height: 218.w, - )), - ) - .toList(), - ), - ], - ), - ), - ], + ), + ], + ), ), - bottom: _bottomCard(userRole), + bottom: _model == null ? SizedBox() : _bottomCard(), ); } - Widget _bottomCard(USER_ROLE userRole) { - switch (widget.cardMedel.status) { - case OUTDOORSTATUS.NOT_OUT: - return userRole == USER_ROLE.SECURITY + Widget _bottomCard() { + final userProvider = Provider.of(context); + switch (_model.status) { + case 1: + return userProvider.infoModel.canPass ? Container( height: 98.w, decoration: BoxDecoration( @@ -181,9 +296,10 @@ class _ItemsOutdoorDetailsPageState extends State { children: [ AkuButton( onPressed: () { - Get.to(OutdoorNotpassPage( - model: widget.cardMedel, - )); + //TODO not pass + // Get.to(OutdoorNotpassPage( + // model: widget.cardMedel, + // )); }, child: Container( width: 304.w, @@ -203,9 +319,10 @@ class _ItemsOutdoorDetailsPageState extends State { Spacer(), AkuMaterialButton( onPressed: () { - Get.to(OutdoorPassPage( - model: widget.cardMedel, - )); + //TODO pass + // Get.to(OutdoorPassPage( + // model: widget.cardMedel, + // )); }, radius: 4.w, color: Color(0xFFFFC40C), @@ -221,7 +338,7 @@ class _ItemsOutdoorDetailsPageState extends State { ) : SizedBox(); break; - case OUTDOORSTATUS.OUT_DONE: + case 2: return Container( height: 226.w, color: Color(0xFFFFFFFF), @@ -247,7 +364,10 @@ class _ItemsOutdoorDetailsPageState extends State { ), Spacer(), Text( - widget.cardMedel.finalOutTime, + DateUtil.formatDate( + _model.expected, + format: 'yyyy-MM-dd HH:mm', + ), style: AppStyle().primaryStyle, ), ], @@ -267,7 +387,7 @@ class _ItemsOutdoorDetailsPageState extends State { ), Spacer(), Text( - widget.cardMedel.outPlace, + _model.exportValue, style: AppStyle().primaryStyle, ), ], @@ -276,7 +396,7 @@ class _ItemsOutdoorDetailsPageState extends State { ), ); break; - case OUTDOORSTATUS.REJECTED: + case 3: return Container( height: 226.w, color: Color(0xFFFFFFFF), @@ -302,7 +422,10 @@ class _ItemsOutdoorDetailsPageState extends State { ), Spacer(), Text( - widget.cardMedel.finalOutTime, + DateUtil.formatDate( + _model.expected, + format: 'yyyy-MM-dd HH:mm', + ), style: AppStyle().primaryStyle, ), ], @@ -321,11 +444,13 @@ class _ItemsOutdoorDetailsPageState extends State { style: AppStyle().secondaryTextStyle, ), Spacer(), - Text(widget.cardMedel.rejectReason, - style: TextStyle( - color: Color(0xFFFF4501), - fontSize: 28.sp, - fontWeight: FontWeight.bold)), + Text( + _model.remarks, + style: TextStyle( + color: Color(0xFFFF4501), + fontSize: 28.sp, + fontWeight: FontWeight.bold), + ), ], ), ], diff --git a/lib/ui/sub_pages/items_outdoor/items_outdoor_page.dart b/lib/ui/sub_pages/items_outdoor/items_outdoor_page.dart index 8574f6d..671693c 100644 --- a/lib/ui/sub_pages/items_outdoor/items_outdoor_page.dart +++ b/lib/ui/sub_pages/items_outdoor/items_outdoor_page.dart @@ -1,5 +1,10 @@ // Flutter imports: +import 'package:aku_community_manager/const/api.dart'; +import 'package:aku_community_manager/models/manager/goods_out/goods_out_item_model.dart'; +import 'package:aku_community_manager/ui/sub_pages/items_outdoor/items_outdoor_view.dart'; +import 'package:aku_community_manager/ui/widgets/common/bee_list_view.dart'; import 'package:flutter/material.dart'; +import 'package:flutter_easyrefresh/easy_refresh.dart'; // Package imports: import 'package:flutter_screenutil/flutter_screenutil.dart'; @@ -23,6 +28,7 @@ class _ItemsOutdoorPageState extends State with TickerProviderStateMixin { List _tabs = ['待出户', '已出户', '已驳回', '已作废', '全部']; TabController _tabController; + EasyRefreshController _refreshController = EasyRefreshController(); @override void initState() { super.initState(); @@ -44,24 +50,15 @@ class _ItemsOutdoorPageState extends State child: AkuTabBar(controller: _tabController, tabs: _tabs), ), body: TabBarView( - controller: _tabController, - children: - _tabs.map((e) => _buildListView(_tabs.indexOf(e))).toList()), - ); - } - - Widget _buildListView(int index) { - final _outdoorModels = Provider.of(context); - List _selectModels = - _outdoorModels.getOutdoorModels(index); - return ListView( - padding: EdgeInsets.only(left: 32.w, right: 32.w), - children: _selectModels - .map((e) => ItemsOutdoorCard( - cardModel: e, - isdetail: false, - )) - .toList(), + controller: _tabController, + children: [ + ItemsOutdoorView(status: 1), + ItemsOutdoorView(status: 2), + ItemsOutdoorView(status: 3), + ItemsOutdoorView(status: 4), + ItemsOutdoorView(status: null), + ], + ), ); } } diff --git a/lib/ui/sub_pages/items_outdoor/items_outdoor_view.dart b/lib/ui/sub_pages/items_outdoor/items_outdoor_view.dart new file mode 100644 index 0000000..b3403b2 --- /dev/null +++ b/lib/ui/sub_pages/items_outdoor/items_outdoor_view.dart @@ -0,0 +1,45 @@ +import 'package:aku_community_manager/const/api.dart'; +import 'package:aku_community_manager/models/manager/goods_out/goods_out_item_model.dart'; +import 'package:aku_community_manager/ui/sub_pages/items_outdoor/items_outdoor_card.dart'; +import 'package:aku_community_manager/ui/widgets/common/bee_list_view.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_easyrefresh/easy_refresh.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart'; + +class ItemsOutdoorView extends StatefulWidget { + final int status; + ItemsOutdoorView({Key key, this.status}) : super(key: key); + + @override + _ItemsOutdoorViewState createState() => _ItemsOutdoorViewState(); +} + +class _ItemsOutdoorViewState extends State + with AutomaticKeepAliveClientMixin { + EasyRefreshController _refreshController = new EasyRefreshController(); + @override + Widget build(BuildContext context) { + super.build(context); + return BeeListView( + path: API.manage.goodsOutList, + extraParams: {'articleOutStatus': widget.status}, + controller: _refreshController, + convert: (model) => + model.tableList.map((e) => GoodsOutItemModel.fromJson(e)).toList(), + builder: (items) { + return ListView.builder( + itemBuilder: (context, index) { + return ItemsOutdoorCard( + model: items[index], + ); + }, + padding: EdgeInsets.only(left: 32.w, right: 32.w), + itemCount: items.length, + ); + }, + ); + } + + @override + bool get wantKeepAlive => true; +}