|
...
|
...
|
@@ -9,6 +9,7 @@ import 'package:dotted_border/dotted_border.dart'; |
|
|
|
// import 'package:easy_contact_picker/easy_contact_picker.dart';
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
import 'package:flutter/services.dart';
|
|
|
|
import 'package:flutter_easyrefresh/easy_refresh.dart';
|
|
|
|
import 'package:flutter_native_contact_picker/flutter_native_contact_picker.dart';
|
|
|
|
import 'package:flutter_native_contact_picker/model/contact.dart';
|
|
|
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
|
...
|
...
|
@@ -179,6 +180,7 @@ class TableManagerPageState extends State<TableManagerPage> { |
|
|
|
DateTime? dateTimeSelect;
|
|
|
|
int selectNumber = 0;
|
|
|
|
late StoreBaseIndoProvider storeBaseIndoProvider;
|
|
|
|
late EasyRefreshController? _controller;
|
|
|
|
|
|
|
|
@override
|
|
|
|
void initState() {
|
|
...
|
...
|
@@ -186,6 +188,7 @@ class TableManagerPageState extends State<TableManagerPage> { |
|
|
|
super.initState();
|
|
|
|
|
|
|
|
LogUtil.v("table_manager_page initState");
|
|
|
|
_controller = EasyRefreshController();
|
|
|
|
|
|
|
|
// if (App.sp.containsKey('user')) {
|
|
|
|
// String s = App.sp.getString('user');
|
|
...
|
...
|
@@ -845,159 +848,172 @@ class TableManagerPageState extends State<TableManagerPage> { |
|
|
|
}
|
|
|
|
|
|
|
|
Widget item(int i) {
|
|
|
|
return GridView.builder(
|
|
|
|
// controller: _areaController,
|
|
|
|
// physics: NeverScrollableScrollPhysics(),
|
|
|
|
padding: EdgeInsets.symmetric(
|
|
|
|
vertical: ScreenUtil().setWidth(20),
|
|
|
|
horizontal: ScreenUtil().setWidth(10)),
|
|
|
|
shrinkWrap: true,
|
|
|
|
itemCount:
|
|
|
|
tableManagerModel!.tablesOrReserveDataShow![i].tableList!.length,
|
|
|
|
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
|
|
|
|
crossAxisCount: 4,
|
|
|
|
childAspectRatio: 1,
|
|
|
|
mainAxisSpacing: ScreenUtil().setWidth(30),
|
|
|
|
crossAxisSpacing: ScreenUtil().setWidth(12),
|
|
|
|
),
|
|
|
|
|
|
|
|
itemBuilder: (BuildContext context, int index) {
|
|
|
|
// List<t.Table> data = tableManagerModel.tableOuterList.length == 0
|
|
|
|
// ? []
|
|
|
|
// : tableManagerModel.currentArea == '全部'
|
|
|
|
// ? tableManagerModel.tablesShow
|
|
|
|
// : tableManagerModel.areaTableMapShow[
|
|
|
|
// tableManagerModel.tablesOrReserveDataShow[i].name];
|
|
|
|
|
|
|
|
TableListReserve data =
|
|
|
|
tableManagerModel!.tablesOrReserveDataShow![i].tableList![index];
|
|
|
|
|
|
|
|
return Selector<TableManagerModelOrReserve, TableListReserve>(
|
|
|
|
shouldRebuild: (pre, next) => true,
|
|
|
|
selector: (context, model) => data,
|
|
|
|
builder: (context, table, _) {
|
|
|
|
return TableItemOrReserve(table,
|
|
|
|
fromPage: 'table_manage',
|
|
|
|
canSelected: true,
|
|
|
|
selectTables: tableManagerModel!.selectTablesOrReserve,
|
|
|
|
addOrder: isRealAddOver,
|
|
|
|
banquetListTids: tableManagerModel!.banquetListTids,
|
|
|
|
onSelected: (table) {
|
|
|
|
if (table.signStr == '已预订') {
|
|
|
|
if (table.sign == '10') {
|
|
|
|
//宴会订单
|
|
|
|
NavigatorUtil.goFeastDetailPage(context, table.notebookId,
|
|
|
|
canEdit: false, needChange: true);
|
|
|
|
} else {
|
|
|
|
//进入订座详情页面
|
|
|
|
NavigatorUtil.goNotebookDetailPage(
|
|
|
|
context, table.notebookId, data.reserveList!.uid);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
if (table.selected) {
|
|
|
|
tableManagerModel!.selectTablesOrReserve.add(table);
|
|
|
|
tableManagerModel!.tablesOrReserveDataShow!
|
|
|
|
.forEach((element) {
|
|
|
|
element.tableList!.forEach((element1) {
|
|
|
|
if (element1.id == table.id) {
|
|
|
|
element1.selected = true;
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
} else {
|
|
|
|
tableManagerModel!.selectTablesOrReserve
|
|
|
|
.removeWhere((t) => t.id == table.id);
|
|
|
|
tableManagerModel!.tablesOrReserveDataShow!
|
|
|
|
.forEach((element) {
|
|
|
|
element.tableList!.forEach((element1) {
|
|
|
|
if (element1.id == table.id) {
|
|
|
|
element1.selected = false;
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
if (tableManagerModel!.selectTablesOrReserve.length == 0) {
|
|
|
|
// wechatNotification = true;
|
|
|
|
_clearData();
|
|
|
|
}
|
|
|
|
// if (tableManagerModel.selectTables.length > 1) {
|
|
|
|
// _scrollCrl.position
|
|
|
|
// .didUpdateScrollPositionBy(0); //这里触发更新滚动条
|
|
|
|
// }
|
|
|
|
setState(() {});
|
|
|
|
}
|
|
|
|
// 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.tablesOrReserveDataShow) {
|
|
|
|
// if (area.name ==
|
|
|
|
// tableManagerModel.currentArea) {
|
|
|
|
// if (table.sign != '5' && table.sign != '1') {
|
|
|
|
// //已预订
|
|
|
|
// area.count++;
|
|
|
|
// }
|
|
|
|
// break;
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
// } else {
|
|
|
|
// for (Area area in tableManagerModel.tablesOrReserveDataShow) {
|
|
|
|
// 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;
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
// });
|
|
|
|
}, rid: "");
|
|
|
|
return EasyRefresh(
|
|
|
|
onRefresh: () async {
|
|
|
|
// offset = 0;
|
|
|
|
// getMessage(typeid, showLoading: false);
|
|
|
|
await tableManagerModel!.getTableListOrReserve(
|
|
|
|
context, currTimeIndex, dateTime, selectNumber,
|
|
|
|
showLoading: true, onRefresh: true);
|
|
|
|
setState(() {});
|
|
|
|
},
|
|
|
|
onLoad: () async {
|
|
|
|
// offset++;
|
|
|
|
// getMessage(typeid, showLoading: false);
|
|
|
|
},
|
|
|
|
child: GridView.builder(
|
|
|
|
// controller: _areaController,
|
|
|
|
// physics: NeverScrollableScrollPhysics(),
|
|
|
|
padding: EdgeInsets.symmetric(
|
|
|
|
vertical: ScreenUtil().setWidth(20),
|
|
|
|
horizontal: ScreenUtil().setWidth(10)),
|
|
|
|
shrinkWrap: true,
|
|
|
|
itemCount:
|
|
|
|
tableManagerModel!.tablesOrReserveDataShow![i].tableList!.length,
|
|
|
|
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
|
|
|
|
crossAxisCount: 4,
|
|
|
|
childAspectRatio: 1,
|
|
|
|
mainAxisSpacing: ScreenUtil().setWidth(30),
|
|
|
|
crossAxisSpacing: ScreenUtil().setWidth(12),
|
|
|
|
),
|
|
|
|
|
|
|
|
itemBuilder: (BuildContext context, int index) {
|
|
|
|
// List<t.Table> data = tableManagerModel.tableOuterList.length == 0
|
|
|
|
// ? []
|
|
|
|
// : tableManagerModel.currentArea == '全部'
|
|
|
|
// ? tableManagerModel.tablesShow
|
|
|
|
// : tableManagerModel.areaTableMapShow[
|
|
|
|
// tableManagerModel.tablesOrReserveDataShow[i].name];
|
|
|
|
|
|
|
|
TableListReserve data = tableManagerModel!
|
|
|
|
.tablesOrReserveDataShow![i].tableList![index];
|
|
|
|
|
|
|
|
return Selector<TableManagerModelOrReserve, TableListReserve>(
|
|
|
|
shouldRebuild: (pre, next) => true,
|
|
|
|
selector: (context, model) => data,
|
|
|
|
builder: (context, table, _) {
|
|
|
|
return TableItemOrReserve(table,
|
|
|
|
fromPage: 'table_manage',
|
|
|
|
canSelected: true,
|
|
|
|
selectTables: tableManagerModel!.selectTablesOrReserve,
|
|
|
|
addOrder: isRealAddOver,
|
|
|
|
banquetListTids: tableManagerModel!.banquetListTids,
|
|
|
|
onSelected: (table) {
|
|
|
|
if (table.signStr == '已预订') {
|
|
|
|
if (table.sign == '10') {
|
|
|
|
//宴会订单
|
|
|
|
NavigatorUtil.goFeastDetailPage(context, table.notebookId,
|
|
|
|
canEdit: false, needChange: true);
|
|
|
|
} else {
|
|
|
|
//进入订座详情页面
|
|
|
|
NavigatorUtil.goNotebookDetailPage(
|
|
|
|
context, table.notebookId, data.reserveList!.uid);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
if (table.selected) {
|
|
|
|
tableManagerModel!.selectTablesOrReserve.add(table);
|
|
|
|
tableManagerModel!.tablesOrReserveDataShow!
|
|
|
|
.forEach((element) {
|
|
|
|
element.tableList!.forEach((element1) {
|
|
|
|
if (element1.id == table.id) {
|
|
|
|
element1.selected = true;
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
} else {
|
|
|
|
tableManagerModel!.selectTablesOrReserve
|
|
|
|
.removeWhere((t) => t.id == table.id);
|
|
|
|
tableManagerModel!.tablesOrReserveDataShow!
|
|
|
|
.forEach((element) {
|
|
|
|
element.tableList!.forEach((element1) {
|
|
|
|
if (element1.id == table.id) {
|
|
|
|
element1.selected = false;
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
if (tableManagerModel!.selectTablesOrReserve.length == 0) {
|
|
|
|
// wechatNotification = true;
|
|
|
|
_clearData();
|
|
|
|
}
|
|
|
|
// if (tableManagerModel.selectTables.length > 1) {
|
|
|
|
// _scrollCrl.position
|
|
|
|
// .didUpdateScrollPositionBy(0); //这里触发更新滚动条
|
|
|
|
// }
|
|
|
|
setState(() {});
|
|
|
|
}
|
|
|
|
// 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.tablesOrReserveDataShow) {
|
|
|
|
// if (area.name ==
|
|
|
|
// tableManagerModel.currentArea) {
|
|
|
|
// if (table.sign != '5' && table.sign != '1') {
|
|
|
|
// //已预订
|
|
|
|
// area.count++;
|
|
|
|
// }
|
|
|
|
// break;
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
// } else {
|
|
|
|
// for (Area area in tableManagerModel.tablesOrReserveDataShow) {
|
|
|
|
// 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;
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
// });
|
|
|
|
}, rid: "");
|
|
|
|
},
|
|
|
|
);
|
|
|
|
// }
|
|
|
|
},
|
|
|
|
);
|
|
|
|
// }
|
|
|
|
},
|
|
|
|
);
|
|
|
|
));
|
|
|
|
}
|
|
|
|
|
|
|
|
_openAddressBook() async {
|
|
...
|
...
|
@@ -4877,7 +4893,27 @@ class TableManagerPageState extends State<TableManagerPage> { |
|
|
|
// : Expanded(
|
|
|
|
// flex: 5, child: _selectTableWidgetSms())
|
|
|
|
: SizedBox()
|
|
|
|
]))
|
|
|
|
])
|
|
|
|
// SliverList(
|
|
|
|
// delegate: SliverChildBuilderDelegate(
|
|
|
|
// (BuildContext context, int index) {
|
|
|
|
// return MessageItemF(
|
|
|
|
// model.messagesHas[index],
|
|
|
|
// collectStoreProvider,
|
|
|
|
// isTreated: true,
|
|
|
|
// );
|
|
|
|
// }, childCount: model.messagesHas.length),
|
|
|
|
// )
|
|
|
|
// ,
|
|
|
|
// onRefresh: () async {
|
|
|
|
// // offset = 0;
|
|
|
|
// // getMessage(typeid, showLoading: false);
|
|
|
|
// },
|
|
|
|
// onLoad: () async {
|
|
|
|
// // offset++;
|
|
|
|
// // getMessage(typeid, showLoading: false);
|
|
|
|
// },
|
|
|
|
)
|
|
|
|
// return CCMenuPage.builder(
|
|
|
|
// tableManagerModel: tableManagerModel,
|
|
|
|
// itemCount: tableManagerModel.tablesOrReserveDataShow.length,
|
...
|
...
|
|