From df7bf47956598c14c07ed7dfe2afee6c4aead2b9 Mon Sep 17 00:00:00 2001 From: zhang <494089941@qq.com> Date: Tue, 26 Jan 2021 19:09:05 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AF=B9=E6=8E=A5=E6=8E=A5=E5=8F=A3=EF=BC=9A?= =?UTF-8?q?=E5=AE=8C=E6=88=90=E6=8A=A5=E4=BF=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/pages/manager_func.dart | 11 ++++++ .../things_page/widget/fixed_detail_page.dart | 35 +++++++++++++++++-- 2 files changed, 44 insertions(+), 2 deletions(-) diff --git a/lib/pages/manager_func.dart b/lib/pages/manager_func.dart index a550c576..04a32c52 100644 --- a/lib/pages/manager_func.dart +++ b/lib/pages/manager_func.dart @@ -81,4 +81,15 @@ class ManagerFunc { ); return baseModel; } + + static Future reportRepairComplete(int id) async { + BaseModel baseModel = await NetUtil().get( + API.manager.reportRepairComplete, + params: { + 'repairId': id, + }, + showMessage: true, + ); + return baseModel; + } } diff --git a/lib/pages/things_page/widget/fixed_detail_page.dart b/lib/pages/things_page/widget/fixed_detail_page.dart index 84cfc087..a8bab8e6 100644 --- a/lib/pages/things_page/widget/fixed_detail_page.dart +++ b/lib/pages/things_page/widget/fixed_detail_page.dart @@ -1,5 +1,6 @@ // Flutter imports: import 'package:akuCommunity/pages/things_page/widget/fixed_evaluate_page.dart'; +import 'package:akuCommunity/utils/network/base_model.dart'; import 'package:bot_toast/bot_toast.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; @@ -44,6 +45,23 @@ class _FixedDetailPageState extends State { FixedDetailModel _model = FixedDetailModel(); bool get showRepairCard => _model?.appDispatchListVo != null; bool get showProcessCard => _model.appProcessRecordVo.isNotEmpty; + + bool _canComplete(int state) { + switch (state) { + case 1: + case 2: + case 3: + case 4: + return true; + case 5: + case 6: + case 7: + return false; + default: + return false; + } + } + Color _getColor(int state) { switch (state) { case 1: @@ -453,9 +471,22 @@ class _FixedDetailPageState extends State { mainAxisSize: MainAxisSize.max, children: [ MaterialButton( + textColor: ktextPrimary, + disabledColor: kDarkSubColor, + disabledTextColor: ktextPrimary.withOpacity(0.8), minWidth: 375.w, - onPressed: () {}, - child: '完成维修'.text.black.size(32.sp).bold.make(), + onPressed: _canComplete(_model.appReportRepairVo.status) + ? () async { + BaseModel baseModel = + await ManagerFunc.reportRepairComplete( + _model.appReportRepairVo.id); + if (baseModel.status) { + Get.back(); + Get.back(); + } + } + : null, + child: '完成维修'.text.size(32.sp).bold.make(), padding: EdgeInsets.symmetric(vertical: 26.w), materialTapTargetSize: MaterialTapTargetSize.shrinkWrap, elevation: 0,