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