Commit b125a9a25b2eb4dbf760176722aea8863d2f0dec

Authored by wdn127929
1 parent 2cf8aebd

桌位管理选择桌位页面越界

@@ -3,7 +3,7 @@ @@ -3,7 +3,7 @@
3 archiveVersion = 1; 3 archiveVersion = 1;
4 classes = { 4 classes = {
5 }; 5 };
6 - objectVersion = 46; 6 + objectVersion = 50;
7 objects = { 7 objects = {
8 8
9 /* Begin PBXBuildFile section */ 9 /* Begin PBXBuildFile section */
@@ -84,6 +84,7 @@ class MergeTableSelectPageState extends State<MergeTableSelectPage> { @@ -84,6 +84,7 @@ class MergeTableSelectPageState extends State<MergeTableSelectPage> {
84 Map dailyMap = {}; // 早市对应半点钟,午市对应半点钟、晚市对应半点钟 84 Map dailyMap = {}; // 早市对应半点钟,午市对应半点钟、晚市对应半点钟
85 85
86 String selectTableId; 86 String selectTableId;
  87 + ScrollController _scrollCrl = ScrollController();
87 88
88 @override 89 @override
89 void initState() { 90 void initState() {
@@ -546,500 +547,517 @@ class MergeTableSelectPageState extends State<MergeTableSelectPage> { @@ -546,500 +547,517 @@ class MergeTableSelectPageState extends State<MergeTableSelectPage> {
546 ], 547 ],
547 ))) 548 )))
548 : SizedBox(), 549 : SizedBox(),
549 - GridView.builder(  
550 - // controller: _areaController,  
551 - // physics: NeverScrollableScrollPhysics(),  
552 - padding: EdgeInsets.symmetric(  
553 - vertical: ScreenUtil().setWidth(20),  
554 - horizontal: ScreenUtil().setWidth(64)),  
555 - shrinkWrap: true,  
556 - itemCount: _chooseTableModel.tablesShow.length == 0 ||  
557 - (i != null &&  
558 - _chooseTableModel  
559 - .areaTableMapShow[areas[i].name].length ==  
560 - 0)  
561 - ? 0  
562 - : _chooseTableModel.areaTableMapShow[areas[i].name].length,  
563 - // itemCount: _chooseTableModel.tablesShow.length == 0 ||  
564 - // (i != null &&  
565 - // _chooseTableModel.areaTableMapShow[areas[i].name].length == 0)  
566 - // ? 0  
567 - // : currentArea == '全部'  
568 - // ? _chooseTableModel.tablesShow.length  
569 - // : _chooseTableModel.areaTableMapShow[areas[i].name].length,  
570 - gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(  
571 - crossAxisCount: 4,  
572 - childAspectRatio: 1,  
573 - mainAxisSpacing: ScreenUtil().setWidth(28),  
574 - crossAxisSpacing: ScreenUtil().setWidth(48),  
575 - ),  
576 -  
577 - itemBuilder: (BuildContext context, int index) {  
578 - List<t.Table> data = _chooseTableModel.tablesShow.length == 0 ||  
579 - (i != null &&  
580 - _chooseTableModel  
581 - .areaTableMapShow[areas[i].name].length ==  
582 - 0)  
583 - ? 0  
584 - : _chooseTableModel.areaTableMapShow[areas[i].name];  
585 - // if (index == data.length || data.length == 0) {  
586 - // return InkWell(  
587 - // onTap: () async {  
588 - // List<String> areasTemp = [];  
589 - // for (int i = 0; i < areas.length; i++) {  
590 - // areasTemp.add(areas[i].name);  
591 - // }  
592 -  
593 - // //添加桌位弹框  
594 - // await DialogUtil.openCreateTableDialog(  
595 - // context, areasTemp, i, personNumList,  
596 - // onTap: (Map<String, String> value) async {  
597 - // print(value);  
598 - // // 'areaname':  
599 - // // areas[currentAreaIndex],  
600 - // // 'name': controller.text,  
601 - // // 'pnumMin': pnumMin,  
602 - // // 'pnumMax': pnumMax  
603 - // //添加桌位 接口参数带整合???  
604 - // // 以下是旧的不去,明天添加桌位接口  
605 - // String rid;  
606 - // for (Area item in areas) {  
607 - // if (item.name == value['areaname']) {  
608 - // rid = item.rid;  
609 - // }  
610 - // }  
611 - // Map<String, String> params = {  
612 - // 'rid': rid,  
613 - // 'name': value['name'],  
614 - // };  
615 - // if (value['pnumMin'] != '') {  
616 - // params['pnum'] = value['pnumMin'];  
617 - // }  
618 - // if (value['pnumMax'] != '') {  
619 - // params['most_pnum'] = value['pnumMax'];  
620 - // }  
621 - // bool success =  
622 - // await _chooseTableModel.addTable(context, params);  
623 - // print(success);  
624 - // if (success) {  
625 - // Utils.showToast('添加成功!');  
626 - // // TableOuter tableOuter = TableOuter();  
627 - // // tableOuter.name = value;  
628 - // // tableOuter.list = [];  
629 - // // tableManagerModel.tableOuterList.add(tableOuter);  
630 - // // tableManagerModel.initData();  
631 - // // Timer(  
632 - // // Duration(milliseconds: 500),  
633 - // // () => _areaController.jumpTo(  
634 - // // _areaController.position.maxScrollExtent));  
635 -  
636 - // // await tableManagerModel  
637 - // // .getTableList(context);  
638 - // // await tableManagerModel  
639 - // // .initData();  
640 - // refreshTable(context);  
641 - // }  
642 - // });  
643 - // },  
644 - // child: Container(  
645 - // child: DottedBorder(  
646 - // dashPattern: [5, 5, 5, 5],  
647 - // borderType: BorderType.RRect,  
648 - // radius: Radius.circular(ScreenUtil().setWidth(20)),  
649 - // // padding: EdgeInsets.all(ScreenUtil().setWidth(70)),  
650 - // color: MyColours.color_E0E0E0,  
651 - // strokeWidth: ScreenUtil().setWidth(2),  
652 - // child: ClipRRect(  
653 - // borderRadius: BorderRadius.all(  
654 - // Radius.circular(ScreenUtil().setWidth(20))),  
655 - // child: Container(  
656 - // height: ScreenUtil().screenWidth -  
657 - // ScreenUtil().setWidth(12 * 3 - 10 * 2),  
658 - // width: ScreenUtil().screenWidth -  
659 - // ScreenUtil().setWidth(12 * 3 - 10 * 2),  
660 - // child: Column(  
661 - // mainAxisAlignment: MainAxisAlignment.center,  
662 - // children: [  
663 - // Image.asset(Utils.getImgPath('add_store'),  
664 - // width: ScreenUtil().setWidth(32)),  
665 - // ],  
666 - // ),  
667 - // ),  
668 - // ),  
669 - // )));  
670 - // } else {  
671 - return Selector<ChooseTableModel, t.Table>(  
672 - shouldRebuild: (pre, next) => true,  
673 - selector: (context, model) => data[index],  
674 - builder: (context, table, _) {  
675 - return MergeTableItem(  
676 - data[index],  
677 - canSelected: true,  
678 - onSelected: (t.Table table) {  
679 - print(areaTableMap.keys);  
680 - // for (String item in areaTableMap.keys) {  
681 - // for (t.Table tableItem in areaTableMap[item]) {  
682 - // tableItem.selected = false;  
683 - // selectNum = 0;  
684 - // if (table.id == tableItem.id) {  
685 - // selectTableId = table.id;  
686 -  
687 - // selectTables = [];  
688 - // selectNum++;  
689 - if (table.selected) {  
690 - //选中  
691 - selectTables.add(table);  
692 - Map temp = {  
693 - 'tid':  
694 - selectTables.length > 0 ? selectTables[0].id : '',  
695 - 'tname':  
696 - selectTables.length > 0 ? selectTables[0].name : ''  
697 - };  
698 - // print(selectNum);  
699 - print(selectTables);  
700 - //检测当前选中区域全选按钮状态更新 550 + Expanded(
  551 + child: Padding(
  552 + padding: EdgeInsets.only(right: w(5)),
  553 + child: Scrollbar(
  554 + isAlwaysShown: true, //设置滚动条常亮
  555 + controller: _scrollCrl, //必须设置一个controller
  556 + radius: Radius.circular(r(6)), // 圆角半径
  557 + thickness: w(4), // 线宽
  558 + // hoverThickness: 12,
701 559
702 - } else {  
703 - //取消选中  
704 - selectTables  
705 - .removeWhere((element) => table.id == element.id);  
706 - }  
707 - List<t.Table> temp = [];  
708 - temp.addAll(tableOuterList[i].list);  
709 - temp.removeWhere((element) {  
710 - if (element.isLock == '1' &&  
711 - !widget.tids.split(',').contains(element.id)) {  
712 - return true;  
713 - }  
714 - return false;  
715 - });  
716 - tableOuterList[i].isAll =  
717 - temp.every((element) => element.selected);  
718 -  
719 - setState(() {});  
720 -  
721 - // NavigatorUtil.goTableMergeTableSelectPage(context,  
722 - // tid: table.id, tname: table.name);  
723 - // setState(() {  
724 - // tableItem.selected = true;  
725 - // });  
726 - // }  
727 - // }  
728 - // }  
729 - },  
730 - fromPage: widget.fromPage,  
731 - tableMap: tableMap,  
732 - rid: null,  
733 - tids: widget.tids,  
734 - );  
735 - },  
736 - );  
737 - // }  
738 - },  
739 - ) 560 + ///添加进度条
  561 + child: GridView.builder(
  562 + // controller: _areaController,
  563 + controller: _scrollCrl,
  564 + // physics: NeverScrollableScrollPhysics(),
  565 +
  566 + padding: EdgeInsets.symmetric(
  567 + vertical: ScreenUtil().setWidth(20),
  568 + horizontal: ScreenUtil().setWidth(64)),
  569 + shrinkWrap: true,
  570 + itemCount: _chooseTableModel.tablesShow.length == 0 ||
  571 + (i != null &&
  572 + _chooseTableModel
  573 + .areaTableMapShow[areas[i].name]
  574 + .length ==
  575 + 0)
  576 + ? 0
  577 + : _chooseTableModel
  578 + .areaTableMapShow[areas[i].name].length,
  579 + // itemCount: _chooseTableModel.tablesShow.length == 0 ||
  580 + // (i != null &&
  581 + // _chooseTableModel.areaTableMapShow[areas[i].name].length == 0)
  582 + // ? 0
  583 + // : currentArea == '全部'
  584 + // ? _chooseTableModel.tablesShow.length
  585 + // : _chooseTableModel.areaTableMapShow[areas[i].name].length,
  586 + gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
  587 + crossAxisCount: 4,
  588 + childAspectRatio: 1,
  589 + mainAxisSpacing: ScreenUtil().setWidth(28),
  590 + crossAxisSpacing: ScreenUtil().setWidth(48),
  591 + ),
  592 +
  593 + itemBuilder: (BuildContext context, int index) {
  594 + List<t.Table> data =
  595 + _chooseTableModel.tablesShow.length == 0 ||
  596 + (i != null &&
  597 + _chooseTableModel
  598 + .areaTableMapShow[areas[i].name]
  599 + .length ==
  600 + 0)
  601 + ? 0
  602 + : _chooseTableModel
  603 + .areaTableMapShow[areas[i].name];
  604 + // if (index == data.length || data.length == 0) {
  605 + // return InkWell(
  606 + // onTap: () async {
  607 + // List<String> areasTemp = [];
  608 + // for (int i = 0; i < areas.length; i++) {
  609 + // areasTemp.add(areas[i].name);
  610 + // }
  611 +
  612 + // //添加桌位弹框
  613 + // await DialogUtil.openCreateTableDialog(
  614 + // context, areasTemp, i, personNumList,
  615 + // onTap: (Map<String, String> value) async {
  616 + // print(value);
  617 + // // 'areaname':
  618 + // // areas[currentAreaIndex],
  619 + // // 'name': controller.text,
  620 + // // 'pnumMin': pnumMin,
  621 + // // 'pnumMax': pnumMax
  622 + // //添加桌位 接口参数带整合???
  623 + // // 以下是旧的不去,明天添加桌位接口
  624 + // String rid;
  625 + // for (Area item in areas) {
  626 + // if (item.name == value['areaname']) {
  627 + // rid = item.rid;
  628 + // }
  629 + // }
  630 + // Map<String, String> params = {
  631 + // 'rid': rid,
  632 + // 'name': value['name'],
  633 + // };
  634 + // if (value['pnumMin'] != '') {
  635 + // params['pnum'] = value['pnumMin'];
  636 + // }
  637 + // if (value['pnumMax'] != '') {
  638 + // params['most_pnum'] = value['pnumMax'];
  639 + // }
  640 + // bool success =
  641 + // await _chooseTableModel.addTable(context, params);
  642 + // print(success);
  643 + // if (success) {
  644 + // Utils.showToast('添加成功!');
  645 + // // TableOuter tableOuter = TableOuter();
  646 + // // tableOuter.name = value;
  647 + // // tableOuter.list = [];
  648 + // // tableManagerModel.tableOuterList.add(tableOuter);
  649 + // // tableManagerModel.initData();
  650 + // // Timer(
  651 + // // Duration(milliseconds: 500),
  652 + // // () => _areaController.jumpTo(
  653 + // // _areaController.position.maxScrollExtent));
  654 +
  655 + // // await tableManagerModel
  656 + // // .getTableList(context);
  657 + // // await tableManagerModel
  658 + // // .initData();
  659 + // refreshTable(context);
  660 + // }
  661 + // });
  662 + // },
  663 + // child: Container(
  664 + // child: DottedBorder(
  665 + // dashPattern: [5, 5, 5, 5],
  666 + // borderType: BorderType.RRect,
  667 + // radius: Radius.circular(ScreenUtil().setWidth(20)),
  668 + // // padding: EdgeInsets.all(ScreenUtil().setWidth(70)),
  669 + // color: MyColours.color_E0E0E0,
  670 + // strokeWidth: ScreenUtil().setWidth(2),
  671 + // child: ClipRRect(
  672 + // borderRadius: BorderRadius.all(
  673 + // Radius.circular(ScreenUtil().setWidth(20))),
  674 + // child: Container(
  675 + // height: ScreenUtil().screenWidth -
  676 + // ScreenUtil().setWidth(12 * 3 - 10 * 2),
  677 + // width: ScreenUtil().screenWidth -
  678 + // ScreenUtil().setWidth(12 * 3 - 10 * 2),
  679 + // child: Column(
  680 + // mainAxisAlignment: MainAxisAlignment.center,
  681 + // children: [
  682 + // Image.asset(Utils.getImgPath('add_store'),
  683 + // width: ScreenUtil().setWidth(32)),
  684 + // ],
  685 + // ),
  686 + // ),
  687 + // ),
  688 + // )));
  689 + // } else {
  690 + return Selector<ChooseTableModel, t.Table>(
  691 + shouldRebuild: (pre, next) => true,
  692 + selector: (context, model) => data[index],
  693 + builder: (context, table, _) {
  694 + return MergeTableItem(
  695 + data[index],
  696 + canSelected: true,
  697 + onSelected: (t.Table table) {
  698 + print(areaTableMap.keys);
  699 + // for (String item in areaTableMap.keys) {
  700 + // for (t.Table tableItem in areaTableMap[item]) {
  701 + // tableItem.selected = false;
  702 + // selectNum = 0;
  703 + // if (table.id == tableItem.id) {
  704 + // selectTableId = table.id;
  705 +
  706 + // selectTables = [];
  707 + // selectNum++;
  708 + if (table.selected) {
  709 + //选中
  710 + selectTables.add(table);
  711 + Map temp = {
  712 + 'tid': selectTables.length > 0
  713 + ? selectTables[0].id
  714 + : '',
  715 + 'tname': selectTables.length > 0
  716 + ? selectTables[0].name
  717 + : ''
  718 + };
  719 + // print(selectNum);
  720 + print(selectTables);
  721 + //检测当前选中区域全选按钮状态更新
  722 +
  723 + } else {
  724 + //取消选中
  725 + selectTables.removeWhere(
  726 + (element) => table.id == element.id);
  727 + }
  728 + List<t.Table> temp = [];
  729 + temp.addAll(tableOuterList[i].list);
  730 + temp.removeWhere((element) {
  731 + if (element.isLock == '1' &&
  732 + !widget.tids
  733 + .split(',')
  734 + .contains(element.id)) {
  735 + return true;
  736 + }
  737 + return false;
  738 + });
  739 + tableOuterList[i].isAll =
  740 + temp.every((element) => element.selected);
  741 +
  742 + setState(() {});
  743 +
  744 + // NavigatorUtil.goTableMergeTableSelectPage(context,
  745 + // tid: table.id, tname: table.name);
  746 + // setState(() {
  747 + // tableItem.selected = true;
  748 + // });
  749 + // }
  750 + // }
  751 + // }
  752 + },
  753 + fromPage: widget.fromPage,
  754 + tableMap: tableMap,
  755 + rid: null,
  756 + tids: widget.tids,
  757 + );
  758 + },
  759 + );
  760 + // }
  761 + },
  762 + ))))
740 ], 763 ],
741 ); 764 );
742 } 765 }
743 766
  767 + Widget _topAreaWidget() {
  768 + return Container(
  769 + color: MyColours.color_ffffff,
  770 + height: ScreenUtil().setWidth(92),
  771 + margin: EdgeInsets.only(bottom: ScreenUtil().setWidth(30)),
  772 + child: Row(
  773 + children: [
  774 + HEmptyView(48),
  775 + Expanded(
  776 + child: ListView.builder(
  777 + itemCount: areas.length,
  778 + shrinkWrap: true,
  779 + scrollDirection: Axis.horizontal,
  780 + itemBuilder: (BuildContext contxt, int index) {
  781 + // if (index == areas.length + 1 ||
  782 + // areas.length == 0) {
  783 + // return InkWell(
  784 + // onTap: () async {
  785 + // //添加区域弹框
  786 + // await DialogUtil.openCreateAreaDialog(
  787 + // context, onTap: (value) async {
  788 + // print(value);
  789 + // //添加区域
  790 + // bool success = await _chooseTableModel
  791 + // .addTableAreas(context, value);
  792 + // print(success);
  793 + // if (success) {
  794 + // Utils.showToast('添加成功!');
  795 + // UserModel userModel =
  796 + // Provider.of<UserModel>(context,
  797 + // listen: false);
  798 + // Map<String, String> params = {
  799 + // "sellerid": userModel.user.sellerid
  800 + // };
  801 + // await _chooseTableModel.getTableList(
  802 + // context, params,
  803 + // needLoading: false);
  804 + // initData();
  805 +
  806 + // // setState(() {
  807 + // // updateMenu();
  808 + // // });
  809 + // // _scrollToIndex(widget
  810 + // // .tableManagerModel
  811 + // // .areas
  812 + // // .length);
  813 +
  814 + // }
  815 + // });
  816 + // },
  817 + // child: Column(
  818 + // children: [
  819 + // VEmptyView(20),
  820 + // DottedBorder(
  821 + // dashPattern: [5, 5, 5, 5],
  822 + // borderType: BorderType.RRect,
  823 + // radius: Radius.circular(
  824 + // ScreenUtil().setWidth(10)),
  825 + // // padding: EdgeInsets.all(ScreenUtil().setWidth(70)),
  826 + // color: MyColours.color_199095,
  827 + // strokeWidth: ScreenUtil().setWidth(2),
  828 + // child: ClipRRect(
  829 + // borderRadius: BorderRadius.all(
  830 + // Radius.circular(
  831 + // ScreenUtil().setWidth(10))),
  832 + // child: Container(
  833 + // height:
  834 + // ScreenUtil().setWidth(25 * 2),
  835 + // width: ScreenUtil()
  836 + // .setWidth(104 * 2),
  837 + // child: Column(
  838 + // mainAxisAlignment:
  839 + // MainAxisAlignment.center,
  840 + // children: [
  841 + // Image.asset(
  842 + // Utils.getImgPath(
  843 + // 'add_area'),
  844 + // width: ScreenUtil()
  845 + // .setWidth(24)),
  846 + // ],
  847 + // ),
  848 + // ),
  849 + // ),
  850 + // )
  851 + // ],
  852 + // ),
  853 + // );
  854 + // } else {
  855 + // if (index == 0) {
  856 + // return InkWell(
  857 + // onTap: () {
  858 + // setState(() {
  859 + // isSelected = true;
  860 + // currentArea = '全部';
  861 + // _chooseTableModel
  862 + // .currentTables =
  863 + // _chooseTableModel
  864 + // .areaTableMapShow[
  865 + // currentArea];
  866 + // });
  867 + // },
  868 + // child: Container(
  869 + // // width: ScreenUtil().setWidth(104 * 2),
  870 + // height: ScreenUtil().setWidth(80),
  871 + // margin: EdgeInsets.only(
  872 + // right:
  873 + // ScreenUtil().setWidth(20),
  874 + // top: ScreenUtil().setWidth(20),
  875 + // ),
  876 + // padding: EdgeInsets.symmetric(
  877 + // horizontal:
  878 + // ScreenUtil().setWidth(20),
  879 + // vertical: ScreenUtil()
  880 + // .setWidth(10)),
  881 + // alignment: Alignment.center,
  882 + // decoration: BoxDecoration(
  883 + // // borderRadius: BorderRadius.circular(ScreenUtil().setWidth(10)),
  884 + // color: isSelected
  885 + // ? MyColours.color_199095
  886 + // : MyColours.color_ffffff,
  887 + // border: Border.all(
  888 + // color: MyColours
  889 + // .color_E0E0E0,
  890 + // width: ScreenUtil()
  891 + // .setWidth(2))),
  892 + // child: Text(
  893 + // '全部',
  894 + // overflow: TextOverflow.ellipsis,
  895 + // style: TextStyle(
  896 + // color: isSelected
  897 + // ? MyColours.color_ffffff
  898 + // : MyColours
  899 + // .color_333333,
  900 + // fontSize:
  901 + // ScreenUtil().setSp(28),
  902 + // decoration:
  903 + // TextDecoration.none,
  904 + // fontWeight:
  905 + // FontWeight.normal),
  906 + // ),
  907 + // ),
  908 + // );
  909 + // } else {
  910 + return AreaItemTable(
  911 + areas[index],
  912 + currentArea,
  913 + (area) {
  914 + setState(() {
  915 + isSelected = false;
  916 + _selectNumber = index;
  917 + currentArea = areas[index].name;
  918 + _chooseTableModel.currentTables =
  919 + _chooseTableModel.areaTableMapShow[currentArea];
  920 + // _anmationMenu();
  921 + });
  922 + },
  923 + showBadge: false,
  924 + );
  925 + // }
  926 + // }
  927 + },
  928 + )),
  929 + ],
  930 + ),
  931 + );
  932 + }
  933 +
744 @override 934 @override
745 Widget build(BuildContext context) { 935 Widget build(BuildContext context) {
746 _chooseTableModel = Provider.of<ChooseTableModel>(context); 936 _chooseTableModel = Provider.of<ChooseTableModel>(context);
747 return Scaffold( 937 return Scaffold(
748 - backgroundColor: MyColours.color_ffffff,  
749 - body: SafeArea(  
750 - child: Column(  
751 - children: <Widget>[  
752 - SystemAppBar(  
753 - "选择要合并的桌位",  
754 - ),  
755 - Expanded(  
756 - child: Consumer<ChooseTableModel>(builder: (context, model, _) {  
757 - if (model.pageState != PageState.Success) {  
758 - return ExceptionPage(  
759 - pageState: model.pageState,  
760 - callback: () {  
761 - getTableList();  
762 - },  
763 - emptyMsg: "暂时没有桌位哦",  
764 - emptyImg: "empty_search",  
765 - showMsg: "加载中,请稍后...",  
766 - );  
767 - } else {  
768 - return Column(  
769 - // crossAxisAlignment: CrossAxisAlignment.center,  
770 - children: [  
771 - Container(  
772 - color: MyColours.color_ffffff,  
773 - height: ScreenUtil().setWidth(92),  
774 - margin: EdgeInsets.only(  
775 - bottom: ScreenUtil().setWidth(30)),  
776 - child: Row(  
777 - children: [  
778 - HEmptyView(48),  
779 - Expanded(  
780 - child: ListView.builder(  
781 - itemCount: areas.length,  
782 - shrinkWrap: true,  
783 - scrollDirection: Axis.horizontal,  
784 - itemBuilder:  
785 - (BuildContext contxt, int index) {  
786 - // if (index == areas.length + 1 ||  
787 - // areas.length == 0) {  
788 - // return InkWell(  
789 - // onTap: () async {  
790 - // //添加区域弹框  
791 - // await DialogUtil.openCreateAreaDialog(  
792 - // context, onTap: (value) async {  
793 - // print(value);  
794 - // //添加区域  
795 - // bool success = await _chooseTableModel  
796 - // .addTableAreas(context, value);  
797 - // print(success);  
798 - // if (success) {  
799 - // Utils.showToast('添加成功!');  
800 - // UserModel userModel =  
801 - // Provider.of<UserModel>(context,  
802 - // listen: false);  
803 - // Map<String, String> params = {  
804 - // "sellerid": userModel.user.sellerid  
805 - // };  
806 - // await _chooseTableModel.getTableList(  
807 - // context, params,  
808 - // needLoading: false);  
809 - // initData();  
810 -  
811 - // // setState(() {  
812 - // // updateMenu();  
813 - // // });  
814 - // // _scrollToIndex(widget  
815 - // // .tableManagerModel  
816 - // // .areas  
817 - // // .length);  
818 -  
819 - // }  
820 - // });  
821 - // },  
822 - // child: Column(  
823 - // children: [  
824 - // VEmptyView(20),  
825 - // DottedBorder(  
826 - // dashPattern: [5, 5, 5, 5],  
827 - // borderType: BorderType.RRect,  
828 - // radius: Radius.circular(  
829 - // ScreenUtil().setWidth(10)),  
830 - // // padding: EdgeInsets.all(ScreenUtil().setWidth(70)),  
831 - // color: MyColours.color_199095,  
832 - // strokeWidth: ScreenUtil().setWidth(2),  
833 - // child: ClipRRect(  
834 - // borderRadius: BorderRadius.all(  
835 - // Radius.circular(  
836 - // ScreenUtil().setWidth(10))),  
837 - // child: Container(  
838 - // height:  
839 - // ScreenUtil().setWidth(25 * 2),  
840 - // width: ScreenUtil()  
841 - // .setWidth(104 * 2),  
842 - // child: Column(  
843 - // mainAxisAlignment:  
844 - // MainAxisAlignment.center,  
845 - // children: [  
846 - // Image.asset(  
847 - // Utils.getImgPath(  
848 - // 'add_area'),  
849 - // width: ScreenUtil()  
850 - // .setWidth(24)),  
851 - // ],  
852 - // ),  
853 - // ),  
854 - // ),  
855 - // )  
856 - // ],  
857 - // ),  
858 - // );  
859 - // } else {  
860 - // if (index == 0) {  
861 - // return InkWell(  
862 - // onTap: () {  
863 - // setState(() {  
864 - // isSelected = true;  
865 - // currentArea = '全部';  
866 - // _chooseTableModel  
867 - // .currentTables =  
868 - // _chooseTableModel  
869 - // .areaTableMapShow[  
870 - // currentArea];  
871 - // });  
872 - // },  
873 - // child: Container(  
874 - // // width: ScreenUtil().setWidth(104 * 2),  
875 - // height: ScreenUtil().setWidth(80),  
876 - // margin: EdgeInsets.only(  
877 - // right:  
878 - // ScreenUtil().setWidth(20),  
879 - // top: ScreenUtil().setWidth(20),  
880 - // ),  
881 - // padding: EdgeInsets.symmetric(  
882 - // horizontal:  
883 - // ScreenUtil().setWidth(20),  
884 - // vertical: ScreenUtil()  
885 - // .setWidth(10)),  
886 - // alignment: Alignment.center,  
887 - // decoration: BoxDecoration(  
888 - // // borderRadius: BorderRadius.circular(ScreenUtil().setWidth(10)),  
889 - // color: isSelected  
890 - // ? MyColours.color_199095  
891 - // : MyColours.color_ffffff,  
892 - // border: Border.all(  
893 - // color: MyColours  
894 - // .color_E0E0E0,  
895 - // width: ScreenUtil()  
896 - // .setWidth(2))),  
897 - // child: Text(  
898 - // '全部',  
899 - // overflow: TextOverflow.ellipsis,  
900 - // style: TextStyle(  
901 - // color: isSelected  
902 - // ? MyColours.color_ffffff  
903 - // : MyColours  
904 - // .color_333333,  
905 - // fontSize:  
906 - // ScreenUtil().setSp(28),  
907 - // decoration:  
908 - // TextDecoration.none,  
909 - // fontWeight:  
910 - // FontWeight.normal),  
911 - // ),  
912 - // ),  
913 - // );  
914 - // } else {  
915 - return AreaItemTable(  
916 - areas[index],  
917 - currentArea,  
918 - (area) {  
919 - setState(() {  
920 - isSelected = false;  
921 - _selectNumber = index;  
922 - currentArea = areas[index].name;  
923 - _chooseTableModel.currentTables =  
924 - _chooseTableModel  
925 - .areaTableMapShow[  
926 - currentArea];  
927 - // _anmationMenu();  
928 - });  
929 - },  
930 - showBadge: false,  
931 - );  
932 - // }  
933 - // }  
934 - },  
935 - )),  
936 - ],  
937 - ),  
938 - ),  
939 - Expanded(  
940 - // flex: 2,  
941 - child: Container(  
942 - constraints: BoxConstraints(  
943 - minHeight: ScreenUtil().setWidth(100)),  
944 - color: MyColours.color_ffffff,  
945 - child: item(_selectNumber))),  
946 - Container(  
947 - padding: EdgeInsets.symmetric(horizontal: w(48)),  
948 - margin: EdgeInsets.only(bottom: w(40)),  
949 - child: Row(  
950 - mainAxisAlignment:  
951 - MainAxisAlignment.spaceBetween,  
952 - children: [  
953 - RoundButton(  
954 - // content: widget.fromPage == 'tablePhoto'  
955 - // ? '确定'  
956 - // : "已选${selectNum}个 确定",  
957 -  
958 - text: '返回',  
959 - radius: r(4),  
960 - width: w(128),  
961 - height: w(36),  
962 - fontSize: 28,  
963 - isBold: false,  
964 - textColor: MyColours.color_515151,  
965 - gradientStart: MyColours.color_DBDBDB,  
966 - gradientEnd: MyColours.color_DBDBDB,  
967 - onPressed: () {  
968 - Navigator.of(context).pop();  
969 - },  
970 - ),  
971 - RoundButton(  
972 - // content: widget.fromPage == 'tablePhoto'  
973 - // ? '确定'  
974 - // : "已选${selectNum}个 确定",  
975 - text: '保存',  
976 - width: w(128),  
977 - height: w(36),  
978 - radius: r(4),  
979 - isBold: false,  
980 - gradientStart: MyColours.color_438E93,  
981 - gradientEnd: MyColours.color_438E93,  
982 - fontSize: 28,  
983 - textColor: MyColours.color_ffffff,  
984 - onPressed: () {  
985 - // if (widget.fromPage == "tablePhoto") {  
986 - // Map temp = {  
987 - // 'tid': selectTables.length > 0  
988 - // ? selectTables[0].id  
989 - // : '',  
990 - // 'tname': selectTables.length > 0  
991 - // ? selectTables[0].name  
992 - // : ''  
993 - // };  
994 - // Navigator.of(context).pop(temp);  
995 - // } else {  
996 - if (widget.canChoose) {  
997 - // // if (widget.tableList.length > 0) {  
998 - // String tid = "";  
999 - // for (TableList table  
1000 - // in widget.tableList) {  
1001 - // tid += table.id + ",";  
1002 - // }  
1003 - // if (widget.tableList.length > 0) {  
1004 - // tid = tid.substring(  
1005 - // 0, tid.length - 1);  
1006 - // }  
1007 -  
1008 - // Map temp = {  
1009 - // 'object': widget.tableList,  
1010 - // 'tid': tid  
1011 - // };  
1012 - // Navigator.of(context).pop(temp);  
1013 - // // }  
1014 - // } else {  
1015 -  
1016 - String tid = "";  
1017 - for (t.Table table in selectTables) {  
1018 - tid += table.id + ",";  
1019 - }  
1020 - if (selectTables.length > 0) {  
1021 - tid =  
1022 - tid.substring(0, tid.length - 1);  
1023 - }  
1024 -  
1025 - Map temp = {  
1026 - 'object': selectTables,  
1027 - 'tid': tid  
1028 - };  
1029 - Navigator.of(context).pop(temp);  
1030 - }  
1031 - // }  
1032 - },  
1033 - ),  
1034 - ],  
1035 - ))  
1036 - ]);  
1037 - }  
1038 - }),  
1039 - ),  
1040 - ],  
1041 - ),  
1042 - )); 938 + backgroundColor: MyColours.color_ffffff,
  939 + appBar: SystemAppBar(
  940 + "选择要合并的桌位",
  941 + ),
  942 + body: Consumer<ChooseTableModel>(builder: (context, model, _) {
  943 + if (model.pageState != PageState.Success) {
  944 + return ExceptionPage(
  945 + pageState: model.pageState,
  946 + callback: () {
  947 + getTableList();
  948 + },
  949 + emptyMsg: "暂时没有桌位哦",
  950 + emptyImg: "empty_search",
  951 + showMsg: "加载中,请稍后...",
  952 + );
  953 + } else {
  954 + return Column(
  955 + // crossAxisAlignment: CrossAxisAlignment.center,
  956 + children: [
  957 + Expanded(
  958 + child: Column(
  959 + children: [
  960 + _topAreaWidget(),
  961 + Expanded(
  962 + // flex: 2,
  963 + child: Container(
  964 + constraints: BoxConstraints(
  965 + minHeight: ScreenUtil().setWidth(100)),
  966 + color: MyColours.color_ffffff,
  967 + child: item(_selectNumber))),
  968 + ],
  969 + ),
  970 + ),
  971 + Container(
  972 + color: MyColours.color_ffffff,
  973 + padding: EdgeInsets.symmetric(horizontal: w(48)),
  974 + margin: EdgeInsets.only(bottom: w(35), top: w(25)),
  975 + child: Row(
  976 + mainAxisAlignment: MainAxisAlignment.spaceBetween,
  977 + children: [
  978 + RoundButton(
  979 + // content: widget.fromPage == 'tablePhoto'
  980 + // ? '确定'
  981 + // : "已选${selectNum}个 确定",
  982 +
  983 + text: '返回',
  984 + radius: r(4),
  985 + width: w(128),
  986 + height: w(36),
  987 + fontSize: 28,
  988 + isBold: false,
  989 + textColor: MyColours.color_515151,
  990 + gradientStart: MyColours.color_DBDBDB,
  991 + gradientEnd: MyColours.color_DBDBDB,
  992 + onPressed: () {
  993 + Navigator.of(context).pop();
  994 + },
  995 + ),
  996 + RoundButton(
  997 + // content: widget.fromPage == 'tablePhoto'
  998 + // ? '确定'
  999 + // : "已选${selectNum}个 确定",
  1000 + text: '保存',
  1001 + width: w(128),
  1002 + height: w(36),
  1003 + radius: r(4),
  1004 + isBold: false,
  1005 + gradientStart: MyColours.color_438E93,
  1006 + gradientEnd: MyColours.color_438E93,
  1007 + fontSize: 28,
  1008 + textColor: MyColours.color_ffffff,
  1009 + onPressed: () {
  1010 + // if (widget.fromPage == "tablePhoto") {
  1011 + // Map temp = {
  1012 + // 'tid': selectTables.length > 0
  1013 + // ? selectTables[0].id
  1014 + // : '',
  1015 + // 'tname': selectTables.length > 0
  1016 + // ? selectTables[0].name
  1017 + // : ''
  1018 + // };
  1019 + // Navigator.of(context).pop(temp);
  1020 + // } else {
  1021 + if (widget.canChoose) {
  1022 + // // if (widget.tableList.length > 0) {
  1023 + // String tid = "";
  1024 + // for (TableList table
  1025 + // in widget.tableList) {
  1026 + // tid += table.id + ",";
  1027 + // }
  1028 + // if (widget.tableList.length > 0) {
  1029 + // tid = tid.substring(
  1030 + // 0, tid.length - 1);
  1031 + // }
  1032 +
  1033 + // Map temp = {
  1034 + // 'object': widget.tableList,
  1035 + // 'tid': tid
  1036 + // };
  1037 + // Navigator.of(context).pop(temp);
  1038 + // // }
  1039 + // } else {
  1040 +
  1041 + String tid = "";
  1042 + for (t.Table table in selectTables) {
  1043 + tid += table.id + ",";
  1044 + }
  1045 + if (selectTables.length > 0) {
  1046 + tid = tid.substring(0, tid.length - 1);
  1047 + }
  1048 +
  1049 + Map temp = {'object': selectTables, 'tid': tid};
  1050 + Navigator.of(context).pop(temp);
  1051 + }
  1052 + // }
  1053 + },
  1054 + ),
  1055 + ],
  1056 + ))
  1057 + ]);
  1058 + }
  1059 + }),
  1060 + );
1043 } 1061 }
1044 1062
1045 _backLastPage() { 1063 _backLastPage() {