对接 借还管理提交检查结果,借还管理检查信息 接口

hmxc
小赖 4 years ago
parent 8cbfebae61
commit e73e75e96c

@ -69,5 +69,15 @@ class _Manage {
///id ///id
String get borrowItemDetail => '/user/borrow/findById'; String get borrowItemDetail => '/user/borrow/findById';
///
String get borrowStatusList => '/user/borrow/list'; String get borrowStatusList => '/user/borrow/list';
///()
String get remindUserReturn => '/user/borrow/remind';
///
String get borrowCheckInfo => '/user/borrow/checkItems';
///
String get borrowCheck => '/user/borrow/submitCheck';
} }

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

@ -1,12 +1,15 @@
// Flutter imports: // Flutter imports:
import 'package:aku_community_manager/const/api.dart'; 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/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:
import 'package:aku_ui/common_widgets/aku_material_button.dart'; import 'package:aku_ui/common_widgets/aku_material_button.dart';
import 'package:bot_toast/bot_toast.dart'; import 'package:bot_toast/bot_toast.dart';
import 'package:common_utils/common_utils.dart'; import 'package:common_utils/common_utils.dart';
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';
@ -142,8 +145,21 @@ class _BorrowManagerCardState extends State<BorrowManagerCard> {
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(
'提醒归还', '提醒归还',
@ -161,9 +177,8 @@ class _BorrowManagerCardState extends State<BorrowManagerCard> {
height: 64.w, height: 64.w,
color: AppStyle.primaryColor, color: AppStyle.primaryColor,
radius: 4.w, radius: 4.w,
onPressed: () { onPressed: () async {
//TODO await Get.to(BorrowManagerCheckPage(id: widget.model.id));
// Get.to(BorrowManagerCheckPage(model: widget.model));
}, },
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,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'; 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(
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), padding: EdgeInsets.symmetric(vertical: 16.w),
children: [ children: [
Container( Container(
@ -44,7 +77,7 @@ class _BorrowManagerCheckPageState extends State<BorrowManagerCheckPage> {
_buildRow( _buildRow(
'物品名称', '物品名称',
Text( Text(
widget.model.borrowGoods.name, _model.articleName,
style: TextStyle( style: TextStyle(
color: AppStyle.primaryTextColor, color: AppStyle.primaryTextColor,
fontSize: 28.sp, fontSize: 28.sp,
@ -56,7 +89,7 @@ class _BorrowManagerCheckPageState extends State<BorrowManagerCheckPage> {
_buildRow( _buildRow(
'物品单号', '物品单号',
Text( Text(
widget.model.borrowGoods.code, _model.code,
style: TextStyle( style: TextStyle(
color: AppStyle.primaryTextColor, color: AppStyle.primaryTextColor,
fontSize: 28.sp, fontSize: 28.sp,
@ -80,11 +113,11 @@ class _BorrowManagerCheckPageState extends State<BorrowManagerCheckPage> {
'物品情况', '物品情况',
Row( Row(
children: [ children: [
_buildCard(GOODS_STATUS.NORMAL), _buildCard(1),
AkuBox.w(24), AkuBox.w(24),
_buildCard(GOODS_STATUS.BROKEN), _buildCard(2),
AkuBox.w(24), AkuBox.w(24),
_buildCard(GOODS_STATUS.LOST), _buildCard(3),
], ],
), ),
), ),
@ -92,18 +125,11 @@ class _BorrowManagerCheckPageState extends State<BorrowManagerCheckPage> {
AkuBox.h(16), AkuBox.h(16),
_buildRow( _buildRow(
'物品图片', '物品图片',
(widget.model.borrowGoods.assetpath is String) FadeInImage.assetNetwork(
? Image.asset( placeholder: R.ASSETS_PLACEHOLDER_WEBP,
widget.model.borrowGoods.assetpath, image: API.image(_model.firstImg?.url ?? ''),
height: 184.w, height: 184.w,
width: 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), 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( 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

@ -37,7 +37,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 {

@ -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