diff --git a/lib/constants/api.dart b/lib/constants/api.dart index 6f6db79a..f9868770 100644 --- a/lib/constants/api.dart +++ b/lib/constants/api.dart @@ -62,4 +62,7 @@ class _Manager { ///添加填写的访客信息 String get insertVisitorInfo => '/user/visitorAccess/insertVisitorInfo'; + + ///物品出户:查询当前用户所有的物品出户信息 + String get articleOut => '/user/articleOut/list'; } diff --git a/lib/model/manager/goods_out_model.dart b/lib/model/manager/goods_out_model.dart new file mode 100644 index 00000000..de53666b --- /dev/null +++ b/lib/model/manager/goods_out_model.dart @@ -0,0 +1,40 @@ +class GoodsOutModel { + int id; + String name; + int weight; + String expectedTime; + int approach; + int status; + String movingCompanyTel; + + GoodsOutModel( + {this.id, + this.name, + this.weight, + this.expectedTime, + this.approach, + this.status, + this.movingCompanyTel}); + + GoodsOutModel.fromJson(Map json) { + id = json['id']; + name = json['name']; + weight = json['weight']; + expectedTime = json['expectedTime']; + approach = json['approach']; + status = json['status']; + movingCompanyTel = json['movingCompanyTel']; + } + + Map toJson() { + final Map data = new Map(); + data['id'] = this.id; + data['name'] = this.name; + data['weight'] = this.weight; + data['expectedTime'] = this.expectedTime; + data['approach'] = this.approach; + data['status'] = this.status; + data['movingCompanyTel'] = this.movingCompanyTel; + return data; + } +} diff --git a/lib/pages/goods_deto_page/deto_create_page/widget/common_picker.dart b/lib/pages/goods_deto_page/deto_create_page/widget/common_picker.dart index 85605c6a..2f6ec97b 100644 --- a/lib/pages/goods_deto_page/deto_create_page/widget/common_picker.dart +++ b/lib/pages/goods_deto_page/deto_create_page/widget/common_picker.dart @@ -1,3 +1,4 @@ +import 'package:akuCommunity/widget/picker/bee_date_picker.dart'; import 'package:flutter/material.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter_icons/flutter_icons.dart'; @@ -30,24 +31,24 @@ class _CommonPickerState extends State { margin: EdgeInsets.only(right: 30.w), child: Text( widget.title, - style: TextStyle( - fontSize: 28.sp, color: Color(0xff333333)), + style: TextStyle(fontSize: 28.sp, color: Color(0xff333333)), ), ), InkWell( onTap: () { switch (widget.title) { case '出户时间': - DatePicker.showDatePicker(context, - showTitleActions: true, - minTime: DateTime(2020, 1, 1), - maxTime: DateTime(2020, 12, 31), onChanged: (date) { - print('change $date in time zone ' + - date.timeZoneOffset.inHours.toString()); - }, onConfirm: (date) { - pickerData = date.toString().substring(0, 11); - setState(() {}); - }, currentTime: DateTime.now(), locale: LocaleType.zh); + BeeDatePicker.pick(DateTime.now()); + // DatePicker.showDatePicker(context, + // showTitleActions: true, + // minTime: DateTime(2020, 1, 1), + // maxTime: DateTime(2020, 12, 31), onChanged: (date) { + // print('change $date in time zone ' + + // date.timeZoneOffset.inHours.toString()); + // }, onConfirm: (date) { + // pickerData = date.toString().substring(0, 11); + // setState(() {}); + // }, currentTime: DateTime.now(), locale: LocaleType.zh); break; case '物品名称': Picker( @@ -92,9 +93,7 @@ class _CommonPickerState extends State { children: [ Text( pickerData, - style: TextStyle( - fontSize: 28.sp, - color: Color(0xff999999)), + style: TextStyle(fontSize: 28.sp, color: Color(0xff999999)), ), Icon( AntDesign.right, diff --git a/lib/pages/goods_deto_page/goods_deto_page.dart b/lib/pages/goods_deto_page/goods_deto_page.dart index c53e2311..1e4b0886 100644 --- a/lib/pages/goods_deto_page/goods_deto_page.dart +++ b/lib/pages/goods_deto_page/goods_deto_page.dart @@ -1,8 +1,12 @@ +import 'package:akuCommunity/constants/api.dart'; +import 'package:akuCommunity/model/manager/goods_out_model.dart'; import 'package:akuCommunity/pages/goods_deto_page/deto_create_page/deto_create_page.dart'; +import 'package:akuCommunity/pages/things_page/widget/bee_list_view.dart'; import 'package:akuCommunity/utils/headers.dart'; import 'package:akuCommunity/widget/bee_scaffold.dart'; import 'package:flutter/material.dart'; import 'package:flutter/cupertino.dart'; +import 'package:flutter_easyrefresh/easy_refresh.dart'; import 'package:pull_to_refresh/pull_to_refresh.dart'; import 'package:akuCommunity/widget/bottom_button.dart'; import 'widget/goods_info_card.dart'; @@ -15,118 +19,36 @@ class GoodsDetoPage extends StatefulWidget { } class _GoodsDetoPageState extends State { - List _listImage = [ - 'https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1600160449547&di=21b73a9a117988683773490f1230dacf&imgtype=0&src=http%3A%2F%2Ffile3.youboy.com%2Fd%2F157%2F50%2F46%2F1%2F873561.jpg', - 'https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1600160548603&di=56a586397e8d4223f10a8912c011f46a&imgtype=0&src=http%3A%2F%2Fimages.paiming.net%2Fimages%2Fupload%2F20181025%2F20181025113249_2421.jpg', - 'https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1600160568752&di=dc5e904c452f8b59a6b0526861d67697&imgtype=0&src=http%3A%2F%2Fwww.llfbj.com%2Fuploads%2Fallimg%2F160218%2F1-16021R22K2V9.jpg', - 'https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1600160586384&di=28d8cd4a547baa87571e03a5e6ffda03&imgtype=0&src=http%3A%2F%2Fdownload.img.dns4.cn%2Fpic%2F209211%2Fp2%2F20171115151608_6648_zs.jpg%3F308*308', - 'https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1600160602710&di=8c44c989c744c94bedf58d64f3db2abd&imgtype=0&src=http%3A%2F%2Ftu.ossfiles.cn%3A9186%2Fgroup3%2FM00%2F0F%2FFE%2FrBpVfl88i4mAARmAAACZsU16st0080.jpg', - 'https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1600160627146&di=3b38d04039273ef288f2fe8307c503bc&imgtype=0&src=http%3A%2F%2Ffile5.youboy.com%2Fd%2F158%2F85%2F68%2F1%2F237131s.jpg' - ]; - - List> _listView = [ - { - 'status': '已提交', - 'details': >[ - {'title': '物品重量', 'content': '< 50kg'}, - {'title': '出户时间', 'content': '2020-10-10 12:00'}, - {'title': '物品名称', 'content': '家具'}, - {'title': '搬运方式', 'content': '搬家公司'} - ] - }, - { - 'status': '已出户', - 'details': >[ - {'title': '物品重量', 'content': '< 50kg'}, - {'title': '出户时间', 'content': '2020-10-10 12:00'}, - {'title': '实际出户时间', 'content': '2020-10-10 14:00'}, - {'title': '物品名称', 'content': '全部'}, - {'title': '搬运方式', 'content': '自己搬家'} - ] - }, - { - 'status': '已驳回', - 'details': >[ - {'title': '物品重量', 'content': '< 50kg'}, - {'title': '出户时间', 'content': '2020-10-10 12:00'}, - {'title': '实际出户时间', 'content': '2020-10-10 14:00'}, - {'title': '物品名称', 'content': '全部'}, - {'title': '搬运方式', 'content': '自己搬家'} - ] - } - ]; - - RefreshController _refreshController = - RefreshController(initialRefresh: false); - - @override - void initState() { - super.initState(); - } - - void _onRefresh() async { - await Future.delayed(Duration(milliseconds: 1500)); - - _refreshController.refreshCompleted(); - } - - void _onLoading() async { - await Future.delayed(Duration(milliseconds: 1500)); - - if (mounted) setState(() {}); - _refreshController.loadComplete(); - } - - @override - void dispose() { - super.dispose(); - _refreshController.dispose(); - } - + EasyRefreshController _refreshController = EasyRefreshController(); @override Widget build(BuildContext context) { return BeeScaffold( title: '物品出户', - body: Stack( - children: [ - Padding( - padding: EdgeInsets.only(bottom: 98.w), - child: RefreshConfiguration( - hideFooterWhenNotFull: true, - child: SmartRefresher( - controller: _refreshController, - header: WaterDropHeader(), - footer: ClassicFooter(), - onRefresh: _onRefresh, - onLoading: _onLoading, - enablePullUp: true, - child: CustomScrollView( - slivers: [ - SliverList( - delegate: SliverChildBuilderDelegate( - (BuildContext context, int index) => GoodsInfoCard( - listImage: _listImage, - status: _listView[index]['status'], - detoInfoList: _listView[index]['details'], - ), - childCount: _listView.length, - ), - ) - ], - ), - ), - ), - ), - Positioned( - bottom: 0, - child: BottomButton( - title: '新增', - fun: () { - DetoCreatePage().to(); + body: Padding( + padding: EdgeInsets.only(bottom: 98.w), + child: BeeListView( + controller: _refreshController, + path: API.manager.articleOut, + convert: (model) { + return model.tableList + .map((e) => GoodsOutModel.fromJson(e)) + .toList(); + }, + builder: (items) { + return ListView.builder( + itemBuilder: (context, index) { + return GoodsInfoCard(); }, - ), - ), - ], + itemCount: items.length, + ); + }, + ), + ), + bottomNavi: BottomButton( + title: '新增', + fun: () { + DetoCreatePage().to(); + }, ), ); } diff --git a/lib/pages/setting_page/feedback_page/feedback_page.dart b/lib/pages/setting_page/feedback_page/feedback_page.dart index 76b3859a..2a4146b5 100644 --- a/lib/pages/setting_page/feedback_page/feedback_page.dart +++ b/lib/pages/setting_page/feedback_page/feedback_page.dart @@ -21,10 +21,7 @@ class _FeedBackPageState extends State { Widget _containerTextField() { return Container( - padding: EdgeInsets.only( - top: 24.w, - left: 24.w, - right: 32.w), + padding: EdgeInsets.only(top: 24.w, left: 24.w, right: 32.w), decoration: BoxDecoration( borderRadius: BorderRadius.all(Radius.circular(6)), border: Border.all(color: Color(0xffd4cfbe), width: 1.0), @@ -62,18 +59,13 @@ class _FeedBackPageState extends State { return InkWell( onTap: () { if (TextUtil.isEmpty(_ideaContent.text)) - BotToast.showText(text:'意见不能为空'); + BotToast.showText(text: '意见不能为空'); else { - showDialog( - context: context, - child: Center( - child: CupertinoActivityIndicator(), - ), - ); + var cancelAction = BotToast.showLoading(); Future.delayed(Duration(milliseconds: 1000 + Random().nextInt(1000)), () { - BotToast.showText(text:'提交成功'); - Get.back(); + BotToast.showText(text: '提交成功'); + cancelAction(); Get.back(); }); } @@ -122,18 +114,14 @@ class _FeedBackPageState extends State { SizedBox(height: 76.w), Text( '意见反馈', - style: TextStyle( - fontSize: 28.sp, - color: Color(0xff333333)), + style: TextStyle(fontSize: 28.sp, color: Color(0xff333333)), ), SizedBox(height: 24.w), _containerTextField(), SizedBox(height: 24.w), Text( '添加图片信息(0/9)', - style: TextStyle( - fontSize: 28.sp, - color: Color(0xff333333)), + style: TextStyle(fontSize: 28.sp, color: Color(0xff333333)), ), SizedBox(height: 24.w), CommonImagePicker(), diff --git a/lib/widget/picker/bee_date_picker.dart b/lib/widget/picker/bee_date_picker.dart new file mode 100644 index 00000000..9905c842 --- /dev/null +++ b/lib/widget/picker/bee_date_picker.dart @@ -0,0 +1,59 @@ +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:get/get.dart'; +import 'package:velocity_x/velocity_x.dart'; + +class BeeDatePicker { + static Future pick(DateTime initDate) async { + return await Get.bottomSheet(_BeeDatePicker(date: initDate)); + } +} + +class _BeeDatePicker extends StatefulWidget { + final DateTime date; + _BeeDatePicker({Key key, @required this.date}) : super(key: key); + + @override + __BeeDatePickerState createState() => __BeeDatePickerState(); +} + +class __BeeDatePickerState extends State<_BeeDatePicker> { + DateTime _date = DateTime.now(); + @override + void initState() { + super.initState(); + _date = widget.date ?? DateTime.now(); + } + + @override + Widget build(BuildContext context) { + return SizedBox( + child: Material( + borderRadius: BorderRadius.vertical(top: Radius.circular(10)), + child: Column( + children: [ + SizedBox( + height: 48, + child: NavigationToolbar( + leading: TextButton( + onPressed: Get.back, + child: '取消'.text.black.make(), + ), + trailing: TextButton( + onPressed: () => Get.back(result: _date), + child: '确定'.text.black.make(), + ), + ), + ), + CupertinoDatePicker( + initialDateTime: _date, + onDateTimeChanged: (date) => _date = date, + mode: CupertinoDatePickerMode.date, + ).expand(), + ], + ), + ), + height: Get.height / 3, + ); + } +}