|
...
|
...
|
@@ -84,6 +84,7 @@ class MergeTableSelectPageState extends State<MergeTableSelectPage> { |
|
|
|
Map dailyMap = {}; // 早市对应半点钟,午市对应半点钟、晚市对应半点钟
|
|
|
|
|
|
|
|
String selectTableId;
|
|
|
|
ScrollController _scrollCrl = ScrollController();
|
|
|
|
|
|
|
|
@override
|
|
|
|
void initState() {
|
|
...
|
...
|
@@ -546,500 +547,517 @@ class MergeTableSelectPageState extends State<MergeTableSelectPage> { |
|
|
|
],
|
|
|
|
)))
|
|
|
|
: SizedBox(),
|
|
|
|
GridView.builder(
|
|
|
|
// controller: _areaController,
|
|
|
|
// physics: NeverScrollableScrollPhysics(),
|
|
|
|
padding: EdgeInsets.symmetric(
|
|
|
|
vertical: ScreenUtil().setWidth(20),
|
|
|
|
horizontal: ScreenUtil().setWidth(64)),
|
|
|
|
shrinkWrap: true,
|
|
|
|
itemCount: _chooseTableModel.tablesShow.length == 0 ||
|
|
|
|
(i != null &&
|
|
|
|
_chooseTableModel
|
|
|
|
.areaTableMapShow[areas[i].name].length ==
|
|
|
|
0)
|
|
|
|
? 0
|
|
|
|
: _chooseTableModel.areaTableMapShow[areas[i].name].length,
|
|
|
|
// itemCount: _chooseTableModel.tablesShow.length == 0 ||
|
|
|
|
// (i != null &&
|
|
|
|
// _chooseTableModel.areaTableMapShow[areas[i].name].length == 0)
|
|
|
|
// ? 0
|
|
|
|
// : currentArea == '全部'
|
|
|
|
// ? _chooseTableModel.tablesShow.length
|
|
|
|
// : _chooseTableModel.areaTableMapShow[areas[i].name].length,
|
|
|
|
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
|
|
|
|
crossAxisCount: 4,
|
|
|
|
childAspectRatio: 1,
|
|
|
|
mainAxisSpacing: ScreenUtil().setWidth(28),
|
|
|
|
crossAxisSpacing: ScreenUtil().setWidth(48),
|
|
|
|
),
|
|
|
|
|
|
|
|
itemBuilder: (BuildContext context, int index) {
|
|
|
|
List<t.Table> data = _chooseTableModel.tablesShow.length == 0 ||
|
|
|
|
(i != null &&
|
|
|
|
_chooseTableModel
|
|
|
|
.areaTableMapShow[areas[i].name].length ==
|
|
|
|
0)
|
|
|
|
? 0
|
|
|
|
: _chooseTableModel.areaTableMapShow[areas[i].name];
|
|
|
|
// if (index == data.length || data.length == 0) {
|
|
|
|
// return InkWell(
|
|
|
|
// onTap: () async {
|
|
|
|
// List<String> areasTemp = [];
|
|
|
|
// for (int i = 0; i < areas.length; i++) {
|
|
|
|
// areasTemp.add(areas[i].name);
|
|
|
|
// }
|
|
|
|
|
|
|
|
// //添加桌位弹框
|
|
|
|
// await DialogUtil.openCreateTableDialog(
|
|
|
|
// context, areasTemp, i, personNumList,
|
|
|
|
// onTap: (Map<String, String> value) async {
|
|
|
|
// print(value);
|
|
|
|
// // 'areaname':
|
|
|
|
// // areas[currentAreaIndex],
|
|
|
|
// // 'name': controller.text,
|
|
|
|
// // 'pnumMin': pnumMin,
|
|
|
|
// // 'pnumMax': pnumMax
|
|
|
|
// //添加桌位 接口参数带整合???
|
|
|
|
// // 以下是旧的不去,明天添加桌位接口
|
|
|
|
// String rid;
|
|
|
|
// for (Area item in areas) {
|
|
|
|
// if (item.name == value['areaname']) {
|
|
|
|
// rid = item.rid;
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
// Map<String, String> params = {
|
|
|
|
// 'rid': rid,
|
|
|
|
// 'name': value['name'],
|
|
|
|
// };
|
|
|
|
// if (value['pnumMin'] != '') {
|
|
|
|
// params['pnum'] = value['pnumMin'];
|
|
|
|
// }
|
|
|
|
// if (value['pnumMax'] != '') {
|
|
|
|
// params['most_pnum'] = value['pnumMax'];
|
|
|
|
// }
|
|
|
|
// bool success =
|
|
|
|
// await _chooseTableModel.addTable(context, params);
|
|
|
|
// print(success);
|
|
|
|
// if (success) {
|
|
|
|
// Utils.showToast('添加成功!');
|
|
|
|
// // TableOuter tableOuter = TableOuter();
|
|
|
|
// // tableOuter.name = value;
|
|
|
|
// // tableOuter.list = [];
|
|
|
|
// // tableManagerModel.tableOuterList.add(tableOuter);
|
|
|
|
// // tableManagerModel.initData();
|
|
|
|
// // Timer(
|
|
|
|
// // Duration(milliseconds: 500),
|
|
|
|
// // () => _areaController.jumpTo(
|
|
|
|
// // _areaController.position.maxScrollExtent));
|
|
|
|
|
|
|
|
// // await tableManagerModel
|
|
|
|
// // .getTableList(context);
|
|
|
|
// // await tableManagerModel
|
|
|
|
// // .initData();
|
|
|
|
// refreshTable(context);
|
|
|
|
// }
|
|
|
|
// });
|
|
|
|
// },
|
|
|
|
// child: Container(
|
|
|
|
// child: DottedBorder(
|
|
|
|
// dashPattern: [5, 5, 5, 5],
|
|
|
|
// borderType: BorderType.RRect,
|
|
|
|
// radius: Radius.circular(ScreenUtil().setWidth(20)),
|
|
|
|
// // padding: EdgeInsets.all(ScreenUtil().setWidth(70)),
|
|
|
|
// color: MyColours.color_E0E0E0,
|
|
|
|
// strokeWidth: ScreenUtil().setWidth(2),
|
|
|
|
// child: ClipRRect(
|
|
|
|
// borderRadius: BorderRadius.all(
|
|
|
|
// Radius.circular(ScreenUtil().setWidth(20))),
|
|
|
|
// child: Container(
|
|
|
|
// height: ScreenUtil().screenWidth -
|
|
|
|
// ScreenUtil().setWidth(12 * 3 - 10 * 2),
|
|
|
|
// width: ScreenUtil().screenWidth -
|
|
|
|
// ScreenUtil().setWidth(12 * 3 - 10 * 2),
|
|
|
|
// child: Column(
|
|
|
|
// mainAxisAlignment: MainAxisAlignment.center,
|
|
|
|
// children: [
|
|
|
|
// Image.asset(Utils.getImgPath('add_store'),
|
|
|
|
// width: ScreenUtil().setWidth(32)),
|
|
|
|
// ],
|
|
|
|
// ),
|
|
|
|
// ),
|
|
|
|
// ),
|
|
|
|
// )));
|
|
|
|
// } else {
|
|
|
|
return Selector<ChooseTableModel, t.Table>(
|
|
|
|
shouldRebuild: (pre, next) => true,
|
|
|
|
selector: (context, model) => data[index],
|
|
|
|
builder: (context, table, _) {
|
|
|
|
return MergeTableItem(
|
|
|
|
data[index],
|
|
|
|
canSelected: true,
|
|
|
|
onSelected: (t.Table table) {
|
|
|
|
print(areaTableMap.keys);
|
|
|
|
// for (String item in areaTableMap.keys) {
|
|
|
|
// for (t.Table tableItem in areaTableMap[item]) {
|
|
|
|
// tableItem.selected = false;
|
|
|
|
// selectNum = 0;
|
|
|
|
// if (table.id == tableItem.id) {
|
|
|
|
// selectTableId = table.id;
|
|
|
|
|
|
|
|
// selectTables = [];
|
|
|
|
// selectNum++;
|
|
|
|
if (table.selected) {
|
|
|
|
//选中
|
|
|
|
selectTables.add(table);
|
|
|
|
Map temp = {
|
|
|
|
'tid':
|
|
|
|
selectTables.length > 0 ? selectTables[0].id : '',
|
|
|
|
'tname':
|
|
|
|
selectTables.length > 0 ? selectTables[0].name : ''
|
|
|
|
};
|
|
|
|
// print(selectNum);
|
|
|
|
print(selectTables);
|
|
|
|
//检测当前选中区域全选按钮状态更新
|
|
|
|
Expanded(
|
|
|
|
child: Padding(
|
|
|
|
padding: EdgeInsets.only(right: w(5)),
|
|
|
|
child: Scrollbar(
|
|
|
|
isAlwaysShown: true, //设置滚动条常亮
|
|
|
|
controller: _scrollCrl, //必须设置一个controller
|
|
|
|
radius: Radius.circular(r(6)), // 圆角半径
|
|
|
|
thickness: w(4), // 线宽
|
|
|
|
// hoverThickness: 12,
|
|
|
|
|
|
|
|
} else {
|
|
|
|
//取消选中
|
|
|
|
selectTables
|
|
|
|
.removeWhere((element) => table.id == element.id);
|
|
|
|
}
|
|
|
|
List<t.Table> temp = [];
|
|
|
|
temp.addAll(tableOuterList[i].list);
|
|
|
|
temp.removeWhere((element) {
|
|
|
|
if (element.isLock == '1' &&
|
|
|
|
!widget.tids.split(',').contains(element.id)) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
});
|
|
|
|
tableOuterList[i].isAll =
|
|
|
|
temp.every((element) => element.selected);
|
|
|
|
|
|
|
|
setState(() {});
|
|
|
|
|
|
|
|
// NavigatorUtil.goTableMergeTableSelectPage(context,
|
|
|
|
// tid: table.id, tname: table.name);
|
|
|
|
// setState(() {
|
|
|
|
// tableItem.selected = true;
|
|
|
|
// });
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
},
|
|
|
|
fromPage: widget.fromPage,
|
|
|
|
tableMap: tableMap,
|
|
|
|
rid: null,
|
|
|
|
tids: widget.tids,
|
|
|
|
);
|
|
|
|
},
|
|
|
|
);
|
|
|
|
// }
|
|
|
|
},
|
|
|
|
)
|
|
|
|
///添加进度条
|
|
|
|
child: GridView.builder(
|
|
|
|
// controller: _areaController,
|
|
|
|
controller: _scrollCrl,
|
|
|
|
// physics: NeverScrollableScrollPhysics(),
|
|
|
|
|
|
|
|
padding: EdgeInsets.symmetric(
|
|
|
|
vertical: ScreenUtil().setWidth(20),
|
|
|
|
horizontal: ScreenUtil().setWidth(64)),
|
|
|
|
shrinkWrap: true,
|
|
|
|
itemCount: _chooseTableModel.tablesShow.length == 0 ||
|
|
|
|
(i != null &&
|
|
|
|
_chooseTableModel
|
|
|
|
.areaTableMapShow[areas[i].name]
|
|
|
|
.length ==
|
|
|
|
0)
|
|
|
|
? 0
|
|
|
|
: _chooseTableModel
|
|
|
|
.areaTableMapShow[areas[i].name].length,
|
|
|
|
// itemCount: _chooseTableModel.tablesShow.length == 0 ||
|
|
|
|
// (i != null &&
|
|
|
|
// _chooseTableModel.areaTableMapShow[areas[i].name].length == 0)
|
|
|
|
// ? 0
|
|
|
|
// : currentArea == '全部'
|
|
|
|
// ? _chooseTableModel.tablesShow.length
|
|
|
|
// : _chooseTableModel.areaTableMapShow[areas[i].name].length,
|
|
|
|
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
|
|
|
|
crossAxisCount: 4,
|
|
|
|
childAspectRatio: 1,
|
|
|
|
mainAxisSpacing: ScreenUtil().setWidth(28),
|
|
|
|
crossAxisSpacing: ScreenUtil().setWidth(48),
|
|
|
|
),
|
|
|
|
|
|
|
|
itemBuilder: (BuildContext context, int index) {
|
|
|
|
List<t.Table> data =
|
|
|
|
_chooseTableModel.tablesShow.length == 0 ||
|
|
|
|
(i != null &&
|
|
|
|
_chooseTableModel
|
|
|
|
.areaTableMapShow[areas[i].name]
|
|
|
|
.length ==
|
|
|
|
0)
|
|
|
|
? 0
|
|
|
|
: _chooseTableModel
|
|
|
|
.areaTableMapShow[areas[i].name];
|
|
|
|
// if (index == data.length || data.length == 0) {
|
|
|
|
// return InkWell(
|
|
|
|
// onTap: () async {
|
|
|
|
// List<String> areasTemp = [];
|
|
|
|
// for (int i = 0; i < areas.length; i++) {
|
|
|
|
// areasTemp.add(areas[i].name);
|
|
|
|
// }
|
|
|
|
|
|
|
|
// //添加桌位弹框
|
|
|
|
// await DialogUtil.openCreateTableDialog(
|
|
|
|
// context, areasTemp, i, personNumList,
|
|
|
|
// onTap: (Map<String, String> value) async {
|
|
|
|
// print(value);
|
|
|
|
// // 'areaname':
|
|
|
|
// // areas[currentAreaIndex],
|
|
|
|
// // 'name': controller.text,
|
|
|
|
// // 'pnumMin': pnumMin,
|
|
|
|
// // 'pnumMax': pnumMax
|
|
|
|
// //添加桌位 接口参数带整合???
|
|
|
|
// // 以下是旧的不去,明天添加桌位接口
|
|
|
|
// String rid;
|
|
|
|
// for (Area item in areas) {
|
|
|
|
// if (item.name == value['areaname']) {
|
|
|
|
// rid = item.rid;
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
// Map<String, String> params = {
|
|
|
|
// 'rid': rid,
|
|
|
|
// 'name': value['name'],
|
|
|
|
// };
|
|
|
|
// if (value['pnumMin'] != '') {
|
|
|
|
// params['pnum'] = value['pnumMin'];
|
|
|
|
// }
|
|
|
|
// if (value['pnumMax'] != '') {
|
|
|
|
// params['most_pnum'] = value['pnumMax'];
|
|
|
|
// }
|
|
|
|
// bool success =
|
|
|
|
// await _chooseTableModel.addTable(context, params);
|
|
|
|
// print(success);
|
|
|
|
// if (success) {
|
|
|
|
// Utils.showToast('添加成功!');
|
|
|
|
// // TableOuter tableOuter = TableOuter();
|
|
|
|
// // tableOuter.name = value;
|
|
|
|
// // tableOuter.list = [];
|
|
|
|
// // tableManagerModel.tableOuterList.add(tableOuter);
|
|
|
|
// // tableManagerModel.initData();
|
|
|
|
// // Timer(
|
|
|
|
// // Duration(milliseconds: 500),
|
|
|
|
// // () => _areaController.jumpTo(
|
|
|
|
// // _areaController.position.maxScrollExtent));
|
|
|
|
|
|
|
|
// // await tableManagerModel
|
|
|
|
// // .getTableList(context);
|
|
|
|
// // await tableManagerModel
|
|
|
|
// // .initData();
|
|
|
|
// refreshTable(context);
|
|
|
|
// }
|
|
|
|
// });
|
|
|
|
// },
|
|
|
|
// child: Container(
|
|
|
|
// child: DottedBorder(
|
|
|
|
// dashPattern: [5, 5, 5, 5],
|
|
|
|
// borderType: BorderType.RRect,
|
|
|
|
// radius: Radius.circular(ScreenUtil().setWidth(20)),
|
|
|
|
// // padding: EdgeInsets.all(ScreenUtil().setWidth(70)),
|
|
|
|
// color: MyColours.color_E0E0E0,
|
|
|
|
// strokeWidth: ScreenUtil().setWidth(2),
|
|
|
|
// child: ClipRRect(
|
|
|
|
// borderRadius: BorderRadius.all(
|
|
|
|
// Radius.circular(ScreenUtil().setWidth(20))),
|
|
|
|
// child: Container(
|
|
|
|
// height: ScreenUtil().screenWidth -
|
|
|
|
// ScreenUtil().setWidth(12 * 3 - 10 * 2),
|
|
|
|
// width: ScreenUtil().screenWidth -
|
|
|
|
// ScreenUtil().setWidth(12 * 3 - 10 * 2),
|
|
|
|
// child: Column(
|
|
|
|
// mainAxisAlignment: MainAxisAlignment.center,
|
|
|
|
// children: [
|
|
|
|
// Image.asset(Utils.getImgPath('add_store'),
|
|
|
|
// width: ScreenUtil().setWidth(32)),
|
|
|
|
// ],
|
|
|
|
// ),
|
|
|
|
// ),
|
|
|
|
// ),
|
|
|
|
// )));
|
|
|
|
// } else {
|
|
|
|
return Selector<ChooseTableModel, t.Table>(
|
|
|
|
shouldRebuild: (pre, next) => true,
|
|
|
|
selector: (context, model) => data[index],
|
|
|
|
builder: (context, table, _) {
|
|
|
|
return MergeTableItem(
|
|
|
|
data[index],
|
|
|
|
canSelected: true,
|
|
|
|
onSelected: (t.Table table) {
|
|
|
|
print(areaTableMap.keys);
|
|
|
|
// for (String item in areaTableMap.keys) {
|
|
|
|
// for (t.Table tableItem in areaTableMap[item]) {
|
|
|
|
// tableItem.selected = false;
|
|
|
|
// selectNum = 0;
|
|
|
|
// if (table.id == tableItem.id) {
|
|
|
|
// selectTableId = table.id;
|
|
|
|
|
|
|
|
// selectTables = [];
|
|
|
|
// selectNum++;
|
|
|
|
if (table.selected) {
|
|
|
|
//选中
|
|
|
|
selectTables.add(table);
|
|
|
|
Map temp = {
|
|
|
|
'tid': selectTables.length > 0
|
|
|
|
? selectTables[0].id
|
|
|
|
: '',
|
|
|
|
'tname': selectTables.length > 0
|
|
|
|
? selectTables[0].name
|
|
|
|
: ''
|
|
|
|
};
|
|
|
|
// print(selectNum);
|
|
|
|
print(selectTables);
|
|
|
|
//检测当前选中区域全选按钮状态更新
|
|
|
|
|
|
|
|
} else {
|
|
|
|
//取消选中
|
|
|
|
selectTables.removeWhere(
|
|
|
|
(element) => table.id == element.id);
|
|
|
|
}
|
|
|
|
List<t.Table> temp = [];
|
|
|
|
temp.addAll(tableOuterList[i].list);
|
|
|
|
temp.removeWhere((element) {
|
|
|
|
if (element.isLock == '1' &&
|
|
|
|
!widget.tids
|
|
|
|
.split(',')
|
|
|
|
.contains(element.id)) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
});
|
|
|
|
tableOuterList[i].isAll =
|
|
|
|
temp.every((element) => element.selected);
|
|
|
|
|
|
|
|
setState(() {});
|
|
|
|
|
|
|
|
// NavigatorUtil.goTableMergeTableSelectPage(context,
|
|
|
|
// tid: table.id, tname: table.name);
|
|
|
|
// setState(() {
|
|
|
|
// tableItem.selected = true;
|
|
|
|
// });
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
},
|
|
|
|
fromPage: widget.fromPage,
|
|
|
|
tableMap: tableMap,
|
|
|
|
rid: null,
|
|
|
|
tids: widget.tids,
|
|
|
|
);
|
|
|
|
},
|
|
|
|
);
|
|
|
|
// }
|
|
|
|
},
|
|
|
|
))))
|
|
|
|
],
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
Widget _topAreaWidget() {
|
|
|
|
return Container(
|
|
|
|
color: MyColours.color_ffffff,
|
|
|
|
height: ScreenUtil().setWidth(92),
|
|
|
|
margin: EdgeInsets.only(bottom: ScreenUtil().setWidth(30)),
|
|
|
|
child: Row(
|
|
|
|
children: [
|
|
|
|
HEmptyView(48),
|
|
|
|
Expanded(
|
|
|
|
child: ListView.builder(
|
|
|
|
itemCount: areas.length,
|
|
|
|
shrinkWrap: true,
|
|
|
|
scrollDirection: Axis.horizontal,
|
|
|
|
itemBuilder: (BuildContext contxt, int index) {
|
|
|
|
// if (index == areas.length + 1 ||
|
|
|
|
// areas.length == 0) {
|
|
|
|
// return InkWell(
|
|
|
|
// onTap: () async {
|
|
|
|
// //添加区域弹框
|
|
|
|
// await DialogUtil.openCreateAreaDialog(
|
|
|
|
// context, onTap: (value) async {
|
|
|
|
// print(value);
|
|
|
|
// //添加区域
|
|
|
|
// bool success = await _chooseTableModel
|
|
|
|
// .addTableAreas(context, value);
|
|
|
|
// print(success);
|
|
|
|
// if (success) {
|
|
|
|
// Utils.showToast('添加成功!');
|
|
|
|
// UserModel userModel =
|
|
|
|
// Provider.of<UserModel>(context,
|
|
|
|
// listen: false);
|
|
|
|
// Map<String, String> params = {
|
|
|
|
// "sellerid": userModel.user.sellerid
|
|
|
|
// };
|
|
|
|
// await _chooseTableModel.getTableList(
|
|
|
|
// context, params,
|
|
|
|
// needLoading: false);
|
|
|
|
// initData();
|
|
|
|
|
|
|
|
// // setState(() {
|
|
|
|
// // updateMenu();
|
|
|
|
// // });
|
|
|
|
// // _scrollToIndex(widget
|
|
|
|
// // .tableManagerModel
|
|
|
|
// // .areas
|
|
|
|
// // .length);
|
|
|
|
|
|
|
|
// }
|
|
|
|
// });
|
|
|
|
// },
|
|
|
|
// child: Column(
|
|
|
|
// children: [
|
|
|
|
// VEmptyView(20),
|
|
|
|
// DottedBorder(
|
|
|
|
// dashPattern: [5, 5, 5, 5],
|
|
|
|
// borderType: BorderType.RRect,
|
|
|
|
// radius: Radius.circular(
|
|
|
|
// ScreenUtil().setWidth(10)),
|
|
|
|
// // padding: EdgeInsets.all(ScreenUtil().setWidth(70)),
|
|
|
|
// color: MyColours.color_199095,
|
|
|
|
// strokeWidth: ScreenUtil().setWidth(2),
|
|
|
|
// child: ClipRRect(
|
|
|
|
// borderRadius: BorderRadius.all(
|
|
|
|
// Radius.circular(
|
|
|
|
// ScreenUtil().setWidth(10))),
|
|
|
|
// child: Container(
|
|
|
|
// height:
|
|
|
|
// ScreenUtil().setWidth(25 * 2),
|
|
|
|
// width: ScreenUtil()
|
|
|
|
// .setWidth(104 * 2),
|
|
|
|
// child: Column(
|
|
|
|
// mainAxisAlignment:
|
|
|
|
// MainAxisAlignment.center,
|
|
|
|
// children: [
|
|
|
|
// Image.asset(
|
|
|
|
// Utils.getImgPath(
|
|
|
|
// 'add_area'),
|
|
|
|
// width: ScreenUtil()
|
|
|
|
// .setWidth(24)),
|
|
|
|
// ],
|
|
|
|
// ),
|
|
|
|
// ),
|
|
|
|
// ),
|
|
|
|
// )
|
|
|
|
// ],
|
|
|
|
// ),
|
|
|
|
// );
|
|
|
|
// } else {
|
|
|
|
// if (index == 0) {
|
|
|
|
// return InkWell(
|
|
|
|
// onTap: () {
|
|
|
|
// setState(() {
|
|
|
|
// isSelected = true;
|
|
|
|
// currentArea = '全部';
|
|
|
|
// _chooseTableModel
|
|
|
|
// .currentTables =
|
|
|
|
// _chooseTableModel
|
|
|
|
// .areaTableMapShow[
|
|
|
|
// currentArea];
|
|
|
|
// });
|
|
|
|
// },
|
|
|
|
// child: Container(
|
|
|
|
// // width: ScreenUtil().setWidth(104 * 2),
|
|
|
|
// height: ScreenUtil().setWidth(80),
|
|
|
|
// margin: EdgeInsets.only(
|
|
|
|
// right:
|
|
|
|
// ScreenUtil().setWidth(20),
|
|
|
|
// top: ScreenUtil().setWidth(20),
|
|
|
|
// ),
|
|
|
|
// padding: EdgeInsets.symmetric(
|
|
|
|
// horizontal:
|
|
|
|
// ScreenUtil().setWidth(20),
|
|
|
|
// vertical: ScreenUtil()
|
|
|
|
// .setWidth(10)),
|
|
|
|
// alignment: Alignment.center,
|
|
|
|
// decoration: BoxDecoration(
|
|
|
|
// // borderRadius: BorderRadius.circular(ScreenUtil().setWidth(10)),
|
|
|
|
// color: isSelected
|
|
|
|
// ? MyColours.color_199095
|
|
|
|
// : MyColours.color_ffffff,
|
|
|
|
// border: Border.all(
|
|
|
|
// color: MyColours
|
|
|
|
// .color_E0E0E0,
|
|
|
|
// width: ScreenUtil()
|
|
|
|
// .setWidth(2))),
|
|
|
|
// child: Text(
|
|
|
|
// '全部',
|
|
|
|
// overflow: TextOverflow.ellipsis,
|
|
|
|
// style: TextStyle(
|
|
|
|
// color: isSelected
|
|
|
|
// ? MyColours.color_ffffff
|
|
|
|
// : MyColours
|
|
|
|
// .color_333333,
|
|
|
|
// fontSize:
|
|
|
|
// ScreenUtil().setSp(28),
|
|
|
|
// decoration:
|
|
|
|
// TextDecoration.none,
|
|
|
|
// fontWeight:
|
|
|
|
// FontWeight.normal),
|
|
|
|
// ),
|
|
|
|
// ),
|
|
|
|
// );
|
|
|
|
// } else {
|
|
|
|
return AreaItemTable(
|
|
|
|
areas[index],
|
|
|
|
currentArea,
|
|
|
|
(area) {
|
|
|
|
setState(() {
|
|
|
|
isSelected = false;
|
|
|
|
_selectNumber = index;
|
|
|
|
currentArea = areas[index].name;
|
|
|
|
_chooseTableModel.currentTables =
|
|
|
|
_chooseTableModel.areaTableMapShow[currentArea];
|
|
|
|
// _anmationMenu();
|
|
|
|
});
|
|
|
|
},
|
|
|
|
showBadge: false,
|
|
|
|
);
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
},
|
|
|
|
)),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
_chooseTableModel = Provider.of<ChooseTableModel>(context);
|
|
|
|
return Scaffold(
|
|
|
|
backgroundColor: MyColours.color_ffffff,
|
|
|
|
body: SafeArea(
|
|
|
|
child: Column(
|
|
|
|
children: <Widget>[
|
|
|
|
SystemAppBar(
|
|
|
|
"选择要合并的桌位",
|
|
|
|
),
|
|
|
|
Expanded(
|
|
|
|
child: Consumer<ChooseTableModel>(builder: (context, model, _) {
|
|
|
|
if (model.pageState != PageState.Success) {
|
|
|
|
return ExceptionPage(
|
|
|
|
pageState: model.pageState,
|
|
|
|
callback: () {
|
|
|
|
getTableList();
|
|
|
|
},
|
|
|
|
emptyMsg: "暂时没有桌位哦",
|
|
|
|
emptyImg: "empty_search",
|
|
|
|
showMsg: "加载中,请稍后...",
|
|
|
|
);
|
|
|
|
} else {
|
|
|
|
return Column(
|
|
|
|
// crossAxisAlignment: CrossAxisAlignment.center,
|
|
|
|
children: [
|
|
|
|
Container(
|
|
|
|
color: MyColours.color_ffffff,
|
|
|
|
height: ScreenUtil().setWidth(92),
|
|
|
|
margin: EdgeInsets.only(
|
|
|
|
bottom: ScreenUtil().setWidth(30)),
|
|
|
|
child: Row(
|
|
|
|
children: [
|
|
|
|
HEmptyView(48),
|
|
|
|
Expanded(
|
|
|
|
child: ListView.builder(
|
|
|
|
itemCount: areas.length,
|
|
|
|
shrinkWrap: true,
|
|
|
|
scrollDirection: Axis.horizontal,
|
|
|
|
itemBuilder:
|
|
|
|
(BuildContext contxt, int index) {
|
|
|
|
// if (index == areas.length + 1 ||
|
|
|
|
// areas.length == 0) {
|
|
|
|
// return InkWell(
|
|
|
|
// onTap: () async {
|
|
|
|
// //添加区域弹框
|
|
|
|
// await DialogUtil.openCreateAreaDialog(
|
|
|
|
// context, onTap: (value) async {
|
|
|
|
// print(value);
|
|
|
|
// //添加区域
|
|
|
|
// bool success = await _chooseTableModel
|
|
|
|
// .addTableAreas(context, value);
|
|
|
|
// print(success);
|
|
|
|
// if (success) {
|
|
|
|
// Utils.showToast('添加成功!');
|
|
|
|
// UserModel userModel =
|
|
|
|
// Provider.of<UserModel>(context,
|
|
|
|
// listen: false);
|
|
|
|
// Map<String, String> params = {
|
|
|
|
// "sellerid": userModel.user.sellerid
|
|
|
|
// };
|
|
|
|
// await _chooseTableModel.getTableList(
|
|
|
|
// context, params,
|
|
|
|
// needLoading: false);
|
|
|
|
// initData();
|
|
|
|
|
|
|
|
// // setState(() {
|
|
|
|
// // updateMenu();
|
|
|
|
// // });
|
|
|
|
// // _scrollToIndex(widget
|
|
|
|
// // .tableManagerModel
|
|
|
|
// // .areas
|
|
|
|
// // .length);
|
|
|
|
|
|
|
|
// }
|
|
|
|
// });
|
|
|
|
// },
|
|
|
|
// child: Column(
|
|
|
|
// children: [
|
|
|
|
// VEmptyView(20),
|
|
|
|
// DottedBorder(
|
|
|
|
// dashPattern: [5, 5, 5, 5],
|
|
|
|
// borderType: BorderType.RRect,
|
|
|
|
// radius: Radius.circular(
|
|
|
|
// ScreenUtil().setWidth(10)),
|
|
|
|
// // padding: EdgeInsets.all(ScreenUtil().setWidth(70)),
|
|
|
|
// color: MyColours.color_199095,
|
|
|
|
// strokeWidth: ScreenUtil().setWidth(2),
|
|
|
|
// child: ClipRRect(
|
|
|
|
// borderRadius: BorderRadius.all(
|
|
|
|
// Radius.circular(
|
|
|
|
// ScreenUtil().setWidth(10))),
|
|
|
|
// child: Container(
|
|
|
|
// height:
|
|
|
|
// ScreenUtil().setWidth(25 * 2),
|
|
|
|
// width: ScreenUtil()
|
|
|
|
// .setWidth(104 * 2),
|
|
|
|
// child: Column(
|
|
|
|
// mainAxisAlignment:
|
|
|
|
// MainAxisAlignment.center,
|
|
|
|
// children: [
|
|
|
|
// Image.asset(
|
|
|
|
// Utils.getImgPath(
|
|
|
|
// 'add_area'),
|
|
|
|
// width: ScreenUtil()
|
|
|
|
// .setWidth(24)),
|
|
|
|
// ],
|
|
|
|
// ),
|
|
|
|
// ),
|
|
|
|
// ),
|
|
|
|
// )
|
|
|
|
// ],
|
|
|
|
// ),
|
|
|
|
// );
|
|
|
|
// } else {
|
|
|
|
// if (index == 0) {
|
|
|
|
// return InkWell(
|
|
|
|
// onTap: () {
|
|
|
|
// setState(() {
|
|
|
|
// isSelected = true;
|
|
|
|
// currentArea = '全部';
|
|
|
|
// _chooseTableModel
|
|
|
|
// .currentTables =
|
|
|
|
// _chooseTableModel
|
|
|
|
// .areaTableMapShow[
|
|
|
|
// currentArea];
|
|
|
|
// });
|
|
|
|
// },
|
|
|
|
// child: Container(
|
|
|
|
// // width: ScreenUtil().setWidth(104 * 2),
|
|
|
|
// height: ScreenUtil().setWidth(80),
|
|
|
|
// margin: EdgeInsets.only(
|
|
|
|
// right:
|
|
|
|
// ScreenUtil().setWidth(20),
|
|
|
|
// top: ScreenUtil().setWidth(20),
|
|
|
|
// ),
|
|
|
|
// padding: EdgeInsets.symmetric(
|
|
|
|
// horizontal:
|
|
|
|
// ScreenUtil().setWidth(20),
|
|
|
|
// vertical: ScreenUtil()
|
|
|
|
// .setWidth(10)),
|
|
|
|
// alignment: Alignment.center,
|
|
|
|
// decoration: BoxDecoration(
|
|
|
|
// // borderRadius: BorderRadius.circular(ScreenUtil().setWidth(10)),
|
|
|
|
// color: isSelected
|
|
|
|
// ? MyColours.color_199095
|
|
|
|
// : MyColours.color_ffffff,
|
|
|
|
// border: Border.all(
|
|
|
|
// color: MyColours
|
|
|
|
// .color_E0E0E0,
|
|
|
|
// width: ScreenUtil()
|
|
|
|
// .setWidth(2))),
|
|
|
|
// child: Text(
|
|
|
|
// '全部',
|
|
|
|
// overflow: TextOverflow.ellipsis,
|
|
|
|
// style: TextStyle(
|
|
|
|
// color: isSelected
|
|
|
|
// ? MyColours.color_ffffff
|
|
|
|
// : MyColours
|
|
|
|
// .color_333333,
|
|
|
|
// fontSize:
|
|
|
|
// ScreenUtil().setSp(28),
|
|
|
|
// decoration:
|
|
|
|
// TextDecoration.none,
|
|
|
|
// fontWeight:
|
|
|
|
// FontWeight.normal),
|
|
|
|
// ),
|
|
|
|
// ),
|
|
|
|
// );
|
|
|
|
// } else {
|
|
|
|
return AreaItemTable(
|
|
|
|
areas[index],
|
|
|
|
currentArea,
|
|
|
|
(area) {
|
|
|
|
setState(() {
|
|
|
|
isSelected = false;
|
|
|
|
_selectNumber = index;
|
|
|
|
currentArea = areas[index].name;
|
|
|
|
_chooseTableModel.currentTables =
|
|
|
|
_chooseTableModel
|
|
|
|
.areaTableMapShow[
|
|
|
|
currentArea];
|
|
|
|
// _anmationMenu();
|
|
|
|
});
|
|
|
|
},
|
|
|
|
showBadge: false,
|
|
|
|
);
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
},
|
|
|
|
)),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
Expanded(
|
|
|
|
// flex: 2,
|
|
|
|
child: Container(
|
|
|
|
constraints: BoxConstraints(
|
|
|
|
minHeight: ScreenUtil().setWidth(100)),
|
|
|
|
color: MyColours.color_ffffff,
|
|
|
|
child: item(_selectNumber))),
|
|
|
|
Container(
|
|
|
|
padding: EdgeInsets.symmetric(horizontal: w(48)),
|
|
|
|
margin: EdgeInsets.only(bottom: w(40)),
|
|
|
|
child: Row(
|
|
|
|
mainAxisAlignment:
|
|
|
|
MainAxisAlignment.spaceBetween,
|
|
|
|
children: [
|
|
|
|
RoundButton(
|
|
|
|
// content: widget.fromPage == 'tablePhoto'
|
|
|
|
// ? '确定'
|
|
|
|
// : "已选${selectNum}个 确定",
|
|
|
|
|
|
|
|
text: '返回',
|
|
|
|
radius: r(4),
|
|
|
|
width: w(128),
|
|
|
|
height: w(36),
|
|
|
|
fontSize: 28,
|
|
|
|
isBold: false,
|
|
|
|
textColor: MyColours.color_515151,
|
|
|
|
gradientStart: MyColours.color_DBDBDB,
|
|
|
|
gradientEnd: MyColours.color_DBDBDB,
|
|
|
|
onPressed: () {
|
|
|
|
Navigator.of(context).pop();
|
|
|
|
},
|
|
|
|
),
|
|
|
|
RoundButton(
|
|
|
|
// content: widget.fromPage == 'tablePhoto'
|
|
|
|
// ? '确定'
|
|
|
|
// : "已选${selectNum}个 确定",
|
|
|
|
text: '保存',
|
|
|
|
width: w(128),
|
|
|
|
height: w(36),
|
|
|
|
radius: r(4),
|
|
|
|
isBold: false,
|
|
|
|
gradientStart: MyColours.color_438E93,
|
|
|
|
gradientEnd: MyColours.color_438E93,
|
|
|
|
fontSize: 28,
|
|
|
|
textColor: MyColours.color_ffffff,
|
|
|
|
onPressed: () {
|
|
|
|
// if (widget.fromPage == "tablePhoto") {
|
|
|
|
// Map temp = {
|
|
|
|
// 'tid': selectTables.length > 0
|
|
|
|
// ? selectTables[0].id
|
|
|
|
// : '',
|
|
|
|
// 'tname': selectTables.length > 0
|
|
|
|
// ? selectTables[0].name
|
|
|
|
// : ''
|
|
|
|
// };
|
|
|
|
// Navigator.of(context).pop(temp);
|
|
|
|
// } else {
|
|
|
|
if (widget.canChoose) {
|
|
|
|
// // if (widget.tableList.length > 0) {
|
|
|
|
// String tid = "";
|
|
|
|
// for (TableList table
|
|
|
|
// in widget.tableList) {
|
|
|
|
// tid += table.id + ",";
|
|
|
|
// }
|
|
|
|
// if (widget.tableList.length > 0) {
|
|
|
|
// tid = tid.substring(
|
|
|
|
// 0, tid.length - 1);
|
|
|
|
// }
|
|
|
|
|
|
|
|
// Map temp = {
|
|
|
|
// 'object': widget.tableList,
|
|
|
|
// 'tid': tid
|
|
|
|
// };
|
|
|
|
// Navigator.of(context).pop(temp);
|
|
|
|
// // }
|
|
|
|
// } else {
|
|
|
|
|
|
|
|
String tid = "";
|
|
|
|
for (t.Table table in selectTables) {
|
|
|
|
tid += table.id + ",";
|
|
|
|
}
|
|
|
|
if (selectTables.length > 0) {
|
|
|
|
tid =
|
|
|
|
tid.substring(0, tid.length - 1);
|
|
|
|
}
|
|
|
|
|
|
|
|
Map temp = {
|
|
|
|
'object': selectTables,
|
|
|
|
'tid': tid
|
|
|
|
};
|
|
|
|
Navigator.of(context).pop(temp);
|
|
|
|
}
|
|
|
|
// }
|
|
|
|
},
|
|
|
|
),
|
|
|
|
],
|
|
|
|
))
|
|
|
|
]);
|
|
|
|
}
|
|
|
|
}),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
));
|
|
|
|
backgroundColor: MyColours.color_ffffff,
|
|
|
|
appBar: SystemAppBar(
|
|
|
|
"选择要合并的桌位",
|
|
|
|
),
|
|
|
|
body: Consumer<ChooseTableModel>(builder: (context, model, _) {
|
|
|
|
if (model.pageState != PageState.Success) {
|
|
|
|
return ExceptionPage(
|
|
|
|
pageState: model.pageState,
|
|
|
|
callback: () {
|
|
|
|
getTableList();
|
|
|
|
},
|
|
|
|
emptyMsg: "暂时没有桌位哦",
|
|
|
|
emptyImg: "empty_search",
|
|
|
|
showMsg: "加载中,请稍后...",
|
|
|
|
);
|
|
|
|
} else {
|
|
|
|
return Column(
|
|
|
|
// crossAxisAlignment: CrossAxisAlignment.center,
|
|
|
|
children: [
|
|
|
|
Expanded(
|
|
|
|
child: Column(
|
|
|
|
children: [
|
|
|
|
_topAreaWidget(),
|
|
|
|
Expanded(
|
|
|
|
// flex: 2,
|
|
|
|
child: Container(
|
|
|
|
constraints: BoxConstraints(
|
|
|
|
minHeight: ScreenUtil().setWidth(100)),
|
|
|
|
color: MyColours.color_ffffff,
|
|
|
|
child: item(_selectNumber))),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
Container(
|
|
|
|
color: MyColours.color_ffffff,
|
|
|
|
padding: EdgeInsets.symmetric(horizontal: w(48)),
|
|
|
|
margin: EdgeInsets.only(bottom: w(35), top: w(25)),
|
|
|
|
child: Row(
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
children: [
|
|
|
|
RoundButton(
|
|
|
|
// content: widget.fromPage == 'tablePhoto'
|
|
|
|
// ? '确定'
|
|
|
|
// : "已选${selectNum}个 确定",
|
|
|
|
|
|
|
|
text: '返回',
|
|
|
|
radius: r(4),
|
|
|
|
width: w(128),
|
|
|
|
height: w(36),
|
|
|
|
fontSize: 28,
|
|
|
|
isBold: false,
|
|
|
|
textColor: MyColours.color_515151,
|
|
|
|
gradientStart: MyColours.color_DBDBDB,
|
|
|
|
gradientEnd: MyColours.color_DBDBDB,
|
|
|
|
onPressed: () {
|
|
|
|
Navigator.of(context).pop();
|
|
|
|
},
|
|
|
|
),
|
|
|
|
RoundButton(
|
|
|
|
// content: widget.fromPage == 'tablePhoto'
|
|
|
|
// ? '确定'
|
|
|
|
// : "已选${selectNum}个 确定",
|
|
|
|
text: '保存',
|
|
|
|
width: w(128),
|
|
|
|
height: w(36),
|
|
|
|
radius: r(4),
|
|
|
|
isBold: false,
|
|
|
|
gradientStart: MyColours.color_438E93,
|
|
|
|
gradientEnd: MyColours.color_438E93,
|
|
|
|
fontSize: 28,
|
|
|
|
textColor: MyColours.color_ffffff,
|
|
|
|
onPressed: () {
|
|
|
|
// if (widget.fromPage == "tablePhoto") {
|
|
|
|
// Map temp = {
|
|
|
|
// 'tid': selectTables.length > 0
|
|
|
|
// ? selectTables[0].id
|
|
|
|
// : '',
|
|
|
|
// 'tname': selectTables.length > 0
|
|
|
|
// ? selectTables[0].name
|
|
|
|
// : ''
|
|
|
|
// };
|
|
|
|
// Navigator.of(context).pop(temp);
|
|
|
|
// } else {
|
|
|
|
if (widget.canChoose) {
|
|
|
|
// // if (widget.tableList.length > 0) {
|
|
|
|
// String tid = "";
|
|
|
|
// for (TableList table
|
|
|
|
// in widget.tableList) {
|
|
|
|
// tid += table.id + ",";
|
|
|
|
// }
|
|
|
|
// if (widget.tableList.length > 0) {
|
|
|
|
// tid = tid.substring(
|
|
|
|
// 0, tid.length - 1);
|
|
|
|
// }
|
|
|
|
|
|
|
|
// Map temp = {
|
|
|
|
// 'object': widget.tableList,
|
|
|
|
// 'tid': tid
|
|
|
|
// };
|
|
|
|
// Navigator.of(context).pop(temp);
|
|
|
|
// // }
|
|
|
|
// } else {
|
|
|
|
|
|
|
|
String tid = "";
|
|
|
|
for (t.Table table in selectTables) {
|
|
|
|
tid += table.id + ",";
|
|
|
|
}
|
|
|
|
if (selectTables.length > 0) {
|
|
|
|
tid = tid.substring(0, tid.length - 1);
|
|
|
|
}
|
|
|
|
|
|
|
|
Map temp = {'object': selectTables, 'tid': tid};
|
|
|
|
Navigator.of(context).pop(temp);
|
|
|
|
}
|
|
|
|
// }
|
|
|
|
},
|
|
|
|
),
|
|
|
|
],
|
|
|
|
))
|
|
|
|
]);
|
|
|
|
}
|
|
|
|
}),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
_backLastPage() {
|
...
|
...
|
|