diff --git a/lib/models/todo_bussiness/todo_model.dart b/lib/models/todo_bussiness/todo_model.dart new file mode 100644 index 0000000..0d271f9 --- /dev/null +++ b/lib/models/todo_bussiness/todo_model.dart @@ -0,0 +1,38 @@ +import 'package:aku_community_manager/models/manager/bussiness_and_fix/bussiness_and_fix_model.dart'; +import 'package:aku_community_manager/models/todo_bussiness/todo_outdoor_model.dart'; + +class ToDoModel { + dynamic dynamicModel; + int type; + + ToDoModel({this.dynamicModel, this.type}); + + ToDoModel.fromJson(Map json) { + type = json['type']; + switch (type) { + case 1: + dynamicModel = json['dataList'] != null + ? new BussinessAndFixModel.fromJson(json['dataList']) + : null; + break; + case 2: + dynamicModel = json['dataList'] != null + ? new ToDoOutDoorModel.fromJson(json['dataList']) + : null; + break; + default: + dynamicModel = json['dataList'] != null + ? [] + : null; + } + } + + Map toJson() { + final Map data = new Map(); + if (this.dynamicModel != null) { + data['dataList'] = this.dynamicModel.toJson(); + } + data['type'] = this.type; + return data; + } +} diff --git a/lib/models/todo_bussiness/todo_outdoor_model.dart b/lib/models/todo_bussiness/todo_outdoor_model.dart new file mode 100644 index 0000000..0585fe6 --- /dev/null +++ b/lib/models/todo_bussiness/todo_outdoor_model.dart @@ -0,0 +1,85 @@ +import 'package:flutter/material.dart'; + +class ToDoOutDoorModel { + int id; + int status; + String roomName; + String applicantName; + int identity; + String articleOutName; + String expectedTime; + String applicantDate; + + ToDoOutDoorModel( + {this.id, + this.status, + this.roomName, + this.applicantName, + this.identity, + this.articleOutName, + this.expectedTime, + this.applicantDate}); + + ToDoOutDoorModel.fromJson(Map json) { + id = json['id']; + status = json['status']; + roomName = json['roomName']; + applicantName = json['applicantName']; + identity = json['identity']; + articleOutName = json['articleOutName']; + expectedTime = json['expectedTime']; + applicantDate = json['applicantDate']; + } + + 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; + data['applicantDate'] = this.applicantDate; + return data; + } + + ///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 '未知'; + } + } + + +} diff --git a/lib/ui/home/business/business_page.dart b/lib/ui/home/business/business_page.dart index 4f9472c..1fb6ea8 100644 --- a/lib/ui/home/business/business_page.dart +++ b/lib/ui/home/business/business_page.dart @@ -1,6 +1,7 @@ // Flutter imports: import 'package:aku_community_manager/models/manager/bussiness_and_fix/bussiness_and_fix_model.dart'; import 'package:aku_community_manager/models/manager/decoration/decoration_list_model.dart'; +import 'package:aku_community_manager/ui/home/business/business_view.dart'; import 'package:flutter/material.dart'; // Project imports: @@ -66,18 +67,19 @@ class _BusinessPageState extends State } Widget _buildTabPage(List list) { - return ListView.builder( - padding: EdgeInsets.symmetric(horizontal: 32.w), - itemBuilder: (context, index) { - final item = list[index]; - if (item is DecorationListModel) { - return DecorationManagerCard(model: item); - } else if (item is BussinessAndFixModel) { - return BusinessFixCard(model: item); - } else - return SizedBox(); - }, - itemCount: list.length, - ); + // return ListView.builder( + // padding: EdgeInsets.symmetric(horizontal: 32.w), + // itemBuilder: (context, index) { + // final item = list[index]; + // if (item is DecorationListModel) { + // return DecorationManagerCard(model: item); + // } else if (item is BussinessAndFixModel) { + // return BusinessFixCard(model: item); + // } else + // return SizedBox(); + // }, + // itemCount: list.length, + // ); + return BussinessView(); } } diff --git a/lib/ui/home/business/business_view.dart b/lib/ui/home/business/business_view.dart new file mode 100644 index 0000000..da82f19 --- /dev/null +++ b/lib/ui/home/business/business_view.dart @@ -0,0 +1,49 @@ +import 'package:aku_community_manager/const/api.dart'; +import 'package:aku_community_manager/models/manager/bussiness_and_fix/bussiness_and_fix_model.dart'; +import 'package:aku_community_manager/models/todo_bussiness/todo_model.dart'; +import 'package:aku_community_manager/models/todo_bussiness/todo_outdoor_model.dart'; +import 'package:aku_community_manager/ui/home/business/bussiness_func.dart'; +import 'package:aku_community_manager/ui/home/business/todo_outdoor_card.dart'; +import 'package:aku_community_manager/ui/sub_pages/business_and_fix/business_fix_card.dart'; +import 'package:aku_community_manager/utils/network/net_util.dart'; +import 'package:dio/dio.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_easyrefresh/easy_refresh.dart'; +import 'package:velocity_x/velocity_x.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart'; + +class BussinessView extends StatefulWidget { + final int backlogStatus; + BussinessView({Key key, this.backlogStatus}) : super(key: key); + + @override + _BussinessViewState createState() => _BussinessViewState(); +} + +class _BussinessViewState extends State { + List _modelList; + @override + Widget build(BuildContext context) { + return EasyRefresh( + firstRefresh: true, + header: MaterialHeader(), + onRefresh: () async { + List dataList = + await BussinessFunc.getBussinessModelList(widget.backlogStatus); + _modelList = dataList.map((e) => ToDoModel.fromJson(e)).toList(); + }, + child: ListView( + children: [ + ..._modelList.map((e) { + if (e.runtimeType == BussinessAndFixModel) { + BusinessFixCard(model: e); + } else if (e.runtimeType == ToDoOutDoorModel) { + ToDoOutDoorCard( + model: e, + ); + } + }).toList() + ], + )); + } +} diff --git a/lib/ui/home/business/bussiness_func.dart b/lib/ui/home/business/bussiness_func.dart new file mode 100644 index 0000000..43d80f0 --- /dev/null +++ b/lib/ui/home/business/bussiness_func.dart @@ -0,0 +1,13 @@ +import 'package:aku_community_manager/const/api.dart'; +import 'package:aku_community_manager/utils/network/net_util.dart'; +import 'package:dio/dio.dart'; + +class BussinessFunc { + static Future getBussinessModelList(int backlogStatus) async { + Response response = + await NetUtil().dio.get(API.manage.backlogList, queryParameters: { + "backlogStatus": backlogStatus, + }); + return response.data as List; + } +} diff --git a/lib/ui/home/business/todo_outdoor_card.dart b/lib/ui/home/business/todo_outdoor_card.dart new file mode 100644 index 0000000..2545981 --- /dev/null +++ b/lib/ui/home/business/todo_outdoor_card.dart @@ -0,0 +1,218 @@ +import 'package:aku_community_manager/models/todo_bussiness/todo_outdoor_model.dart'; +import 'package:aku_community_manager/style/app_style.dart'; +import 'package:aku_community_manager/ui/sub_pages/items_outdoor/items_outdoor_details_page.dart'; +import 'package:aku_ui/aku_ui.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart'; +import 'package:get/get.dart'; +import 'package:velocity_x/velocity_x.dart'; + +class ToDoOutDoorCard extends StatefulWidget { + final ToDoOutDoorModel model; + ToDoOutDoorCard({Key key, this.model}) : super(key: key); + + @override + _ToDoOutDoorCardState createState() => _ToDoOutDoorCardState(); +} + +class _ToDoOutDoorCardState extends State { + @override + Widget build(BuildContext context) { + TextStyle _textStyle = + TextStyle(color: AppStyle.minorTextColor, fontSize: 28.sp); + return Container( + color: Color(0xFFFFFFFF), + margin: EdgeInsets.only(top: 16.w), + padding: EdgeInsets.only(left: 24.w, right: 24.w), + child: Column( + children: [ + 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), + ), + ), + 16.w.widthBox, + //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, + ), + 4.w.widthBox, + Text( + '小区名称', + style: _textStyle, + ), + Spacer(), + Text( + '五象新区人才公寓', + style: AppStyle().primaryStyle, + ), + ], + ), + 12.w.heightBox, + Row( + children: [ + Image.asset( + R.ASSETS_OUTDOOR_IC_ADDRESS_PNG, + width: 40.w, + height: 40.w, + ), + 4.w.widthBox, + Text('详细地址', style: _textStyle), + Spacer(), + Text( + widget.model.roomName, + style: AppStyle().primaryStyle, + ), + ], + ), + 12.w.heightBox, + Row( + children: [ + Image.asset( + R.ASSETS_OUTDOOR_IC_GOOUT_PNG, + width: 40.w, + height: 40.w, + ), + 4.w.widthBox, + Text( + '出户人', + style: _textStyle, + ), + Spacer(), + Text( + widget.model.applicantName, + style: AppStyle().primaryStyle, + ), + ], + ), + 12.w.heightBox, + Row( + children: [ + Image.asset( + R.ASSETS_OUTDOOR_IC_PEOPLE_PNG, + width: 40.w, + height: 40.w, + ), + 4.w.widthBox, + Text( + '身份', + style: _textStyle, + ), + Spacer(), + Text( + widget.model.identityValue, + style: AppStyle().primaryStyle, + ), + ], + ), + 12.w.heightBox, + 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, + ), + ], + ), + 12.w.heightBox, + Row( + children: [ + Image.asset( + R.ASSETS_OUTDOOR_IC_TIME_PNG, + width: 40.w, + height: 40.w, + ), + 4.w.widthBox, + Text( + '出户时间', + style: _textStyle, + ), + Spacer(), + Text( + widget.model.expectedTime, + style: AppStyle().primaryStyle, + ), + ], + ), + 24.w.heightBox, + 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/borrow_manager/all_borrow_goods.dart b/lib/ui/sub_pages/borrow_manager/all_borrow_goods.dart index 25a8047..eb2c1fa 100644 --- a/lib/ui/sub_pages/borrow_manager/all_borrow_goods.dart +++ b/lib/ui/sub_pages/borrow_manager/all_borrow_goods.dart @@ -1,7 +1,9 @@ // Flutter imports: import 'package:aku_community_manager/const/api.dart'; import 'package:aku_community_manager/models/manager/borrow/borrow_item_model.dart'; +import 'package:aku_community_manager/ui/sub_pages/borrow_manager/add_borrow_object_page.dart'; import 'package:aku_community_manager/ui/widgets/common/bee_list_view.dart'; +import 'package:aku_ui/common_widgets/aku_material_button.dart'; import 'package:flutter/material.dart'; // Package imports: @@ -28,22 +30,19 @@ class _AllBorrowGoodsState extends State { Widget build(BuildContext context) { return AkuScaffold( title: '全部物品', - actions: [ - // userProvider.userInfoModel.role == USER_ROLE.MANAGER - // ? AkuMaterialButton( - // minWidth: 120.w, - // onPressed: () { - // Get.to(()=>AddBorrowObjectPage()); - // }, - // child: Text( - // '新增', - // style: TextStyle( - // fontSize: 28.w, - // color: AppStyle.primaryTextColor, - // ), - // ), - // ) - // : SizedBox(), + actions: [ AkuMaterialButton( + minWidth: 120.w, + onPressed: () { + Get.to(()=>AddBorrowObjectPage()); + }, + child: Text( + '新增', + style: TextStyle( + fontSize: 28.w, + color: AppStyle.primaryTextColor, + ), + ), + ) ], body: BeeListView( path: API.manage.borrowList,