|
...
|
...
|
@@ -8,6 +8,7 @@ import 'package:one_key/constant/state.dart'; |
|
|
|
import 'package:one_key/models/area.dart';
|
|
|
|
import 'package:one_key/models/notebook_detail.dart';
|
|
|
|
import 'package:one_key/models/tableOuter.dart';
|
|
|
|
import 'package:one_key/models/table_list.dart';
|
|
|
|
import 'package:one_key/pages/table/area_item_table.dart';
|
|
|
|
import 'package:one_key/pages/table/cc_menu_wdn.dart';
|
|
|
|
import 'package:one_key/provider/table_manager_model.dart';
|
|
...
|
...
|
@@ -24,6 +25,7 @@ import 'package:one_key/widgets/common_button_flat.dart'; |
|
|
|
import 'package:one_key/widgets/f_table_item.dart';
|
|
|
|
import 'package:one_key/widgets/h_empty_view.dart';
|
|
|
|
import 'package:one_key/widgets/page_exception.dart';
|
|
|
|
import 'package:one_key/widgets/round_button.dart';
|
|
|
|
import 'package:one_key/widgets/system_app_bar.dart';
|
|
|
|
import 'package:one_key/widgets/table_item.dart';
|
|
|
|
import 'package:one_key/models/table.dart' as t;
|
|
...
|
...
|
@@ -55,7 +57,7 @@ class TableManagerPageState extends State<TableManagerPage> { |
|
|
|
bool isSelected = true; //全部按钮
|
|
|
|
|
|
|
|
int _selectNumber;
|
|
|
|
|
|
|
|
ScrollController _scrollCrl = ScrollController();
|
|
|
|
final ItemPositionsListener itemPositionsListener =
|
|
|
|
ItemPositionsListener.create();
|
|
|
|
|
|
...
|
...
|
@@ -85,6 +87,14 @@ class TableManagerPageState extends State<TableManagerPage> { |
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
@override
|
|
|
|
void dispose() {
|
|
|
|
// TODO: implement dispose
|
|
|
|
super.dispose();
|
|
|
|
EventBus().off("refresh_tablemanager");
|
|
|
|
EventBus().off("refresh_tablePhoto");
|
|
|
|
}
|
|
|
|
|
|
|
|
///刷新图片显示
|
|
|
|
_refreshTablePhoto() async {
|
|
|
|
List temp =
|
|
...
|
...
|
@@ -240,81 +250,94 @@ class TableManagerPageState extends State<TableManagerPage> { |
|
|
|
shouldRebuild: (pre, next) => true,
|
|
|
|
selector: (context, model) => data[index],
|
|
|
|
builder: (context, table, _) {
|
|
|
|
return FTableItem(table, onSelected: (table) {
|
|
|
|
if ((table as t.Table).selected) {
|
|
|
|
tableManagerModel.selectTables.add(table);
|
|
|
|
return FTableItem(table, canSelected: true, onSelected: (table) {
|
|
|
|
if (table.signStr == '已预订') {
|
|
|
|
//进入订座详情页面
|
|
|
|
NavigatorUtil.goNotebookDetailPage(
|
|
|
|
context,
|
|
|
|
tableManagerModel.tableMap[table.id].id,
|
|
|
|
tableManagerModel.tableMap[table.id].uid);
|
|
|
|
} else {
|
|
|
|
tableManagerModel.selectTables
|
|
|
|
.removeWhere((t) => t.id == table.id);
|
|
|
|
}
|
|
|
|
DialogUtil.showTableManagerDialog(context, table).then((value) {
|
|
|
|
if (value != null) {
|
|
|
|
switch (value) {
|
|
|
|
case 1: //查看详情
|
|
|
|
NavigatorUtil.goNotebookDetailPage(
|
|
|
|
context,
|
|
|
|
tableManagerModel.tableMap[table.id].id,
|
|
|
|
tableManagerModel.tableMap[table.id].uid);
|
|
|
|
break;
|
|
|
|
case 2: //订座
|
|
|
|
NavigatorUtil.goNoteBookChangePage(
|
|
|
|
context,
|
|
|
|
NotebookDetail.fromTableManager(
|
|
|
|
tableManagerModel.getCurrDdateStr(),
|
|
|
|
tableManagerModel.currTimeIndex.toString(),
|
|
|
|
table),
|
|
|
|
"");
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 3: //停用,启用桌位
|
|
|
|
Map<String, String> params = {
|
|
|
|
"id": (table as t.Table).id,
|
|
|
|
"status": (table as t.Table).enable == "1" ? "0" : "1"
|
|
|
|
};
|
|
|
|
tableManagerModel
|
|
|
|
.setSwitchStatus(context, params)
|
|
|
|
.then((value) {
|
|
|
|
if (value != null) {
|
|
|
|
(table as t.Table).enable =
|
|
|
|
((int.parse((table as t.Table).enable) + 1) % 2)
|
|
|
|
.toString();
|
|
|
|
if ((table as t.Table).enable == "1") {
|
|
|
|
for (Area area in tableManagerModel.areas) {
|
|
|
|
if (area.name ==
|
|
|
|
tableManagerModel.currentArea) {
|
|
|
|
if (table.sign != '5' && table.sign != '1') {
|
|
|
|
//已预订
|
|
|
|
area.count++;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
for (Area area in tableManagerModel.areas) {
|
|
|
|
if (area.name ==
|
|
|
|
tableManagerModel.currentArea) {
|
|
|
|
if (table.sign != '5' && table.sign != '1') {
|
|
|
|
//已预订
|
|
|
|
area.count--;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
tableManagerModel.notifyListeners();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
break;
|
|
|
|
case 4: //照片管理
|
|
|
|
NavigatorUtil.goTablePhotoManagerPage(context,
|
|
|
|
tid: (table as t.Table).id,
|
|
|
|
tname: (table as t.Table).name);
|
|
|
|
break;
|
|
|
|
setState(() {
|
|
|
|
if ((table as t.Table).selected) {
|
|
|
|
tableManagerModel.selectTables.add(table);
|
|
|
|
} else {
|
|
|
|
tableManagerModel.selectTables
|
|
|
|
.removeWhere((t) => t.id == table.id);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
if (tableManagerModel.selectTables.length > 1) {
|
|
|
|
_scrollCrl.position
|
|
|
|
.didUpdateScrollPositionBy(0); //这里触发更新滚动条
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
// DialogUtil.showTableManagerDialog(context, table).then((value) {
|
|
|
|
// if (value != null) {
|
|
|
|
// switch (value) {
|
|
|
|
// case 1: //查看详情
|
|
|
|
// NavigatorUtil.goNotebookDetailPage(
|
|
|
|
// context,
|
|
|
|
// tableManagerModel.tableMap[table.id].id,
|
|
|
|
// tableManagerModel.tableMap[table.id].uid);
|
|
|
|
// break;
|
|
|
|
// case 2: //订座
|
|
|
|
// NavigatorUtil.goNoteBookChangePage(
|
|
|
|
// context,
|
|
|
|
// NotebookDetail.fromTableManager(
|
|
|
|
// tableManagerModel.getCurrDdateStr(),
|
|
|
|
// tableManagerModel.currTimeIndex.toString(),
|
|
|
|
// table),
|
|
|
|
// "");
|
|
|
|
// break;
|
|
|
|
|
|
|
|
// case 3: //停用,启用桌位
|
|
|
|
// Map<String, String> params = {
|
|
|
|
// "id": (table as t.Table).id,
|
|
|
|
// "status": (table as t.Table).enable == "1" ? "0" : "1"
|
|
|
|
// };
|
|
|
|
// tableManagerModel
|
|
|
|
// .setSwitchStatus(context, params)
|
|
|
|
// .then((value) {
|
|
|
|
// if (value != null) {
|
|
|
|
// (table as t.Table).enable =
|
|
|
|
// ((int.parse((table as t.Table).enable) + 1) % 2)
|
|
|
|
// .toString();
|
|
|
|
// if ((table as t.Table).enable == "1") {
|
|
|
|
// for (Area area in tableManagerModel.areas) {
|
|
|
|
// if (area.name ==
|
|
|
|
// tableManagerModel.currentArea) {
|
|
|
|
// if (table.sign != '5' && table.sign != '1') {
|
|
|
|
// //已预订
|
|
|
|
// area.count++;
|
|
|
|
// }
|
|
|
|
// break;
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
// } else {
|
|
|
|
// for (Area area in tableManagerModel.areas) {
|
|
|
|
// if (area.name ==
|
|
|
|
// tableManagerModel.currentArea) {
|
|
|
|
// if (table.sign != '5' && table.sign != '1') {
|
|
|
|
// //已预订
|
|
|
|
// area.count--;
|
|
|
|
// }
|
|
|
|
// break;
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
// tableManagerModel.notifyListeners();
|
|
|
|
// }
|
|
|
|
// });
|
|
|
|
// break;
|
|
|
|
// case 4: //照片管理
|
|
|
|
// NavigatorUtil.goTablePhotoManagerPage(context,
|
|
|
|
// tid: (table as t.Table).id,
|
|
|
|
// tname: (table as t.Table).name);
|
|
|
|
// break;
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
// });
|
|
|
|
},
|
|
|
|
canSelected: false,
|
|
|
|
fromPage: 'table_manage',
|
|
|
|
tableMap: tableManagerModel.tableMap,
|
|
|
|
rid: "");
|
|
...
|
...
|
@@ -325,6 +348,190 @@ class TableManagerPageState extends State<TableManagerPage> { |
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
///选中的桌子widget
|
|
|
|
Widget _selectTableWidget() {
|
|
|
|
return Expanded(
|
|
|
|
flex: 1,
|
|
|
|
child: Container(
|
|
|
|
// constraints: BoxConstraints(maxHeight: ScreenUtil().setWidth(300)),
|
|
|
|
// height: ScreenUtil().setWidth(400),
|
|
|
|
width: double.infinity,
|
|
|
|
padding: EdgeInsets.symmetric(
|
|
|
|
horizontal: ScreenUtil().setWidth(40),
|
|
|
|
vertical: ScreenUtil().setWidth(30)),
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
color: MyColours.color_ffffff,
|
|
|
|
boxShadow: [
|
|
|
|
BoxShadow(
|
|
|
|
color: MyColours.color_333333,
|
|
|
|
blurRadius: ScreenUtil().setWidth(14))
|
|
|
|
],
|
|
|
|
borderRadius: BorderRadius.only(
|
|
|
|
topLeft: Radius.circular(ScreenUtil().setWidth(30)),
|
|
|
|
topRight: Radius.circular(ScreenUtil().setWidth(30)),
|
|
|
|
)),
|
|
|
|
child: Row(
|
|
|
|
// mainAxisSize: MainAxisSize.min,
|
|
|
|
children: [
|
|
|
|
Column(
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
children: [
|
|
|
|
Text(
|
|
|
|
tableManagerModel.selectDateStr,
|
|
|
|
style: TextStyle(
|
|
|
|
color: MyColours.color_333333,
|
|
|
|
fontSize: ScreenUtil().setSp(28)),
|
|
|
|
),
|
|
|
|
VEmptyView(20),
|
|
|
|
Text(
|
|
|
|
'已选桌位:',
|
|
|
|
style: TextStyle(
|
|
|
|
color: MyColours.color_333333,
|
|
|
|
fontSize: ScreenUtil().setSp(26)),
|
|
|
|
),
|
|
|
|
VEmptyView(20),
|
|
|
|
Expanded(
|
|
|
|
child: Container(
|
|
|
|
width: ScreenUtil.screenWidthDp -
|
|
|
|
ScreenUtil().setWidth(100 + 180),
|
|
|
|
// height: ScreenUtil().setWidth(200),
|
|
|
|
// color: Colors.blueAccent,
|
|
|
|
child:
|
|
|
|
// ListView.builder(
|
|
|
|
// shrinkWrap: true,
|
|
|
|
// itemBuilder: (BuildContext context, int index) {
|
|
|
|
// return
|
|
|
|
Scrollbar(
|
|
|
|
isAlwaysShown: true, //设置滚动条常亮
|
|
|
|
controller: _scrollCrl, //必须设置一个controller
|
|
|
|
|
|
|
|
///添加进度条
|
|
|
|
child: SingleChildScrollView(
|
|
|
|
controller: _scrollCrl,
|
|
|
|
child: Container(
|
|
|
|
width: ScreenUtil.screenWidthDp -
|
|
|
|
ScreenUtil().setWidth(100 + 180),
|
|
|
|
child: Wrap(
|
|
|
|
spacing: ScreenUtil().setWidth(20),
|
|
|
|
runSpacing:
|
|
|
|
ScreenUtil().setWidth(20),
|
|
|
|
children: _buildAlwayItems())),
|
|
|
|
))
|
|
|
|
// },
|
|
|
|
// itemCount: 1,
|
|
|
|
// ),
|
|
|
|
))
|
|
|
|
],
|
|
|
|
),
|
|
|
|
HEmptyView(20),
|
|
|
|
Container(
|
|
|
|
// width: ScreenUtil().setWidth(100),
|
|
|
|
// color: Colors.red,
|
|
|
|
child: Column(
|
|
|
|
children: [
|
|
|
|
RoundButton(
|
|
|
|
onPressed: () async {
|
|
|
|
await tableManagerModel.setReserveInfo(context);
|
|
|
|
},
|
|
|
|
text: '预订',
|
|
|
|
fontSize: 48,
|
|
|
|
isBold: true,
|
|
|
|
width: ScreenUtil().setWidth(180),
|
|
|
|
height: ScreenUtil().setWidth(140),
|
|
|
|
padding: EdgeInsets.symmetric(
|
|
|
|
horizontal: ScreenUtil().setWidth(20),
|
|
|
|
vertical: ScreenUtil().setWidth(4)),
|
|
|
|
textColor: MyColours.color_ffffff,
|
|
|
|
gradientStart: MyColours.color_199095,
|
|
|
|
gradientEnd: MyColours.color_199095,
|
|
|
|
radius: ScreenUtil().setWidth(10),
|
|
|
|
borderColor: MyColours.color_199095,
|
|
|
|
),
|
|
|
|
InkWell(
|
|
|
|
onTap: () {
|
|
|
|
tableManagerModel.selectTables = [];
|
|
|
|
for (t.Table item in tableManagerModel.tablesShow) {
|
|
|
|
item.selected = false;
|
|
|
|
}
|
|
|
|
tableManagerModel.areaTableMapShow
|
|
|
|
.forEach((key, value) {
|
|
|
|
value.forEach((element) {
|
|
|
|
element.selected = false;
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
tableManagerModel.notifyListeners();
|
|
|
|
},
|
|
|
|
child: Padding(
|
|
|
|
padding: EdgeInsets.symmetric(
|
|
|
|
horizontal: ScreenUtil().setWidth(40),
|
|
|
|
vertical: ScreenUtil().setWidth(30)),
|
|
|
|
child: Text(
|
|
|
|
'取消重置',
|
|
|
|
style: TextStyle(
|
|
|
|
color: MyColours.color_199095,
|
|
|
|
fontSize: ScreenUtil().setSp(26)),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
)
|
|
|
|
],
|
|
|
|
),
|
|
|
|
));
|
|
|
|
}
|
|
|
|
|
|
|
|
//构建常用备注
|
|
|
|
List<Widget> _buildAlwayItems() {
|
|
|
|
List<Widget> tables = [];
|
|
|
|
for (t.Table table in tableManagerModel.selectTables) {
|
|
|
|
tables.add(Container(
|
|
|
|
padding: EdgeInsets.symmetric(
|
|
|
|
horizontal: ScreenUtil().setWidth(20),
|
|
|
|
vertical: ScreenUtil().setWidth(4)),
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
border: Border.all(
|
|
|
|
color: MyColours.color_E0E0E0,
|
|
|
|
width: ScreenUtil().setWidth(2)),
|
|
|
|
borderRadius:
|
|
|
|
BorderRadius.circular(ScreenUtil().setWidth(10))),
|
|
|
|
child: Text(
|
|
|
|
table.name,
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize: ScreenUtil().setSp(26),
|
|
|
|
color: MyColours.color_333333,
|
|
|
|
fontWeight: FontWeight.bold),
|
|
|
|
))
|
|
|
|
// RoundButton(
|
|
|
|
// onPressed: () async {},
|
|
|
|
// text: table.name,
|
|
|
|
// fontSize: 26,
|
|
|
|
// isBold: false,
|
|
|
|
// padding: EdgeInsets.symmetric(
|
|
|
|
// horizontal: ScreenUtil().setWidth(20),
|
|
|
|
// vertical: ScreenUtil().setWidth(4)),
|
|
|
|
// height: ScreenUtil().setWidth(48),
|
|
|
|
// textColor: MyColours.color_333333,
|
|
|
|
// gradientStart: MyColours.color_ffffff,
|
|
|
|
// gradientEnd: MyColours.color_ffffff,
|
|
|
|
// radius: ScreenUtil().setWidth(10),
|
|
|
|
// borderColor: MyColours.color_E0E0E0,
|
|
|
|
// )
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
return tables;
|
|
|
|
}
|
|
|
|
|
|
|
|
///早餐、午餐、晚餐点击方法
|
|
|
|
_clickMorAndNoonAndNig() {
|
|
|
|
tableManagerModel.selectDateStr = tableManagerModel.returnDayDateWeekStr(
|
|
|
|
tableManagerModel.dateTimeSelect, tableManagerModel.currTimeIndex);
|
|
|
|
|
|
|
|
tableManagerModel.getReserveList(context, needLoading: false);
|
|
|
|
}
|
|
|
|
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
tableManagerModel = Provider.of<TableManagerModel>(context, listen: true);
|
|
...
|
...
|
@@ -435,7 +642,7 @@ class TableManagerPageState extends State<TableManagerPage> { |
|
|
|
if (tableManagerModel.currTimeIndex == 1)
|
|
|
|
return;
|
|
|
|
tableManagerModel.currTimeIndex = 1;
|
|
|
|
tableManagerModel.getReserveList(context);
|
|
|
|
_clickMorAndNoonAndNig();
|
|
|
|
},
|
|
|
|
)),
|
|
|
|
btnNum == 3 && tableManagerModel.currTimeIndex == 3
|
|
...
|
...
|
@@ -469,7 +676,7 @@ class TableManagerPageState extends State<TableManagerPage> { |
|
|
|
if (tableManagerModel.currTimeIndex == 2)
|
|
|
|
return;
|
|
|
|
tableManagerModel.currTimeIndex = 2;
|
|
|
|
tableManagerModel.getReserveList(context);
|
|
|
|
_clickMorAndNoonAndNig();
|
|
|
|
},
|
|
|
|
)),
|
|
|
|
btnNum == 3 && tableManagerModel.currTimeIndex == 1
|
|
...
|
...
|
@@ -500,7 +707,7 @@ class TableManagerPageState extends State<TableManagerPage> { |
|
|
|
if (tableManagerModel.currTimeIndex == 3)
|
|
|
|
return;
|
|
|
|
tableManagerModel.currTimeIndex = 3;
|
|
|
|
tableManagerModel.getReserveList(context);
|
|
|
|
_clickMorAndNoonAndNig();
|
|
|
|
},
|
|
|
|
)),
|
|
|
|
),
|
|
...
|
...
|
@@ -761,9 +968,15 @@ class TableManagerPageState extends State<TableManagerPage> { |
|
|
|
),
|
|
|
|
),
|
|
|
|
Expanded(
|
|
|
|
flex: 2,
|
|
|
|
child: Container(
|
|
|
|
constraints: BoxConstraints(
|
|
|
|
minHeight: ScreenUtil().setWidth(100)),
|
|
|
|
color: Color.fromRGBO(249, 249, 249, 1),
|
|
|
|
child: item(_selectNumber))),
|
|
|
|
tableManagerModel.selectTables.length > 0
|
|
|
|
? _selectTableWidget()
|
|
|
|
: SizedBox()
|
|
|
|
]))
|
|
|
|
// return CCMenuPage.builder(
|
|
|
|
// tableManagerModel: tableManagerModel,
|
|
...
|
...
|
@@ -818,12 +1031,4 @@ class TableManagerPageState extends State<TableManagerPage> { |
|
|
|
},
|
|
|
|
));
|
|
|
|
}
|
|
|
|
|
|
|
|
@override
|
|
|
|
void dispose() {
|
|
|
|
// TODO: implement dispose
|
|
|
|
super.dispose();
|
|
|
|
EventBus().off("refresh_tablemanager");
|
|
|
|
EventBus().off("refresh_tablePhoto");
|
|
|
|
}
|
|
|
|
} |
...
|
...
|
|