|
|
@ -1,25 +1,23 @@
|
|
|
|
// 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: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';
|
|
|
|
|
|
|
|
|
|
|
|
// 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 +44,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 +60,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 +71,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 +105,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 +128,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,7 +136,7 @@ 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,
|
|
|
@ -169,14 +155,15 @@ 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: () {
|
|
|
|
Get.to(BorrowManagerCheckPage(model: widget.model));
|
|
|
|
//TODO
|
|
|
|
|
|
|
|
// Get.to(BorrowManagerCheckPage(model: widget.model));
|
|
|
|
},
|
|
|
|
},
|
|
|
|
child: Text(
|
|
|
|
child: Text(
|
|
|
|
'检查信息',
|
|
|
|
'检查信息',
|
|
|
|