Showing
6 changed files
with
431 additions
and
159 deletions
lib/models/get_board_model.dart
0 → 100644
| 1 | +class FeastBoardModel { | ||
| 2 | + String title; | ||
| 3 | + Map<String, List<FeastBoardSunModel>> data; | ||
| 4 | + | ||
| 5 | + FeastBoardModel({this.title, this.data}); | ||
| 6 | + | ||
| 7 | + FeastBoardModel.fromJson(Map<String, dynamic> json) { | ||
| 8 | + data = {}; | ||
| 9 | + json.forEach((key, value) { | ||
| 10 | + List<FeastBoardSunModel> temp = []; | ||
| 11 | + value.forEach((element) { | ||
| 12 | + FeastBoardSunModel sunModel = new FeastBoardSunModel.fromJson(element); | ||
| 13 | + temp.add(sunModel); | ||
| 14 | + }); | ||
| 15 | + data[key] = temp; | ||
| 16 | + }); | ||
| 17 | + } | ||
| 18 | + | ||
| 19 | + Map<String, dynamic> toJson() { | ||
| 20 | + final Map<String, dynamic> data = new Map<String, dynamic>(); | ||
| 21 | + data['title'] = this.title; | ||
| 22 | + data['data'] = this.data; | ||
| 23 | + return data; | ||
| 24 | + } | ||
| 25 | +} | ||
| 26 | + | ||
| 27 | +class FeastBoardSunModel { | ||
| 28 | + String rname; | ||
| 29 | + String id; | ||
| 30 | + String rid; | ||
| 31 | + String className; | ||
| 32 | + String nickName; | ||
| 33 | + String account; | ||
| 34 | + | ||
| 35 | + FeastBoardSunModel( | ||
| 36 | + {this.rname, | ||
| 37 | + this.id, | ||
| 38 | + this.rid, | ||
| 39 | + this.className, | ||
| 40 | + this.nickName, | ||
| 41 | + this.account}); | ||
| 42 | + | ||
| 43 | + FeastBoardSunModel.fromJson(Map<String, dynamic> json) { | ||
| 44 | + rname = json['rname']; | ||
| 45 | + id = json['id']; | ||
| 46 | + rid = json['rid']; | ||
| 47 | + className = json['class_name']; | ||
| 48 | + nickName = json['nick_name']; | ||
| 49 | + account = json['account']; | ||
| 50 | + } | ||
| 51 | + | ||
| 52 | + Map<String, dynamic> toJson() { | ||
| 53 | + final Map<String, dynamic> data = new Map<String, dynamic>(); | ||
| 54 | + data['rname'] = this.rname; | ||
| 55 | + data['id'] = this.id; | ||
| 56 | + data['rid'] = this.rid; | ||
| 57 | + data['class_name'] = this.className; | ||
| 58 | + data['nick_name'] = this.nickName; | ||
| 59 | + data['account'] = this.account; | ||
| 60 | + return data; | ||
| 61 | + } | ||
| 62 | +} |
| @@ -329,4 +329,7 @@ class HttpUrl { | @@ -329,4 +329,7 @@ class HttpUrl { | ||
| 329 | static const String get_exits_banquet_by_date = | 329 | static const String get_exits_banquet_by_date = |
| 330 | "?service=App.Banquet.GetExitsBanquetByDate"; //查看指定时间内是否有宴会预定 | 330 | "?service=App.Banquet.GetExitsBanquetByDate"; //查看指定时间内是否有宴会预定 |
| 331 | 331 | ||
| 332 | + static const String get_banquet_by_date = | ||
| 333 | + "?service=App.Banquet.GetBanquetByDate"; //指定日期、时段宴会预定 | ||
| 334 | + | ||
| 332 | } | 335 | } |
| @@ -2,8 +2,10 @@ | @@ -2,8 +2,10 @@ | ||
| 2 | * 宴会看板 | 2 | * 宴会看板 |
| 3 | */ | 3 | */ |
| 4 | 4 | ||
| 5 | +import 'package:common_utils/common_utils.dart'; | ||
| 5 | import 'package:flutter/material.dart'; | 6 | import 'package:flutter/material.dart'; |
| 6 | import 'package:flutter_screenutil/flutter_screenutil.dart'; | 7 | import 'package:flutter_screenutil/flutter_screenutil.dart'; |
| 8 | +import 'package:one_key/models/get_board_model.dart'; | ||
| 7 | import 'package:one_key/res/colors.dart'; | 9 | import 'package:one_key/res/colors.dart'; |
| 8 | import 'package:one_key/widgets/system_app_bar.dart'; | 10 | import 'package:one_key/widgets/system_app_bar.dart'; |
| 9 | import 'package:provider/provider.dart'; | 11 | import 'package:provider/provider.dart'; |
| @@ -11,10 +13,12 @@ import 'package:table_calendar/table_calendar.dart'; | @@ -11,10 +13,12 @@ import 'package:table_calendar/table_calendar.dart'; | ||
| 11 | 13 | ||
| 12 | import '../../provider/feast_model.dart'; | 14 | import '../../provider/feast_model.dart'; |
| 13 | import '../../provider/user_model.dart'; | 15 | import '../../provider/user_model.dart'; |
| 16 | +import '../../route/navigator_util.dart'; | ||
| 17 | +import '../../utils/screen_util.dart'; | ||
| 14 | import '../../utils/utils.dart'; | 18 | import '../../utils/utils.dart'; |
| 15 | import '../../widgets/round_button.dart'; | 19 | import '../../widgets/round_button.dart'; |
| 16 | import '../../widgets/v_empty_view.dart'; | 20 | import '../../widgets/v_empty_view.dart'; |
| 17 | -import 'feast_board.item.dart'; | 21 | +import 'feast_board_item.dart'; |
| 18 | 22 | ||
| 19 | class FeastBoardPage extends StatefulWidget { | 23 | class FeastBoardPage extends StatefulWidget { |
| 20 | FeastBoardPage({Key key}) : super(key: key); | 24 | FeastBoardPage({Key key}) : super(key: key); |
| @@ -28,6 +32,7 @@ class _FeastBoardPageState extends State<FeastBoardPage> { | @@ -28,6 +32,7 @@ class _FeastBoardPageState extends State<FeastBoardPage> { | ||
| 28 | DateTime dateTimeNow; //当前日期 | 32 | DateTime dateTimeNow; //当前日期 |
| 29 | bool calendarShow = true; //日历展开 | 33 | bool calendarShow = true; //日历展开 |
| 30 | FeastModel feastModel; | 34 | FeastModel feastModel; |
| 35 | + ScrollController controller = ScrollController(); | ||
| 31 | 36 | ||
| 32 | @override | 37 | @override |
| 33 | void initState() { | 38 | void initState() { |
| @@ -37,9 +42,40 @@ class _FeastBoardPageState extends State<FeastBoardPage> { | @@ -37,9 +42,40 @@ class _FeastBoardPageState extends State<FeastBoardPage> { | ||
| 37 | Utils.changeStatusColor(color: MyColours.color_438E93); | 42 | Utils.changeStatusColor(color: MyColours.color_438E93); |
| 38 | WidgetsBinding.instance.addPostFrameCallback((_) { | 43 | WidgetsBinding.instance.addPostFrameCallback((_) { |
| 39 | _getExitsBanquetByDate(); | 44 | _getExitsBanquetByDate(); |
| 45 | + _getBanquetByDate(); | ||
| 40 | }); | 46 | }); |
| 41 | } | 47 | } |
| 42 | 48 | ||
| 49 | + ///指定日期、时段宴会预定 | ||
| 50 | + _getBanquetByDate() async { | ||
| 51 | + UserModel userModel = Provider.of<UserModel>(context, listen: false); | ||
| 52 | + String timeStrStart = dateTimeNow.year.toString() + | ||
| 53 | + "-" + | ||
| 54 | + Utils.addZeroNumber(dateTimeNow.month) + | ||
| 55 | + "-" + | ||
| 56 | + Utils.addZeroNumber(dateTimeNow.day) + | ||
| 57 | + " 00:00:00"; | ||
| 58 | + String timeStrEnd = dateTimeNow.year.toString() + | ||
| 59 | + "-" + | ||
| 60 | + Utils.addZeroNumber(dateTimeNow.month) + | ||
| 61 | + "-" + | ||
| 62 | + Utils.addZeroNumber(dateTimeNow.day) + | ||
| 63 | + " 23:59:59"; | ||
| 64 | + | ||
| 65 | + String start = | ||
| 66 | + (DateUtil.getDateMsByTimeStr(timeStrStart) / 1000).floor().toString(); | ||
| 67 | + String end = | ||
| 68 | + (DateUtil.getDateMsByTimeStr(timeStrEnd) / 1000).floor().toString(); | ||
| 69 | + Map<String, String> pramas = { | ||
| 70 | + 'sid': userModel.user.sellerid, | ||
| 71 | + 'rdate': '${start}', | ||
| 72 | + 'edate': '${end}' | ||
| 73 | + }; | ||
| 74 | + bool success = | ||
| 75 | + await feastModel.getBanquetByDate(context, pramas, showLoading: true); | ||
| 76 | + if (success) {} | ||
| 77 | + } | ||
| 78 | + | ||
| 43 | //解析返回显示的日期 | 79 | //解析返回显示的日期 |
| 44 | static String _parseDateDay(DateTime dateTime) { | 80 | static String _parseDateDay(DateTime dateTime) { |
| 45 | DateTime now = DateTime.now(); | 81 | DateTime now = DateTime.now(); |
| @@ -56,6 +92,46 @@ class _FeastBoardPageState extends State<FeastBoardPage> { | @@ -56,6 +92,46 @@ class _FeastBoardPageState extends State<FeastBoardPage> { | ||
| 56 | } | 92 | } |
| 57 | } | 93 | } |
| 58 | 94 | ||
| 95 | + Widget _callButton( | ||
| 96 | + {GestureTapCallback onPress, | ||
| 97 | + content, | ||
| 98 | + hasLeftBorder = true, | ||
| 99 | + isSelect = false}) { | ||
| 100 | + return InkWell( | ||
| 101 | + onTap: onPress, | ||
| 102 | + child: Container( | ||
| 103 | + height: h(48), | ||
| 104 | + decoration: BoxDecoration( | ||
| 105 | + color: isSelect ? MyColours.color_438E93 : MyColours.color_ffffff, | ||
| 106 | + border: Border( | ||
| 107 | + bottom: BorderSide( | ||
| 108 | + color: MyColours.color_438E93, | ||
| 109 | + width: ScreenUtil().setWidth(2)), | ||
| 110 | + top: BorderSide( | ||
| 111 | + color: MyColours.color_438E93, | ||
| 112 | + width: ScreenUtil().setWidth(2)), | ||
| 113 | + left: hasLeftBorder | ||
| 114 | + ? BorderSide( | ||
| 115 | + color: MyColours.color_438E93, | ||
| 116 | + width: ScreenUtil().setWidth(2)) | ||
| 117 | + : BorderSide.none, | ||
| 118 | + right: BorderSide( | ||
| 119 | + color: MyColours.color_438E93, | ||
| 120 | + width: ScreenUtil().setWidth(2)))), | ||
| 121 | + child: Align( | ||
| 122 | + alignment: Alignment.center, | ||
| 123 | + child: Text( | ||
| 124 | + content, | ||
| 125 | + style: TextStyle( | ||
| 126 | + color: | ||
| 127 | + isSelect ? MyColours.color_F6F6F6 : MyColours.color_438E93, | ||
| 128 | + fontSize: ScreenUtil().setSp(36)), | ||
| 129 | + ), | ||
| 130 | + ), | ||
| 131 | + ), | ||
| 132 | + ); | ||
| 133 | + } | ||
| 134 | + | ||
| 59 | ///查看指定时间内是否有宴会预定 | 135 | ///查看指定时间内是否有宴会预定 |
| 60 | _getExitsBanquetByDate() async { | 136 | _getExitsBanquetByDate() async { |
| 61 | UserModel userModel = Provider.of<UserModel>(context, listen: false); | 137 | UserModel userModel = Provider.of<UserModel>(context, listen: false); |
| @@ -114,6 +190,7 @@ class _FeastBoardPageState extends State<FeastBoardPage> { | @@ -114,6 +190,7 @@ class _FeastBoardPageState extends State<FeastBoardPage> { | ||
| 114 | if (!Utils.isOneDay(day, dateTimeNow)) { | 190 | if (!Utils.isOneDay(day, dateTimeNow)) { |
| 115 | //不是一天 | 191 | //不是一天 |
| 116 | dateTimeNow = day; | 192 | dateTimeNow = day; |
| 193 | + _getBanquetByDate(); | ||
| 117 | } | 194 | } |
| 118 | }, | 195 | }, |
| 119 | // holidays: _holidays, | 196 | // holidays: _holidays, |
| @@ -458,7 +535,6 @@ class _FeastBoardPageState extends State<FeastBoardPage> { | @@ -458,7 +535,6 @@ class _FeastBoardPageState extends State<FeastBoardPage> { | ||
| 458 | // }, | 535 | // }, |
| 459 | ), | 536 | ), |
| 460 | ), | 537 | ), |
| 461 | - VEmptyView(4), | ||
| 462 | InkWell( | 538 | InkWell( |
| 463 | onTap: () { | 539 | onTap: () { |
| 464 | calendarShow = !calendarShow; | 540 | calendarShow = !calendarShow; |
| @@ -472,57 +548,63 @@ class _FeastBoardPageState extends State<FeastBoardPage> { | @@ -472,57 +548,63 @@ class _FeastBoardPageState extends State<FeastBoardPage> { | ||
| 472 | } | 548 | } |
| 473 | setState(() {}); | 549 | setState(() {}); |
| 474 | }, | 550 | }, |
| 475 | - child: Image.asset( | ||
| 476 | - Utils.getImgPath(calendarShow | ||
| 477 | - ? 'y_chevron_up_circle' | ||
| 478 | - : 'y_chevron_down_circle'), | ||
| 479 | - width: ScreenUtil().setWidth(32))), | ||
| 480 | - VEmptyView(32), | 551 | + child: Container( |
| 552 | + width: double.infinity, | ||
| 553 | + color: Colors.white, | ||
| 554 | + child: Column( | ||
| 555 | + children: [ | ||
| 556 | + VEmptyView(4), | ||
| 557 | + Image.asset( | ||
| 558 | + Utils.getImgPath(calendarShow | ||
| 559 | + ? 'y_chevron_up_circle' | ||
| 560 | + : 'y_chevron_down_circle'), | ||
| 561 | + width: ScreenUtil().setWidth(32)), | ||
| 562 | + VEmptyView(32), | ||
| 563 | + ], | ||
| 564 | + ), | ||
| 565 | + )) | ||
| 481 | ], | 566 | ], |
| 482 | )), | 567 | )), |
| 483 | VEmptyView(48), | 568 | VEmptyView(48), |
| 484 | Expanded( | 569 | Expanded( |
| 485 | child: ListView.builder( | 570 | child: ListView.builder( |
| 486 | - padding: EdgeInsets.symmetric(horizontal: ScreenUtil().setWidth(8)), | ||
| 487 | - itemBuilder: (context, index) { | ||
| 488 | - return FeastBoardItem(); | ||
| 489 | - }, | ||
| 490 | - itemCount: 100, | ||
| 491 | - )), | 571 | + shrinkWrap: true, |
| 572 | + padding: EdgeInsets.symmetric( | ||
| 573 | + horizontal: ScreenUtil().setWidth(8)), | ||
| 574 | + controller: controller, | ||
| 575 | + itemBuilder: (context, index) { | ||
| 576 | + FeastBoardModel boardModel = | ||
| 577 | + feastModel.banquetByDateData[index]; | ||
| 578 | + return FeastBoardItem( | ||
| 579 | + boardModel: boardModel, | ||
| 580 | + controller: controller, | ||
| 581 | + isOpen: !calendarShow, | ||
| 582 | + ); | ||
| 583 | + }, | ||
| 584 | + itemCount: feastModel.banquetByDateData.length)), | ||
| 492 | Row( | 585 | Row( |
| 493 | - mainAxisAlignment: MainAxisAlignment.spaceEvenly, | ||
| 494 | children: [ | 586 | children: [ |
| 495 | - RoundButton( | ||
| 496 | - onPressed: () async { | ||
| 497 | - _calendarController.setSelectedDay(DateTime.now()); | ||
| 498 | - setState(() {}); | ||
| 499 | - }, | ||
| 500 | - text: '回到今天', | ||
| 501 | - fontSize: 28, | ||
| 502 | - isBold: false, | ||
| 503 | - height: ScreenUtil().setWidth(70), | ||
| 504 | - width: ScreenUtil().setWidth(220), | ||
| 505 | - gradientStart: MyColours.color_2bb5b7, | ||
| 506 | - gradientEnd: MyColours.color_2bb5b7, | ||
| 507 | - radius: ScreenUtil().setWidth(10), | ||
| 508 | - ), | ||
| 509 | - RoundButton( | ||
| 510 | - onPressed: () async { | ||
| 511 | - Navigator.pop(context); | ||
| 512 | - }, | ||
| 513 | - text: '取消', | ||
| 514 | - fontSize: 28, | ||
| 515 | - isBold: false, | ||
| 516 | - textColor: MyColours.color_333333, | ||
| 517 | - borderColor: Color.fromRGBO(119, 119, 119, 1), | ||
| 518 | - height: ScreenUtil().setWidth(70), | ||
| 519 | - width: ScreenUtil().setWidth(220), | ||
| 520 | - gradientStart: Colors.transparent, | ||
| 521 | - gradientEnd: Colors.transparent, | ||
| 522 | - radius: ScreenUtil().setWidth(10), | ||
| 523 | - ) | 587 | + Expanded( |
| 588 | + child: _callButton( | ||
| 589 | + onPress: () async { | ||
| 590 | + _calendarController.setSelectedDay(DateTime.now()); | ||
| 591 | + dateTimeNow = DateTime.now(); | ||
| 592 | + setState(() {}); | ||
| 593 | + _getBanquetByDate(); | ||
| 594 | + }, | ||
| 595 | + content: '回到今天', | ||
| 596 | + hasLeftBorder: true, | ||
| 597 | + isSelect: false)), | ||
| 598 | + Expanded( | ||
| 599 | + child: _callButton( | ||
| 600 | + onPress: () async { | ||
| 601 | + NavigatorUtil.goFeastCreatePage(context); | ||
| 602 | + }, | ||
| 603 | + content: '创建宴会', | ||
| 604 | + hasLeftBorder: true, | ||
| 605 | + isSelect: true)) | ||
| 524 | ], | 606 | ], |
| 525 | - ), | 607 | + ) |
| 526 | ], | 608 | ], |
| 527 | ), | 609 | ), |
| 528 | ); | 610 | ); |
| 1 | -import 'package:flutter/material.dart'; | ||
| 2 | -import 'package:flutter_screenutil/flutter_screenutil.dart'; | ||
| 3 | -import 'package:one_key/res/colors.dart'; | ||
| 4 | -import 'package:one_key/widgets/MyDivider.dart'; | ||
| 5 | -import 'package:one_key/widgets/h_empty_view.dart'; | ||
| 6 | -import 'package:one_key/widgets/v_empty_view.dart'; | ||
| 7 | - | ||
| 8 | -import '../../widgets/round_button.dart'; | ||
| 9 | - | ||
| 10 | -class FeastBoardItem extends StatefulWidget { | ||
| 11 | - FeastBoardItem({Key key}) : super(key: key); | ||
| 12 | - | ||
| 13 | - @override | ||
| 14 | - _FeastBoardItemState createState() => _FeastBoardItemState(); | ||
| 15 | -} | ||
| 16 | - | ||
| 17 | -class _FeastBoardItemState extends State<FeastBoardItem> { | ||
| 18 | - Widget numWidget(String title, bool select, {bool needMargin = true}) { | ||
| 19 | - return Container( | ||
| 20 | - width: ScreenUtil().setWidth(32), | ||
| 21 | - height: ScreenUtil().setWidth(32), | ||
| 22 | - alignment: Alignment.center, | ||
| 23 | - margin: needMargin | ||
| 24 | - ? EdgeInsets.only(right: ScreenUtil().setWidth(50)) | ||
| 25 | - : EdgeInsets.zero, | ||
| 26 | - decoration: BoxDecoration( | ||
| 27 | - color: select ? MyColours.color_438E93 : MyColours.color_BFC4D4, | ||
| 28 | - borderRadius: BorderRadius.circular(ScreenUtil().radius(4))), | ||
| 29 | - child: Text( | ||
| 30 | - title, | ||
| 31 | - style: TextStyle( | ||
| 32 | - color: select ? MyColours.color_ffffff : MyColours.color_515151, | ||
| 33 | - fontSize: ScreenUtil().setSp(16)), | ||
| 34 | - ), | ||
| 35 | - ); | ||
| 36 | - } | ||
| 37 | - | ||
| 38 | - Widget canduanWidget(String title) { | ||
| 39 | - return Column( | ||
| 40 | - children: [ | ||
| 41 | - VEmptyView(16), | ||
| 42 | - Row( | ||
| 43 | - children: [ | ||
| 44 | - Text( | ||
| 45 | - title, | ||
| 46 | - style: TextStyle( | ||
| 47 | - fontSize: ScreenUtil().setSp(28), | ||
| 48 | - color: MyColours.color_000000, | ||
| 49 | - fontWeight: FontWeight.bold), | ||
| 50 | - ), | ||
| 51 | - HEmptyView(56), | ||
| 52 | - RoundButton( | ||
| 53 | - onPressed: () async {}, | ||
| 54 | - text: '刘经理 30桌', | ||
| 55 | - fontSize: 20, | ||
| 56 | - isBold: false, | ||
| 57 | - height: ScreenUtil().setWidth(36), | ||
| 58 | - width: ScreenUtil().setWidth(64 * 2), | ||
| 59 | - gradientStart: MyColours.color_438E93, | ||
| 60 | - gradientEnd: MyColours.color_438E93, | ||
| 61 | - radius: ScreenUtil().radius(10), | ||
| 62 | - textColor: MyColours.color_F6F6F6, | ||
| 63 | - ), | ||
| 64 | - ], | ||
| 65 | - ), | ||
| 66 | - VEmptyView(16), | ||
| 67 | - MyDivider( | ||
| 68 | - double.infinity, | ||
| 69 | - ScreenUtil().setWidth(2), | ||
| 70 | - color: MyColours.color_DBDBDB, | ||
| 71 | - ) | ||
| 72 | - ], | ||
| 73 | - ); | ||
| 74 | - } | ||
| 75 | - | ||
| 76 | - @override | ||
| 77 | - Widget build(BuildContext context) { | ||
| 78 | - return Container( | ||
| 79 | - margin: EdgeInsets.only(bottom: ScreenUtil().setWidth(40)), | ||
| 80 | - padding: EdgeInsets.symmetric( | ||
| 81 | - horizontal: ScreenUtil().setWidth(24), | ||
| 82 | - vertical: ScreenUtil().setWidth(16)), | ||
| 83 | - decoration: BoxDecoration( | ||
| 84 | - borderRadius: BorderRadius.circular(ScreenUtil().radius(10)), | ||
| 85 | - border: Border.all( | ||
| 86 | - color: MyColours.color_438E93, width: ScreenUtil().setWidth(2))), | ||
| 87 | - child: Column( | ||
| 88 | - children: [ | ||
| 89 | - Row( | ||
| 90 | - children: [ | ||
| 91 | - Text( | ||
| 92 | - '凤凰厅', | ||
| 93 | - style: TextStyle( | ||
| 94 | - color: MyColours.color_438E93, | ||
| 95 | - fontSize: ScreenUtil().setSp(40), | ||
| 96 | - fontWeight: FontWeight.bold), | ||
| 97 | - ), | ||
| 98 | - Spacer(), | ||
| 99 | - numWidget('空', false), | ||
| 100 | - numWidget('1', true), | ||
| 101 | - numWidget('空', false), | ||
| 102 | - numWidget('空', false, needMargin: false), | ||
| 103 | - ], | ||
| 104 | - ), | ||
| 105 | - VEmptyView(24), | ||
| 106 | - canduanWidget('早餐'), | ||
| 107 | - canduanWidget('午餐'), | ||
| 108 | - canduanWidget('晚餐'), | ||
| 109 | - canduanWidget('其他'), | ||
| 110 | - ], | ||
| 111 | - ), | ||
| 112 | - ); | ||
| 113 | - } | ||
| 114 | -} |
lib/pages/feast/feast_board_item.dart
0 → 100644
| 1 | +import 'package:flutter/material.dart'; | ||
| 2 | +import 'package:flutter_screenutil/flutter_screenutil.dart'; | ||
| 3 | +import 'package:one_key/res/colors.dart'; | ||
| 4 | +import 'package:one_key/widgets/MyDivider.dart'; | ||
| 5 | +import 'package:one_key/widgets/h_empty_view.dart'; | ||
| 6 | +import 'package:one_key/widgets/v_empty_view.dart'; | ||
| 7 | + | ||
| 8 | +import '../../models/get_board_model.dart'; | ||
| 9 | +import '../../route/navigator_util.dart'; | ||
| 10 | +import '../../utils/screen_util.dart'; | ||
| 11 | +import '../../widgets/round_button.dart'; | ||
| 12 | + | ||
| 13 | +class FeastBoardItem extends StatefulWidget { | ||
| 14 | + final FeastBoardModel boardModel; | ||
| 15 | + final ScrollController controller; | ||
| 16 | + final bool isOpen; | ||
| 17 | + FeastBoardItem({Key key, this.boardModel, this.controller, this.isOpen}) | ||
| 18 | + : super(key: key); | ||
| 19 | + | ||
| 20 | + @override | ||
| 21 | + _FeastBoardItemState createState() => _FeastBoardItemState(); | ||
| 22 | +} | ||
| 23 | + | ||
| 24 | +class _FeastBoardItemState extends State<FeastBoardItem> { | ||
| 25 | + Widget numWidget(String title, bool select, String subTitle, | ||
| 26 | + {bool needMargin = true}) { | ||
| 27 | + return Container( | ||
| 28 | + margin: needMargin | ||
| 29 | + ? EdgeInsets.only(right: ScreenUtil().setWidth(50)) | ||
| 30 | + : EdgeInsets.zero, | ||
| 31 | + child: Column( | ||
| 32 | + crossAxisAlignment: CrossAxisAlignment.center, | ||
| 33 | + mainAxisAlignment: MainAxisAlignment.center, | ||
| 34 | + children: [ | ||
| 35 | + Container( | ||
| 36 | + width: ScreenUtil().setWidth(32), | ||
| 37 | + height: ScreenUtil().setWidth(32), | ||
| 38 | + alignment: Alignment.center, | ||
| 39 | + decoration: BoxDecoration( | ||
| 40 | + color: | ||
| 41 | + select ? MyColours.color_438E93 : MyColours.color_BFC4D4, | ||
| 42 | + borderRadius: BorderRadius.circular(ScreenUtil().radius(4))), | ||
| 43 | + child: Text( | ||
| 44 | + title, | ||
| 45 | + style: TextStyle( | ||
| 46 | + color: select | ||
| 47 | + ? MyColours.color_ffffff | ||
| 48 | + : MyColours.color_515151, | ||
| 49 | + fontSize: ScreenUtil().setSp(16)), | ||
| 50 | + ), | ||
| 51 | + ), | ||
| 52 | + VEmptyView(4), | ||
| 53 | + Container( | ||
| 54 | + // width: ScreenUtil().setWidth(32), | ||
| 55 | + child: Text( | ||
| 56 | + subTitle, | ||
| 57 | + style: | ||
| 58 | + TextStyle(color: MyColours.color_515151, fontSize: font(14)), | ||
| 59 | + )) | ||
| 60 | + ], | ||
| 61 | + )); | ||
| 62 | + } | ||
| 63 | + | ||
| 64 | + Widget canduanWidget(String title) { | ||
| 65 | + return Column( | ||
| 66 | + children: [ | ||
| 67 | + VEmptyView(16), | ||
| 68 | + Row( | ||
| 69 | + children: [ | ||
| 70 | + Text( | ||
| 71 | + title, | ||
| 72 | + style: TextStyle( | ||
| 73 | + fontSize: ScreenUtil().setSp(28), | ||
| 74 | + color: MyColours.color_000000, | ||
| 75 | + fontWeight: FontWeight.bold), | ||
| 76 | + ), | ||
| 77 | + HEmptyView(56), | ||
| 78 | + Expanded( | ||
| 79 | + child: ListView.builder( | ||
| 80 | + shrinkWrap: true, | ||
| 81 | + padding: EdgeInsets.symmetric( | ||
| 82 | + horizontal: ScreenUtil().setWidth(8)), | ||
| 83 | + controller: widget.controller, | ||
| 84 | + physics: NeverScrollableScrollPhysics(), | ||
| 85 | + itemBuilder: (context, index) { | ||
| 86 | + FeastBoardSunModel boardSunModel = | ||
| 87 | + widget.boardModel.data[title][index]; | ||
| 88 | + | ||
| 89 | + return InkWell( | ||
| 90 | + onTap: () { | ||
| 91 | + //点击进入宴会详情 | ||
| 92 | + NavigatorUtil.goFeastDetailPage( | ||
| 93 | + context, boardSunModel.rid); | ||
| 94 | + }, | ||
| 95 | + child: Row( | ||
| 96 | + mainAxisSize: MainAxisSize.min, | ||
| 97 | + children: <Widget>[ | ||
| 98 | + Expanded( | ||
| 99 | + flex: 3, | ||
| 100 | + child: Container( | ||
| 101 | + height: h(24), | ||
| 102 | + // constraints: BoxConstraints.expand(), | ||
| 103 | + alignment: Alignment.centerLeft, | ||
| 104 | + margin: index == | ||
| 105 | + widget.boardModel.data[title] | ||
| 106 | + .length - | ||
| 107 | + 1 | ||
| 108 | + ? EdgeInsets.zero | ||
| 109 | + : EdgeInsets.only(bottom: h(16)), | ||
| 110 | + padding: EdgeInsets.symmetric( | ||
| 111 | + horizontal: w(4), vertical: w(2)), | ||
| 112 | + decoration: BoxDecoration( | ||
| 113 | + color: MyColours.color_438E93, | ||
| 114 | + borderRadius: | ||
| 115 | + BorderRadius.circular(w(5)), | ||
| 116 | + ), | ||
| 117 | + child: Text( | ||
| 118 | + '${boardSunModel.className}-${boardSunModel.rname}-桌子名称顿号隔开', | ||
| 119 | + overflow: TextOverflow.ellipsis, | ||
| 120 | + maxLines: 1, | ||
| 121 | + style: TextStyle( | ||
| 122 | + fontSize: font(14), | ||
| 123 | + color: MyColours.color_F6F6F6), | ||
| 124 | + ), | ||
| 125 | + )), | ||
| 126 | + Expanded(child: SizedBox()), | ||
| 127 | + ])); | ||
| 128 | + }, | ||
| 129 | + itemCount: widget.boardModel.data[title].length)), | ||
| 130 | + ], | ||
| 131 | + ), | ||
| 132 | + VEmptyView(16), | ||
| 133 | + MyDivider( | ||
| 134 | + double.infinity, | ||
| 135 | + ScreenUtil().setWidth(2), | ||
| 136 | + color: MyColours.color_DBDBDB, | ||
| 137 | + ) | ||
| 138 | + ], | ||
| 139 | + ); | ||
| 140 | + } | ||
| 141 | + | ||
| 142 | + @override | ||
| 143 | + Widget build(BuildContext context) { | ||
| 144 | + return Container( | ||
| 145 | + margin: EdgeInsets.only(bottom: ScreenUtil().setWidth(40)), | ||
| 146 | + padding: EdgeInsets.symmetric( | ||
| 147 | + horizontal: ScreenUtil().setWidth(24), | ||
| 148 | + vertical: ScreenUtil().setWidth(16)), | ||
| 149 | + decoration: BoxDecoration( | ||
| 150 | + borderRadius: BorderRadius.circular(ScreenUtil().radius(10)), | ||
| 151 | + border: Border.all( | ||
| 152 | + color: MyColours.color_438E93, width: ScreenUtil().setWidth(2))), | ||
| 153 | + child: Column( | ||
| 154 | + children: [ | ||
| 155 | + Row( | ||
| 156 | + children: [ | ||
| 157 | + Text( | ||
| 158 | + widget.boardModel.title, | ||
| 159 | + style: TextStyle( | ||
| 160 | + color: MyColours.color_438E93, | ||
| 161 | + fontSize: ScreenUtil().setSp(40), | ||
| 162 | + fontWeight: FontWeight.bold), | ||
| 163 | + ), | ||
| 164 | + Spacer(), | ||
| 165 | + numWidget( | ||
| 166 | + widget.boardModel.data['早餐'].length == 0 | ||
| 167 | + ? '空' | ||
| 168 | + : '${widget.boardModel.data['早餐'].length}', | ||
| 169 | + widget.boardModel.data['早餐'].length == 0 ? false : true, | ||
| 170 | + '早餐'), | ||
| 171 | + numWidget( | ||
| 172 | + widget.boardModel.data['午餐'].length == 0 | ||
| 173 | + ? '空' | ||
| 174 | + : '${widget.boardModel.data['午餐'].length}', | ||
| 175 | + widget.boardModel.data['午餐'].length == 0 ? false : true, | ||
| 176 | + '午餐'), | ||
| 177 | + numWidget( | ||
| 178 | + widget.boardModel.data['晚餐'].length == 0 | ||
| 179 | + ? '空' | ||
| 180 | + : '${widget.boardModel.data['晚餐'].length}', | ||
| 181 | + widget.boardModel.data['晚餐'].length == 0 ? false : true, | ||
| 182 | + '晚餐'), | ||
| 183 | + numWidget( | ||
| 184 | + widget.boardModel.data['其他'].length == 0 | ||
| 185 | + ? '空' | ||
| 186 | + : '${widget.boardModel.data['其他'].length}', | ||
| 187 | + widget.boardModel.data['其他'].length == 0 ? false : true, | ||
| 188 | + '其他', | ||
| 189 | + needMargin: false), | ||
| 190 | + ], | ||
| 191 | + ), | ||
| 192 | + widget.isOpen ? VEmptyView(24) : SizedBox(), | ||
| 193 | + widget.isOpen ? canduanWidget('早餐') : SizedBox(), | ||
| 194 | + widget.isOpen ? canduanWidget('午餐') : SizedBox(), | ||
| 195 | + widget.isOpen ? canduanWidget('晚餐') : SizedBox(), | ||
| 196 | + widget.isOpen ? canduanWidget('其他') : SizedBox(), | ||
| 197 | + ], | ||
| 198 | + ), | ||
| 199 | + ); | ||
| 200 | + } | ||
| 201 | +} |
| @@ -13,6 +13,7 @@ import '../models/filter_btn_model.dart'; | @@ -13,6 +13,7 @@ import '../models/filter_btn_model.dart'; | ||
| 13 | import '../models/get_banquet_be_follow_model.dart'; | 13 | import '../models/get_banquet_be_follow_model.dart'; |
| 14 | import '../models/get_banquet_by_id_new_model.dart'; | 14 | import '../models/get_banquet_by_id_new_model.dart'; |
| 15 | import '../models/get_banquet_deposit_model.dart'; | 15 | import '../models/get_banquet_deposit_model.dart'; |
| 16 | +import '../models/get_board_model.dart'; | ||
| 16 | import '../models/get_deposit_model.dart'; | 17 | import '../models/get_deposit_model.dart'; |
| 17 | import '../models/get_seller_user_by_sellerid_model.dart'; | 18 | import '../models/get_seller_user_by_sellerid_model.dart'; |
| 18 | import '../models/get_setmeal_class_by_id_model.dart'; | 19 | import '../models/get_setmeal_class_by_id_model.dart'; |
| @@ -87,6 +88,8 @@ class FeastModel extends ChangeNotifier { | @@ -87,6 +88,8 @@ class FeastModel extends ChangeNotifier { | ||
| 87 | 88 | ||
| 88 | Map<String, String> fullStatusByTime = {}; // 宴会看板 ---- 日历显示红点数据 | 89 | Map<String, String> fullStatusByTime = {}; // 宴会看板 ---- 日历显示红点数据 |
| 89 | 90 | ||
| 91 | + List<FeastBoardModel> banquetByDateData = []; //宴会看板数据 | ||
| 92 | + | ||
| 90 | /** | 93 | /** |
| 91 | * 宴会看板 | 94 | * 宴会看板 |
| 92 | */ | 95 | */ |
| @@ -118,6 +121,41 @@ class FeastModel extends ChangeNotifier { | @@ -118,6 +121,41 @@ class FeastModel extends ChangeNotifier { | ||
| 118 | return fullStatusByTime; | 121 | return fullStatusByTime; |
| 119 | } | 122 | } |
| 120 | 123 | ||
| 124 | + //指定日期、时段宴会预定 | ||
| 125 | + | ||
| 126 | + Future<bool> getBanquetByDate( | ||
| 127 | + BuildContext context, Map<String, String> params, | ||
| 128 | + {showLoading = false}) async { | ||
| 129 | + BaseResp<dynamic> baseResp = await DioUtil() | ||
| 130 | + .request<dynamic>(context, Method.get, HttpUrl.get_banquet_by_date, | ||
| 131 | + data: params, showLoading: showLoading) | ||
| 132 | + .catchError((error) { | ||
| 133 | + print(error.toString()); | ||
| 134 | + if (error is MyError) {} | ||
| 135 | + return false; | ||
| 136 | + }); | ||
| 137 | + if (baseResp == null) return false; | ||
| 138 | + if (baseResp.code == Constant.status_success) { | ||
| 139 | + if (baseResp.data is List) { | ||
| 140 | + banquetByDateData = []; | ||
| 141 | + notifyListeners(); | ||
| 142 | + return true; | ||
| 143 | + } | ||
| 144 | + banquetByDateData = []; | ||
| 145 | + baseResp.data.forEach((key, value) { | ||
| 146 | + FeastBoardModel boardModel = FeastBoardModel(); | ||
| 147 | + boardModel.title = key; | ||
| 148 | + boardModel.data = FeastBoardModel.fromJson(value).data; | ||
| 149 | + banquetByDateData.add(boardModel); | ||
| 150 | + }); | ||
| 151 | + notifyListeners(); | ||
| 152 | + return true; | ||
| 153 | + } else { | ||
| 154 | + Utils.showToast(baseResp.msg ?? ""); | ||
| 155 | + } | ||
| 156 | + return false; | ||
| 157 | + } | ||
| 158 | + | ||
| 121 | /** | 159 | /** |
| 122 | * 宴会定金管理 | 160 | * 宴会定金管理 |
| 123 | */ | 161 | */ |
-
Please register or login to post a comment