添加 借还管理-借出-物品总类界面

添加 借还管理-借出-选择物品界面
对接:借还管理:根据物品总类主键id查询未借出的物品明细(出借状态恒为未出借
hmxc
张萌 4 years ago
parent 5f5813724b
commit cef324e737

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

@ -116,6 +116,14 @@ class R {
static const String ASSETS_ICONS_APP_REDUCE_PNG =
'assets/icons/app_reduce.png';
/// ![preview](file:///Users/zhangmeng/akuCommunity/assets/icons/article_count.png)
static const String ASSETS_ICONS_ARTICLE_COUNT_PNG =
'assets/icons/article_count.png';
/// ![preview](file:///Users/zhangmeng/akuCommunity/assets/icons/article_name.png)
static const String ASSETS_ICONS_ARTICLE_NAME_PNG =
'assets/icons/article_name.png';
/// ![preview](file:///Users/zhangmeng/akuCommunity/assets/icons/comment_notice.png)
static const String ASSETS_ICONS_COMMENT_NOTICE_PNG =
'assets/icons/comment_notice.png';

@ -160,6 +160,9 @@ class _Manager {
///
String get fromLoss => '/user/articleBorrow/frmLoss';
///id()
String get articleBorrowFindDetail => '/user/articleBorrow/findDetailById';
///list
String get dailyPaymentList => '/user/dailyPayment/list';

@ -0,0 +1,50 @@
import 'package:akuCommunity/model/common/img_model.dart';
class ArticleBorrowDetailModel {
int id;
String name;
String code;
int status;
List<ImgModel> imgList;
String get borrowStatus {
switch (this.status) {
case 1:
return '正常';
break;
case 2:
return '破损';
case 3:
return '丢失';
default:
return '';
}
}
ArticleBorrowDetailModel(
{this.id, this.name, this.code, this.status, this.imgList});
ArticleBorrowDetailModel.fromJson(Map<String, dynamic> json) {
id = json['id'];
name = json['name'];
code = json['code'];
status = json['status'];
if (json['imgList'] != null) {
imgList = new List<ImgModel>();
json['imgList'].forEach((v) {
imgList.add(new ImgModel.fromJson(v));
});
}
}
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['status'] = this.status;
if (this.imgList != null) {
data['imgList'] = this.imgList.map((v) => v.toJson()).toList();
}
return data;
}
}

@ -0,0 +1,73 @@
import 'package:akuCommunity/model/common/img_model.dart';
class ArticleReturnModel {
int id;
String name;
String code;
String beginDate;
int borrowTime;
List<ImgModel> imgList;
ArticleReturnModel(
{this.id,
this.name,
this.code,
this.beginDate,
this.borrowTime,
this.imgList});
ArticleReturnModel.fromJson(Map<String, dynamic> json) {
id = json['id'];
name = json['name'];
code = json['code'];
beginDate = json['beginDate'];
borrowTime = json['borrowTime'];
if (json['imgList'] != null) {
imgList = new List<ImgModel>();
json['imgList'].forEach((v) {
imgList.add(new ImgModel.fromJson(v));
});
}
}
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['beginDate'] = this.beginDate;
data['borrowTime'] = this.borrowTime;
if (this.imgList != null) {
data['imgList'] = this.imgList.map((v) => v.toJson()).toList();
}
return data;
}
}
class ImgList {
String url;
String size;
int longs;
int paragraph;
int sort;
ImgList({this.url, this.size, this.longs, this.paragraph, this.sort});
ImgList.fromJson(Map<String, dynamic> json) {
url = json['url'];
size = json['size'];
longs = json['longs'];
paragraph = json['paragraph'];
sort = json['sort'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['url'] = this.url;
data['size'] = this.size;
data['longs'] = this.longs;
data['paragraph'] = this.paragraph;
data['sort'] = this.sort;
return data;
}
}

@ -2,11 +2,13 @@ import 'package:akuCommunity/base/base_style.dart';
import 'package:akuCommunity/constants/api.dart';
import 'package:akuCommunity/model/common/img_model.dart';
import 'package:akuCommunity/model/manager/article_borrow_model.dart';
import 'package:akuCommunity/pages/goods_manage_page/borrow_goods_detail_page.dart';
import 'package:akuCommunity/pages/things_page/widget/bee_list_view.dart';
import 'package:akuCommunity/widget/bee_scaffold.dart';
import 'package:flutter/material.dart';
import 'package:flutter_easyrefresh/easy_refresh.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:velocity_x/velocity_x.dart';
import 'package:akuCommunity/const/resource.dart';
@ -54,6 +56,7 @@ class _BorrowGoodsPageState extends State<BorrowGoodsPage> {
},
builder: (items) {
return ListView.separated(
padding: EdgeInsets.symmetric(vertical: 16.w, horizontal: 32.w),
itemBuilder: (context, index) {
return _goodsCard(items[index]);
},
@ -64,9 +67,9 @@ class _BorrowGoodsPageState extends State<BorrowGoodsPage> {
}),
bottomNavi: Row(
children: [
'已选择'.richText.color(ktextPrimary).size(28.sp).withTextSpanChildren([
'0'.textSpan.size(32.sp).color(ktextPrimary).bold.make(),
''.textSpan.size(28.sp).color(ktextPrimary).make(),
'已选择 '.richText.color(ktextPrimary).size(24.sp).withTextSpanChildren([
'0'.textSpan.size(32.sp).color(ktextPrimary).make(),
' '.textSpan.size(24.sp).color(ktextPrimary).make(),
]).make(),
Spacer(),
MaterialButton(
@ -76,12 +79,13 @@ class _BorrowGoodsPageState extends State<BorrowGoodsPage> {
color: kPrimaryColor,
padding: EdgeInsets.symmetric(horizontal: 50.w, vertical: 15.w),
onPressed: () {},
child: '选好了'.text.black.size(32.sp).bold.make(),
child: '借出'.text.black.size(32.sp).bold.make(),
),
],
)
.pSymmetric(v: 20.w, h: 10.w)
.pSymmetric(v: 22.w, h: 32.w)
.box
.color(Colors.white)
.width(double.infinity)
.padding(
EdgeInsets.only(bottom: MediaQuery.of(context).padding.bottom))
@ -94,8 +98,8 @@ class _BorrowGoodsPageState extends State<BorrowGoodsPage> {
crossAxisAlignment: CrossAxisAlignment.start,
children: [
SizedBox(
width: 160.w,
height: 120.w,
width: 184.w,
height: 184.w,
child: ClipRRect(
child: FadeInImage.assetNetwork(
placeholder: R.ASSETS_IMAGES_PLACEHOLDER_WEBP,
@ -103,42 +107,46 @@ class _BorrowGoodsPageState extends State<BorrowGoodsPage> {
),
),
),
20.w.widthBox,
24.w.widthBox,
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
children: [
Image.asset(
R.ASSETS_IMAGES_PLACEHOLDER_WEBP,
width: 20.w,
height: 20.w,
R.ASSETS_ICONS_ARTICLE_NAME_PNG,
width: 40.w,
height: 40.w,
),
4.w.widthBox,
'物品名称:'.text.color(ktextSubColor).size(28.sp).make(),
'${model.name}'.text.color(ktextPrimary).size(30.sp).make(),
'${model.name}'.text.color(ktextPrimary).size(28.sp).make(),
],
),
12.w.heightBox,
Row(
children: [
Image.asset(
R.ASSETS_IMAGES_PLACEHOLDER_WEBP,
width: 20.w,
height: 20.w,
R.ASSETS_ICONS_ARTICLE_COUNT_PNG,
width: 40.w,
height: 40.w,
),
4.w.widthBox,
'物品名称:'.text.color(ktextSubColor).size(28.sp).make(),
'${model.quantity}'.text.color(ktextPrimary).size(30.sp).make(),
'剩余数量:'.text.color(ktextSubColor).size(28.sp).make(),
'${model.quantity}'.text.color(ktextPrimary).size(28.sp).make(),
],
),
],
).expand(),
)
],
)
.box
.color(Colors.white)
.padding(EdgeInsets.symmetric(vertical: 12.w, horizontal: 10.w))
.padding(EdgeInsets.symmetric(vertical: 24.w, horizontal: 24.w))
.withRounded(value: 6.w)
.make();
.make()
.onInkTap(() {
Get.to(() => BorrowGoodsDetailPage());
});
}
}

@ -0,0 +1,139 @@
import 'package:akuCommunity/base/base_style.dart';
import 'package:akuCommunity/constants/api.dart';
import 'package:akuCommunity/model/common/img_model.dart';
import 'package:akuCommunity/model/manager/article_borrow_detail_model.dart';
import 'package:akuCommunity/pages/goods_deto_page/deto_create_page/widget/common_radio.dart';
import 'package:akuCommunity/pages/things_page/widget/bee_list_view.dart';
import 'package:akuCommunity/utils/network/base_model.dart';
import 'package:akuCommunity/utils/network/net_util.dart';
import 'package:akuCommunity/widget/bee_scaffold.dart';
import 'package:flutter/material.dart';
import 'package:flutter_easyrefresh/easy_refresh.dart';
import 'package:velocity_x/velocity_x.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:akuCommunity/const/resource.dart';
class BorrowGoodsDetailPage extends StatefulWidget {
final int articleId;
BorrowGoodsDetailPage({Key key, this.articleId}) : super(key: key);
@override
_BorrowGoodsDetailPageState createState() => _BorrowGoodsDetailPageState();
}
class _BorrowGoodsDetailPageState extends State<BorrowGoodsDetailPage> {
EasyRefreshController _easyRefreshController;
List<ArticleBorrowDetailModel> _models;
bool _onload = true;
List<int> _selectItems = [];
@override
void initState() {
super.initState();
_easyRefreshController = EasyRefreshController();
}
@override
void dispose() {
_easyRefreshController?.dispose();
super.dispose();
}
@override
Widget build(BuildContext context) {
return BeeScaffold(
title: '选择物品',
body: EasyRefresh(
firstRefresh: true,
header: MaterialHeader(),
onRefresh: () async {
List models = await getModels();
_models =
models.map((e) => ArticleBorrowDetailModel.fromJson(e)).toList();
_onload = false;
setState(() {});
},
child: _onload
? _empty()
: ListView(
children: [..._models.map((e) => _goodsCard(e)).toList()],
),
),
);
}
Widget _empty() {
return Container();
}
Future getModels() async {
BaseModel baseModel =
await NetUtil().get(API.manager.articleBorrowFindDetail, params: {
"articleId": widget.articleId,
});
return baseModel.data as List;
}
Widget _goodsCard(ArticleBorrowDetailModel model) {
return Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
CommonRadio(
size: 32.w,
value: model.id,
groupValue: _selectItems,
),
24.w.widthBox,
SizedBox(
width: 184.w,
height: 184.w,
child: ClipRRect(
child: FadeInImage.assetNetwork(
placeholder: R.ASSETS_IMAGES_PLACEHOLDER_WEBP,
image: API.image(ImgModel.first(model.imgList)),
),
),
),
24.w.widthBox,
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
children: [
Image.asset(
R.ASSETS_ICONS_ARTICLE_NAME_PNG,
width: 40.w,
height: 40.w,
),
4.w.widthBox,
'物品名称:'.text.color(ktextSubColor).size(28.sp).make(),
'${model.name}'.text.color(ktextPrimary).size(28.sp).make(),
],
),
12.w.heightBox,
Row(
children: [
Image.asset(
R.ASSETS_ICONS_ARTICLE_COUNT_PNG,
width: 40.w,
height: 40.w,
),
4.w.widthBox,
'剩余数量:'.text.color(ktextSubColor).size(28.sp).make(),
'${model.borrowStatus}'
.text
.color(ktextPrimary)
.size(28.sp)
.make(),
],
),
],
)
],
)
.box
.color(Colors.white)
.padding(EdgeInsets.symmetric(vertical: 24.w, horizontal: 24.w))
.withRounded(value: 6.w)
.make();
}
}

@ -1,3 +1,4 @@
import 'package:akuCommunity/pages/goods_manage_page/borrow/borrow_goods_page.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
@ -117,7 +118,11 @@ class _GoodsManagePageState extends State<GoodsManagePage> {
}),
bottomNavi: BottomButton(
child: '扫一扫'.text.black.size(32.sp).bold.make(),
onPressed: () {},
onPressed: widget.isBorrow
? () {
Get.to(() => BorrowGoodsPage());
}
: () {},
),
);
}

@ -53,9 +53,11 @@ class _SelectBorrowReturnPageState extends State<SelectBorrowReturnPage> {
.withRounded(value: 8.w)
.make()
.onInkTap(() {
Get.to(() => GoodsManagePage(
isBorrow: isBorrow,
));
Get.to(
() => GoodsManagePage(
isBorrow: isBorrow,
),
);
});
}
}

Loading…
Cancel
Save