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 _Auth auth = _Auth();
static _User user = _User(); static _User user = _User();
static _Manage manage = _Manage(); static _Manage manage = _Manage();
static _Upload upload = _Upload();
} }
class _Auth { class _Auth {
@ -41,8 +42,10 @@ class _User {
String get sendTelUpdateCode => '/user/personalData/sendTelUpdateCode'; String get sendTelUpdateCode => '/user/personalData/sendTelUpdateCode';
/// ///
String get updateTel =>'/user/personalData/updateTel'; String get updateTel => '/user/personalData/updateTel';
///
String get updateAvatar => '/user/personalData/updateHeadPortrait';
} }
class _Manage { class _Manage {
@ -87,4 +90,44 @@ class _Manage {
/// ///
String get handleResult => '/user/repair/handleResult'; 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/app_provider.dart';
import 'package:aku_community_manager/provider/fix_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/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/provider/user_provider.dart';
import 'package:aku_community_manager/ui/splash/splash_page.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) => FixProvider()),
ChangeNotifierProvider(create: (context) => GreenManageProvider()), ChangeNotifierProvider(create: (context) => GreenManageProvider()),
ChangeNotifierProvider(create: (context) => InspectionManageProvider()), ChangeNotifierProvider(create: (context) => InspectionManageProvider()),
ChangeNotifierProvider(create: (context) => OutdoorProvider()),
ChangeNotifierProvider(create: (context) => GreenManageProvider()), ChangeNotifierProvider(create: (context) => GreenManageProvider()),
ChangeNotifierProvider(create: (context) => InspectionManageProvider()), ChangeNotifierProvider(create: (context) => InspectionManageProvider()),
ChangeNotifierProvider(create: (context) => AnouncementProvider()), ChangeNotifierProvider(create: (context) => AnouncementProvider()),

@ -2,6 +2,8 @@
import 'package:aku_community_manager/const/resource.dart'; import 'package:aku_community_manager/const/resource.dart';
import 'package:aku_community_manager/mock_models/borrow/borrow_model.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 { class BorrowData {
static List<BorrowModel> get checkModels => models.where((e) { static List<BorrowModel> get checkModels => models.where((e) {
return e.borrowGoods.status == BORROW_STATUS.WAIT_CHECK; return e.borrowGoods.status == BORROW_STATUS.WAIT_CHECK;

@ -24,6 +24,8 @@ enum GOODS_STATUS {
LOST, LOST,
} }
//TODO CLEAN BOTTOM CODES.
@Deprecated(" borrow_model need to be cleaned.")
class BorrowModel { class BorrowModel {
String borrowPerson; String borrowPerson;
String phone; 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'; import 'dart:io';
// Flutter imports: // 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'; import 'package:flutter/material.dart';
// Project imports: // Project imports:
@ -87,20 +89,34 @@ class UserProvider extends ChangeNotifier {
_isSigned = true; _isSigned = true;
notifyListeners(); notifyListeners();
} }
///
///
setNickName(String name) { setNickName(String name) {
_infoModel.nickName = name; _infoModel.nickName = name;
notifyListeners(); notifyListeners();
} }
setAvatar(File file) { ///
_userInfoModel.avatar = file; setAvatar(File file) async {
notifyListeners(); 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){ setTel(String tel) {
_profileModel.tel=tel; _profileModel.tel = tel;
notifyListeners(); notifyListeners();
} }
} }

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

@ -50,6 +50,8 @@ class _SplashPageState extends State<SplashPage> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
ScreenUtil.init(context,
designSize: Size(750, 1334), allowFontScaling: true);
return Scaffold( return Scaffold(
body: Center( body: Center(
child: Image.asset(R.ASSETS_PLACEHOLDER_WEBP), child: Image.asset(R.ASSETS_PLACEHOLDER_WEBP),

@ -1,20 +1,17 @@
// Flutter imports: // 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'; import 'package:flutter/material.dart';
// Package imports: // 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:get/get.dart';
import 'package:provider/provider.dart';
// Project imports: // Project imports:
import 'package:aku_community_manager/const/resource.dart'; 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/style/app_style.dart';
import 'package:aku_community_manager/tools/widget_tool.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/sub_pages/borrow_manager/borrow_items_page.dart';
import 'package:aku_community_manager/ui/widgets/common/aku_scaffold.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> { class _AllBorrowGoodsState extends State<AllBorrowGoods> {
EasyRefreshController _refreshController = EasyRefreshController();
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final userProvider = Provider.of<UserProvider>(context);
return AkuScaffold( return AkuScaffold(
title: '全部物品', title: '全部物品',
actions: [ actions: [
userProvider.userInfoModel.role == USER_ROLE.MANAGER // userProvider.userInfoModel.role == USER_ROLE.MANAGER
? AkuMaterialButton( // ? AkuMaterialButton(
minWidth: 120.w, // minWidth: 120.w,
onPressed: () { // onPressed: () {
Get.to(AddBorrowObjectPage()); // Get.to(AddBorrowObjectPage());
}, // },
child: Text( // child: Text(
'新增', // '新增',
style: TextStyle( // style: TextStyle(
fontSize: 28.w, // fontSize: 28.w,
color: AppStyle.primaryTextColor, // color: AppStyle.primaryTextColor,
), // ),
), // ),
) // )
: SizedBox(), // : SizedBox(),
], ],
body: ListView.builder( body: BeeListView(
padding: EdgeInsets.symmetric( path: API.manage.borrowList,
horizontal: 32.w, controller: _refreshController,
), convert: (model) =>
itemBuilder: (context, index) { model.tableList.map((e) => BorrowItemModel.fromJson(e)).toList(),
return _buildCard(BorrowData.borrowObjects[index]); builder: (items) {
return ListView.builder(
padding: EdgeInsets.symmetric(
horizontal: 32.w,
),
itemBuilder: (context, index) {
return _buildCard(items[index]);
},
itemCount: items.length,
);
}, },
itemCount: BorrowData.borrowObjects.length,
), ),
); );
} }
_buildCard(BorrowObject object) { _buildCard(BorrowItemModel object) {
return GestureDetector( return GestureDetector(
onTap: () => Get.to(BorrowItemPage(object: object)), onTap: () => Get.to(BorrowItemPage(id: object.id)),
child: Container( child: Container(
padding: EdgeInsets.all(24.w), padding: EdgeInsets.all(24.w),
margin: EdgeInsets.only(top: 16.w), margin: EdgeInsets.only(top: 16.w),
@ -70,19 +75,12 @@ class _AllBorrowGoodsState extends State<AllBorrowGoods> {
children: [ children: [
ClipRRect( ClipRRect(
borderRadius: BorderRadius.circular(4.w), borderRadius: BorderRadius.circular(4.w),
child: (object.assetPath is String) child: FadeInImage.assetNetwork(
? Image.asset( placeholder: R.ASSETS_PLACEHOLDER_WEBP,
object.assetPath, image: API.image(object.firstImg?.url ?? ''),
width: 184.w, height: 184.w,
height: 184.w, width: 184.w,
fit: BoxFit.cover, ),
)
: Image.file(
object.assetPath,
width: 184.w,
height: 184.w,
fit: BoxFit.cover,
),
), ),
AkuBox.w(24), AkuBox.w(24),
Expanded( Expanded(
@ -91,10 +89,10 @@ class _AllBorrowGoodsState extends State<AllBorrowGoods> {
_buildRow(R.ASSETS_MANAGE_ARTICLE_PNG, '物品名称', object.name), _buildRow(R.ASSETS_MANAGE_ARTICLE_PNG, '物品名称', object.name),
AkuBox.h(12), AkuBox.h(12),
_buildRow(R.ASSETS_MANAGE_BORROW_PNG, '借出数量', _buildRow(R.ASSETS_MANAGE_BORROW_PNG, '借出数量',
object.borrowNumber.toString()), object.borrowNum.toString()),
AkuBox.h(12), AkuBox.h(12),
_buildRow(R.ASSETS_MANAGE_REMAINING_PNG, '剩余数量', _buildRow(R.ASSETS_MANAGE_REMAINING_PNG, '剩余数量',
object.items.length.toString()), object.remainingNum.toString()),
], ],
)), )),
], ],

@ -1,8 +1,14 @@
// Flutter imports: // 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'; import 'package:flutter/material.dart';
// Package imports: // Package imports:
import 'package:aku_ui/common_widgets/aku_material_button.dart'; import 'package:aku_ui/common_widgets/aku_material_button.dart';
import 'package:flutter_easyrefresh/easy_refresh.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
// Project imports: // 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'; import 'package:aku_community_manager/ui/widgets/common/aku_scaffold.dart';
class BorrowItemDetailPage extends StatefulWidget { class BorrowItemDetailPage extends StatefulWidget {
final SingleBorrowGoods item; final int id;
BorrowItemDetailPage({Key key, this.item}) : super(key: key); BorrowItemDetailPage({Key key, this.id}) : super(key: key);
@override @override
_BorrowItemDetailPageState createState() => _BorrowItemDetailPageState(); _BorrowItemDetailPageState createState() => _BorrowItemDetailPageState();
@ -24,10 +30,11 @@ class BorrowItemDetailPage extends StatefulWidget {
class _BorrowItemDetailPageState extends State<BorrowItemDetailPage> { class _BorrowItemDetailPageState extends State<BorrowItemDetailPage> {
bool _isEditing = false; bool _isEditing = false;
TextEditingController _textEditingController; TextEditingController _textEditingController;
BorrowItemDetailModel _detailModel;
@override @override
void initState() { void initState() {
super.initState(); super.initState();
_textEditingController = TextEditingController(text: widget.item.name); _textEditingController = TextEditingController(text: '');
} }
@override @override
@ -45,7 +52,21 @@ class _BorrowItemDetailPageState extends State<BorrowItemDetailPage> {
userProvider.userInfoModel.role == USER_ROLE.MANAGER userProvider.userInfoModel.role == USER_ROLE.MANAGER
? AkuMaterialButton( ? AkuMaterialButton(
minWidth: 120.w, 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(() { setState(() {
_isEditing = !_isEditing; _isEditing = !_isEditing;
}); });
@ -60,77 +81,86 @@ class _BorrowItemDetailPageState extends State<BorrowItemDetailPage> {
) )
: SizedBox(), : SizedBox(),
], ],
body: ListView( body: EasyRefresh(
padding: EdgeInsets.symmetric(vertical: 16.w), firstRefresh: true,
children: [ header: MaterialHeader(),
Container( onRefresh: () async {
color: Colors.white, BaseModel model = await NetUtil().get(
padding: EdgeInsets.symmetric(horizontal: 32.w), API.manage.borrowItemDetail,
child: Column( params: {'articleDetailId': widget.id},
children: [ );
_buildRow( _detailModel = BorrowItemDetailModel.fromJson(model.data);
'物品名称', _textEditingController.text = _detailModel.name;
TextField( setState(() {});
style: TextStyle( },
color: AppStyle.primaryTextColor, child: _detailModel == null
fontSize: 28.sp, ? SizedBox()
fontWeight: FontWeight.bold, : ListView(
), padding: EdgeInsets.symmetric(vertical: 16.w),
controller: _textEditingController, children: [
enabled: _isEditing, Container(
onChanged: (text) { color: Colors.white,
widget.item.name = text; padding: EdgeInsets.symmetric(horizontal: 32.w),
}, child: Column(
decoration: InputDecoration( children: [
border: InputBorder.none, _buildRow(
), '物品名称',
)), TextField(
Divider(height: 1.w), style: TextStyle(
_buildRow( color: AppStyle.primaryTextColor,
'物品单号', fontSize: 28.sp,
Text( fontWeight: FontWeight.bold,
widget.item.code, ),
style: TextStyle( controller: _textEditingController,
color: _isEditing enabled: _isEditing,
? AppStyle.minorTextColor onChanged: (text) {
: AppStyle.primaryTextColor, //TODO edit
fontSize: 28.sp, // widget.item.name = text;
fontWeight: FontWeight.bold, },
), decoration: InputDecoration(
)), border: InputBorder.none,
_buildRow( ),
'出借状态', )),
Text( Divider(height: 1.w),
'未出借', _buildRow(
style: TextStyle( '物品单号',
color: _isEditing Text(
? AppStyle.minorTextColor _detailModel.code,
: AppStyle.primaryTextColor, style: TextStyle(
fontSize: 28.sp, color: _isEditing
fontWeight: FontWeight.bold, ? AppStyle.minorTextColor
), : AppStyle.primaryTextColor,
)), fontSize: 28.sp,
_buildRow( fontWeight: FontWeight.bold,
'物品图片', ),
(widget.item.assetpath is String) )),
? Image.asset( _buildRow(
widget.item.assetpath, '出借状态',
height: 184.w, Text(
width: 184.w, '未出借',
fit: BoxFit.cover, style: TextStyle(
) color: _isEditing
: Image.file( ? AppStyle.minorTextColor
widget.item.assetpath, : AppStyle.primaryTextColor,
height: 184.w, fontSize: 28.sp,
width: 184.w, fontWeight: FontWeight.bold,
fit: BoxFit.cover, ),
)),
_buildRow(
'物品图片',
FadeInImage.assetNetwork(
placeholder: R.ASSETS_PLACEHOLDER_WEBP,
image: API.image(_detailModel.firstImg?.url ?? ''),
height: 184.w,
width: 184.w,
),
), ),
), AkuBox.h(28),
AkuBox.h(28), ],
], ),
), ),
), ],
], ),
), ),
); );
} }

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

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

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

@ -1,4 +1,5 @@
// Flutter imports: // Flutter imports:
import 'package:aku_community_manager/ui/sub_pages/borrow_manager/borrow_manager_view.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
// Package imports: // Package imports:
@ -30,12 +31,13 @@ class _BorrowManagerPageState extends State<BorrowManagerPage>
Provider.of<UserProvider>(context, listen: false).userInfoModel.role; Provider.of<UserProvider>(context, listen: false).userInfoModel.role;
TabController _tabController; TabController _tabController;
List<String> get _tabs { List<String> get _tabs {
switch (role) { final userProvider = Provider.of<UserProvider>(context, listen: false);
case USER_ROLE.MANAGER: return [
return ['全部', '出借中', '待检查', '已归还']; '全部',
default: '出借中',
return ['全部', '出借中', '已归还']; ...userProvider.infoModel.canOperation ? ['待检查'] : [],
} '已归还'
];
} }
@override @override
@ -77,32 +79,14 @@ class _BorrowManagerPageState extends State<BorrowManagerPage>
} }
List<Widget> _getChildren() { List<Widget> _getChildren() {
switch (role) { final userProvider = Provider.of<UserProvider>(context);
case USER_ROLE.MANAGER: return [
return [ BorrowManagerView(),
getView(BorrowData.models), BorrowManagerView(status: 1),
getView(BorrowData.borrowModels), ...userProvider.infoModel.canOperation
getView(BorrowData.checkModels), ? [BorrowManagerView(status: 3)]
getView(BorrowData.doneModels), : [],
]; 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: // 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'; import 'package:flutter/material.dart';
// Package imports: // Package imports:
import 'package:aku_ui/common_widgets/aku_common_widgets.dart'; 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:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
// Project imports: // Project imports:
import 'package:aku_community_manager/const/resource.dart'; 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/style/app_style.dart';
import 'package:aku_community_manager/tools/widget_tool.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 { class ItemsOutdoorCard extends StatefulWidget {
final ItemsOutdoorModel cardModel; final GoodsOutItemModel model;
final bool isdetail; ItemsOutdoorCard({Key key, @required this.model}) : super(key: key);
ItemsOutdoorCard({
Key key,
@required this.cardModel,
this.isdetail = false,
}) : super(key: key);
@override @override
_ItemsOutdoorCardState createState() => _ItemsOutdoorCardState(); _ItemsOutdoorCardState createState() => _ItemsOutdoorCardState();
} }
class _ItemsOutdoorCardState extends State<ItemsOutdoorCard> { 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 @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
TextStyle _textStyle = TextStyle _textStyle =
@ -47,250 +30,196 @@ class _ItemsOutdoorCardState extends State<ItemsOutdoorCard> {
color: Color(0xFFFFFFFF), color: Color(0xFFFFFFFF),
margin: EdgeInsets.only(top: 16.w), margin: EdgeInsets.only(top: 16.w),
padding: EdgeInsets.only(left: 24.w, right: 24.w), padding: EdgeInsets.only(left: 24.w, right: 24.w),
child: Column(children: [ child: Column(
widget.isdetail children: [
? Container( Container(
alignment: Alignment.centerLeft, alignment: Alignment.centerLeft,
height: 90.w, height: 88.w,
width: double.infinity, width: double.infinity,
child: Row( child: Row(
children: [ children: [
Text( Container(
'出户信息',
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(
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),
),
),
AkuBox.w(16),
Text(
_datetime,
style: TextStyle(
color: AppStyle.minorTextColor,
fontSize: 22.sp,
),
),
Spacer(),
Text(
ItemsOutdoorModel.outdoorStatusMap[_cardModel.status],
style: TextStyle(
color: _cardModel.status == OUTDOORSTATUS.CANCELLATION
? Color(0xFF999999)
: Color(0xFFFF4501),
fontSize: 24.sp,
fontWeight: FontWeight.bold),
),
],
),
),
Row(
children: [
Image.asset(
R.ASSETS_OUTDOOR_IC_HOME_PNG,
width: 40.w,
height: 40.w,
),
AkuBox.w(4),
Text(
'小区名称',
style: _textStyle,
),
Spacer(),
Text(
_cardModel.communityname,
style: AppStyle().primaryStyle,
),
],
),
AkuBox.h(12),
Row(
children: [
Image.asset(
R.ASSETS_OUTDOOR_IC_ADDRESS_PNG,
width: 40.w,
height: 40.w,
),
AkuBox.w(4),
Text('详细地址', style: _textStyle),
Spacer(),
Text(
_cardModel.adress,
style: AppStyle().primaryStyle,
),
],
),
AkuBox.h(12),
Row(
children: [
Image.asset(
R.ASSETS_OUTDOOR_IC_GOOUT_PNG,
width: 40.w,
height: 40.w,
),
AkuBox.w(4),
Text(
'出户人',
style: _textStyle,
),
Spacer(),
Text(
_cardModel.name,
style: AppStyle().primaryStyle,
),
],
),
AkuBox.h(12),
Row(
children: [
Image.asset(
R.ASSETS_OUTDOOR_IC_PEOPLE_PNG,
width: 40.w,
height: 40.w,
),
AkuBox.w(4),
Text(
'身份',
style: _textStyle,
),
Spacer(),
Text(
_cardModel.identify,
style: AppStyle().primaryStyle,
),
],
),
AkuBox.h(12),
Row(
children: [
Image.asset(
R.ASSETS_OUTDOOR_IC_CHUHU_PNG,
width: 40.w,
height: 40.w,
),
Text(
'出户物品',
style: _textStyle,
),
Spacer(),
Text(
_cardModel.items.itemname,
style: AppStyle().primaryStyle,
),
],
),
AkuBox.h(12),
Row(
children: [
Image.asset(
R.ASSETS_OUTDOOR_IC_TIME_PNG,
width: 40.w,
height: 40.w,
),
AkuBox.w(4),
Text(
'出户时间',
style: _textStyle,
),
Spacer(),
Text(
_cardModel.outtime,
style: AppStyle().primaryStyle,
),
],
),
AkuBox.h(24),
Divider(
height: 1.w,
),
widget.isdetail
? AkuButton(
onPressed: () {},
child: Container(
alignment: Alignment.center, alignment: Alignment.center,
height: 96.w, width: 112.w,
child: Row( height: 40.w,
mainAxisSize: MainAxisSize.min, decoration: BoxDecoration(
children: [ border: Border.all(color: Color(0xFF3F8FFE), width: 2.w),
Image.asset( ),
R.ASSETS_OUTDOOR_IC_PHONEBLUE_PNG, child: Text(
width: 38.w, '物品出户',
height: 39.w, style: TextStyle(
), color: Color(0xFF3F8FFE),
AkuBox.w(16), fontSize: 20.sp,
Text('联系业主', fontWeight: FontWeight.bold),
style: TextStyle(
color: Color(0xFF3F8FFE),
fontSize: 28.sp,
fontWeight: FontWeight.bold)),
],
), ),
), ),
) AkuBox.w(16),
: Container( //TODO
height: 112.w, // Text(
alignment: Alignment.centerRight, // widget.model.create,
child: AkuButton( // style: TextStyle(
onPressed: () { // color: AppStyle.minorTextColor,
Get.to(ItemsOutdoorDetailsPage( // fontSize: 22.sp,
cardMedel: _cardModel, // ),
)); // ),
}, Spacer(),
child: Container( Text(
alignment: Alignment.center, widget.model.statusValue,
width: 160.w, style: TextStyle(
height: 64.w, color: widget.model.statusColor,
decoration: BoxDecoration( fontSize: 24.sp,
borderRadius: BorderRadius.circular(8.w), fontWeight: FontWeight.bold,
gradient: LinearGradient(
begin: Alignment.topLeft,
end: Alignment.bottomRight,
colors: [
AppStyle.primaryColor,
AppStyle.minorColor
])),
child: Text(
'查看详情',
style: AppStyle().primaryStyle,
),
), ),
), ),
],
),
),
Row(
children: [
Image.asset(
R.ASSETS_OUTDOOR_IC_HOME_PNG,
width: 40.w,
height: 40.w,
),
AkuBox.w(4),
Text(
'小区名称',
style: _textStyle,
),
Spacer(),
//TODO
Text(
'XXXXXX',
style: AppStyle().primaryStyle,
),
],
),
AkuBox.h(12),
Row(
children: [
Image.asset(
R.ASSETS_OUTDOOR_IC_ADDRESS_PNG,
width: 40.w,
height: 40.w,
),
AkuBox.w(4),
Text('详细地址', style: _textStyle),
Spacer(),
Text(
widget.model.roomName,
style: AppStyle().primaryStyle,
),
],
),
AkuBox.h(12),
Row(
children: [
Image.asset(
R.ASSETS_OUTDOOR_IC_GOOUT_PNG,
width: 40.w,
height: 40.w,
),
AkuBox.w(4),
Text(
'出户人',
style: _textStyle,
),
Spacer(),
Text(
widget.model.applicantName,
style: AppStyle().primaryStyle,
),
],
),
AkuBox.h(12),
Row(
children: [
Image.asset(
R.ASSETS_OUTDOOR_IC_PEOPLE_PNG,
width: 40.w,
height: 40.w,
),
AkuBox.w(4),
Text(
'身份',
style: _textStyle,
),
Spacer(),
Text(
widget.model.identityValue,
style: AppStyle().primaryStyle,
),
],
),
AkuBox.h(12),
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,
),
],
),
AkuBox.h(12),
Row(
children: [
Image.asset(
R.ASSETS_OUTDOOR_IC_TIME_PNG,
width: 40.w,
height: 40.w,
),
AkuBox.w(4),
Text(
'出户时间',
style: _textStyle,
),
Spacer(),
Text(
widget.model.expectedTime,
style: AppStyle().primaryStyle,
),
],
),
AkuBox.h(24),
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,
),
), ),
]), ),
),
],
),
); );
} }
} }

@ -1,29 +1,33 @@
// Flutter imports: // 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:flutter/material.dart';
import 'package:aku_community_manager/tools/extensions/list_extension_tool.dart';
// Package imports: // Package imports:
import 'package:aku_ui/aku_ui.dart'; import 'package:aku_ui/aku_ui.dart';
import 'package:aku_ui/common_widgets/aku_material_button.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:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
// Project imports: // Project imports:
import 'package:aku_community_manager/const/resource.dart'; 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/provider/user_provider.dart';
import 'package:aku_community_manager/style/app_style.dart'; import 'package:aku_community_manager/style/app_style.dart';
import 'package:aku_community_manager/tools/widget_tool.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_notpass_page.dart';
import 'package:aku_community_manager/ui/sub_pages/items_outdoor/outdoor_pass_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:aku_community_manager/ui/widgets/common/aku_scaffold.dart';
import 'package:url_launcher/url_launcher.dart';
class ItemsOutdoorDetailsPage extends StatefulWidget { class ItemsOutdoorDetailsPage extends StatefulWidget {
final ItemsOutdoorModel cardMedel; final int id;
ItemsOutdoorDetailsPage({Key key, @required this.cardMedel}) ItemsOutdoorDetailsPage({Key key, @required this.id}) : super(key: key);
: super(key: key);
@override @override
_ItemsOutdoorDetailsPageState createState() => _ItemsOutdoorDetailsPageState createState() =>
@ -31,137 +35,248 @@ class ItemsOutdoorDetailsPage extends StatefulWidget {
} }
class _ItemsOutdoorDetailsPageState extends State<ItemsOutdoorDetailsPage> { 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 @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
UserProvider _userprovider =
Provider.of<UserProvider>(context, listen: false);
USER_ROLE userRole = _userprovider.userInfoModel.role;
return AkuScaffold( return AkuScaffold(
title: '出户详情', title: '出户详情',
body: ListView( body: EasyRefresh(
children: [ firstRefresh: true,
ItemsOutdoorCard( onRefresh: () async {
cardModel: widget.cardMedel, BaseModel model = await NetUtil().get(
isdetail: true, API.manage.goodsOutDetail,
), params: {'articleOutId': widget.id},
Container( );
color: Color(0xFFFFFFFF), _model = GoodsOutDetailModel.fromJson(model.data);
margin: EdgeInsets.only(top: 16.w), setState(() {});
padding: EdgeInsets.only( },
top: 24.w, left: 32.w, right: 32.w, bottom: 40.w), header: MaterialHeader(),
child: Column( child: _model == null
crossAxisAlignment: CrossAxisAlignment.start, ? SizedBox()
children: [ : ListView(
Text( padding: EdgeInsets.symmetric(vertical: 16.w),
'物品信息', children: [
style: AppStyle().barTitleStyle, Container(
), padding:
AkuBox.h(16), EdgeInsets.symmetric(horizontal: 32.w, vertical: 24.w),
Row( color: Colors.white,
children: [ child: Column(
Image.asset( crossAxisAlignment: CrossAxisAlignment.start,
R.ASSETS_OUTDOOR_IC_CHUHU_PNG, children: [
width: 40.w, Row(
height: 40.w, children: [
), Text(
AkuBox.w(4), '出户信息',
Text( style: AppStyle().barTitleStyle,
'出户物品', ),
style: AppStyle().secondaryTextStyle, Spacer(),
), Text(
Spacer(), _model.statusValue,
Text( style: TextStyle(
widget.cardMedel.items.itemname, color: _model.statusColor,
style: AppStyle().primaryStyle, fontSize: 24.sp,
), fontWeight: FontWeight.bold,
], ),
), ),
AkuBox.h(16), ],
Row( ),
children: [ AkuBox.h(16),
Image.asset( ...<Widget>[
R.ASSETS_OUTDOOR_IC_WEIGHT_PNG, _buildTile(
width: 40.w, R.ASSETS_OUTDOOR_IC_HOME_PNG, '小区名称', 'XXXX'),
height: 40.w, _buildTile(
), R.ASSETS_OUTDOOR_IC_ADDRESS_PNG,
AkuBox.w(4), '详细地址',
Text( _model.roomName,
'物品重量', ),
style: AppStyle().secondaryTextStyle, _buildTile(R.ASSETS_OUTDOOR_IC_HOME_PNG, '出户人',
), _model.applicantName),
Spacer(), _buildTile(R.ASSETS_OUTDOOR_IC_HOME_PNG, '身份',
Text( _model.identityValue),
widget.cardMedel.items.weight < 50.0 _buildTile(R.ASSETS_OUTDOOR_IC_HOME_PNG, '联系方式',
? '<50kg' _model.applicantTel),
: '${widget.cardMedel.items.weight}kg', _buildTile(
style: AppStyle().primaryStyle, R.ASSETS_OUTDOOR_IC_HOME_PNG,
), '出户时间',
], DateUtil.formatDate(
), _model.expected,
AkuBox.h(16), format: 'yyyy-MM-dd HH:mm',
Row( ),
children: [ ),
Image.asset( ].sepWidget(separate: AkuBox.h(12)),
R.ASSETS_OUTDOOR_IC_TRANSPORT_PNG, ],
width: 40.w,
height: 40.w,
),
AkuBox.w(4),
Text(
'搬运方式',
style: AppStyle().secondaryTextStyle,
), ),
Spacer(), ),
Text( Divider(height: 1.w),
widget.cardMedel.items.way, MaterialButton(
style: AppStyle().primaryStyle, onPressed: () {
) launch('tel:${_model.applicantTel}');
], },
), elevation: 0,
AkuBox.h(16), child: Row(
Row( mainAxisSize: MainAxisSize.min,
children: [ children: [
Image.asset( Image.asset(
R.ASSETS_OUTDOOR_IC_IMAGE_PNG, R.ASSETS_OUTDOOR_IC_PHONEBLUE_PNG,
width: 40.w, width: 30.w,
height: 40.w, height: 30.w,
),
AkuBox.w(16),
Text(
'联系业主',
style: TextStyle(
color: Color(0xFF3F8FFE),
fontSize: 28.sp,
),
),
],
), ),
AkuBox.w(4), color: Colors.white,
Text( height: 96.w,
'图片信息', materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,
style: AppStyle().secondaryTextStyle, ),
Container(
color: Color(0xFFFFFFFF),
margin: EdgeInsets.only(top: 16.w),
padding: EdgeInsets.only(
top: 24.w, left: 32.w, right: 32.w, bottom: 40.w),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
'物品信息',
style: AppStyle().barTitleStyle,
),
AkuBox.h(16),
Row(
children: [
Image.asset(
R.ASSETS_OUTDOOR_IC_CHUHU_PNG,
width: 40.w,
height: 40.w,
),
AkuBox.w(4),
Text(
'出户物品',
style: AppStyle().secondaryTextStyle,
),
Spacer(),
Text(
_model.articleOutName ?? '',
style: AppStyle().primaryStyle,
),
],
),
AkuBox.h(16),
Row(
children: [
Image.asset(
R.ASSETS_OUTDOOR_IC_WEIGHT_PNG,
width: 40.w,
height: 40.w,
),
AkuBox.w(4),
Text(
'物品重量',
style: AppStyle().secondaryTextStyle,
),
Spacer(),
Text(
_model.weightValue,
style: AppStyle().primaryStyle,
),
],
),
AkuBox.h(16),
Row(
children: [
Image.asset(
R.ASSETS_OUTDOOR_IC_TRANSPORT_PNG,
width: 40.w,
height: 40.w,
),
AkuBox.w(4),
Text(
'搬运方式',
style: AppStyle().secondaryTextStyle,
),
Spacer(),
Text(
_model.approachValue,
style: AppStyle().primaryStyle,
)
],
),
AkuBox.h(16),
Row(
children: [
Image.asset(
R.ASSETS_OUTDOOR_IC_IMAGE_PNG,
width: 40.w,
height: 40.w,
),
AkuBox.w(4),
Text(
'图片信息',
style: AppStyle().secondaryTextStyle,
),
Spacer(),
],
),
AkuBox.h(16),
Wrap(
spacing: 16.w,
children: _model.imgUrls
.map(
(e) => ClipRRect(
borderRadius: BorderRadius.circular(4.w),
child: FadeInImage.assetNetwork(
placeholder: R.ASSETS_PLACEHOLDER_WEBP,
image: API.image(e?.url ?? ''),
width: 218.w,
height: 218.w,
)),
)
.toList(),
),
],
), ),
Spacer(), ),
], ],
), ),
AkuBox.h(16),
Wrap(
spacing: 16.w,
children: widget.cardMedel.items.imagepath
.map(
(e) => ClipRRect(
borderRadius: BorderRadius.circular(4.w),
child: Image.asset(
e,
width: 218.w,
height: 218.w,
)),
)
.toList(),
),
],
),
),
],
), ),
bottom: _bottomCard(userRole), bottom: _model == null ? SizedBox() : _bottomCard(),
); );
} }
Widget _bottomCard(USER_ROLE userRole) { Widget _bottomCard() {
switch (widget.cardMedel.status) { final userProvider = Provider.of<UserProvider>(context);
case OUTDOORSTATUS.NOT_OUT: switch (_model.status) {
return userRole == USER_ROLE.SECURITY case 1:
return userProvider.infoModel.canPass
? Container( ? Container(
height: 98.w, height: 98.w,
decoration: BoxDecoration( decoration: BoxDecoration(
@ -181,9 +296,7 @@ class _ItemsOutdoorDetailsPageState extends State<ItemsOutdoorDetailsPage> {
children: [ children: [
AkuButton( AkuButton(
onPressed: () { onPressed: () {
Get.to(OutdoorNotpassPage( Get.to(OutdoorNotpassPage(id: _model.id));
model: widget.cardMedel,
));
}, },
child: Container( child: Container(
width: 304.w, width: 304.w,
@ -203,9 +316,7 @@ class _ItemsOutdoorDetailsPageState extends State<ItemsOutdoorDetailsPage> {
Spacer(), Spacer(),
AkuMaterialButton( AkuMaterialButton(
onPressed: () { onPressed: () {
Get.to(OutdoorPassPage( Get.to(OutdoorPassPage(id: _model.id));
model: widget.cardMedel,
));
}, },
radius: 4.w, radius: 4.w,
color: Color(0xFFFFC40C), color: Color(0xFFFFC40C),
@ -221,7 +332,7 @@ class _ItemsOutdoorDetailsPageState extends State<ItemsOutdoorDetailsPage> {
) )
: SizedBox(); : SizedBox();
break; break;
case OUTDOORSTATUS.OUT_DONE: case 2:
return Container( return Container(
height: 226.w, height: 226.w,
color: Color(0xFFFFFFFF), color: Color(0xFFFFFFFF),
@ -247,7 +358,10 @@ class _ItemsOutdoorDetailsPageState extends State<ItemsOutdoorDetailsPage> {
), ),
Spacer(), Spacer(),
Text( Text(
widget.cardMedel.finalOutTime, DateUtil.formatDate(
_model.expected,
format: 'yyyy-MM-dd HH:mm',
),
style: AppStyle().primaryStyle, style: AppStyle().primaryStyle,
), ),
], ],
@ -267,7 +381,7 @@ class _ItemsOutdoorDetailsPageState extends State<ItemsOutdoorDetailsPage> {
), ),
Spacer(), Spacer(),
Text( Text(
widget.cardMedel.outPlace, _model.exportValue,
style: AppStyle().primaryStyle, style: AppStyle().primaryStyle,
), ),
], ],
@ -276,7 +390,7 @@ class _ItemsOutdoorDetailsPageState extends State<ItemsOutdoorDetailsPage> {
), ),
); );
break; break;
case OUTDOORSTATUS.REJECTED: case 3:
return Container( return Container(
height: 226.w, height: 226.w,
color: Color(0xFFFFFFFF), color: Color(0xFFFFFFFF),
@ -302,7 +416,10 @@ class _ItemsOutdoorDetailsPageState extends State<ItemsOutdoorDetailsPage> {
), ),
Spacer(), Spacer(),
Text( Text(
widget.cardMedel.finalOutTime, DateUtil.formatDate(
_model.expected,
format: 'yyyy-MM-dd HH:mm',
),
style: AppStyle().primaryStyle, style: AppStyle().primaryStyle,
), ),
], ],
@ -321,11 +438,13 @@ class _ItemsOutdoorDetailsPageState extends State<ItemsOutdoorDetailsPage> {
style: AppStyle().secondaryTextStyle, style: AppStyle().secondaryTextStyle,
), ),
Spacer(), Spacer(),
Text(widget.cardMedel.rejectReason, Text(
style: TextStyle( _model.remarks,
color: Color(0xFFFF4501), style: TextStyle(
fontSize: 28.sp, color: Color(0xFFFF4501),
fontWeight: FontWeight.bold)), fontSize: 28.sp,
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/material.dart';
import 'package:flutter_easyrefresh/easy_refresh.dart';
// Package imports: // Package imports:
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:provider/provider.dart';
// Project imports: // 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/common/aku_scaffold.dart';
import 'package:aku_community_manager/ui/widgets/inner/aku_tab_bar.dart'; import 'package:aku_community_manager/ui/widgets/inner/aku_tab_bar.dart';
@ -23,6 +21,7 @@ class _ItemsOutdoorPageState extends State<ItemsOutdoorPage>
with TickerProviderStateMixin { with TickerProviderStateMixin {
List<String> _tabs = ['待出户', '已出户', '已驳回', '已作废', '全部']; List<String> _tabs = ['待出户', '已出户', '已驳回', '已作废', '全部'];
TabController _tabController; TabController _tabController;
EasyRefreshController _refreshController = EasyRefreshController();
@override @override
void initState() { void initState() {
super.initState(); super.initState();
@ -44,24 +43,15 @@ class _ItemsOutdoorPageState extends State<ItemsOutdoorPage>
child: AkuTabBar(controller: _tabController, tabs: _tabs), child: AkuTabBar(controller: _tabController, tabs: _tabs),
), ),
body: TabBarView( body: TabBarView(
controller: _tabController, controller: _tabController,
children: children: [
_tabs.map((e) => _buildListView(_tabs.indexOf(e))).toList()), ItemsOutdoorView(status: 1),
); ItemsOutdoorView(status: 2),
} ItemsOutdoorView(status: 3),
ItemsOutdoorView(status: 4),
Widget _buildListView(int index) { ItemsOutdoorView(status: null),
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(),
); );
} }
} }

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

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

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

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

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

@ -192,6 +192,20 @@ packages:
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "0.3.5" 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: dio:
dependency: "direct main" dependency: "direct main"
description: description:
@ -464,6 +478,13 @@ packages:
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "1.9.3" 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: path:
dependency: transitive dependency: transitive
description: description:
@ -554,7 +575,7 @@ packages:
name: power_logger name: power_logger
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "0.1.0" version: "0.1.1"
pretty_json: pretty_json:
dependency: transitive dependency: transitive
description: description:

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

Loading…
Cancel
Save