|
...
|
...
|
@@ -32,6 +32,7 @@ import 'package:one_key/widgets/v_empty_view.dart'; |
|
|
|
import 'package:provider/provider.dart';
|
|
|
|
import 'dart:convert' as convert;
|
|
|
|
import 'package:scrollable_positioned_list/scrollable_positioned_list.dart';
|
|
|
|
import 'package:one_key/models/table_list.dart' as table;
|
|
|
|
|
|
|
|
const scrollDuration = Duration(microseconds: 500);
|
|
|
|
|
|
...
|
...
|
@@ -55,7 +56,7 @@ class TableManagerPageState extends State<TableManagerPage> { |
|
|
|
List<String> personNumList = [];
|
|
|
|
bool isSelected = true; //全部按钮
|
|
|
|
|
|
|
|
ScrollController _scrollCrl = ScrollController();
|
|
|
|
// ScrollController _scrollCrl = ScrollController();
|
|
|
|
final ItemPositionsListener itemPositionsListener =
|
|
|
|
ItemPositionsListener.create();
|
|
|
|
|
|
...
|
...
|
@@ -264,10 +265,10 @@ class TableManagerPageState extends State<TableManagerPage> { |
|
|
|
tableManagerModel.selectTables
|
|
|
|
.removeWhere((t) => t.id == table.id);
|
|
|
|
}
|
|
|
|
if (tableManagerModel.selectTables.length > 1) {
|
|
|
|
_scrollCrl.position
|
|
|
|
.didUpdateScrollPositionBy(0); //这里触发更新滚动条
|
|
|
|
}
|
|
|
|
// if (tableManagerModel.selectTables.length > 1) {
|
|
|
|
// _scrollCrl.position
|
|
|
|
// .didUpdateScrollPositionBy(0); //这里触发更新滚动条
|
|
|
|
// }
|
|
|
|
});
|
|
|
|
}
|
|
|
|
// DialogUtil.showTableManagerDialog(context, table).then((value) {
|
|
...
|
...
|
@@ -349,268 +350,455 @@ class TableManagerPageState extends State<TableManagerPage> { |
|
|
|
|
|
|
|
///选中的桌子widget
|
|
|
|
Widget _selectTableWidget() {
|
|
|
|
return Expanded(
|
|
|
|
flex: 1,
|
|
|
|
child: Container(
|
|
|
|
// constraints: BoxConstraints(minHeight: ScreenUtil().setWidth(600)),
|
|
|
|
// height: ScreenUtil().setWidth(400),
|
|
|
|
width: double.infinity,
|
|
|
|
padding: EdgeInsets.only(
|
|
|
|
left: ScreenUtil().setWidth(40),
|
|
|
|
right: ScreenUtil().setWidth(40),
|
|
|
|
top: 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,
|
|
|
|
return Container(
|
|
|
|
// constraints: BoxConstraints(maxHeight: ScreenUtil().setWidth(760)),
|
|
|
|
// height: ScreenUtil().setWidth(400),
|
|
|
|
width: double.infinity,
|
|
|
|
padding: EdgeInsets.only(
|
|
|
|
left: ScreenUtil().setWidth(40),
|
|
|
|
right: ScreenUtil().setWidth(40),
|
|
|
|
top: ScreenUtil().setWidth(15)),
|
|
|
|
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: Column(
|
|
|
|
// mainAxisSize: MainAxisSize.min,
|
|
|
|
mainAxisAlignment: MainAxisAlignment.start,
|
|
|
|
children: [
|
|
|
|
Row(
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
children: [
|
|
|
|
Column(
|
|
|
|
mainAxisAlignment: MainAxisAlignment.start,
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
children: [
|
|
|
|
Text(
|
|
|
|
tableManagerModel.selectDateStr,
|
|
|
|
style: TextStyle(
|
|
|
|
color: MyColours.color_333333,
|
|
|
|
fontSize: ScreenUtil().setSp(28)),
|
|
|
|
fontSize: ScreenUtil().setSp(45),
|
|
|
|
fontWeight: FontWeight.bold),
|
|
|
|
),
|
|
|
|
VEmptyView(15),
|
|
|
|
Text(
|
|
|
|
'已选桌位:',
|
|
|
|
tableManagerModel.selectWeekAndLunarCalendar,
|
|
|
|
style: TextStyle(
|
|
|
|
color: MyColours.color_333333,
|
|
|
|
fontSize: ScreenUtil().setSp(26)),
|
|
|
|
fontSize: ScreenUtil().setSp(30)),
|
|
|
|
),
|
|
|
|
VEmptyView(15),
|
|
|
|
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),
|
|
|
|
Spacer(),
|
|
|
|
Padding(
|
|
|
|
padding: EdgeInsets.only(
|
|
|
|
top: ScreenUtil().setWidth(6),
|
|
|
|
),
|
|
|
|
child: Text(
|
|
|
|
tableManagerModel.doltStr,
|
|
|
|
style: TextStyle(
|
|
|
|
color: MyColours.color_333333,
|
|
|
|
fontSize: ScreenUtil().setSp(48),
|
|
|
|
fontWeight: FontWeight.bold),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
VEmptyView(40),
|
|
|
|
Row(
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
children: [
|
|
|
|
// HEmptyView(15),
|
|
|
|
Padding(
|
|
|
|
// width: ScreenUtil().setWidth(120),
|
|
|
|
padding: EdgeInsets.only(top: ScreenUtil().setWidth(10)),
|
|
|
|
child: Text(
|
|
|
|
'已选桌位:',
|
|
|
|
style: TextStyle(
|
|
|
|
color: MyColours.color_333333,
|
|
|
|
fontSize: ScreenUtil().setSp(26)),
|
|
|
|
)),
|
|
|
|
HEmptyView(15),
|
|
|
|
// Expanded(
|
|
|
|
// child:
|
|
|
|
// width: ScreenUtil.screenWidthDp -
|
|
|
|
// ScreenUtil().setWidth(160),
|
|
|
|
// constraints:
|
|
|
|
// BoxConstraints(maxHeight: ScreenUtil().setWidth(140)),
|
|
|
|
// color: Colors.blueAccent,
|
|
|
|
|
|
|
|
// ListView.builder(
|
|
|
|
// shrinkWrap: true,
|
|
|
|
// itemBuilder: (BuildContext context, int index) {
|
|
|
|
// return
|
|
|
|
// Scrollbar(
|
|
|
|
// isAlwaysShown: true, //设置滚动条常亮
|
|
|
|
// controller: _scrollCrl, //必须设置一个controller
|
|
|
|
|
|
|
|
// ///添加进度条
|
|
|
|
// child:
|
|
|
|
// SingleChildScrollView(
|
|
|
|
// controller: _scrollCrl,
|
|
|
|
// child:
|
|
|
|
Container(
|
|
|
|
// width: ScreenUtil().setWidth(100),
|
|
|
|
// color: Colors.red,
|
|
|
|
constraints: BoxConstraints(
|
|
|
|
minHeight: ScreenUtil().setWidth(500),
|
|
|
|
// color: Colors.red,
|
|
|
|
width: ScreenUtil.screenWidthDp -
|
|
|
|
ScreenUtil().setWidth(100 + 130),
|
|
|
|
child: Wrap(
|
|
|
|
spacing: ScreenUtil().setWidth(20),
|
|
|
|
runSpacing: ScreenUtil().setWidth(20),
|
|
|
|
children: _buildAlwayItems())),
|
|
|
|
// )
|
|
|
|
// )
|
|
|
|
// },
|
|
|
|
// itemCount: 1,
|
|
|
|
// ),
|
|
|
|
// )
|
|
|
|
],
|
|
|
|
),
|
|
|
|
VEmptyView(40),
|
|
|
|
Container(
|
|
|
|
// width: ScreenUtil().setWidth(100),
|
|
|
|
// color: Colors.red,
|
|
|
|
// constraints: BoxConstraints(
|
|
|
|
// minHeight: ScreenUtil().setWidth(500),
|
|
|
|
// ),
|
|
|
|
child: Row(
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
|
|
|
children: [
|
|
|
|
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: Container(
|
|
|
|
padding: EdgeInsets.all(
|
|
|
|
ScreenUtil().setWidth(30),
|
|
|
|
),
|
|
|
|
child: Text(
|
|
|
|
'取消重置',
|
|
|
|
style: TextStyle(
|
|
|
|
color: MyColours.color_199095,
|
|
|
|
fontSize: ScreenUtil().setSp(26)),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
child: Column(
|
|
|
|
children: [
|
|
|
|
RoundButton(
|
|
|
|
onPressed: () async {
|
|
|
|
SunReserveInfoModel _model = await tableManagerModel
|
|
|
|
.setReserveInfo(context, needKeep: true);
|
|
|
|
if (_model != null &&
|
|
|
|
ObjectUtil.isNotEmpty(_model.row) &&
|
|
|
|
ObjectUtil.isNotEmpty(_model.row.id)) {
|
|
|
|
print('成功');
|
|
|
|
tableManagerModel.selectTables = [];
|
|
|
|
// _homeEnterModel.clearData();
|
|
|
|
bus.emit("refresh_tablemanager"); //刷新当前页面
|
|
|
|
bus.emit("refresh_book_list"); //刷新已预订列表
|
|
|
|
//进入订座详情页面
|
|
|
|
NavigatorUtil.goNotebookDetailPage(
|
|
|
|
context,
|
|
|
|
_model.row.id,
|
|
|
|
Provider.of<UserModel>(context, listen: false)
|
|
|
|
.user
|
|
|
|
.openid,
|
|
|
|
);
|
|
|
|
// String ddate_solt = '';
|
|
|
|
// if (_model.row.isSetDdate == '1') {
|
|
|
|
// String createtime =
|
|
|
|
// _model.row.ddate.toString() + '000';
|
|
|
|
// DateTime createTime =
|
|
|
|
// DateTime.fromMillisecondsSinceEpoch(
|
|
|
|
// int.parse(createtime));
|
|
|
|
// ddate_solt = DateUtil.formatDate(createTime,
|
|
|
|
// format: DateFormats.h_m);
|
|
|
|
// } else {
|
|
|
|
// if (_model.row.ddateSolt == '1') {
|
|
|
|
// ddate_solt = '早餐';
|
|
|
|
// } else if (_model.row.ddateSolt == '2') {
|
|
|
|
// ddate_solt = '午餐';
|
|
|
|
// } else if (_model.row.ddateSolt == '3') {
|
|
|
|
// ddate_solt = '晚餐';
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
// List<dynamic> tableinfo =
|
|
|
|
// convert.jsonDecode(_model.row.tableinfo);
|
|
|
|
// print(tableinfo);
|
|
|
|
RoundButton(
|
|
|
|
onPressed: () async {
|
|
|
|
SunReserveInfoModel _model = await tableManagerModel
|
|
|
|
.setReserveInfo(context, needKeep: true);
|
|
|
|
if (_model != null &&
|
|
|
|
ObjectUtil.isNotEmpty(_model.row) &&
|
|
|
|
ObjectUtil.isNotEmpty(_model.row.id)) {
|
|
|
|
print('成功');
|
|
|
|
tableManagerModel.selectTables = [];
|
|
|
|
// _homeEnterModel.clearData();
|
|
|
|
bus.emit("refresh_tablemanager"); //刷新当前页面
|
|
|
|
bus.emit("refresh_book_list"); //刷新已预订列表
|
|
|
|
//进入订座详情页面
|
|
|
|
NavigatorUtil.goNotebookDetailPage(
|
|
|
|
context,
|
|
|
|
_model.row.id,
|
|
|
|
Provider.of<UserModel>(context, listen: false)
|
|
|
|
.user
|
|
|
|
.openid,
|
|
|
|
);
|
|
|
|
// String ddate_solt = '';
|
|
|
|
// if (_model.row.isSetDdate == '1') {
|
|
|
|
// String createtime =
|
|
|
|
// _model.row.ddate.toString() + '000';
|
|
|
|
// DateTime createTime =
|
|
|
|
// DateTime.fromMillisecondsSinceEpoch(
|
|
|
|
// int.parse(createtime));
|
|
|
|
// ddate_solt = DateUtil.formatDate(createTime,
|
|
|
|
// format: DateFormats.h_m);
|
|
|
|
// } else {
|
|
|
|
// if (_model.row.ddateSolt == '1') {
|
|
|
|
// ddate_solt = '早餐';
|
|
|
|
// } else if (_model.row.ddateSolt == '2') {
|
|
|
|
// ddate_solt = '午餐';
|
|
|
|
// } else if (_model.row.ddateSolt == '3') {
|
|
|
|
// ddate_solt = '晚餐';
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
// List<dynamic> tableinfo =
|
|
|
|
// convert.jsonDecode(_model.row.tableinfo);
|
|
|
|
// print(tableinfo);
|
|
|
|
|
|
|
|
// String _nameStr =
|
|
|
|
// t.TableList.fromJson(tableinfo[0]).name;
|
|
|
|
// if (tableinfo.length > 1) {
|
|
|
|
// _nameStr = t.TableList.fromJson(tableinfo[0]).name +
|
|
|
|
// '等${tableinfo.length}桌';
|
|
|
|
// }
|
|
|
|
// LogUtil.v(_nameStr);
|
|
|
|
// String _tid = '';
|
|
|
|
// for (int i = 0; i < tableinfo.length; i++) {
|
|
|
|
// _tid += '${t.TableList.fromJson(tableinfo[i]).id},';
|
|
|
|
// }
|
|
|
|
// if (_tid.endsWith(',')) {
|
|
|
|
// _tid = _tid.substring(0, _tid.length - 1);
|
|
|
|
// }
|
|
|
|
// NavigatorUtil.goInvicationPage(
|
|
|
|
// context,
|
|
|
|
// _model.row.id,
|
|
|
|
// _nameStr,
|
|
|
|
// _model.row.ddate,
|
|
|
|
// ddate_solt,
|
|
|
|
// _model.row.phone,
|
|
|
|
// _model.row.ddateSolt,
|
|
|
|
// tid: _tid,
|
|
|
|
// replace: false);
|
|
|
|
// //今天 明天 其他天
|
|
|
|
// String tempTime = _homeEnterModel.ddateStr;
|
|
|
|
// if (_homeEnterModel.ddateStr == '') {
|
|
|
|
// if (currTimeIndex == 1) {
|
|
|
|
// tempTime = '08:00';
|
|
|
|
// } else if (currTimeIndex == 2) {
|
|
|
|
// tempTime = '12:00';
|
|
|
|
// } else if (currTimeIndex == 3) {
|
|
|
|
// tempTime = '18:00';
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
// print(_model.row.tableinfo);
|
|
|
|
// _clearData();
|
|
|
|
// String timeStr = dateText + ' ' + tempTime + ':00';
|
|
|
|
// String _nameStr =
|
|
|
|
// t.TableList.fromJson(tableinfo[0]).name;
|
|
|
|
// if (tableinfo.length > 1) {
|
|
|
|
// _nameStr = t.TableList.fromJson(tableinfo[0]).name +
|
|
|
|
// '等${tableinfo.length}桌';
|
|
|
|
// }
|
|
|
|
// LogUtil.v(_nameStr);
|
|
|
|
// String _tid = '';
|
|
|
|
// for (int i = 0; i < tableinfo.length; i++) {
|
|
|
|
// _tid += '${t.TableList.fromJson(tableinfo[i]).id},';
|
|
|
|
// }
|
|
|
|
// if (_tid.endsWith(',')) {
|
|
|
|
// _tid = _tid.substring(0, _tid.length - 1);
|
|
|
|
// }
|
|
|
|
// NavigatorUtil.goInvicationPage(
|
|
|
|
// context,
|
|
|
|
// _model.row.id,
|
|
|
|
// _nameStr,
|
|
|
|
// _model.row.ddate,
|
|
|
|
// ddate_solt,
|
|
|
|
// _model.row.phone,
|
|
|
|
// _model.row.ddateSolt,
|
|
|
|
// tid: _tid,
|
|
|
|
// replace: false);
|
|
|
|
// //今天 明天 其他天
|
|
|
|
// String tempTime = _homeEnterModel.ddateStr;
|
|
|
|
// if (_homeEnterModel.ddateStr == '') {
|
|
|
|
// if (currTimeIndex == 1) {
|
|
|
|
// tempTime = '08:00';
|
|
|
|
// } else if (currTimeIndex == 2) {
|
|
|
|
// tempTime = '12:00';
|
|
|
|
// } else if (currTimeIndex == 3) {
|
|
|
|
// tempTime = '18:00';
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
// print(_model.row.tableinfo);
|
|
|
|
// _clearData();
|
|
|
|
// String timeStr = dateText + ' ' + tempTime + ':00';
|
|
|
|
|
|
|
|
// LogUtil.v(timeStr);
|
|
|
|
// int ddate = DateUtil.getDateMsByTimeStr(timeStr);
|
|
|
|
// LogUtil.v(timeStr);
|
|
|
|
// int ddate = DateUtil.getDateMsByTimeStr(timeStr);
|
|
|
|
|
|
|
|
// _homeEnterModel.getNewTableList(context, '${ddate}',
|
|
|
|
// currTimeIndex.toString(), pnum);
|
|
|
|
// _homeEnterModel.getNewTableList(context, '${ddate}',
|
|
|
|
// currTimeIndex.toString(), pnum);
|
|
|
|
|
|
|
|
// EventBus().emit("refresh_tablemanager"); //刷新桌位
|
|
|
|
} else {
|
|
|
|
Utils.showToast("预订失败!");
|
|
|
|
}
|
|
|
|
},
|
|
|
|
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;
|
|
|
|
// EventBus().emit("refresh_tablemanager"); //刷新桌位
|
|
|
|
} else {
|
|
|
|
Utils.showToast("预订失败!");
|
|
|
|
}
|
|
|
|
},
|
|
|
|
text: '仅预订',
|
|
|
|
fontSize: 32,
|
|
|
|
isBold: false,
|
|
|
|
width: ScreenUtil().setWidth(180),
|
|
|
|
height: ScreenUtil().setWidth(90),
|
|
|
|
padding: EdgeInsets.symmetric(
|
|
|
|
horizontal: ScreenUtil().setWidth(20),
|
|
|
|
vertical: ScreenUtil().setWidth(4)),
|
|
|
|
textColor: MyColours.color_199095,
|
|
|
|
gradientStart: MyColours.color_ffffff,
|
|
|
|
gradientEnd: MyColours.color_ffffff,
|
|
|
|
radius: ScreenUtil().setWidth(10),
|
|
|
|
borderColor: MyColours.color_199095,
|
|
|
|
),
|
|
|
|
RoundButton(
|
|
|
|
onPressed: () async {
|
|
|
|
SunReserveInfoModel _model = await tableManagerModel
|
|
|
|
.setReserveInfo(context, needKeep: true);
|
|
|
|
if (_model != null &&
|
|
|
|
ObjectUtil.isNotEmpty(_model.row) &&
|
|
|
|
ObjectUtil.isNotEmpty(_model.row.id)) {
|
|
|
|
print('成功');
|
|
|
|
tableManagerModel.selectTables = [];
|
|
|
|
// _homeEnterModel.clearData();
|
|
|
|
bus.emit("refresh_tablemanager"); //刷新当前页面
|
|
|
|
bus.emit("refresh_book_list"); //刷新已预订列表
|
|
|
|
// //进入订座详情页面
|
|
|
|
// NavigatorUtil.goNotebookDetailPage(
|
|
|
|
// context,
|
|
|
|
// _model.row.id,
|
|
|
|
// Provider.of<UserModel>(context, listen: false)
|
|
|
|
// .user
|
|
|
|
// .openid,
|
|
|
|
// );
|
|
|
|
String ddate_solt = '';
|
|
|
|
if (_model.row.isSetDdate == '1') {
|
|
|
|
String createtime = _model.row.ddate.toString() + '000';
|
|
|
|
DateTime createTime =
|
|
|
|
DateTime.fromMillisecondsSinceEpoch(
|
|
|
|
int.parse(createtime));
|
|
|
|
ddate_solt = DateUtil.formatDate(createTime,
|
|
|
|
format: DateFormats.h_m);
|
|
|
|
} else {
|
|
|
|
if (_model.row.ddateSolt == '1') {
|
|
|
|
ddate_solt = '早餐';
|
|
|
|
} else if (_model.row.ddateSolt == '2') {
|
|
|
|
ddate_solt = '午餐';
|
|
|
|
} else if (_model.row.ddateSolt == '3') {
|
|
|
|
ddate_solt = '晚餐';
|
|
|
|
}
|
|
|
|
tableManagerModel.areaTableMapShow
|
|
|
|
.forEach((key, value) {
|
|
|
|
value.forEach((element) {
|
|
|
|
element.selected = false;
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
List<dynamic> tableinfo =
|
|
|
|
convert.jsonDecode(_model.row.tableinfo);
|
|
|
|
print(tableinfo);
|
|
|
|
|
|
|
|
tableManagerModel.notifyListeners();
|
|
|
|
},
|
|
|
|
child: Padding(
|
|
|
|
padding: EdgeInsets.only(
|
|
|
|
left: ScreenUtil().setWidth(30),
|
|
|
|
right: ScreenUtil().setWidth(30),
|
|
|
|
top: ScreenUtil().setWidth(15)),
|
|
|
|
child: Text(
|
|
|
|
'取消重置',
|
|
|
|
style: TextStyle(
|
|
|
|
color: MyColours.color_199095,
|
|
|
|
fontSize: ScreenUtil().setSp(26)),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
String _nameStr =
|
|
|
|
table.TableList.fromJson(tableinfo[0]).name;
|
|
|
|
if (tableinfo.length > 1) {
|
|
|
|
_nameStr = table.TableList.fromJson(tableinfo[0]).name +
|
|
|
|
'等${tableinfo.length}桌';
|
|
|
|
}
|
|
|
|
LogUtil.v(_nameStr);
|
|
|
|
String _tid = '';
|
|
|
|
for (int i = 0; i < tableinfo.length; i++) {
|
|
|
|
_tid += '${table.TableList.fromJson(tableinfo[i]).id},';
|
|
|
|
}
|
|
|
|
if (_tid.endsWith(',')) {
|
|
|
|
_tid = _tid.substring(0, _tid.length - 1);
|
|
|
|
}
|
|
|
|
NavigatorUtil.goInvicationPage(
|
|
|
|
context,
|
|
|
|
_model.row.id,
|
|
|
|
_nameStr,
|
|
|
|
_model.row.ddate,
|
|
|
|
ddate_solt,
|
|
|
|
_model.row.phone,
|
|
|
|
_model.row.ddateSolt,
|
|
|
|
tid: _tid,
|
|
|
|
replace: false);
|
|
|
|
// //今天 明天 其他天
|
|
|
|
// String tempTime = _homeEnterModel.ddateStr;
|
|
|
|
// if (_homeEnterModel.ddateStr == '') {
|
|
|
|
// if (currTimeIndex == 1) {
|
|
|
|
// tempTime = '08:00';
|
|
|
|
// } else if (currTimeIndex == 2) {
|
|
|
|
// tempTime = '12:00';
|
|
|
|
// } else if (currTimeIndex == 3) {
|
|
|
|
// tempTime = '18:00';
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
// print(_model.row.tableinfo);
|
|
|
|
// _clearData();
|
|
|
|
// String timeStr = dateText + ' ' + tempTime + ':00';
|
|
|
|
|
|
|
|
// LogUtil.v(timeStr);
|
|
|
|
// int ddate = DateUtil.getDateMsByTimeStr(timeStr);
|
|
|
|
|
|
|
|
// _homeEnterModel.getNewTableList(context, '${ddate}',
|
|
|
|
// currTimeIndex.toString(), pnum);
|
|
|
|
|
|
|
|
// EventBus().emit("refresh_tablemanager"); //刷新桌位
|
|
|
|
} else {
|
|
|
|
Utils.showToast("预订失败!");
|
|
|
|
}
|
|
|
|
},
|
|
|
|
text: '预订并通知',
|
|
|
|
fontSize: 32,
|
|
|
|
isBold: false,
|
|
|
|
width: ScreenUtil().setWidth(220),
|
|
|
|
height: ScreenUtil().setWidth(90),
|
|
|
|
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,
|
|
|
|
),
|
|
|
|
)
|
|
|
|
],
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
));
|
|
|
|
VEmptyView(40),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
//构建常用备注
|
|
|
|
List<Widget> _buildAlwayItems() {
|
|
|
|
List<Widget> tables = [];
|
|
|
|
for (t.Table table in tableManagerModel.selectTables) {
|
|
|
|
tables.add(Container(
|
|
|
|
if (tableManagerModel.selectTables.length < 6) {
|
|
|
|
for (t.Table table in tableManagerModel.selectTables) {
|
|
|
|
tables.add(Container(
|
|
|
|
padding: EdgeInsets.symmetric(
|
|
|
|
horizontal: ScreenUtil().setWidth(10),
|
|
|
|
vertical: ScreenUtil().setWidth(6)),
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
color: MyColours.color_199095,
|
|
|
|
// 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(36),
|
|
|
|
color: MyColours.color_ffffff,
|
|
|
|
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,
|
|
|
|
// )
|
|
|
|
);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
for (int i = 0; i < 6; i++) {
|
|
|
|
if (i == 5) {
|
|
|
|
tables.add(Container(
|
|
|
|
padding: EdgeInsets.only(
|
|
|
|
left: ScreenUtil().setWidth(10),
|
|
|
|
right: ScreenUtil().setWidth(10),
|
|
|
|
top: ScreenUtil().setWidth(10)),
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
color: MyColours.color_ffffff,
|
|
|
|
// border: Border.all(
|
|
|
|
// color: MyColours.color_E0E0E0,
|
|
|
|
// width: ScreenUtil().setWidth(2)),
|
|
|
|
borderRadius:
|
|
|
|
BorderRadius.circular(ScreenUtil().setWidth(10))),
|
|
|
|
child: Text(
|
|
|
|
'等${tableManagerModel.selectTables.length}个桌位',
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize: ScreenUtil().setSp(26),
|
|
|
|
color: MyColours.color_199095,
|
|
|
|
),
|
|
|
|
)));
|
|
|
|
return tables;
|
|
|
|
} else {
|
|
|
|
tables.add(Container(
|
|
|
|
padding: EdgeInsets.symmetric(
|
|
|
|
horizontal: ScreenUtil().setWidth(20),
|
|
|
|
vertical: ScreenUtil().setWidth(4)),
|
|
|
|
horizontal: ScreenUtil().setWidth(10),
|
|
|
|
vertical: ScreenUtil().setWidth(6)),
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
border: Border.all(
|
|
|
|
color: MyColours.color_E0E0E0,
|
|
|
|
width: ScreenUtil().setWidth(2)),
|
|
|
|
color: MyColours.color_199095,
|
|
|
|
borderRadius:
|
|
|
|
BorderRadius.circular(ScreenUtil().setWidth(10))),
|
|
|
|
child: Text(
|
|
|
|
table.name,
|
|
|
|
tableManagerModel.selectTables[i].name,
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize: ScreenUtil().setSp(26),
|
|
|
|
color: MyColours.color_333333,
|
|
|
|
fontSize: ScreenUtil().setSp(36),
|
|
|
|
color: MyColours.color_ffffff,
|
|
|
|
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;
|
|
...
|
...
|
@@ -618,10 +806,12 @@ class TableManagerPageState extends State<TableManagerPage> { |
|
|
|
|
|
|
|
///早餐、午餐、晚餐点击方法
|
|
|
|
_clickMorAndNoonAndNig() async {
|
|
|
|
tableManagerModel.selectDateStr = tableManagerModel.returnDayDateWeekStr(
|
|
|
|
tableManagerModel.dateTimeSelect, tableManagerModel.currTimeIndex);
|
|
|
|
|
|
|
|
await tableManagerModel.getReserveList(context, needLoading: true);
|
|
|
|
tableManagerModel.selectDateStr =
|
|
|
|
tableManagerModel.returnDayDateStr(tableManagerModel.dateTimeSelect);
|
|
|
|
tableManagerModel.selectWeekAndLunarCalendar = tableManagerModel
|
|
|
|
.returnWeekAndLunarCalendar(tableManagerModel.dateTimeSelect);
|
|
|
|
await tableManagerModel.getReserveList(context,
|
|
|
|
needLoading: true, showMsg: true);
|
|
|
|
}
|
|
|
|
|
|
|
|
@override
|
|
...
|
...
|
@@ -629,8 +819,9 @@ class TableManagerPageState extends State<TableManagerPage> { |
|
|
|
tableManagerModel = Provider.of<TableManagerModel>(context, listen: true);
|
|
|
|
return Scaffold(
|
|
|
|
backgroundColor: MyColours.color_ffffff,
|
|
|
|
appBar: SystemAppBar("桌位", showLeading: false),
|
|
|
|
body: Consumer<TableManagerModel>(
|
|
|
|
body: SafeArea(child:
|
|
|
|
// appBar: SystemAppBar("桌位", showLeading: false),
|
|
|
|
Consumer<TableManagerModel>(
|
|
|
|
builder: (context, model, child) {
|
|
|
|
int sum = 3;
|
|
|
|
int hide = 0;
|
|
...
|
...
|
@@ -647,6 +838,7 @@ class TableManagerPageState extends State<TableManagerPage> { |
|
|
|
btnNum = sum - hide;
|
|
|
|
return Column(
|
|
|
|
children: <Widget>[
|
|
|
|
VEmptyView(40),
|
|
|
|
Container(
|
|
|
|
color: MyColours.color_ffffff,
|
|
|
|
padding: EdgeInsets.symmetric(
|
|
...
|
...
|
@@ -658,9 +850,11 @@ class TableManagerPageState extends State<TableManagerPage> { |
|
|
|
onTap: () {
|
|
|
|
DialogUtil.showCalendarDialog(
|
|
|
|
context, tableManagerModel.dateTime)
|
|
|
|
.then((day) {
|
|
|
|
.then((day) async {
|
|
|
|
if (day != null) {
|
|
|
|
tableManagerModel.createDateText(context, day);
|
|
|
|
await tableManagerModel.getReserveList(context,
|
|
|
|
needLoading: true, showMsg: true);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
},
|
|
...
|
...
|
@@ -684,7 +878,7 @@ class TableManagerPageState extends State<TableManagerPage> { |
|
|
|
color: MyColours.color_ffffff,
|
|
|
|
fontSize: ScreenUtil().setSp(28)),
|
|
|
|
)),
|
|
|
|
HEmptyView(10),
|
|
|
|
// HEmptyView(10),
|
|
|
|
Image.asset(
|
|
|
|
Utils.getImgPath('f_arrow_right'),
|
|
|
|
width: ScreenUtil().setWidth(25),
|
|
...
|
...
|
@@ -704,9 +898,9 @@ class TableManagerPageState extends State<TableManagerPage> { |
|
|
|
width: btnNum == 3 &&
|
|
|
|
(tableManagerModel.currTimeIndex == 3 ||
|
|
|
|
tableManagerModel.currTimeIndex == 1)
|
|
|
|
? ScreenUtil().setWidth(206) +
|
|
|
|
? ScreenUtil().setWidth(300) +
|
|
|
|
ScreenUtil().setWidth(4)
|
|
|
|
: ScreenUtil().setWidth(206),
|
|
|
|
: ScreenUtil().setWidth(300),
|
|
|
|
height: ScreenUtil().setWidth(74),
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
color: Color.fromRGBO(232, 232, 232, 1),
|
|
...
|
...
|
@@ -734,7 +928,7 @@ class TableManagerPageState extends State<TableManagerPage> { |
|
|
|
"00:00-00:00"
|
|
|
|
? true
|
|
|
|
: false,
|
|
|
|
width: ScreenUtil().setWidth(206) / btnNum,
|
|
|
|
width: ScreenUtil().setWidth(300) / btnNum,
|
|
|
|
onPress: () {
|
|
|
|
if (tableManagerModel.currTimeIndex == 1)
|
|
|
|
return;
|
|
...
|
...
|
@@ -763,7 +957,7 @@ class TableManagerPageState extends State<TableManagerPage> { |
|
|
|
? 1
|
|
|
|
: 0,
|
|
|
|
fontSize: 28,
|
|
|
|
width: ScreenUtil().setWidth(206) / btnNum,
|
|
|
|
width: ScreenUtil().setWidth(300) / btnNum,
|
|
|
|
left:
|
|
|
|
tableManagerModel.morning == "00:00-00:00"
|
|
|
|
? true
|
|
...
|
...
|
@@ -804,7 +998,7 @@ class TableManagerPageState extends State<TableManagerPage> { |
|
|
|
? 1
|
|
|
|
: 0,
|
|
|
|
fontSize: 28,
|
|
|
|
width: ScreenUtil().setWidth(206) / btnNum,
|
|
|
|
width: ScreenUtil().setWidth(300) / btnNum,
|
|
|
|
onPress: () {
|
|
|
|
if (tableManagerModel.currTimeIndex == 3)
|
|
|
|
return;
|
|
...
|
...
|
@@ -822,7 +1016,7 @@ class TableManagerPageState extends State<TableManagerPage> { |
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
VEmptyView(30),
|
|
|
|
VEmptyView(10),
|
|
|
|
|
|
|
|
model.pageState != PageState.Success
|
|
|
|
? Expanded(
|
|
...
|
...
|
@@ -845,9 +1039,9 @@ class TableManagerPageState extends State<TableManagerPage> { |
|
|
|
children: [
|
|
|
|
Container(
|
|
|
|
color: MyColours.color_ffffff,
|
|
|
|
height: ScreenUtil().setWidth(92),
|
|
|
|
height: ScreenUtil().setWidth(82),
|
|
|
|
margin: EdgeInsets.only(
|
|
|
|
bottom: ScreenUtil().setWidth(30)),
|
|
|
|
bottom: ScreenUtil().setWidth(24)),
|
|
|
|
child: Row(
|
|
|
|
children: [
|
|
|
|
HEmptyView(20),
|
|
...
|
...
|
@@ -907,8 +1101,8 @@ class TableManagerPageState extends State<TableManagerPage> { |
|
|
|
DottedBorder(
|
|
|
|
dashPattern: [5, 5, 5, 5],
|
|
|
|
borderType: BorderType.RRect,
|
|
|
|
radius: Radius.circular(
|
|
|
|
ScreenUtil().setWidth(10)),
|
|
|
|
// radius: Radius.circular(
|
|
|
|
// ScreenUtil().setWidth(10)),
|
|
|
|
// padding: EdgeInsets.all(ScreenUtil().setWidth(70)),
|
|
|
|
color: MyColours.color_199095,
|
|
|
|
strokeWidth:
|
|
...
|
...
|
@@ -922,7 +1116,7 @@ class TableManagerPageState extends State<TableManagerPage> { |
|
|
|
height: ScreenUtil()
|
|
|
|
.setWidth(25 * 2),
|
|
|
|
width: ScreenUtil()
|
|
|
|
.setWidth(104 * 2),
|
|
|
|
.setWidth(70 * 2),
|
|
|
|
child: Column(
|
|
|
|
mainAxisAlignment:
|
|
|
|
MainAxisAlignment
|
|
...
|
...
|
@@ -959,12 +1153,12 @@ class TableManagerPageState extends State<TableManagerPage> { |
|
|
|
height: ScreenUtil().setWidth(80),
|
|
|
|
margin: EdgeInsets.only(
|
|
|
|
right:
|
|
|
|
ScreenUtil().setWidth(20),
|
|
|
|
ScreenUtil().setWidth(15),
|
|
|
|
top: ScreenUtil().setWidth(20),
|
|
|
|
),
|
|
|
|
padding: EdgeInsets.symmetric(
|
|
|
|
horizontal:
|
|
|
|
ScreenUtil().setWidth(20),
|
|
|
|
ScreenUtil().setWidth(14),
|
|
|
|
vertical: ScreenUtil()
|
|
|
|
.setWidth(10)),
|
|
|
|
alignment: Alignment.center,
|
|
...
|
...
|
@@ -987,7 +1181,7 @@ class TableManagerPageState extends State<TableManagerPage> { |
|
|
|
: MyColours
|
|
|
|
.color_333333,
|
|
|
|
fontSize:
|
|
|
|
ScreenUtil().setSp(28),
|
|
|
|
ScreenUtil().setSp(24),
|
|
|
|
decoration:
|
|
|
|
TextDecoration.none,
|
|
|
|
fontWeight:
|
|
...
|
...
|
@@ -1055,7 +1249,7 @@ class TableManagerPageState extends State<TableManagerPage> { |
|
|
|
'f_swich_on')
|
|
|
|
: Utils.getImgPath(
|
|
|
|
'f_swich_off'),
|
|
|
|
width: ScreenUtil().setWidth(90),
|
|
|
|
width: ScreenUtil().setWidth(60),
|
|
|
|
// height: ScreenUtil().setWidth(82),
|
|
|
|
),
|
|
|
|
HEmptyView(20),
|
|
...
|
...
|
@@ -1063,7 +1257,7 @@ class TableManagerPageState extends State<TableManagerPage> { |
|
|
|
'仅看\n空座',
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize:
|
|
|
|
ScreenUtil().setSp(28),
|
|
|
|
ScreenUtil().setSp(23),
|
|
|
|
color: MyColours.color_333333,
|
|
|
|
),
|
|
|
|
),
|
|
...
|
...
|
@@ -1075,7 +1269,7 @@ class TableManagerPageState extends State<TableManagerPage> { |
|
|
|
),
|
|
|
|
),
|
|
|
|
Expanded(
|
|
|
|
flex: 2,
|
|
|
|
// flex: 2,
|
|
|
|
child: Container(
|
|
|
|
constraints: BoxConstraints(
|
|
|
|
minHeight: ScreenUtil().setWidth(100)),
|
|
...
|
...
|
@@ -1137,6 +1331,6 @@ class TableManagerPageState extends State<TableManagerPage> { |
|
|
|
],
|
|
|
|
);
|
|
|
|
},
|
|
|
|
));
|
|
|
|
)));
|
|
|
|
}
|
|
|
|
} |
...
|
...
|
|