Merge commit '2dc12ad9964a968e3d7bbd78f0cb79b9a6e5467e' into zhang

# Conflicts:
#	lib/const/api.dart
hmxc
张萌 4 years ago
commit 8c8fdb6aae

@ -14,6 +14,7 @@ class API {
static _Auth auth = _Auth();
static _User user = _User();
static _Manage manage = _Manage();
static _Upload upload = _Upload();
}
class _Auth {
@ -43,6 +44,8 @@ class _User {
///
String get updateTel => '/user/personalData/updateTel';
///
String get updateAvatar => '/user/personalData/updateHeadPortrait';
}
class _Manage {
@ -87,4 +90,44 @@ class _Manage {
///
String get handleResult => '/user/repair/handleResult';
///
String get borrowList => '/user/borrow/articleList';
///id
String get borrowDetailList => '/user/borrow/articleDetailList';
///id
String get borrowItemDetail => '/user/borrow/findById';
///
String get borrowStatusList => '/user/borrow/list';
///()
String get remindUserReturn => '/user/borrow/remind';
///
String get borrowCheckInfo => '/user/borrow/checkItems';
///
String get borrowCheck => '/user/borrow/submitCheck';
///
String get borrowEdit => '/user/borrow/updateArticleDetail';
///()
String get goodsOutList => '/user/articleOut/list';
///id
String get goodsOutDetail => '/user/articleOut/findById';
///
String get goodsOutRelease => '/user/articleOut/release';
///
String get goodsOutNotRelease => '/user/articleOut/noRelease';
}
class _Upload {
///
String get avatar => '/user/upload/butlerAppHeadSculpture';
}

@ -15,7 +15,6 @@ import 'package:aku_community_manager/provider/anouncement_provider.dart';
import 'package:aku_community_manager/provider/app_provider.dart';
import 'package:aku_community_manager/provider/fix_provider.dart';
import 'package:aku_community_manager/provider/manage_provider.dart';
import 'package:aku_community_manager/provider/outdoor_provider.dart';
import 'package:aku_community_manager/provider/user_provider.dart';
import 'package:aku_community_manager/ui/splash/splash_page.dart';
@ -58,7 +57,7 @@ class MyApp extends StatelessWidget {
ChangeNotifierProvider(create: (context) => FixProvider()),
ChangeNotifierProvider(create: (context) => GreenManageProvider()),
ChangeNotifierProvider(create: (context) => InspectionManageProvider()),
ChangeNotifierProvider(create: (context) => OutdoorProvider()),
ChangeNotifierProvider(create: (context) => GreenManageProvider()),
ChangeNotifierProvider(create: (context) => InspectionManageProvider()),
ChangeNotifierProvider(create: (context) => AnouncementProvider()),

@ -2,6 +2,8 @@
import 'package:aku_community_manager/const/resource.dart';
import 'package:aku_community_manager/mock_models/borrow/borrow_model.dart';
//TODO CLEAN BOTTOM CODES.
@Deprecated("borrow_data need to be cleaned.")
class BorrowData {
static List<BorrowModel> get checkModels => models.where((e) {
return e.borrowGoods.status == BORROW_STATUS.WAIT_CHECK;

@ -24,6 +24,8 @@ enum GOODS_STATUS {
LOST,
}
//TODO CLEAN BOTTOM CODES.
@Deprecated(" borrow_model need to be cleaned.")
class BorrowModel {
String borrowPerson;
String phone;

@ -1,184 +0,0 @@
// Flutter imports:
import 'package:flutter/material.dart';
// Project imports:
import 'package:aku_community_manager/const/resource.dart';
enum OUTDOORSTATUS {
///
NOT_OUT,
///
OUT_DONE,
///
REJECTED,
///
CANCELLATION,
}
class ItemsOutdoorModel {
///
OUTDOORSTATUS status;
///
DateTime datetime;
///
String communityname;
///
String adress;
///
String name;
///
String identify;
///
ItemDetails items;
///
String outtime;
////
String finalOutTime;
///
String outPlace;
///
String rejectReason;
ItemsOutdoorModel({
@required this.status,
@required this.datetime,
@required this.communityname,
@required this.adress,
@required this.name,
@required this.identify,
@required this.items,
@required this.outtime,
this.finalOutTime,
this.outPlace,
this.rejectReason,
});
static List<ItemsOutdoorModel> initList() {
return [
ItemsOutdoorModel(
status: OUTDOORSTATUS.NOT_OUT,
datetime: DateTime(2020, 10, 23, 09, 28, 56),
communityname: '深圳华悦茂峰',
adress: '1幢1单元702室',
name: '马云',
identify: '业主',
items: ItemDetails(
itemname: '家具',
weight: 40,
way: '搬家公司',
imagepath: [
R.ASSETS_OUTDOOR_ITME1_PNG,
R.ASSETS_OUTDOOR_ITEM2_PNG,
R.ASSETS_OUTDOOR_ITEM3_PNG
],
),
outtime: '2020-10-24 12:00',
finalOutTime: '',
outPlace: '',
rejectReason: '',
),
ItemsOutdoorModel(
status: OUTDOORSTATUS.OUT_DONE,
datetime: DateTime(2020, 10, 23, 09, 28, 56),
communityname: '深圳华悦茂峰',
adress: '1幢1单元702室',
name: '马云',
identify: '业主',
items: ItemDetails(
itemname: '家具',
weight: 60,
way: '搬家公司',
imagepath: [
R.ASSETS_OUTDOOR_ITME1_PNG,
R.ASSETS_OUTDOOR_ITEM2_PNG,
R.ASSETS_OUTDOOR_ITEM3_PNG
],
),
outtime: '2020-10-24 12:00',
finalOutTime: '2020-10-23 11:23:56',
outPlace: '东大门',
rejectReason: ''),
ItemsOutdoorModel(
status: OUTDOORSTATUS.REJECTED,
datetime: DateTime(2020, 10, 23, 09, 28, 56),
communityname: '深圳华悦茂峰',
adress: '1幢1单元702室',
name: '马云',
identify: '业主',
items: ItemDetails(
itemname: '家具',
weight: 80,
way: '搬家公司',
imagepath: [
R.ASSETS_OUTDOOR_ITME1_PNG,
R.ASSETS_OUTDOOR_ITEM2_PNG,
R.ASSETS_OUTDOOR_ITEM3_PNG
],
),
outtime: '2020-10-24 12:00',
finalOutTime: '2020-10-24 12:22:34',
outPlace: '',
rejectReason: '申报物品与实际物品不符',
),
ItemsOutdoorModel(
status: OUTDOORSTATUS.CANCELLATION,
datetime: DateTime(2020, 10, 23, 09, 28, 56),
communityname: '深圳华悦茂峰',
adress: '1幢1单元702室',
name: '马云',
identify: '业主',
items: ItemDetails(
itemname: '家具',
weight: 120,
way: '搬家公司',
imagepath: [
R.ASSETS_OUTDOOR_ITME1_PNG,
R.ASSETS_OUTDOOR_ITEM2_PNG,
R.ASSETS_OUTDOOR_ITEM3_PNG
],
),
outtime: '2020-10-24 12:00',
finalOutTime: '',
outPlace: '',
rejectReason: '',
),
];
}
static Map<OUTDOORSTATUS, String> outdoorStatusMap = {
OUTDOORSTATUS.NOT_OUT: '待出户',
OUTDOORSTATUS.OUT_DONE: '已出户',
OUTDOORSTATUS.REJECTED: '已驳回',
OUTDOORSTATUS.CANCELLATION: '已作废',
};
static Map<String, OUTDOORSTATUS> outdoorStatusStringMap = {
'待出户': OUTDOORSTATUS.NOT_OUT,
'已出户': OUTDOORSTATUS.OUT_DONE,
'已驳回': OUTDOORSTATUS.REJECTED,
'已作废': OUTDOORSTATUS.CANCELLATION,
};
}
class ItemDetails {
String itemname;
double weight;
String way;
List<String> imagepath;
ItemDetails(
{@required this.itemname,
@required this.weight,
this.way,
this.imagepath});
}

@ -0,0 +1,47 @@
import 'package:aku_community_manager/models/common/img_model.dart';
class BorrowCheckItemModel {
int id;
int articleDetailId;
String articleName;
String code;
int status;
List<ImgModel> imgUrls;
ImgModel get firstImg => imgUrls.isEmpty ? null : imgUrls.first;
BorrowCheckItemModel(
{this.id,
this.articleDetailId,
this.articleName,
this.code,
this.status,
this.imgUrls});
BorrowCheckItemModel.fromJson(Map<String, dynamic> json) {
id = json['id'];
articleDetailId = json['articleDetailId'];
articleName = json['articleName'];
code = json['code'];
status = json['status'];
if (json['imgUrls'] != null) {
imgUrls = new List<ImgModel>();
json['imgUrls'].forEach((v) {
imgUrls.add(new ImgModel.fromJson(v));
});
} else
imgUrls = [];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['id'] = this.id;
data['articleDetailId'] = this.articleDetailId;
data['articleName'] = this.articleName;
data['code'] = this.code;
data['status'] = this.status;
if (this.imgUrls != null) {
data['imgUrls'] = this.imgUrls.map((v) => v.toJson()).toList();
}
return data;
}
}

@ -0,0 +1,39 @@
import 'package:aku_community_manager/models/common/img_model.dart';
class BorrowDetailItemModel {
int id;
String name;
String code;
int borrowStatus;
List<ImgModel> imgUrls;
ImgModel get firstImg => imgUrls.isEmpty ? null : imgUrls.first;
bool get borrowed => borrowStatus == 2;
BorrowDetailItemModel(
{this.id, this.name, this.code, this.borrowStatus, this.imgUrls});
BorrowDetailItemModel.fromJson(Map<String, dynamic> json) {
id = json['id'];
name = json['name'];
code = json['code'];
borrowStatus = json['borrowStatus'];
if (json['imgUrls'] != null) {
imgUrls = new List<ImgModel>();
json['imgUrls'].forEach((v) {
imgUrls.add(new ImgModel.fromJson(v));
});
} else
imgUrls = [];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['id'] = this.id;
data['name'] = this.name;
data['code'] = this.code;
data['borrowStatus'] = this.borrowStatus;
if (this.imgUrls != null) {
data['imgUrls'] = this.imgUrls.map((v) => v.toJson()).toList();
}
return data;
}
}

@ -0,0 +1,60 @@
import 'package:aku_community_manager/models/common/img_model.dart';
class BorrowItemDetailModel {
int id;
String name;
String code;
int borrowStatus;
int status;
List<ImgModel> imgUrls;
ImgModel get firstImg => imgUrls.isEmpty ? null : imgUrls.first;
bool get borrowed => borrowStatus == 2;
String get statusValue {
switch (status) {
case 1:
return '正常';
case 2:
return '破损';
case 3:
return '丢失';
default:
return '未知';
}
}
BorrowItemDetailModel(
{this.id,
this.name,
this.code,
this.borrowStatus,
this.status,
this.imgUrls});
BorrowItemDetailModel.fromJson(Map<String, dynamic> json) {
id = json['id'];
name = json['name'];
code = json['code'];
borrowStatus = json['borrowStatus'];
status = json['status'];
if (json['imgUrls'] != null) {
imgUrls = new List<ImgModel>();
json['imgUrls'].forEach((v) {
imgUrls.add(new ImgModel.fromJson(v));
});
} else
imgUrls = [];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['id'] = this.id;
data['name'] = this.name;
data['code'] = this.code;
data['borrowStatus'] = this.borrowStatus;
data['status'] = this.status;
if (this.imgUrls != null) {
data['imgUrls'] = this.imgUrls.map((v) => v.toJson()).toList();
}
return data;
}
}

@ -0,0 +1,48 @@
import 'package:aku_community_manager/models/common/img_model.dart';
class BorrowItemModel {
int id;
String name;
int borrowNum;
int remainingNum;
int quantity;
List<ImgModel> imgUrls;
ImgModel get firstImg => imgUrls.isEmpty ? null : imgUrls.first;
BorrowItemModel(
{this.id,
this.name,
this.borrowNum,
this.remainingNum,
this.quantity,
this.imgUrls});
BorrowItemModel.fromJson(Map<String, dynamic> json) {
id = json['id'];
name = json['name'];
borrowNum = json['borrowNum'];
remainingNum = json['remainingNum'];
quantity = json['quantity'];
if (json['imgUrls'] != null) {
imgUrls = new List<ImgModel>();
json['imgUrls'].forEach((v) {
imgUrls.add(new ImgModel.fromJson(v));
});
} else
imgUrls = [];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['id'] = this.id;
data['name'] = this.name;
data['borrowNum'] = this.borrowNum;
data['remainingNum'] = this.remainingNum;
data['quantity'] = this.quantity;
if (this.imgUrls != null) {
data['imgUrls'] = this.imgUrls.map((v) => v.toJson()).toList();
}
return data;
}
}

@ -0,0 +1,119 @@
import 'package:aku_community_manager/models/common/img_model.dart';
import 'package:aku_community_manager/style/app_style.dart';
import 'package:common_utils/common_utils.dart';
import 'package:flutter/material.dart';
class BorrowStatusItemModel {
int id;
int articleDetailId;
String articleName;
///1.2.3.
int borrowStatus;
///1.2.3.
int status;
int borrowTime;
String beginDate;
String endDate;
String borrowName;
String borrowTel;
String createDate;
List<ImgModel> imgUrls;
ImgModel get firstImg => imgUrls.isEmpty ? null : imgUrls.first;
DateTime get create => DateUtil.getDateTime(createDate);
DateTime get begin => DateUtil.getDateTime(beginDate);
DateTime get end => DateUtil.getDateTime(endDate);
///1.2.3.
String get borrowStatusValue {
switch (borrowStatus) {
case 1:
return '出借中';
case 2:
return '已还';
case 3:
return '待检查';
default:
return '未知';
}
}
///1.2.3.
String get statusValue {
switch (status) {
case 1:
return '正常';
case 2:
return '损坏';
case 3:
return '丢失';
default:
return '未知';
}
}
///1.2.3.
Color get statusColor {
switch (status) {
case 1:
return AppStyle.primaryTextColor;
default:
return AppStyle.failColor;
}
}
BorrowStatusItemModel(
{this.id,
this.articleDetailId,
this.articleName,
this.borrowStatus,
this.status,
this.borrowTime,
this.beginDate,
this.endDate,
this.borrowName,
this.borrowTel,
this.createDate,
this.imgUrls});
BorrowStatusItemModel.fromJson(Map<String, dynamic> json) {
id = json['id'];
articleDetailId = json['articleDetailId'];
articleName = json['articleName'];
borrowStatus = json['borrowStatus'];
status = json['status'];
borrowTime = json['borrowTime'];
beginDate = json['beginDate'];
endDate = json['endDate'];
borrowName = json['borrowName'];
borrowTel = json['borrowTel'];
createDate = json['createDate'];
if (json['imgUrls'] != null) {
imgUrls = new List<ImgModel>();
json['imgUrls'].forEach((v) {
imgUrls.add(new ImgModel.fromJson(v));
});
} else
imgUrls = [];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['id'] = this.id;
data['articleDetailId'] = this.articleDetailId;
data['articleName'] = this.articleName;
data['borrowStatus'] = this.borrowStatus;
data['status'] = this.status;
data['borrowTime'] = this.borrowTime;
data['beginDate'] = this.beginDate;
data['endDate'] = this.endDate;
data['borrowName'] = this.borrowName;
data['borrowTel'] = this.borrowTel;
data['createDate'] = this.createDate;
if (this.imgUrls != null) {
data['imgUrls'] = this.imgUrls.map((v) => v.toJson()).toList();
}
return data;
}
}

@ -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 123
// * 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 123
int identity;
String applicantTel;
String expectedTime;
String articleOutName;
int weight;
///approach 1.2.
int approach;
List<ImgModel> 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 123
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<String, dynamic> 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<ImgModel>();
json['imgUrls'].forEach((v) {
imgUrls.add(new ImgModel.fromJson(v));
});
} else
imgUrls = [];
reviewDate = json['reviewDate'];
export = json['export'];
remarks = json['remarks'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
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;
}
}

@ -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 123
/// * articleOutName
/// * expectedTime
class GoodsOutItemModel {
int id;
///(1.2.3.)
int status;
String roomName;
String applicantName;
/// 123
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);
}
}
/// 123
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<String, dynamic> json) {
id = json['id'];
status = json['status'];
roomName = json['roomName'];
applicantName = json['applicantName'];
identity = json['identity'];
articleOutName = json['articleOutName'];
expectedTime = json['expectedTime'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
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;
}
}

@ -1,32 +0,0 @@
// Flutter imports:
import 'package:flutter/material.dart';
// Project imports:
import 'package:aku_community_manager/mock_models/outdoor_models/outdoor_model.dart';
class OutdoorProvider extends ChangeNotifier {
List<ItemsOutdoorModel> _itemOutdoorModel = ItemsOutdoorModel.initList();
List<ItemsOutdoorModel> get itemOutdoorModels => _itemOutdoorModel;
addOutdoormodel(ItemsOutdoorModel model) {
_itemOutdoorModel.insert(0, model);
notifyListeners();
}
List<ItemsOutdoorModel> getOutdoorModels(int index) {
return [
_itemOutdoorModel
.where((element) => element.status == OUTDOORSTATUS.NOT_OUT)
.toList(),
_itemOutdoorModel
.where((element) => element.status == OUTDOORSTATUS.OUT_DONE)
.toList(),
_itemOutdoorModel
.where((element) => element.status == OUTDOORSTATUS.REJECTED)
.toList(),
_itemOutdoorModel
.where((element) => element.status == OUTDOORSTATUS.CANCELLATION)
.toList(),
_itemOutdoorModel,
][index];
}
}

@ -2,6 +2,8 @@
import 'dart:io';
// Flutter imports:
import 'package:aku_community_manager/utils/network/base_file_model.dart';
import 'package:bot_toast/bot_toast.dart';
import 'package:flutter/material.dart';
// Project imports:
@ -87,16 +89,30 @@ class UserProvider extends ChangeNotifier {
_isSigned = true;
notifyListeners();
}
///
setNickName(String name) {
_infoModel.nickName = name;
notifyListeners();
}
setAvatar(File file) {
_userInfoModel.avatar = file;
///
setAvatar(File file) async {
Function cancel = BotToast.showLoading();
BaseFileModel fileModel = await NetUtil().upload(API.upload.avatar, file);
if (fileModel.status == true) {
await NetUtil().post(
API.user.updateAvatar,
params: {
'fileUrls': [fileModel.url],
},
showMessage: true,
);
_profileModel = await updateProfile();
cancel();
notifyListeners();
}
}
///
setTel(String tel) {

@ -1,4 +1,6 @@
// Flutter imports:
import 'dart:io';
import 'package:aku_community_manager/tools/aku_divider.dart';
import 'package:aku_community_manager/ui/settings/nick_name_change_page.dart';
import 'package:aku_community_manager/ui/settings/tel_change_page.dart';
@ -35,10 +37,9 @@ class _UserInfoPageState extends State<UserInfoPage> {
padding: EdgeInsets.symmetric(vertical: 24.w),
children: [
AkuTile(
onTap: () {
akuPickImage().then((file) {
if (file != null) userProvider.setAvatar(file);
});
onTap: () async {
File file = await akuPickImage();
if (file != null) await userProvider.setAvatar(file);
},
title: Text('头像'),
height: 168.w,
@ -55,9 +56,7 @@ class _UserInfoPageState extends State<UserInfoPage> {
AkuTile(
onTap: () async {
await TelChangePage().to();
setState(() {
});
setState(() {});
},
title: Text('手机'),
suffix: Text(TextUtil.hideNumber(userProvider.profileModel.tel)),

@ -50,6 +50,8 @@ class _SplashPageState extends State<SplashPage> {
@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),

@ -1,20 +1,17 @@
// 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/widgets/common/bee_list_view.dart';
import 'package:flutter/material.dart';
// Package imports:
import 'package:aku_ui/common_widgets/aku_material_button.dart';
import 'package:flutter_easyrefresh/easy_refresh.dart';
import 'package:get/get.dart';
import 'package:provider/provider.dart';
// Project imports:
import 'package:aku_community_manager/const/resource.dart';
import 'package:aku_community_manager/mock_models/borrow/borrow_data.dart';
import 'package:aku_community_manager/mock_models/borrow/borrow_model.dart';
import 'package:aku_community_manager/mock_models/users/user_info_model.dart';
import 'package:aku_community_manager/provider/user_provider.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/borrow_manager/add_borrow_object_page.dart';
import 'package:aku_community_manager/ui/sub_pages/borrow_manager/borrow_items_page.dart';
import 'package:aku_community_manager/ui/widgets/common/aku_scaffold.dart';
@ -26,43 +23,51 @@ class AllBorrowGoods extends StatefulWidget {
}
class _AllBorrowGoodsState extends State<AllBorrowGoods> {
EasyRefreshController _refreshController = EasyRefreshController();
@override
Widget build(BuildContext context) {
final userProvider = Provider.of<UserProvider>(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(),
// 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(),
],
body: ListView.builder(
body: BeeListView(
path: API.manage.borrowList,
controller: _refreshController,
convert: (model) =>
model.tableList.map((e) => BorrowItemModel.fromJson(e)).toList(),
builder: (items) {
return ListView.builder(
padding: EdgeInsets.symmetric(
horizontal: 32.w,
),
itemBuilder: (context, index) {
return _buildCard(BorrowData.borrowObjects[index]);
return _buildCard(items[index]);
},
itemCount: items.length,
);
},
itemCount: BorrowData.borrowObjects.length,
),
);
}
_buildCard(BorrowObject object) {
_buildCard(BorrowItemModel object) {
return GestureDetector(
onTap: () => Get.to(BorrowItemPage(object: object)),
onTap: () => Get.to(BorrowItemPage(id: object.id)),
child: Container(
padding: EdgeInsets.all(24.w),
margin: EdgeInsets.only(top: 16.w),
@ -70,18 +75,11 @@ class _AllBorrowGoodsState extends State<AllBorrowGoods> {
children: [
ClipRRect(
borderRadius: BorderRadius.circular(4.w),
child: (object.assetPath is String)
? Image.asset(
object.assetPath,
width: 184.w,
child: FadeInImage.assetNetwork(
placeholder: R.ASSETS_PLACEHOLDER_WEBP,
image: API.image(object.firstImg?.url ?? ''),
height: 184.w,
fit: BoxFit.cover,
)
: Image.file(
object.assetPath,
width: 184.w,
height: 184.w,
fit: BoxFit.cover,
),
),
AkuBox.w(24),
@ -91,10 +89,10 @@ class _AllBorrowGoodsState extends State<AllBorrowGoods> {
_buildRow(R.ASSETS_MANAGE_ARTICLE_PNG, '物品名称', object.name),
AkuBox.h(12),
_buildRow(R.ASSETS_MANAGE_BORROW_PNG, '借出数量',
object.borrowNumber.toString()),
object.borrowNum.toString()),
AkuBox.h(12),
_buildRow(R.ASSETS_MANAGE_REMAINING_PNG, '剩余数量',
object.items.length.toString()),
object.remainingNum.toString()),
],
)),
],

@ -1,8 +1,14 @@
// Flutter imports:
import 'package:aku_community_manager/const/api.dart';
import 'package:aku_community_manager/models/manager/borrow/borrow_item_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:bot_toast/bot_toast.dart';
import 'package:flutter/material.dart';
// Package imports:
import 'package:aku_ui/common_widgets/aku_material_button.dart';
import 'package:flutter_easyrefresh/easy_refresh.dart';
import 'package:provider/provider.dart';
// Project imports:
@ -14,8 +20,8 @@ import 'package:aku_community_manager/tools/widget_tool.dart';
import 'package:aku_community_manager/ui/widgets/common/aku_scaffold.dart';
class BorrowItemDetailPage extends StatefulWidget {
final SingleBorrowGoods item;
BorrowItemDetailPage({Key key, this.item}) : super(key: key);
final int id;
BorrowItemDetailPage({Key key, this.id}) : super(key: key);
@override
_BorrowItemDetailPageState createState() => _BorrowItemDetailPageState();
@ -24,10 +30,11 @@ class BorrowItemDetailPage extends StatefulWidget {
class _BorrowItemDetailPageState extends State<BorrowItemDetailPage> {
bool _isEditing = false;
TextEditingController _textEditingController;
BorrowItemDetailModel _detailModel;
@override
void initState() {
super.initState();
_textEditingController = TextEditingController(text: widget.item.name);
_textEditingController = TextEditingController(text: '');
}
@override
@ -45,7 +52,21 @@ class _BorrowItemDetailPageState extends State<BorrowItemDetailPage> {
userProvider.userInfoModel.role == USER_ROLE.MANAGER
? AkuMaterialButton(
minWidth: 120.w,
onPressed: () {
onPressed: () async {
if (_isEditing && _detailModel != null) {
Function cancel = BotToast.showLoading();
await NetUtil().post(
API.manage.borrowEdit,
params: {
'id': _detailModel.id,
'name': _textEditingController.text,
'fileUrls': _detailModel.imgUrls,
},
showMessage: true,
);
await Future.delayed(Duration(milliseconds: 1000));
cancel();
}
setState(() {
_isEditing = !_isEditing;
});
@ -60,7 +81,21 @@ class _BorrowItemDetailPageState extends State<BorrowItemDetailPage> {
)
: SizedBox(),
],
body: ListView(
body: EasyRefresh(
firstRefresh: true,
header: MaterialHeader(),
onRefresh: () async {
BaseModel model = await NetUtil().get(
API.manage.borrowItemDetail,
params: {'articleDetailId': widget.id},
);
_detailModel = BorrowItemDetailModel.fromJson(model.data);
_textEditingController.text = _detailModel.name;
setState(() {});
},
child: _detailModel == null
? SizedBox()
: ListView(
padding: EdgeInsets.symmetric(vertical: 16.w),
children: [
Container(
@ -79,7 +114,8 @@ class _BorrowItemDetailPageState extends State<BorrowItemDetailPage> {
controller: _textEditingController,
enabled: _isEditing,
onChanged: (text) {
widget.item.name = text;
//TODO edit
// widget.item.name = text;
},
decoration: InputDecoration(
border: InputBorder.none,
@ -89,7 +125,7 @@ class _BorrowItemDetailPageState extends State<BorrowItemDetailPage> {
_buildRow(
'物品单号',
Text(
widget.item.code,
_detailModel.code,
style: TextStyle(
color: _isEditing
? AppStyle.minorTextColor
@ -112,18 +148,11 @@ class _BorrowItemDetailPageState extends State<BorrowItemDetailPage> {
)),
_buildRow(
'物品图片',
(widget.item.assetpath is String)
? Image.asset(
widget.item.assetpath,
FadeInImage.assetNetwork(
placeholder: R.ASSETS_PLACEHOLDER_WEBP,
image: API.image(_detailModel.firstImg?.url ?? ''),
height: 184.w,
width: 184.w,
fit: BoxFit.cover,
)
: Image.file(
widget.item.assetpath,
height: 184.w,
width: 184.w,
fit: BoxFit.cover,
),
),
AkuBox.h(28),
@ -132,6 +161,7 @@ class _BorrowItemDetailPageState extends State<BorrowItemDetailPage> {
),
],
),
),
);
}

@ -1,68 +1,80 @@
// Flutter imports:
import 'package:aku_community_manager/const/api.dart';
import 'package:aku_community_manager/models/manager/borrow/borrow_detail_item_model.dart';
import 'package:aku_community_manager/ui/sub_pages/borrow_manager/borrow_item_detail_page.dart';
import 'package:aku_community_manager/ui/widgets/common/bee_list_view.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
// Package imports:
import 'package:aku_ui/common_widgets/aku_material_button.dart';
import 'package:flutter_easyrefresh/easy_refresh.dart';
import 'package:get/get.dart';
import 'package:provider/provider.dart';
// Project imports:
import 'package:aku_community_manager/mock_models/borrow/borrow_model.dart';
import 'package:aku_community_manager/mock_models/users/user_info_model.dart';
import 'package:aku_community_manager/provider/user_provider.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/borrow_manager/add_borrow_item_page.dart';
import 'package:aku_community_manager/ui/sub_pages/borrow_manager/borrow_item_detail_page.dart';
import 'package:aku_community_manager/ui/widgets/common/aku_scaffold.dart';
class BorrowItemPage extends StatefulWidget {
final BorrowObject object;
BorrowItemPage({Key key, @required this.object}) : super(key: key);
final int id;
BorrowItemPage({Key key, @required this.id}) : super(key: key);
@override
_BorrowItemPageState createState() => _BorrowItemPageState();
}
class _BorrowItemPageState extends State<BorrowItemPage> {
EasyRefreshController _refreshController = EasyRefreshController();
@override
Widget build(BuildContext context) {
final userProvider = Provider.of<UserProvider>(context);
return AkuScaffold(
title: '物品查看',
actions: [
userProvider.userInfoModel.role == USER_ROLE.MANAGER
? AkuMaterialButton(
minWidth: 120.w,
onPressed: () {
Get.to(AddBorrowItemPage(object: widget.object));
},
child: Text(
'新增',
style: TextStyle(
fontSize: 28.w,
color: AppStyle.primaryTextColor,
),
),
)
: SizedBox(),
// userProvider.userInfoModel.role == USER_ROLE.MANAGER
// ? AkuMaterialButton(
// minWidth: 120.w,
// onPressed: () {
// // Get.to(AddBorrowItemPage(object: widget.object));
// },
// child: Text(
// '新增',
// style: TextStyle(
// fontSize: 28.w,
// color: AppStyle.primaryTextColor,
// ),
// ),
// )
// : SizedBox(),
],
body: ListView.builder(
body: BeeListView(
path: API.manage.borrowDetailList,
controller: _refreshController,
extraParams: {'articleId': widget.id},
convert: (model) => model.tableList
.map((e) => BorrowDetailItemModel.fromJson(e))
.toList(),
builder: (items) {
return ListView.builder(
padding: EdgeInsets.symmetric(horizontal: 32.w),
itemBuilder: (context, index) {
return _buildCard(widget.object.items[index]);
return _buildCard(items[index]);
},
itemCount: items.length,
);
},
itemCount: widget.object.items.length,
),
);
}
_buildCard(SingleBorrowGoods item) {
_buildCard(BorrowDetailItemModel item) {
final userProvider = Provider.of<UserProvider>(context);
return GestureDetector(
onTap: () {
Get.to(BorrowItemDetailPage(item: item));
Get.to(BorrowItemDetailPage(id: item.id));
},
child: Container(
margin: EdgeInsets.only(top: 16.w),
@ -81,54 +93,54 @@ class _BorrowItemPageState extends State<BorrowItemPage> {
),
),
Spacer(),
userProvider.userInfoModel.role == USER_ROLE.MANAGER
? AkuMaterialButton(
padding: EdgeInsets.symmetric(horizontal: 24.w),
onPressed: () {
showCupertinoDialog(
context: context,
builder: (context) {
return CupertinoAlertDialog(
title: Text('删除物品'),
content: Text('确定要删除${item.name}该物品吗?'),
actions: [
CupertinoDialogAction(
child: Text('取消'),
onPressed: () {
Get.back();
},
),
CupertinoDialogAction(
child: Text('删除'),
onPressed: () {
widget.object.items.remove(item);
setState(() {});
Get.back();
},
),
],
);
},
);
},
child: Row(
children: [
Icon(
Icons.delete,
color: AppStyle.minorTextColor,
size: 40.w,
),
Text(
'删除',
style: TextStyle(
color: AppStyle.minorTextColor,
fontSize: 28.sp,
),
),
],
),
)
: SizedBox(),
// userProvider.userInfoModel.role == USER_ROLE.MANAGER
// ? AkuMaterialButton(
// padding: EdgeInsets.symmetric(horizontal: 24.w),
// onPressed: () {
// showCupertinoDialog(
// context: context,
// builder: (context) {
// return CupertinoAlertDialog(
// title: Text('删除物品'),
// content: Text('确定要删除${item.name}该物品吗?'),
// actions: [
// CupertinoDialogAction(
// child: Text('取消'),
// onPressed: () {
// Get.back();
// },
// ),
// CupertinoDialogAction(
// child: Text('删除'),
// onPressed: () {
// //TODO delete
// setState(() {});
// Get.back();
// },
// ),
// ],
// );
// },
// );
// },
// child: Row(
// children: [
// Icon(
// Icons.delete,
// color: AppStyle.minorTextColor,
// size: 40.w,
// ),
// Text(
// '删除',
// style: TextStyle(
// color: AppStyle.minorTextColor,
// fontSize: 28.sp,
// ),
// ),
// ],
// ),
// )
// : SizedBox(),
],
),
Divider(
@ -141,18 +153,11 @@ class _BorrowItemPageState extends State<BorrowItemPage> {
AkuBox.w(24),
ClipRRect(
borderRadius: BorderRadius.circular(4.w),
child: (item.assetpath is String)
? Image.asset(
item.assetpath,
height: 184.w,
width: 184.w,
fit: BoxFit.cover,
)
: Image.file(
item.assetpath,
child: FadeInImage.assetNetwork(
placeholder: R.ASSETS_PLACEHOLDER_WEBP,
image: API.image(item.firstImg?.url ?? ''),
height: 184.w,
width: 184.w,
fit: BoxFit.cover,
),
),
AkuBox.w(24),
@ -164,7 +169,7 @@ class _BorrowItemPageState extends State<BorrowItemPage> {
_buildRow(
R.ASSETS_MANAGE_BORROW_PNG,
'出借状态',
'未借出',
item.borrowed ? '已出借' : '未借出',
color: AppStyle.secondaryColor,
),
],

@ -1,4 +1,8 @@
// Flutter imports:
import 'package:aku_community_manager/const/api.dart';
import 'package:aku_community_manager/models/manager/borrow/borrow_status_item_model.dart';
import 'package:aku_community_manager/ui/sub_pages/borrow_manager/borrow_manager_check_page.dart';
import 'package:aku_community_manager/utils/network/net_util.dart';
import 'package:flutter/material.dart';
// Package imports:
@ -9,17 +13,14 @@ import 'package:get/get.dart';
import 'package:provider/provider.dart';
import 'package:url_launcher/url_launcher.dart';
// Project imports:
import 'package:aku_community_manager/mock_models/borrow/borrow_model.dart';
import 'package:aku_community_manager/mock_models/users/user_info_model.dart';
import 'package:aku_community_manager/provider/user_provider.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/borrow_manager/borrow_manager_check_page.dart';
import 'package:aku_community_manager/ui/widgets/inner/aku_chip_box.dart';
class BorrowManagerCard extends StatefulWidget {
final BorrowModel model;
final BorrowStatusItemModel model;
BorrowManagerCard({Key key, this.model}) : super(key: key);
@override
@ -46,12 +47,12 @@ class _BorrowManagerCardState extends State<BorrowManagerCard> {
AkuChipBox(title: '借还管理'),
AkuBox.w(24),
Text(
DateUtil.formatDate(widget.model.date),
DateUtil.formatDate(widget.model.create),
style: TextStyle(),
),
Spacer(),
Text(
widget.model.borrowGoods.borrowValue,
widget.model.borrowStatusValue,
style: TextStyle(
color: AppStyle.failColor,
fontWeight: FontWeight.bold,
@ -62,7 +63,7 @@ class _BorrowManagerCardState extends State<BorrowManagerCard> {
),
AkuBox.h(24),
Text(
widget.model.title,
widget.model.articleName,
style: TextStyle(
color: AppStyle.primaryTextColor,
fontSize: 32.sp,
@ -73,40 +74,27 @@ class _BorrowManagerCardState extends State<BorrowManagerCard> {
Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
(widget.model.borrowGoods.assetpath is String)
? Image.asset(
widget.model.borrowGoods.assetpath,
FadeInImage.assetNetwork(
placeholder: R.ASSETS_PLACEHOLDER_WEBP,
image: API.image(widget.model.firstImg?.url ?? ''),
height: 184.w,
width: 183.w,
fit: BoxFit.cover,
)
: Image.file(
widget.model.borrowGoods.assetpath,
height: 184.w,
width: 183.w,
fit: BoxFit.cover,
width: 184.w,
),
AkuBox.w(24),
Expanded(
child: Column(
children: [
_buildRow(R.ASSETS_MESSAGE_IC_PEOPLE_PNG, '借用人员',
widget.model.borrowPerson),
widget.model.borrowName),
_buildRow(R.ASSETS_MESSAGE_IC_PHONE_PNG, '联系电话',
widget.model.phone),
widget.model.borrowTel),
_buildRow(R.ASSETS_MANAGE_IC_TIME_PNG, '借用时常',
'${widget.model.borrowTime}'),
'${(widget.model.borrowTime / 24).toStringAsFixed(0)}'),
_buildRow(
R.ASSETS_MANAGE_INFO_PNG,
'物品状态',
widget.model.goodsStatus == GOODS_STATUS.BROKEN
? '损坏'
: widget.model.goodsStatus == GOODS_STATUS.LOST
? '丢失'
: '正常',
color: widget.model.goodsStatus == GOODS_STATUS.NORMAL
? AppStyle.primaryTextColor
: AppStyle.failColor,
widget.model.statusValue,
color: widget.model.statusColor,
),
],
),
@ -120,9 +108,10 @@ class _BorrowManagerCardState extends State<BorrowManagerCard> {
}
List<Widget> _buildCard() {
if (role != USER_ROLE.MANAGER)
final userProvider = Provider.of<UserProvider>(context);
if (!userProvider.infoModel.canOperation)
return [];
else if (widget.model.borrowGoods.status == BORROW_STATUS.DONE) {
else if (widget.model.borrowStatus == 2) {
return [];
} else
return [
@ -142,7 +131,7 @@ class _BorrowManagerCardState extends State<BorrowManagerCard> {
),
),
onPressed: () {
launch('tel:${widget.model.phone}');
launch('tel:${widget.model.borrowTel}');
},
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(4.w),
@ -150,14 +139,27 @@ class _BorrowManagerCardState extends State<BorrowManagerCard> {
),
),
AkuBox.w(24),
widget.model.borrowGoods.status == BORROW_STATUS.BORROWING
widget.model.borrowStatus == 1
? AkuMaterialButton(
minWidth: 160.w,
height: 64.w,
color: AppStyle.primaryColor,
radius: 4.w,
onPressed: () {
BotToast.showText(text: '已提醒用户');
onPressed: () async {
//TODO unknown param `butlerMessage`
Function cancel = BotToast.showLoading();
await NetUtil().post(
API.manage.remindUserReturn,
params: {
'borrowId': widget.model.id,
'butlerMessage': {
'title': '',
'content': '',
},
},
showMessage: true,
);
cancel();
},
child: Text(
'提醒归还',
@ -169,14 +171,14 @@ class _BorrowManagerCardState extends State<BorrowManagerCard> {
),
)
: SizedBox(),
widget.model.borrowGoods.status == BORROW_STATUS.WAIT_CHECK
widget.model.borrowStatus == 3
? AkuMaterialButton(
minWidth: 160.w,
height: 64.w,
color: AppStyle.primaryColor,
radius: 4.w,
onPressed: () {
Get.to(BorrowManagerCheckPage(model: widget.model));
onPressed: () async {
await Get.to(BorrowManagerCheckPage(id: widget.model.id));
},
child: Text(
'检查信息',

@ -1,5 +1,11 @@
// Flutter imports:
import 'package:aku_community_manager/const/api.dart';
import 'package:aku_community_manager/models/manager/borrow/borrow_check_item_model.dart';
import 'package:aku_community_manager/utils/network/base_model.dart';
import 'package:aku_community_manager/utils/network/net_util.dart';
import 'package:bot_toast/bot_toast.dart';
import 'package:flutter/material.dart';
import 'package:flutter_easyrefresh/easy_refresh.dart';
// Package imports:
import 'package:get/get.dart';
@ -12,28 +18,55 @@ import 'package:aku_community_manager/ui/widgets/common/aku_scaffold.dart';
import 'package:aku_community_manager/ui/widgets/inner/aku_bottom_button.dart';
class BorrowManagerCheckPage extends StatefulWidget {
final BorrowModel model;
BorrowManagerCheckPage({Key key, @required this.model}) : super(key: key);
final int id;
BorrowManagerCheckPage({Key key, @required this.id}) : super(key: key);
@override
_BorrowManagerCheckPageState createState() => _BorrowManagerCheckPageState();
}
class _BorrowManagerCheckPageState extends State<BorrowManagerCheckPage> {
GOODS_STATUS borrowStatus = GOODS_STATUS.NORMAL;
int borrowStatus = 1;
BorrowCheckItemModel _model;
@override
Widget build(BuildContext context) {
return AkuScaffold(
title: '检查物品',
bottom: AkuBottomButton(
title: '确认归还',
onTap: () {
widget.model.goodsStatus = borrowStatus;
widget.model.borrowGoods.status = BORROW_STATUS.DONE;
Get.back();
onTap: () async {
Function cancel = BotToast.showLoading();
await NetUtil().post(
API.manage.borrowCheck,
params: {
'articleBorrowId': widget.id,
'articleStatus': borrowStatus,
},
showMessage: true,
);
cancel();
Get.back(result: true);
},
),
body: ListView(
body: EasyRefresh(
firstRefresh: true,
onRefresh: () async {
BaseModel model = await NetUtil().get(
API.manage.borrowCheckInfo,
params: {'articleBorrowId': widget.id},
showMessage: true,
);
if (model.data == null) {
// Get.back();
return;
}
_model = BorrowCheckItemModel.fromJson(model.data);
setState(() {});
},
header: MaterialHeader(),
child: _model == null
? SizedBox()
: ListView(
padding: EdgeInsets.symmetric(vertical: 16.w),
children: [
Container(
@ -44,7 +77,7 @@ class _BorrowManagerCheckPageState extends State<BorrowManagerCheckPage> {
_buildRow(
'物品名称',
Text(
widget.model.borrowGoods.name,
_model.articleName,
style: TextStyle(
color: AppStyle.primaryTextColor,
fontSize: 28.sp,
@ -56,7 +89,7 @@ class _BorrowManagerCheckPageState extends State<BorrowManagerCheckPage> {
_buildRow(
'物品单号',
Text(
widget.model.borrowGoods.code,
_model.code,
style: TextStyle(
color: AppStyle.primaryTextColor,
fontSize: 28.sp,
@ -80,11 +113,11 @@ class _BorrowManagerCheckPageState extends State<BorrowManagerCheckPage> {
'物品情况',
Row(
children: [
_buildCard(GOODS_STATUS.NORMAL),
_buildCard(1),
AkuBox.w(24),
_buildCard(GOODS_STATUS.BROKEN),
_buildCard(2),
AkuBox.w(24),
_buildCard(GOODS_STATUS.LOST),
_buildCard(3),
],
),
),
@ -92,18 +125,11 @@ class _BorrowManagerCheckPageState extends State<BorrowManagerCheckPage> {
AkuBox.h(16),
_buildRow(
'物品图片',
(widget.model.borrowGoods.assetpath is String)
? Image.asset(
widget.model.borrowGoods.assetpath,
FadeInImage.assetNetwork(
placeholder: R.ASSETS_PLACEHOLDER_WEBP,
image: API.image(_model.firstImg?.url ?? ''),
height: 184.w,
width: 184.w,
fit: BoxFit.cover,
)
: Image.file(
widget.model.borrowGoods.assetpath,
height: 184.w,
width: 184.w,
fit: BoxFit.cover,
),
),
AkuBox.h(28),
@ -112,6 +138,7 @@ class _BorrowManagerCheckPageState extends State<BorrowManagerCheckPage> {
),
],
),
),
);
}
@ -137,7 +164,7 @@ class _BorrowManagerCheckPageState extends State<BorrowManagerCheckPage> {
);
}
_buildCard(GOODS_STATUS status) {
_buildCard(int status) {
return GestureDetector(
onTap: () {
borrowStatus = status;
@ -148,9 +175,9 @@ class _BorrowManagerCheckPageState extends State<BorrowManagerCheckPage> {
width: 112.w,
child: Text(
{
GOODS_STATUS.NORMAL: '完好',
GOODS_STATUS.BROKEN: '损坏',
GOODS_STATUS.LOST: '丢失',
1: '完好',
2: '损坏',
3: '丢失',
}[status],
style: TextStyle(
color: borrowStatus == status

@ -1,4 +1,5 @@
// Flutter imports:
import 'package:aku_community_manager/ui/sub_pages/borrow_manager/borrow_manager_view.dart';
import 'package:flutter/material.dart';
// Package imports:
@ -30,12 +31,13 @@ class _BorrowManagerPageState extends State<BorrowManagerPage>
Provider.of<UserProvider>(context, listen: false).userInfoModel.role;
TabController _tabController;
List<String> get _tabs {
switch (role) {
case USER_ROLE.MANAGER:
return ['全部', '出借中', '待检查', '已归还'];
default:
return ['全部', '出借中', '已归还'];
}
final userProvider = Provider.of<UserProvider>(context, listen: false);
return [
'全部',
'出借中',
...userProvider.infoModel.canOperation ? ['待检查'] : [],
'已归还'
];
}
@override
@ -77,32 +79,14 @@ class _BorrowManagerPageState extends State<BorrowManagerPage>
}
List<Widget> _getChildren() {
switch (role) {
case USER_ROLE.MANAGER:
final userProvider = Provider.of<UserProvider>(context);
return [
getView(BorrowData.models),
getView(BorrowData.borrowModels),
getView(BorrowData.checkModels),
getView(BorrowData.doneModels),
BorrowManagerView(),
BorrowManagerView(status: 1),
...userProvider.infoModel.canOperation
? [BorrowManagerView(status: 3)]
: [],
BorrowManagerView(status: 2),
];
break;
default:
return [
getView(BorrowData.models),
getView(BorrowData.borrowModels),
getView(BorrowData.doneModels),
];
}
}
}
Widget getView(List<BorrowModel> models) {
return ListView.builder(
itemBuilder: (context, index) {
return BorrowManagerCard(
model: models[index],
);
},
itemCount: models.length,
);
}

@ -0,0 +1,42 @@
import 'package:aku_community_manager/const/api.dart';
import 'package:aku_community_manager/models/manager/borrow/borrow_status_item_model.dart';
import 'package:aku_community_manager/ui/sub_pages/borrow_manager/borrow_manager_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';
class BorrowManagerView extends StatefulWidget {
final int status;
BorrowManagerView({Key key, this.status}) : super(key: key);
@override
_BorrowManagerViewState createState() => _BorrowManagerViewState();
}
class _BorrowManagerViewState extends State<BorrowManagerView>
with AutomaticKeepAliveClientMixin {
EasyRefreshController _refreshController = EasyRefreshController();
@override
Widget build(BuildContext context) {
super.build(context);
return BeeListView(
path: API.manage.borrowStatusList,
extraParams: {'borrowStatus': widget.status},
controller: _refreshController,
convert: (model) => model.tableList
.map((e) => BorrowStatusItemModel.fromJson(e))
.toList(),
builder: (items) {
return ListView.builder(
itemBuilder: (context, index) {
return BorrowManagerCard(model: items[index]);
},
itemCount: items.length,
);
},
);
}
@override
bool get wantKeepAlive => true;
}

@ -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<ItemsOutdoorCard> {
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,35 +30,9 @@ class _ItemsOutdoorCardState extends State<ItemsOutdoorCard> {
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(
child: Column(
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(
Container(
alignment: Alignment.centerLeft,
height: 88.w,
width: double.infinity,
@ -86,8 +43,7 @@ class _ItemsOutdoorCardState extends State<ItemsOutdoorCard> {
width: 112.w,
height: 40.w,
decoration: BoxDecoration(
border:
Border.all(color: Color(0xFF3F8FFE), width: 2.w),
border: Border.all(color: Color(0xFF3F8FFE), width: 2.w),
),
child: Text(
'物品出户',
@ -98,22 +54,22 @@ class _ItemsOutdoorCardState extends State<ItemsOutdoorCard> {
),
),
AkuBox.w(16),
Text(
_datetime,
style: TextStyle(
color: AppStyle.minorTextColor,
fontSize: 22.sp,
),
),
//TODO
// Text(
// widget.model.create,
// style: TextStyle(
// color: AppStyle.minorTextColor,
// fontSize: 22.sp,
// ),
// ),
Spacer(),
Text(
ItemsOutdoorModel.outdoorStatusMap[_cardModel.status],
widget.model.statusValue,
style: TextStyle(
color: _cardModel.status == OUTDOORSTATUS.CANCELLATION
? Color(0xFF999999)
: Color(0xFFFF4501),
color: widget.model.statusColor,
fontSize: 24.sp,
fontWeight: FontWeight.bold),
fontWeight: FontWeight.bold,
),
),
],
),
@ -131,8 +87,9 @@ class _ItemsOutdoorCardState extends State<ItemsOutdoorCard> {
style: _textStyle,
),
Spacer(),
//TODO
Text(
_cardModel.communityname,
'XXXXXX',
style: AppStyle().primaryStyle,
),
],
@ -149,7 +106,7 @@ class _ItemsOutdoorCardState extends State<ItemsOutdoorCard> {
Text('详细地址', style: _textStyle),
Spacer(),
Text(
_cardModel.adress,
widget.model.roomName,
style: AppStyle().primaryStyle,
),
],
@ -169,7 +126,7 @@ class _ItemsOutdoorCardState extends State<ItemsOutdoorCard> {
),
Spacer(),
Text(
_cardModel.name,
widget.model.applicantName,
style: AppStyle().primaryStyle,
),
],
@ -189,7 +146,7 @@ class _ItemsOutdoorCardState extends State<ItemsOutdoorCard> {
),
Spacer(),
Text(
_cardModel.identify,
widget.model.identityValue,
style: AppStyle().primaryStyle,
),
],
@ -208,7 +165,7 @@ class _ItemsOutdoorCardState extends State<ItemsOutdoorCard> {
),
Spacer(),
Text(
_cardModel.items.itemname,
widget.model.articleOutName,
style: AppStyle().primaryStyle,
),
],
@ -228,7 +185,7 @@ class _ItemsOutdoorCardState extends State<ItemsOutdoorCard> {
),
Spacer(),
Text(
_cardModel.outtime,
widget.model.expectedTime,
style: AppStyle().primaryStyle,
),
],
@ -237,38 +194,12 @@ class _ItemsOutdoorCardState extends State<ItemsOutdoorCard> {
Divider(
height: 1.w,
),
widget.isdetail
? AkuButton(
onPressed: () {},
child: 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)),
],
),
),
)
: Container(
Container(
height: 112.w,
alignment: Alignment.centerRight,
child: AkuButton(
onPressed: () {
Get.to(ItemsOutdoorDetailsPage(
cardMedel: _cardModel,
));
Get.to(ItemsOutdoorDetailsPage(id: widget.model.id));
},
child: Container(
alignment: Alignment.center,
@ -279,10 +210,7 @@ class _ItemsOutdoorCardState extends State<ItemsOutdoorCard> {
gradient: LinearGradient(
begin: Alignment.topLeft,
end: Alignment.bottomRight,
colors: [
AppStyle.primaryColor,
AppStyle.minorColor
])),
colors: [AppStyle.primaryColor, AppStyle.minorColor])),
child: Text(
'查看详情',
style: AppStyle().primaryStyle,
@ -290,7 +218,8 @@ class _ItemsOutdoorCardState extends State<ItemsOutdoorCard> {
),
),
),
]),
],
),
);
}
}

@ -1,29 +1,33 @@
// 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';
// 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/mock_models/users/user_info_model.dart';
import 'package:aku_community_manager/provider/user_provider.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_card.dart';
import 'package:aku_community_manager/ui/sub_pages/items_outdoor/outdoor_notpass_page.dart';
import 'package:aku_community_manager/ui/sub_pages/items_outdoor/outdoor_pass_page.dart';
import 'package:aku_community_manager/ui/widgets/common/aku_scaffold.dart';
import 'package:url_launcher/url_launcher.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,18 +35,128 @@ class ItemsOutdoorDetailsPage extends StatefulWidget {
}
class _ItemsOutdoorDetailsPageState extends State<ItemsOutdoorDetailsPage> {
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<UserProvider>(context, listen: false);
USER_ROLE userRole = _userprovider.userInfoModel.role;
return AkuScaffold(
title: '出户详情',
body: ListView(
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),
...<Widget>[
_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)),
],
),
),
Divider(height: 1.w),
MaterialButton(
onPressed: () {
launch('tel:${_model.applicantTel}');
},
elevation: 0,
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
ItemsOutdoorCard(
cardModel: widget.cardMedel,
isdetail: true,
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,
),
),
],
),
color: Colors.white,
height: 96.w,
materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,
),
Container(
color: Color(0xFFFFFFFF),
@ -71,7 +185,7 @@ class _ItemsOutdoorDetailsPageState extends State<ItemsOutdoorDetailsPage> {
),
Spacer(),
Text(
widget.cardMedel.items.itemname,
_model.articleOutName ?? '',
style: AppStyle().primaryStyle,
),
],
@ -91,9 +205,7 @@ class _ItemsOutdoorDetailsPageState extends State<ItemsOutdoorDetailsPage> {
),
Spacer(),
Text(
widget.cardMedel.items.weight < 50.0
? '<50kg'
: '${widget.cardMedel.items.weight}kg',
_model.weightValue,
style: AppStyle().primaryStyle,
),
],
@ -113,7 +225,7 @@ class _ItemsOutdoorDetailsPageState extends State<ItemsOutdoorDetailsPage> {
),
Spacer(),
Text(
widget.cardMedel.items.way,
_model.approachValue,
style: AppStyle().primaryStyle,
)
],
@ -137,12 +249,13 @@ class _ItemsOutdoorDetailsPageState extends State<ItemsOutdoorDetailsPage> {
AkuBox.h(16),
Wrap(
spacing: 16.w,
children: widget.cardMedel.items.imagepath
children: _model.imgUrls
.map(
(e) => ClipRRect(
borderRadius: BorderRadius.circular(4.w),
child: Image.asset(
e,
child: FadeInImage.assetNetwork(
placeholder: R.ASSETS_PLACEHOLDER_WEBP,
image: API.image(e?.url ?? ''),
width: 218.w,
height: 218.w,
)),
@ -154,14 +267,16 @@ class _ItemsOutdoorDetailsPageState extends State<ItemsOutdoorDetailsPage> {
),
],
),
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<UserProvider>(context);
switch (_model.status) {
case 1:
return userProvider.infoModel.canPass
? Container(
height: 98.w,
decoration: BoxDecoration(
@ -181,9 +296,7 @@ class _ItemsOutdoorDetailsPageState extends State<ItemsOutdoorDetailsPage> {
children: [
AkuButton(
onPressed: () {
Get.to(OutdoorNotpassPage(
model: widget.cardMedel,
));
Get.to(OutdoorNotpassPage(id: _model.id));
},
child: Container(
width: 304.w,
@ -203,9 +316,7 @@ class _ItemsOutdoorDetailsPageState extends State<ItemsOutdoorDetailsPage> {
Spacer(),
AkuMaterialButton(
onPressed: () {
Get.to(OutdoorPassPage(
model: widget.cardMedel,
));
Get.to(OutdoorPassPage(id: _model.id));
},
radius: 4.w,
color: Color(0xFFFFC40C),
@ -221,7 +332,7 @@ class _ItemsOutdoorDetailsPageState extends State<ItemsOutdoorDetailsPage> {
)
: SizedBox();
break;
case OUTDOORSTATUS.OUT_DONE:
case 2:
return Container(
height: 226.w,
color: Color(0xFFFFFFFF),
@ -247,7 +358,10 @@ class _ItemsOutdoorDetailsPageState extends State<ItemsOutdoorDetailsPage> {
),
Spacer(),
Text(
widget.cardMedel.finalOutTime,
DateUtil.formatDate(
_model.expected,
format: 'yyyy-MM-dd HH:mm',
),
style: AppStyle().primaryStyle,
),
],
@ -267,7 +381,7 @@ class _ItemsOutdoorDetailsPageState extends State<ItemsOutdoorDetailsPage> {
),
Spacer(),
Text(
widget.cardMedel.outPlace,
_model.exportValue,
style: AppStyle().primaryStyle,
),
],
@ -276,7 +390,7 @@ class _ItemsOutdoorDetailsPageState extends State<ItemsOutdoorDetailsPage> {
),
);
break;
case OUTDOORSTATUS.REJECTED:
case 3:
return Container(
height: 226.w,
color: Color(0xFFFFFFFF),
@ -302,7 +416,10 @@ class _ItemsOutdoorDetailsPageState extends State<ItemsOutdoorDetailsPage> {
),
Spacer(),
Text(
widget.cardMedel.finalOutTime,
DateUtil.formatDate(
_model.expected,
format: 'yyyy-MM-dd HH:mm',
),
style: AppStyle().primaryStyle,
),
],
@ -321,11 +438,13 @@ class _ItemsOutdoorDetailsPageState extends State<ItemsOutdoorDetailsPage> {
style: AppStyle().secondaryTextStyle,
),
Spacer(),
Text(widget.cardMedel.rejectReason,
Text(
_model.remarks,
style: TextStyle(
color: Color(0xFFFF4501),
fontSize: 28.sp,
fontWeight: FontWeight.bold)),
fontWeight: FontWeight.bold),
),
],
),
],

@ -1,14 +1,12 @@
// Flutter imports:
import 'package:aku_community_manager/ui/sub_pages/items_outdoor/items_outdoor_view.dart';
import 'package:flutter/material.dart';
import 'package:flutter_easyrefresh/easy_refresh.dart';
// Package imports:
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:provider/provider.dart';
// Project imports:
import 'package:aku_community_manager/mock_models/outdoor_models/outdoor_model.dart';
import 'package:aku_community_manager/provider/outdoor_provider.dart';
import 'package:aku_community_manager/ui/sub_pages/items_outdoor/items_outdoor_card.dart';
import 'package:aku_community_manager/ui/widgets/common/aku_scaffold.dart';
import 'package:aku_community_manager/ui/widgets/inner/aku_tab_bar.dart';
@ -23,6 +21,7 @@ class _ItemsOutdoorPageState extends State<ItemsOutdoorPage>
with TickerProviderStateMixin {
List<String> _tabs = ['待出户', '已出户', '已驳回', '已作废', '全部'];
TabController _tabController;
EasyRefreshController _refreshController = EasyRefreshController();
@override
void initState() {
super.initState();
@ -45,23 +44,14 @@ class _ItemsOutdoorPageState extends State<ItemsOutdoorPage>
),
body: TabBarView(
controller: _tabController,
children:
_tabs.map((e) => _buildListView(_tabs.indexOf(e))).toList()),
);
}
Widget _buildListView(int index) {
final _outdoorModels = Provider.of<OutdoorProvider>(context);
List<ItemsOutdoorModel> _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(),
children: [
ItemsOutdoorView(status: 1),
ItemsOutdoorView(status: 2),
ItemsOutdoorView(status: 3),
ItemsOutdoorView(status: 4),
ItemsOutdoorView(status: null),
],
),
);
}
}

@ -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<ItemsOutdoorView>
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;
}

@ -1,4 +1,7 @@
// Flutter imports:
import 'package:aku_community_manager/const/api.dart';
import 'package:aku_community_manager/utils/network/net_util.dart';
import 'package:bot_toast/bot_toast.dart';
import 'package:flutter/material.dart';
// Package imports:
@ -7,15 +10,14 @@ import 'package:common_utils/common_utils.dart';
import 'package:get/get.dart';
// Project imports:
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/widgets/common/aku_radio.dart';
import 'package:aku_community_manager/ui/widgets/common/aku_scaffold.dart';
class OutdoorNotpassPage extends StatefulWidget {
final ItemsOutdoorModel model;
OutdoorNotpassPage({Key key, @required this.model}) : super(key: key);
final int id;
OutdoorNotpassPage({Key key, @required this.id}) : super(key: key);
@override
_OutdoorNotpassPageState createState() => _OutdoorNotpassPageState();
@ -185,13 +187,23 @@ class _OutdoorNotpassPageState extends State<OutdoorNotpassPage> {
],
),
bottom: AkuButton(
onPressed: () {
widget.model.finalOutTime = _currentTime;
widget.model.datetime = DateTime.now();
_select == 3
? widget.model.rejectReason = _textEditingController.text
: widget.model.rejectReason = _rejectReason[_select];
widget.model.status = OUTDOORSTATUS.REJECTED;
onPressed: () async {
Function cancel = BotToast.showLoading();
String remark = '';
if (_select <= 2) {
remark = _rejectReason[_select];
} else {
remark = _textEditingController.text;
}
await NetUtil().post(
API.manage.goodsOutNotRelease,
params: {
'id': widget.id,
'remarks': remark,
},
showMessage: true,
);
cancel();
Get.back();
Get.back();
},

@ -1,4 +1,6 @@
// Flutter imports:
import 'package:aku_community_manager/const/api.dart';
import 'package:aku_community_manager/utils/network/net_util.dart';
import 'package:flutter/material.dart';
// Package imports:
@ -9,36 +11,25 @@ import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
// Project imports:
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/widgets/common/aku_scaffold.dart';
class OutdoorPassPage extends StatefulWidget {
final ItemsOutdoorModel model;
OutdoorPassPage({Key key, @required this.model}) : super(key: key);
final int id;
OutdoorPassPage({Key key, this.id}) : super(key: key);
@override
_OutdoorPassPageState createState() => _OutdoorPassPageState();
}
class _OutdoorPassPageState extends State<OutdoorPassPage> {
TextEditingController _textController;
@override
void initState() {
super.initState();
_textController = TextEditingController();
}
@override
void dispose() {
_textController?.dispose();
super.dispose();
}
int _doorValue;
@override
Widget build(BuildContext context) {
String _currentTime = DateUtil.formatDate(DateTime.now());
String _currentTime =
DateUtil.formatDate(DateTime.now(), format: 'yyyy-MM-dd HH:mm');
return AkuScaffold(
title: '放行',
@ -86,21 +77,34 @@ class _OutdoorPassPageState extends State<OutdoorPassPage> {
),
AkuBox.w(32),
Expanded(
child: PopupMenuButton(
itemBuilder: (context) {
return [
PopupMenuItem(child: Text('东门'), value: 1),
PopupMenuItem(child: Text('南门'), value: 2),
PopupMenuItem(child: Text('西门'), value: 3),
PopupMenuItem(child: Text('北门'), value: 4),
];
},
onSelected: (value) {
_doorValue = value;
setState(() {});
},
child: Container(
height: double.infinity,
width: double.infinity,
padding: EdgeInsets.only(left: 48.w),
child: TextFormField(
controller: _textController,
maxLines: 1,
style: TextStyle(
color: AppStyle.primaryTextColor,
fontSize: 32.sp,
child: Text(
_doorValue == null
? '请输入当前入口'
: {
1: '东门',
2: '南门',
3: '西门',
4: '北门',
}[_doorValue],
style: _doorValue == null
? AppStyle().secondaryTextStyle
: AppStyle().primaryStyle,
),
decoration: InputDecoration(
hintText: '请输入当前入口',
hintStyle: AppStyle().secondaryTextStyle,
border: InputBorder.none),
),
),
),
@ -110,15 +114,21 @@ class _OutdoorPassPageState extends State<OutdoorPassPage> {
],
),
bottom: AkuButton(
onPressed: _textController.text == null
onPressed: _doorValue == null
? () {
BotToast.showText(text: '出口不能为空!');
}
: () {
widget.model.finalOutTime = _currentTime;
widget.model.outPlace = _textController.text;
widget.model.datetime = DateTime.now();
widget.model.status = OUTDOORSTATUS.OUT_DONE;
: () async {
Function cancel = BotToast.showLoading();
NetUtil().post(
API.manage.goodsOutRelease,
params: {
'id': widget.id,
'export': _doorValue,
},
showMessage: true,
);
cancel();
Get.back();
Get.back();
},

@ -54,6 +54,7 @@ class _WarningPageState extends State<WarningPage> {
showScaleControl: false,
onMapCreated: (controller) async {
_amapController = controller;
_amapController.showMyLocation(MyLocationOption());
_getLocation();
},
),

@ -27,6 +27,7 @@ class AkuAvatar extends StatelessWidget {
image: API.image(userProvider.profileModel.firstImg?.url ?? ''),
height: size ?? 72.w,
width: size ?? 72.w,
fit: BoxFit.cover,
),
)
: CircleAvatar(

@ -3,6 +3,7 @@ import 'dart:io';
// Package imports:
import 'package:aku_community_manager/provider/user_provider.dart';
import 'package:aku_community_manager/ui/home/home_page.dart';
import 'package:aku_community_manager/ui/login/login_page.dart';
import 'package:bot_toast/bot_toast.dart';
import 'package:dio/dio.dart';
@ -37,7 +38,6 @@ class NetUtil {
onRequest: (RequestOptions options) async => options,
onResponse: (Response response) async {
LoggerData.addData(response);
print(response.headers);
return response;
},
onError: (DioError error) async {
@ -148,6 +148,7 @@ class NetUtil {
}
_parseErr(DioError err) {
final userProvider = Provider.of<UserProvider>(Get.context, listen: false);
LoggerData.addData(err);
_makeToast(String message) {
BotToast.showText(text: '$message\_${err?.response?.statusCode ?? ''}');

@ -192,6 +192,20 @@ packages:
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.3.5"
device_info:
dependency: transitive
description:
name: device_info
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.0.0"
device_info_platform_interface:
dependency: transitive
description:
name: device_info_platform_interface
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.0.1"
dio:
dependency: "direct main"
description:
@ -464,6 +478,13 @@ packages:
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.9.3"
package_info:
dependency: transitive
description:
name: package_info
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.4.3+4"
path:
dependency: transitive
description:
@ -554,7 +575,7 @@ packages:
name: power_logger
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.1.0"
version: "0.1.1"
pretty_json:
dependency: transitive
description:

@ -51,7 +51,7 @@ dependencies:
dio:
power_logger: ^0.1.0
power_logger: ^0.1.1
logger: ^0.9.4
aku_ui:
git:

Loading…
Cancel
Save