parent
58afa4328d
commit
4f419b1258
@ -0,0 +1,44 @@
|
||||
class PackageManageListModel {
|
||||
int id;
|
||||
String code;
|
||||
String addresseeName;
|
||||
String addresseeTel;
|
||||
String address;
|
||||
int status;
|
||||
Null receiveDate;
|
||||
String createDate;
|
||||
|
||||
PackageManageListModel(
|
||||
{this.id,
|
||||
this.code,
|
||||
this.addresseeName,
|
||||
this.addresseeTel,
|
||||
this.address,
|
||||
this.status,
|
||||
this.receiveDate,
|
||||
this.createDate});
|
||||
|
||||
PackageManageListModel.fromJson(Map<String, dynamic> json) {
|
||||
id = json['id'];
|
||||
code = json['code'];
|
||||
addresseeName = json['addresseeName'];
|
||||
addresseeTel = json['addresseeTel'];
|
||||
address = json['address'];
|
||||
status = json['status'];
|
||||
receiveDate = json['receiveDate'];
|
||||
createDate = json['createDate'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
data['id'] = this.id;
|
||||
data['code'] = this.code;
|
||||
data['addresseeName'] = this.addresseeName;
|
||||
data['addresseeTel'] = this.addresseeTel;
|
||||
data['address'] = this.address;
|
||||
data['status'] = this.status;
|
||||
data['receiveDate'] = this.receiveDate;
|
||||
data['createDate'] = this.createDate;
|
||||
return data;
|
||||
}
|
||||
}
|
@ -0,0 +1,121 @@
|
||||
import 'dart:math';
|
||||
|
||||
import 'package:aku_community_manager/models/manager/package_manage/package_manage_list_model.dart';
|
||||
import 'package:aku_community_manager/style/app_style.dart';
|
||||
import 'package:aku_community_manager/tools/aku_divider.dart';
|
||||
import 'package:common_utils/common_utils.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:velocity_x/velocity_x.dart';
|
||||
import 'package:aku_community_manager/const/resource.dart';
|
||||
import 'package:aku_community_manager/tools/extensions/list_extension_tool.dart';
|
||||
|
||||
class PackageManageCard extends StatefulWidget {
|
||||
final int index;
|
||||
final PackageManageListModel model;
|
||||
PackageManageCard({Key key, this.index, this.model}) : super(key: key);
|
||||
|
||||
@override
|
||||
_PackageManageCardState createState() => _PackageManageCardState();
|
||||
}
|
||||
|
||||
class _PackageManageCardState extends State<PackageManageCard> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
width: double.infinity,
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
borderRadius: BorderRadius.circular(8.w),
|
||||
),
|
||||
padding: EdgeInsets.symmetric(vertical: 24.w, horizontal: 24.w),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
'3号柜${Random().nextInt(10)}号箱'
|
||||
.text
|
||||
.size(32.sp)
|
||||
.color(kTextPrimaryColor)
|
||||
.bold
|
||||
.make(),
|
||||
Spacer(),
|
||||
(widget.index == 0 ? '未领取' : '已领取')
|
||||
.text
|
||||
.size(28.sp)
|
||||
.color(widget.index == 1 ? kTextSubColor : kTextPrimaryColor)
|
||||
.make()
|
||||
],
|
||||
),
|
||||
16.w.heightBox,
|
||||
AkuDivider.horizontal(),
|
||||
24.w.heightBox,
|
||||
...<Widget>[
|
||||
_rowTile(
|
||||
R.ASSETS_MANAGE_IC_RENWU_PNG,
|
||||
'包裹代收',
|
||||
widget.model.code.text.size(24.sp).color(kTextSubColor).make(),
|
||||
),
|
||||
_rowTile(
|
||||
R.ASSETS_MANAGE_IC_RENWU_PNG,
|
||||
'收件人',
|
||||
widget.model.addresseeName.text.size(24.sp).color(kTextSubColor).make(),
|
||||
),
|
||||
_rowTile(
|
||||
R.ASSETS_MESSAGE_IC_PHONE_PNG,
|
||||
'联系方式',
|
||||
widget.model.addresseeTel.text.size(24.sp).color(kTextSubColor).make(),
|
||||
),
|
||||
_rowTile(
|
||||
R.ASSETS_MANAGE_IC_TIME_PNG,
|
||||
'送达时间',
|
||||
DateUtil.formatDate(widget.model.receiveDate,format: 'yyyy-MM-dd HH:mm').text.size(24.sp).color(kTextSubColor).make(),
|
||||
),
|
||||
].sepWidget(separate: 12.w.heightBox),
|
||||
widget.index == 1 ? SizedBox() : _bottomButtons()
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _bottomButtons() {
|
||||
return Padding(
|
||||
padding: EdgeInsets.only(top: 40.w),
|
||||
child: Row(
|
||||
children: [
|
||||
Spacer(),
|
||||
MaterialButton(
|
||||
height: 52.w,
|
||||
padding: EdgeInsets.symmetric(vertical: 8.w, horizontal: 24.w),
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(74.w)),
|
||||
color: Colors.black,
|
||||
onPressed: () {},
|
||||
elevation: 0,
|
||||
focusElevation: 0,
|
||||
hoverElevation: 0,
|
||||
highlightElevation: 0,
|
||||
child: '提醒领取'.text.size(26.sp).color(Colors.white).make(),
|
||||
)
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _rowTile(String iconPath, String title, Widget content) {
|
||||
return Row(
|
||||
children: [
|
||||
SizedBox(
|
||||
width: 40.w,
|
||||
height: 40.w,
|
||||
child: Image.asset(iconPath),
|
||||
),
|
||||
12.w.widthBox,
|
||||
title.text.size(24.sp).color(kTextSubColor).make(),
|
||||
Spacer(),
|
||||
content,
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
@ -0,0 +1,40 @@
|
||||
|
||||
import 'package:aku_community_manager/ui/manage_pages/packages_manage/packages_manage_view.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:flutter/material.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:velocity_x/velocity_x.dart';
|
||||
|
||||
class PackagesManagePage extends StatefulWidget {
|
||||
PackagesManagePage({Key key}) : super(key: key);
|
||||
|
||||
@override
|
||||
_PackagesManagePageState createState() => _PackagesManagePageState();
|
||||
}
|
||||
|
||||
class _PackagesManagePageState extends State<PackagesManagePage>
|
||||
with TickerProviderStateMixin {
|
||||
List<String> _tabs = ['未领取', '已领取'];
|
||||
TabController _tabController;
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_tabController = TabController(length: _tabs.length, vsync: this);
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return AkuScaffold(
|
||||
title: '包裹管理',
|
||||
appBarBottom: PreferredSize(
|
||||
child: AkuTabBar(controller: _tabController, tabs: _tabs),
|
||||
preferredSize: Size.fromHeight(88.w),
|
||||
),
|
||||
body: TabBarView(
|
||||
controller: _tabController,
|
||||
children: List.generate(_tabs.length, (index) => PackagesManageView(index: index,)),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
@ -0,0 +1,59 @@
|
||||
import 'package:aku_community_manager/const/api.dart';
|
||||
import 'package:aku_community_manager/models/manager/package_manage/package_manage_list_model.dart';
|
||||
import 'package:aku_community_manager/ui/manage_pages/packages_manage/packages_manage_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';
|
||||
import 'package:velocity_x/velocity_x.dart';
|
||||
|
||||
class PackagesManageView extends StatefulWidget {
|
||||
final int index;
|
||||
PackagesManageView({Key key, this.index}) : super(key: key);
|
||||
|
||||
@override
|
||||
_PackagesManageViewState createState() => _PackagesManageViewState();
|
||||
}
|
||||
|
||||
class _PackagesManageViewState extends State<PackagesManageView> {
|
||||
EasyRefreshController _refreshController;
|
||||
List<PackageManageListModel> _models;
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_refreshController = EasyRefreshController();
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
_refreshController?.dispose();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return BeeListView(
|
||||
path: API.manage.packageManageList,
|
||||
controller: _refreshController,
|
||||
extraParams: {"collectionStatus": widget.index + 1},
|
||||
convert: (models) {
|
||||
return models.tableList
|
||||
.map((e) => PackageManageListModel.fromJson(e))
|
||||
.toList();
|
||||
},
|
||||
builder: (items) {
|
||||
return ListView.separated(
|
||||
itemBuilder: (context, index) {
|
||||
return PackageManageCard(
|
||||
index: widget.index,
|
||||
model: items[index],
|
||||
);
|
||||
},
|
||||
separatorBuilder: (_, __) {
|
||||
return 24.w.heightBox;
|
||||
},
|
||||
itemCount: items.length);
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
Loading…
Reference in new issue