From 9ef282b2ae3ad09062a8a0e2a161eab84af60e4f Mon Sep 17 00:00:00 2001 From: zhangmeng <494089941@qq.com> Date: Tue, 18 May 2021 16:54:00 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E8=A3=85=E4=BF=AE=E7=AE=A1?= =?UTF-8?q?=E7=90=86card=20=E5=AF=B9=E6=8E=A5=EF=BC=9A=E4=B8=80=E9=94=AE?= =?UTF-8?q?=E6=8A=A5=E8=AD=A6=E4=BF=A1=E6=81=AF=E8=AE=B0=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/constants/api.dart | 3 + lib/pages/one_alarm/widget/alarm_page.dart | 12 +- .../renovation_manage_card.dart | 143 +++++++++++++++++- .../renovation_manage_detail_page.dart | 18 +++ .../renovation_manage_page.dart | 2 +- .../renovation_manage_view.dart | 5 +- .../renovation_manage/renovation_map.dart | 50 ++++++ 7 files changed, 228 insertions(+), 5 deletions(-) create mode 100644 lib/pages/renovation_manage/renovation_manage_detail_page.dart create mode 100644 lib/pages/renovation_manage/renovation_map.dart diff --git a/lib/constants/api.dart b/lib/constants/api.dart index 0077b411..0003529b 100644 --- a/lib/constants/api.dart +++ b/lib/constants/api.dart @@ -233,6 +233,9 @@ class _Manager { ///咨询建议/投诉表扬:完成反馈 String get completeFeedBack => '/user/advice/completeFeedback'; + + ///一键报警:记录一键报警信息 + String get recordAlarmInfo => '/user/alarm/insertAlarmRecord'; } class _Community { diff --git a/lib/pages/one_alarm/widget/alarm_page.dart b/lib/pages/one_alarm/widget/alarm_page.dart index b8edc0f8..e54252b7 100644 --- a/lib/pages/one_alarm/widget/alarm_page.dart +++ b/lib/pages/one_alarm/widget/alarm_page.dart @@ -1,3 +1,5 @@ +import 'package:aku_community/constants/api.dart'; +import 'package:aku_community/utils/network/net_util.dart'; import 'package:flutter/material.dart'; import 'package:amap_flutter_base/amap_flutter_base.dart'; @@ -219,10 +221,18 @@ class _AlarmPageState extends State { child: MaterialButton( shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(172.w)), - onPressed: () { + onPressed: () async{ + setState(() { _makephonenum('tel:110'); }); + + if (appProvider.selectedHouse?.status==4) { + await NetUtil().post(API.manager.recordAlarmInfo,params: { + "estateId":appProvider.selectedHouse?.estateId, + }); + } + }, child: Icon( Feather.phone_call, diff --git a/lib/pages/renovation_manage/renovation_manage_card.dart b/lib/pages/renovation_manage/renovation_manage_card.dart index aa8138b3..ad207bd0 100644 --- a/lib/pages/renovation_manage/renovation_manage_card.dart +++ b/lib/pages/renovation_manage/renovation_manage_card.dart @@ -1,7 +1,14 @@ +import 'package:aku_community/base/base_style.dart'; +import 'package:aku_community/pages/renovation_manage/renovation_map.dart'; +import 'package:flustars/flustars.dart'; import 'package:flutter/material.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart'; +import 'package:velocity_x/velocity_x.dart'; +import 'package:aku_community/const/resource.dart'; class RenovationManageCard extends StatefulWidget { - RenovationManageCard({Key? key}) : super(key: key); + final int index; + RenovationManageCard({Key? key, required this.index}) : super(key: key); @override _RenovationManageCardState createState() => _RenovationManageCardState(); @@ -10,6 +17,138 @@ class RenovationManageCard extends StatefulWidget { class _RenovationManageCardState extends State { @override Widget build(BuildContext context) { - return Container(); + return GestureDetector( + onTap: () {}, + child: Container( + margin: EdgeInsets.only(top: 16.w), + padding: EdgeInsets.all(24.w), + child: Column( + children: [ + Row( + children: [ + _akuChipBox('装修管理'), + 16.w.widthBox, + Text( + DateUtil.formatDateStr('2020-10-23 10:24:56', + format: 'yyyy-MM-dd HH:mm:ss'), + style: TextStyle( + color: ktextSubColor, + fontSize: 22.w, + ), + ), + Spacer(), + Text( + RenovationMap.getTagName( + widget.index, + widget.index, + ), + style: TextStyle( + color: RenovationMap.getTagColor(widget.index), + fontSize: 24.w, + ), + ), + ], + ), + 24.w.heightBox, + _buildTile(R.ASSETS_ICONS_ARTICLE_NAME_PNG, '小区名称', '人才公寓'), + 12.w.heightBox, + _buildTile( + R.ASSETS_ICONS_APPOINTMENT_ADDRESS_PNG, + '详细地址', + '1幢-1单元-302室', + ), + 12.w.heightBox, + _buildTile( + R.ASSETS_ICONS_APPOINTMENT_CODE_PNG, + '装修公司', + '深圳莫川装修有限公司', + ), + 12.w.heightBox, + _buildTile( + R.ASSETS_ICONS_APPOINTMENT_DATE_PNG, + '装修状态', + RenovationMap().getDecorationStatus(widget.index), + ), + Divider( + height: 48.w, + ), + Align( + alignment: Alignment.centerRight, + child: MaterialButton( + onPressed: () { + // Get.to(DecorationManagerDetailPage(model: widget.model)); + }, + height: 64.w, + minWidth: 160.w, + color: kPrimaryColor, + child: Text( + '查看详情', + style: TextStyle( + color: ktextPrimary, + fontWeight: FontWeight.bold, + fontSize: 28.w, + ), + ), + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(4.w)), + ), + ), + ], + ), + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(8.w), + ), + ), + ); + } + + _buildTile(String path, String title, String subTitle) { + return Row( + children: [ + Image.asset( + path, + height: 40.w, + width: 40.w, + ), + Text( + title, + style: TextStyle( + color: ktextSubColor, + fontSize: 28.sp, + ), + ), + Spacer(), + Text( + subTitle, + style: TextStyle( + color: ktextPrimary, + fontSize: 28.sp, + fontWeight: FontWeight.bold, + ), + ), + ], + ); + } + + _akuChipBox(String title) { + return Container( + child: Text( + title, + style: TextStyle( + color: kPrimaryColor, + fontSize: 20.sp, + fontWeight: FontWeight.bold, + ), + ), + padding: EdgeInsets.symmetric(vertical: 6.w, horizontal: 16.w), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(2.w), + border: Border.all( + width: 2.w, + color: kPrimaryColor, + ), + ), + ); } } diff --git a/lib/pages/renovation_manage/renovation_manage_detail_page.dart b/lib/pages/renovation_manage/renovation_manage_detail_page.dart new file mode 100644 index 00000000..4dd1001a --- /dev/null +++ b/lib/pages/renovation_manage/renovation_manage_detail_page.dart @@ -0,0 +1,18 @@ +import 'package:aku_community/widget/bee_scaffold.dart'; +import 'package:flutter/material.dart'; + +class RenovationManageDetailPage extends StatefulWidget { + RenovationManageDetailPage({Key? key}) : super(key: key); + + @override + _RenovationManageDetailPageState createState() => + _RenovationManageDetailPageState(); +} + +class _RenovationManageDetailPageState + extends State { + @override + Widget build(BuildContext context) { + return BeeScaffold(title: '装修详情', body: Container()); + } +} diff --git a/lib/pages/renovation_manage/renovation_manage_page.dart b/lib/pages/renovation_manage/renovation_manage_page.dart index 84952e9b..99ab0491 100644 --- a/lib/pages/renovation_manage/renovation_manage_page.dart +++ b/lib/pages/renovation_manage/renovation_manage_page.dart @@ -26,7 +26,7 @@ class _RenovationManagePageState extends State with Ticker @override Widget build(BuildContext context) { return BeeScaffold( - title: '电子商务', + title: '装修管理', appBarBottom: BeeTabBar(controller: _tabController, tabs: _tabs,scrollable: true,), body: TabBarView( controller: _tabController, diff --git a/lib/pages/renovation_manage/renovation_manage_view.dart b/lib/pages/renovation_manage/renovation_manage_view.dart index cc05a2b6..4245d8c4 100644 --- a/lib/pages/renovation_manage/renovation_manage_view.dart +++ b/lib/pages/renovation_manage/renovation_manage_view.dart @@ -1,3 +1,4 @@ +import 'package:aku_community/pages/renovation_manage/renovation_manage_card.dart'; import 'package:flutter/material.dart'; class RenovationManageView extends StatefulWidget { @@ -11,6 +12,8 @@ class RenovationManageView extends StatefulWidget { class _RenovationManageViewState extends State { @override Widget build(BuildContext context) { - return ListView(); + return ListView( + children: [RenovationManageCard(index: widget.index)], + ); } } diff --git a/lib/pages/renovation_manage/renovation_map.dart b/lib/pages/renovation_manage/renovation_map.dart new file mode 100644 index 00000000..69434732 --- /dev/null +++ b/lib/pages/renovation_manage/renovation_map.dart @@ -0,0 +1,50 @@ +import 'package:flutter/material.dart'; + +class RenovationMap { + static String getTagName(int operationStatus, int status, {int? tracker}) { + switch (operationStatus) { + case 0: + return '待指派'; + + case 1: + return '待执行'; + + case 2: + return '已完成'; + + default: + return '已完成'; + } + } + + static Color getTagColor(int operationStatus) { + switch (operationStatus) { + case 1: + case 2: + return Color(0xFFFF4501); + case 3: + return Color(0xFF32B814); + default: + return Color(0xFFFF4501); + } + } + + Map stautsToString = { + -1: '申请中', + -2: '申请未通过', + -3: '申请通过', + 0:'待处理', + 1: '已付押金', + 2: '装修中', + 3: '完工检查申请中', + 4: '完工检查不通过', + 5: '完工检查通过', + 6: '申请退款中', + 7: '装修结束', + 8: '已作废', + }; + + String getDecorationStatus(int status) { + return stautsToString[status]!; + } +}