From 4f419b12589f4129176af71531373ec0925683dd Mon Sep 17 00:00:00 2001 From: zhangmeng <494089941@qq.com> Date: Thu, 13 May 2021 14:01:32 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=20=E5=8C=85=E8=A3=B9?= =?UTF-8?q?=E7=AE=A1=E7=90=86=20=E9=A1=B5=E9=9D=A2/card=20=E5=AF=B9?= =?UTF-8?q?=E6=8E=A5=20=E7=AE=A1=E5=AE=B6app=20=E5=8C=85=E8=A3=B9=E4=BB=A3?= =?UTF-8?q?=E6=94=B6=EF=BC=9A=E6=9F=A5=E8=AF=A2=E6=89=80=E6=9C=89=E7=9A=84?= =?UTF-8?q?=E5=8C=85=E8=A3=B9=E4=BB=A3=E6=94=B6=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/const/api.dart | 4 + .../package_manage_list_model.dart | 44 +++++++ .../home/application/applications_page.dart | 4 +- .../packages_manage/packages_manage_card.dart | 121 ++++++++++++++++++ .../packages_manage/packages_manage_page.dart | 40 ++++++ .../packages_manage/packages_manage_view.dart | 59 +++++++++ pubspec.lock | 7 + pubspec.yaml | 1 + 8 files changed, 279 insertions(+), 1 deletion(-) create mode 100644 lib/models/manager/package_manage/package_manage_list_model.dart create mode 100644 lib/ui/manage_pages/packages_manage/packages_manage_card.dart create mode 100644 lib/ui/manage_pages/packages_manage/packages_manage_page.dart create mode 100644 lib/ui/manage_pages/packages_manage/packages_manage_view.dart diff --git a/lib/const/api.dart b/lib/const/api.dart index b80cdfb..d8eb02b 100644 --- a/lib/const/api.dart +++ b/lib/const/api.dart @@ -185,6 +185,10 @@ class _Manage { ///巡检管理:上传巡检定位信息(开始巡检后,每n秒上传一次) String get uploadLocation => '/user/inspection/uploadLocation'; + + ///管家app 包裹代收:查询所有的包裹代收信息 + String get packageManageList => '/user/packageCollection/list'; + } class _Upload { diff --git a/lib/models/manager/package_manage/package_manage_list_model.dart b/lib/models/manager/package_manage/package_manage_list_model.dart new file mode 100644 index 0000000..a365916 --- /dev/null +++ b/lib/models/manager/package_manage/package_manage_list_model.dart @@ -0,0 +1,44 @@ +class PackageManageListModel { + int id; + String code; + String addresseeName; + String addresseeTel; + String address; + int status; + Null receiveDate; + String createDate; + + PackageManageListModel( + {this.id, + this.code, + this.addresseeName, + this.addresseeTel, + this.address, + this.status, + this.receiveDate, + this.createDate}); + + PackageManageListModel.fromJson(Map json) { + id = json['id']; + code = json['code']; + addresseeName = json['addresseeName']; + addresseeTel = json['addresseeTel']; + address = json['address']; + status = json['status']; + receiveDate = json['receiveDate']; + createDate = json['createDate']; + } + + Map toJson() { + final Map data = new Map(); + data['id'] = this.id; + data['code'] = this.code; + data['addresseeName'] = this.addresseeName; + data['addresseeTel'] = this.addresseeTel; + data['address'] = this.address; + data['status'] = this.status; + data['receiveDate'] = this.receiveDate; + data['createDate'] = this.createDate; + return data; + } +} diff --git a/lib/ui/home/application/applications_page.dart b/lib/ui/home/application/applications_page.dart index 15d764a..a0d67cc 100644 --- a/lib/ui/home/application/applications_page.dart +++ b/lib/ui/home/application/applications_page.dart @@ -1,5 +1,6 @@ // Flutter imports: import 'package:aku_community_manager/models/manager/facilities/facilities_page.dart'; +import 'package:aku_community_manager/ui/manage_pages/packages_manage/packages_manage_page.dart'; import 'package:flutter/material.dart'; // Package imports: @@ -68,7 +69,8 @@ class _ApplicationPageState extends State AppApplication('借还管理', R.ASSETS_HOME_IC_BORROW_PNG, BorrowManagerPage()), AppApplication('巡检管理', R.ASSETS_HOME_IC_PATROL_PNG, InspectionManagePage()), AppApplication('绿化管理', R.ASSETS_HOME_IC_GREENING_PNG, GreenManagePage()), - AppApplication('设施检查', R.ASSETS_HOME_IC_FACILITIES_PNG,FacilitiesPage() ) + AppApplication('设施检查', R.ASSETS_HOME_IC_FACILITIES_PNG,FacilitiesPage() ), + AppApplication('包裹管理', R.ASSETS_PLACEHOLDER_WEBP, PackagesManagePage()) ]; @override diff --git a/lib/ui/manage_pages/packages_manage/packages_manage_card.dart b/lib/ui/manage_pages/packages_manage/packages_manage_card.dart new file mode 100644 index 0000000..58cc7ca --- /dev/null +++ b/lib/ui/manage_pages/packages_manage/packages_manage_card.dart @@ -0,0 +1,121 @@ +import 'dart:math'; + +import 'package:aku_community_manager/models/manager/package_manage/package_manage_list_model.dart'; +import 'package:aku_community_manager/style/app_style.dart'; +import 'package:aku_community_manager/tools/aku_divider.dart'; +import 'package:common_utils/common_utils.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart'; +import 'package:velocity_x/velocity_x.dart'; +import 'package:aku_community_manager/const/resource.dart'; +import 'package:aku_community_manager/tools/extensions/list_extension_tool.dart'; + +class PackageManageCard extends StatefulWidget { + final int index; + final PackageManageListModel model; + PackageManageCard({Key key, this.index, this.model}) : super(key: key); + + @override + _PackageManageCardState createState() => _PackageManageCardState(); +} + +class _PackageManageCardState extends State { + @override + Widget build(BuildContext context) { + return Container( + width: double.infinity, + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(8.w), + ), + padding: EdgeInsets.symmetric(vertical: 24.w, horizontal: 24.w), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + children: [ + '3号柜${Random().nextInt(10)}号箱' + .text + .size(32.sp) + .color(kTextPrimaryColor) + .bold + .make(), + Spacer(), + (widget.index == 0 ? '未领取' : '已领取') + .text + .size(28.sp) + .color(widget.index == 1 ? kTextSubColor : kTextPrimaryColor) + .make() + ], + ), + 16.w.heightBox, + AkuDivider.horizontal(), + 24.w.heightBox, + ...[ + _rowTile( + R.ASSETS_MANAGE_IC_RENWU_PNG, + '包裹代收', + widget.model.code.text.size(24.sp).color(kTextSubColor).make(), + ), + _rowTile( + R.ASSETS_MANAGE_IC_RENWU_PNG, + '收件人', + widget.model.addresseeName.text.size(24.sp).color(kTextSubColor).make(), + ), + _rowTile( + R.ASSETS_MESSAGE_IC_PHONE_PNG, + '联系方式', + widget.model.addresseeTel.text.size(24.sp).color(kTextSubColor).make(), + ), + _rowTile( + R.ASSETS_MANAGE_IC_TIME_PNG, + '送达时间', + DateUtil.formatDate(widget.model.receiveDate,format: 'yyyy-MM-dd HH:mm').text.size(24.sp).color(kTextSubColor).make(), + ), + ].sepWidget(separate: 12.w.heightBox), + widget.index == 1 ? SizedBox() : _bottomButtons() + ], + ), + ); + } + + Widget _bottomButtons() { + return Padding( + padding: EdgeInsets.only(top: 40.w), + child: Row( + children: [ + Spacer(), + MaterialButton( + height: 52.w, + padding: EdgeInsets.symmetric(vertical: 8.w, horizontal: 24.w), + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(74.w)), + color: Colors.black, + onPressed: () {}, + elevation: 0, + focusElevation: 0, + hoverElevation: 0, + highlightElevation: 0, + child: '提醒领取'.text.size(26.sp).color(Colors.white).make(), + ) + ], + ), + ); + } + + Widget _rowTile(String iconPath, String title, Widget content) { + return Row( + children: [ + SizedBox( + width: 40.w, + height: 40.w, + child: Image.asset(iconPath), + ), + 12.w.widthBox, + title.text.size(24.sp).color(kTextSubColor).make(), + Spacer(), + content, + ], + ); + } +} diff --git a/lib/ui/manage_pages/packages_manage/packages_manage_page.dart b/lib/ui/manage_pages/packages_manage/packages_manage_page.dart new file mode 100644 index 0000000..61c68f1 --- /dev/null +++ b/lib/ui/manage_pages/packages_manage/packages_manage_page.dart @@ -0,0 +1,40 @@ + +import 'package:aku_community_manager/ui/manage_pages/packages_manage/packages_manage_view.dart'; +import 'package:aku_community_manager/ui/widgets/common/aku_scaffold.dart'; +import 'package:aku_community_manager/ui/widgets/inner/aku_tab_bar.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart'; +import 'package:velocity_x/velocity_x.dart'; + +class PackagesManagePage extends StatefulWidget { + PackagesManagePage({Key key}) : super(key: key); + + @override + _PackagesManagePageState createState() => _PackagesManagePageState(); +} + +class _PackagesManagePageState extends State + with TickerProviderStateMixin { + List _tabs = ['未领取', '已领取']; + TabController _tabController; + @override + void initState() { + super.initState(); + _tabController = TabController(length: _tabs.length, vsync: this); + } + + @override + Widget build(BuildContext context) { + return AkuScaffold( + title: '包裹管理', + appBarBottom: PreferredSize( + child: AkuTabBar(controller: _tabController, tabs: _tabs), + preferredSize: Size.fromHeight(88.w), + ), + body: TabBarView( + controller: _tabController, + children: List.generate(_tabs.length, (index) => PackagesManageView(index: index,)), + ), + ); + } +} diff --git a/lib/ui/manage_pages/packages_manage/packages_manage_view.dart b/lib/ui/manage_pages/packages_manage/packages_manage_view.dart new file mode 100644 index 0000000..c7da41e --- /dev/null +++ b/lib/ui/manage_pages/packages_manage/packages_manage_view.dart @@ -0,0 +1,59 @@ +import 'package:aku_community_manager/const/api.dart'; +import 'package:aku_community_manager/models/manager/package_manage/package_manage_list_model.dart'; +import 'package:aku_community_manager/ui/manage_pages/packages_manage/packages_manage_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'; +import 'package:velocity_x/velocity_x.dart'; + +class PackagesManageView extends StatefulWidget { + final int index; + PackagesManageView({Key key, this.index}) : super(key: key); + + @override + _PackagesManageViewState createState() => _PackagesManageViewState(); +} + +class _PackagesManageViewState extends State { + EasyRefreshController _refreshController; + List _models; + @override + void initState() { + super.initState(); + _refreshController = EasyRefreshController(); + } + + @override + void dispose() { + _refreshController?.dispose(); + super.dispose(); + } + + @override + Widget build(BuildContext context) { + return BeeListView( + path: API.manage.packageManageList, + controller: _refreshController, + extraParams: {"collectionStatus": widget.index + 1}, + convert: (models) { + return models.tableList + .map((e) => PackageManageListModel.fromJson(e)) + .toList(); + }, + builder: (items) { + return ListView.separated( + itemBuilder: (context, index) { + return PackageManageCard( + index: widget.index, + model: items[index], + ); + }, + separatorBuilder: (_, __) { + return 24.w.heightBox; + }, + itemCount: items.length); + }, + ); + } +} diff --git a/pubspec.lock b/pubspec.lock index 18d2766..8ce939d 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -262,6 +262,13 @@ packages: url: "https://pub.flutter-io.cn" source: hosted version: "2.0.0" + equatable: + dependency: "direct main" + description: + name: equatable + url: "https://pub.flutter-io.cn" + source: hosted + version: "2.0.0" expandable: dependency: "direct main" description: diff --git a/pubspec.yaml b/pubspec.yaml index 3223aac..0950dfa 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -72,6 +72,7 @@ dependencies: shimmer: ^2.0.0-nullsafety.0 badges: ^2.0.0-nullsafety.1 + equatable: ^2.0.0 dev_dependencies: flutter_test: