|
...
|
...
|
@@ -16,14 +16,20 @@ import 'package:one_key/widgets/round_button.dart'; |
|
|
|
import 'package:one_key/widgets/v_empty_view.dart';
|
|
|
|
import 'package:provider/provider.dart';
|
|
|
|
|
|
|
|
import '../../app.dart';
|
|
|
|
import '../../constant/state.dart';
|
|
|
|
import '../../models/dsolt_xt.dart';
|
|
|
|
import '../../models/feast_menu_model.dart';
|
|
|
|
import '../../models/get_banquet_by_id_new_model.dart';
|
|
|
|
import '../../models/get_board_model.dart';
|
|
|
|
import '../../models/notebook.dart';
|
|
|
|
import '../../models/set_xuan_tai_model.dart';
|
|
|
|
import '../../models/setmeal_by_id_model.dart';
|
|
|
|
import '../../models/tableOuter.dart';
|
|
|
|
import '../../models/upload_img_model.dart';
|
|
|
|
import '../../provider/choose_table_model.dart';
|
|
|
|
import '../../provider/feast_model.dart';
|
|
|
|
import '../../provider/notebook_model.dart';
|
|
|
|
import '../../provider/upload_img_provider.dart';
|
|
|
|
import '../../provider/user_model.dart';
|
|
|
|
import '../../res/colors.dart';
|
|
...
|
...
|
@@ -43,6 +49,8 @@ import 'package:one_key/models/table_list.dart' as t; |
|
|
|
import 'package:flutter_keyboard_visibility/flutter_keyboard_visibility.dart';
|
|
|
|
import '../../widgets/special_text/my_extended_text_selection_controls.dart';
|
|
|
|
|
|
|
|
import 'package:one_key/models/table.dart' as table;
|
|
|
|
|
|
|
|
class FeastCreatePage extends StatefulWidget {
|
|
|
|
final GetBanquetByIdNewSunModel banquetDetail;
|
|
|
|
final bool isCreate;
|
|
...
|
...
|
@@ -99,6 +107,11 @@ class _FeastCreatePageState extends State<FeastCreatePage> { |
|
|
|
MyTextSelectionControls _myExtendedMaterialTextSelectionControls =
|
|
|
|
MyTextSelectionControls();
|
|
|
|
|
|
|
|
ChooseTableModel _chooseTableModel;
|
|
|
|
List<Notebook> noteBooks;
|
|
|
|
Map<String, Notebook> tableMap = {}; //记录已预订桌位对应的订单
|
|
|
|
List<TableOuter> tableOuterList = []; //区域-桌位列表
|
|
|
|
|
|
|
|
@override
|
|
|
|
void initState() {
|
|
|
|
// TODO: implement initState
|
|
...
|
...
|
@@ -252,7 +265,10 @@ class _FeastCreatePageState extends State<FeastCreatePage> { |
|
|
|
setXuanTaiModel.endDate; //起始时间
|
|
|
|
setXuanTaiModel.tableList = element.tableList;
|
|
|
|
|
|
|
|
setXuanTaiModel.tableSum = int.parse('${element.tableNum}'); //桌位总数
|
|
|
|
setXuanTaiModel.tableSum =
|
|
|
|
element.tableNum == null || element.tableNum == ''
|
|
|
|
? 0
|
|
|
|
: int.parse('${element.tableNum}'); //桌位总数
|
|
|
|
setXuanTaiModel.customCxt.text = element.remark; //选台备注
|
|
|
|
setXuanTaiModel.feastRemarkXtImageList =
|
|
|
|
element.feastRemarkImages; //宴会备注图片信息列表----选台
|
|
...
|
...
|
@@ -1225,6 +1241,351 @@ class _FeastCreatePageState extends State<FeastCreatePage> { |
|
|
|
return startDay.floor().toString() + "-" + endDay.floor().toString();
|
|
|
|
}
|
|
|
|
|
|
|
|
//获取一天开始-结束时间字符串
|
|
|
|
String _getRdateGetNotebook() {
|
|
|
|
String timeStrStart = '';
|
|
|
|
String timeStrEnd = '';
|
|
|
|
//一天开始时间
|
|
|
|
double startDay;
|
|
|
|
//一天结束时间
|
|
|
|
double endDay;
|
|
|
|
|
|
|
|
SetXuanTaiModel setXuanTaiModel = xuantaiData[xuantaiSelIndex];
|
|
|
|
|
|
|
|
String hmsS = " ${setXuanTaiModel.startDate}:00"; //起始
|
|
|
|
String hmsE = " ${setXuanTaiModel.endDate}:59"; //结束
|
|
|
|
timeStrStart = setXuanTaiModel.dateTimext.year.toString() +
|
|
|
|
"-" +
|
|
|
|
Utils.addZeroNumber(setXuanTaiModel.dateTimext.month) +
|
|
|
|
"-" +
|
|
|
|
Utils.addZeroNumber(setXuanTaiModel.dateTimext.day) +
|
|
|
|
hmsS;
|
|
|
|
timeStrEnd = setXuanTaiModel.dateTimext.year.toString() +
|
|
|
|
"-" +
|
|
|
|
Utils.addZeroNumber(setXuanTaiModel.dateTimext.month) +
|
|
|
|
"-" +
|
|
|
|
Utils.addZeroNumber(setXuanTaiModel.dateTimext.day) +
|
|
|
|
hmsE;
|
|
|
|
// }
|
|
|
|
startDay = (DateTime.parse(timeStrStart).millisecondsSinceEpoch) / 1000;
|
|
|
|
endDay = (DateTime.parse(timeStrEnd).millisecondsSinceEpoch) / 1000;
|
|
|
|
return startDay.floor().toString() + "-" + endDay.floor().toString();
|
|
|
|
}
|
|
|
|
|
|
|
|
//获取预订(原来普通预订和宴会预订)
|
|
|
|
_getReserveListAndFeastData(context, params, showloading) async {
|
|
|
|
UserModel userModel = Provider.of<UserModel>(context, listen: false);
|
|
|
|
SetXuanTaiModel setXuanTaiModel = xuantaiData[xuantaiSelIndex];
|
|
|
|
String timeStrStart = '';
|
|
|
|
String timeStrEnd = '';
|
|
|
|
String hmsS = " ${setXuanTaiModel.startDate}:00"; //起始
|
|
|
|
String hmsE = " ${setXuanTaiModel.endDate}:59"; //结束
|
|
|
|
timeStrStart = setXuanTaiModel.dateTimext.year.toString() +
|
|
|
|
"-" +
|
|
|
|
Utils.addZeroNumber(setXuanTaiModel.dateTimext.month) +
|
|
|
|
"-" +
|
|
|
|
Utils.addZeroNumber(setXuanTaiModel.dateTimext.day) +
|
|
|
|
hmsS;
|
|
|
|
timeStrEnd = setXuanTaiModel.dateTimext.year.toString() +
|
|
|
|
"-" +
|
|
|
|
Utils.addZeroNumber(setXuanTaiModel.dateTimext.month) +
|
|
|
|
"-" +
|
|
|
|
Utils.addZeroNumber(setXuanTaiModel.dateTimext.day) +
|
|
|
|
hmsE;
|
|
|
|
String start =
|
|
|
|
(DateUtil.getDateMsByTimeStr(timeStrStart) / 1000).floor().toString();
|
|
|
|
String end =
|
|
|
|
(DateUtil.getDateMsByTimeStr(timeStrEnd) / 1000).floor().toString();
|
|
|
|
|
|
|
|
Map<String, String> banquetmap = {
|
|
|
|
'sid': userModel.user.sellerid,
|
|
|
|
'rdate': '${start}',
|
|
|
|
'edate': '${end}',
|
|
|
|
// 'ddate_interval': widget.ddate_slot
|
|
|
|
};
|
|
|
|
return await Future.wait<bool>([
|
|
|
|
_getOldReserve(context, params, showloading),
|
|
|
|
_chooseTableModel.getBanquetByDate(context, banquetmap,
|
|
|
|
showLoading: showloading)
|
|
|
|
]).then((results) {
|
|
|
|
if (results[0] && results[1]) {
|
|
|
|
//成功
|
|
|
|
return true;
|
|
|
|
} else {
|
|
|
|
if (!results[0]) {
|
|
|
|
// Utils.showToast('');
|
|
|
|
} else {
|
|
|
|
// Utils.showToast('');
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}).catchError((e) {
|
|
|
|
print(e);
|
|
|
|
return false;
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
Future<bool> _getOldReserve(context, params, showloading) async {
|
|
|
|
NoteBookModel model = new NoteBookModel();
|
|
|
|
noteBooks =
|
|
|
|
await model.getReserveList(context, params, needLoading: showloading);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
List<TableOuter> getSpTableList() {
|
|
|
|
String tableList = App.sp.getString('table_list');
|
|
|
|
if (tableList == null) {
|
|
|
|
return [];
|
|
|
|
}
|
|
|
|
List<TableOuter> temp = [];
|
|
|
|
List list = json.decode(tableList);
|
|
|
|
if (list.length > 0) {
|
|
|
|
list.forEach((element) {
|
|
|
|
temp.add(TableOuter.fromJson2(element));
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
return temp;
|
|
|
|
}
|
|
|
|
|
|
|
|
//获取桌位列表
|
|
|
|
_getTableList({needLoading = true}) async {
|
|
|
|
UserModel userModel = Provider.of<UserModel>(context, listen: false);
|
|
|
|
Map<String, String> params = {"sellerid": userModel.user.sellerid};
|
|
|
|
|
|
|
|
String tableSp = App.sp.getString('table_list');
|
|
|
|
|
|
|
|
if (tableSp == null) {
|
|
|
|
//接口请求桌位
|
|
|
|
tableOuterList = await _chooseTableModel.getTableList(context, params,
|
|
|
|
needLoading: needLoading);
|
|
|
|
} else {
|
|
|
|
tableOuterList = getSpTableList();
|
|
|
|
}
|
|
|
|
|
|
|
|
_chooseTableModel.tablesAll = [];
|
|
|
|
|
|
|
|
for (TableOuter item in tableOuterList) {
|
|
|
|
// if (item.name == "推荐") {
|
|
|
|
// itemModelList.remove(item);
|
|
|
|
// }
|
|
|
|
for (var item1 in item.list) {
|
|
|
|
item1.selected = false;
|
|
|
|
}
|
|
|
|
_chooseTableModel.tablesAll.addAll(item.list);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (tableOuterList.isEmpty) {
|
|
|
|
// _chooseTableModel.pageState = PageState.Success;
|
|
|
|
// _chooseTableModel.notifyListeners();
|
|
|
|
} else {
|
|
|
|
_getReserveList(needLoading: needLoading);
|
|
|
|
}
|
|
|
|
// if (_chooseTableModel.pageState == PageState.Success) {
|
|
|
|
|
|
|
|
// }
|
|
|
|
}
|
|
|
|
|
|
|
|
//获取已预订列表
|
|
|
|
_getReserveList({needLoading = true}) async {
|
|
|
|
Map<String, String> params = {
|
|
|
|
"sid": Provider.of<UserModel>(context, listen: false).user.sellerid,
|
|
|
|
"rdate": _getRdateGetNotebook(),
|
|
|
|
// "ddate_solt": widget.ddate_slot,
|
|
|
|
"y": "200",
|
|
|
|
"x": "1",
|
|
|
|
"keywords": "",
|
|
|
|
"sort": "1"
|
|
|
|
};
|
|
|
|
|
|
|
|
params['source'] = '1';
|
|
|
|
|
|
|
|
bool success =
|
|
|
|
await _getReserveListAndFeastData(context, params, needLoading);
|
|
|
|
if (success) {
|
|
|
|
List<FeastBoardModel> banquetByDateDataTemp = []; //转换为桌子id为key,data为value
|
|
|
|
_chooseTableModel.banquetByDateData.forEach((element) {
|
|
|
|
_chooseTableModel.tablesAll.forEach((table) {
|
|
|
|
if (table.name == element.title) {
|
|
|
|
FeastBoardModel feastBoardModel = FeastBoardModel();
|
|
|
|
feastBoardModel.title = table.id;
|
|
|
|
feastBoardModel.data = element.data;
|
|
|
|
banquetByDateDataTemp.add(feastBoardModel);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
Map<String, List<FeastBoardSunModel>> banquetData = {};
|
|
|
|
banquetByDateDataTemp.forEach((element) {
|
|
|
|
List<FeastBoardSunModel> data = [];
|
|
|
|
if (element.data['其他'].length > 0) {
|
|
|
|
FeastBoardSunModel feastBoardSunModel = element.data['其他'][0];
|
|
|
|
if (feastBoardSunModel.lost == null ||
|
|
|
|
feastBoardSunModel.lost == '') {
|
|
|
|
data.add(feastBoardSunModel); //未丢单宴会合集
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (element.data['早餐'].length > 0) {
|
|
|
|
FeastBoardSunModel feastBoardSunModel = element.data['早餐'][0];
|
|
|
|
if (feastBoardSunModel.lost == null ||
|
|
|
|
feastBoardSunModel.lost == '') {
|
|
|
|
data.add(feastBoardSunModel); //未丢单宴会合集
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (element.data['午餐'].length > 0) {
|
|
|
|
FeastBoardSunModel feastBoardSunModel = element.data['午餐'][0];
|
|
|
|
if (feastBoardSunModel.lost == null ||
|
|
|
|
feastBoardSunModel.lost == '') {
|
|
|
|
data.add(feastBoardSunModel); //未丢单宴会合集
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (element.data['晚餐'].length > 0) {
|
|
|
|
FeastBoardSunModel feastBoardSunModel = element.data['晚餐'][0];
|
|
|
|
if (feastBoardSunModel.lost == null ||
|
|
|
|
feastBoardSunModel.lost == '') {
|
|
|
|
data.add(feastBoardSunModel); //未丢单宴会合集
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (!banquetData.containsKey(element.title)) {
|
|
|
|
banquetData[element.title] = data;
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
// List<String> tidsWidget = xuantaiData[xuantaiSelIndex]
|
|
|
|
// .tableList
|
|
|
|
// .map((element) => element.id)
|
|
|
|
// .toList();
|
|
|
|
// print(tidsWidget);
|
|
|
|
banquetData.forEach((key, value) {
|
|
|
|
value.forEach((element) {
|
|
|
|
//未丢单的宴会
|
|
|
|
|
|
|
|
// if (!tidsWidget.contains(key)) {
|
|
|
|
//带过来的桌子,不能标记已预订,或者已经有宴会
|
|
|
|
Notebook notebook = Notebook();
|
|
|
|
notebook.tid = key;
|
|
|
|
notebook.status = '10'; //宴会类型
|
|
|
|
notebook.className = element.className;
|
|
|
|
notebook.id = element.rid;
|
|
|
|
notebook.rname = element.rname;
|
|
|
|
notebook.nick_name = element.nickName ?? element.account;
|
|
|
|
noteBooks.add(notebook);
|
|
|
|
// }
|
|
|
|
|
|
|
|
print(noteBooks);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
for (Notebook notebook in noteBooks) {
|
|
|
|
if (notebook.tid.isEmpty) continue;
|
|
|
|
if (notebook.status == "1" ||
|
|
|
|
notebook.status == "2" ||
|
|
|
|
notebook.status == "5" ||
|
|
|
|
notebook.status == "10") {
|
|
|
|
//已预订,用餐中,已安排
|
|
|
|
List<String> tids = notebook.tid.split(",");
|
|
|
|
for (String tid in tids) {
|
|
|
|
tableMap["$tid"] = notebook;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// List<Notebook> noteBooks =
|
|
|
|
// await newGetReserveList(context, params, showLoading: showloading);
|
|
|
|
List<t.TableList> tempSelectTables = [];
|
|
|
|
tempSelectTables.addAll(xuantaiData[xuantaiSelIndex].tableList);
|
|
|
|
String msg = '';
|
|
|
|
for (Notebook notebook in noteBooks) {
|
|
|
|
if (notebook.tid.isEmpty) continue;
|
|
|
|
|
|
|
|
//已预订,用餐中,已安排
|
|
|
|
List<String> tids = notebook.tid.split(",");
|
|
|
|
for (String tid in tids) {
|
|
|
|
if (notebook.status == "1" ||
|
|
|
|
notebook.status == "2" ||
|
|
|
|
notebook.status == "5" ||
|
|
|
|
notebook.status == "10") {
|
|
|
|
tableMap["$tid"] = notebook;
|
|
|
|
|
|
|
|
///预订按钮点击的时候提醒已经被预订的桌子
|
|
|
|
///
|
|
|
|
if (xuantaiData[xuantaiSelIndex].tableList.length > 0) {
|
|
|
|
for (t.TableList item in xuantaiData[xuantaiSelIndex].tableList) {
|
|
|
|
// if (item.isMerge == '1') {
|
|
|
|
// // (tids.contains(item.tids))
|
|
|
|
// List<String> mergetids = item.tids.split(',');
|
|
|
|
// outerloop:
|
|
|
|
// for (int i = 0; i < mergetids.length; i++) {
|
|
|
|
// String mergetid = mergetids[i];
|
|
|
|
// if (tids.contains(mergetid)) {
|
|
|
|
// msg += '${item.name},';
|
|
|
|
// tempSelectTables.remove(item);
|
|
|
|
// break outerloop;
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
if (item.id == tid) {
|
|
|
|
msg += '${item.name},';
|
|
|
|
tempSelectTables.remove(item);
|
|
|
|
xuantaiData[xuantaiSelIndex]
|
|
|
|
.tids
|
|
|
|
.removeWhere((element) => element.tid == tid);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// if (xuantaiData[xuantaiSelIndex].tableList.length > 0 &&
|
|
|
|
// notebook.status == "1" ||
|
|
|
|
// notebook.status == "2" ||
|
|
|
|
// notebook.status == "5" ||
|
|
|
|
// notebook.status == "10") {
|
|
|
|
// outerloop:
|
|
|
|
// for (t.TableList item in xuantaiData[xuantaiSelIndex].tableList) {
|
|
|
|
// if (item.isMerge == '1') {
|
|
|
|
// // (tids.contains(item.tids))
|
|
|
|
// List<String> mergetids = item.tids.split(',');
|
|
|
|
|
|
|
|
// for (int i = 0; i < mergetids.length; i++) {
|
|
|
|
// String mergetid = mergetids[i];
|
|
|
|
// if (tids.contains(mergetid)) {
|
|
|
|
// msg += '${item.name},';
|
|
|
|
// tempSelectTables.remove(item);
|
|
|
|
// break outerloop;
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
}
|
|
|
|
if (msg != '' && xuantaiData[xuantaiSelIndex].tableList.length > 0) {
|
|
|
|
if (msg.endsWith(',')) {
|
|
|
|
msg = msg.substring(0, msg.length - 1);
|
|
|
|
}
|
|
|
|
xuantaiData[xuantaiSelIndex].tableList = tempSelectTables;
|
|
|
|
Utils.showToast('${msg}已被预订,请选择其他桌位!');
|
|
|
|
print(tableMap);
|
|
|
|
|
|
|
|
xuantaiData[xuantaiSelIndex].tableSum = 0;
|
|
|
|
|
|
|
|
xuantaiData[xuantaiSelIndex].tids.forEach((element) {
|
|
|
|
xuantaiData[xuantaiSelIndex].tableSum += int.parse(
|
|
|
|
element.numStr == '' || element.numStr == null
|
|
|
|
? '0'
|
|
|
|
: element.numStr);
|
|
|
|
});
|
|
|
|
|
|
|
|
setState(() {});
|
|
|
|
// initData(needKeep: needKeep);
|
|
|
|
|
|
|
|
// notifyListeners();
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
// print(tableMap);
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
/// 选台保存接口
|
|
|
|
Future<bool> xtSave() async {
|
|
|
|
//判断非空选项,并弹窗提醒用户填写信息
|
|
...
|
...
|
@@ -1245,7 +1606,8 @@ class _FeastCreatePageState extends State<FeastCreatePage> { |
|
|
|
canRequest = false;
|
|
|
|
break outerloop;
|
|
|
|
}
|
|
|
|
if (element.cdShow == '不带餐' && element.qsDateShow == '暂未选择') {
|
|
|
|
// if (element.cdShow == '不带餐' && element.qsDateShow == '暂未选择') {
|
|
|
|
if (element.qsDateShow == '暂未选择') {
|
|
|
|
Utils.showToast('请选择${reserveOrder}起始时间');
|
|
|
|
canRequest = false;
|
|
|
|
break outerloop;
|
|
...
|
...
|
@@ -1658,13 +2020,19 @@ class _FeastCreatePageState extends State<FeastCreatePage> { |
|
|
|
.then((day) async {
|
|
|
|
if (day != null) {
|
|
|
|
setState(() {
|
|
|
|
xuantaiData[xuantaiSelIndex].tids = [];
|
|
|
|
xuantaiData[xuantaiSelIndex].tableList = [];
|
|
|
|
xuantaiData[xuantaiSelIndex].tableSum = 0;
|
|
|
|
// xuantaiData[xuantaiSelIndex].tids = [];
|
|
|
|
// xuantaiData[xuantaiSelIndex].tableList = [];
|
|
|
|
// xuantaiData[xuantaiSelIndex].tableSum = 0;
|
|
|
|
xuantaiData[xuantaiSelIndex].dateTimext = day;
|
|
|
|
xuantaiData[xuantaiSelIndex].dateTimeShowxt =
|
|
|
|
createDateText(context, day);
|
|
|
|
});
|
|
|
|
if (xuantaiData[xuantaiSelIndex].startDate != '' &&
|
|
|
|
xuantaiData[xuantaiSelIndex].endDate != '' &&
|
|
|
|
xuantaiData[xuantaiSelIndex].tableList !=
|
|
|
|
null) {
|
|
|
|
_getTableList();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}),
|
|
...
|
...
|
@@ -1677,9 +2045,9 @@ class _FeastCreatePageState extends State<FeastCreatePage> { |
|
|
|
return item.title;
|
|
|
|
}).toList(), (value) {
|
|
|
|
if (value != null) {
|
|
|
|
xuantaiData[xuantaiSelIndex].tids = [];
|
|
|
|
xuantaiData[xuantaiSelIndex].tableList = [];
|
|
|
|
xuantaiData[xuantaiSelIndex].tableSum = 0;
|
|
|
|
// xuantaiData[xuantaiSelIndex].tids = [];
|
|
|
|
// xuantaiData[xuantaiSelIndex].tableList = [];
|
|
|
|
// xuantaiData[xuantaiSelIndex].tableSum = 0;
|
|
|
|
setState(() {
|
|
|
|
xuantaiData[xuantaiSelIndex].cdSelIndex =
|
|
|
|
value.first;
|
|
...
|
...
|
@@ -1703,16 +2071,22 @@ class _FeastCreatePageState extends State<FeastCreatePage> { |
|
|
|
}),
|
|
|
|
_selectWidget(
|
|
|
|
'起始时间', xuantaiData[xuantaiSelIndex].qsDateShow,
|
|
|
|
need: xuantaiData[xuantaiSelIndex].cdShow == '不带餐'
|
|
|
|
? true
|
|
|
|
: false, onTap: () {
|
|
|
|
// need: xuantaiData[xuantaiSelIndex].cdShow == '不带餐'
|
|
|
|
// ? true
|
|
|
|
// : false,
|
|
|
|
need: true, onTap: () {
|
|
|
|
FocusScope.of(context).requestFocus(FocusNode()); //隐藏键盘
|
|
|
|
|
|
|
|
SetTimeWidget.init.showFeastTimeSelector(
|
|
|
|
context,
|
|
|
|
SetTimeWidget.init.getFeastDateData('00:00-23:30'),
|
|
|
|
xuantaiData[xuantaiSelIndex].startDate,
|
|
|
|
xuantaiData[xuantaiSelIndex].endDate, (value) {
|
|
|
|
xuantaiData[xuantaiSelIndex].startDate == ''
|
|
|
|
? '8:00'
|
|
|
|
: xuantaiData[xuantaiSelIndex].startDate,
|
|
|
|
xuantaiData[xuantaiSelIndex].endDate == ''
|
|
|
|
? '8:00'
|
|
|
|
: xuantaiData[xuantaiSelIndex].endDate,
|
|
|
|
(value) {
|
|
|
|
if (value != null) {
|
|
|
|
xuantaiData[xuantaiSelIndex].startDate =
|
|
|
|
SetTimeWidget.init.getSelectTitle(value[0]);
|
|
...
|
...
|
@@ -1723,6 +2097,14 @@ class _FeastCreatePageState extends State<FeastCreatePage> { |
|
|
|
'-' +
|
|
|
|
xuantaiData[xuantaiSelIndex].endDate;
|
|
|
|
setState(() {});
|
|
|
|
if (xuantaiData[xuantaiSelIndex].startDate != '' &&
|
|
|
|
xuantaiData[xuantaiSelIndex].endDate != '' &&
|
|
|
|
xuantaiData[xuantaiSelIndex].dateTimeShowxt !=
|
|
|
|
'请选择' &&
|
|
|
|
xuantaiData[xuantaiSelIndex].tableList !=
|
|
|
|
null) {
|
|
|
|
_getTableList();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
// DialogUtil.showSelectCusmanDialog(
|
|
...
|
...
|
@@ -1855,19 +2237,28 @@ class _FeastCreatePageState extends State<FeastCreatePage> { |
|
|
|
),
|
|
|
|
onChanged: (value) {
|
|
|
|
print('ggg');
|
|
|
|
print(value);
|
|
|
|
|
|
|
|
xuantaiData[xuantaiSelIndex]
|
|
|
|
.tableSum = 0;
|
|
|
|
for (Tids item
|
|
|
|
in xuantaiData[
|
|
|
|
xuantaiSelIndex]
|
|
|
|
.tids) {
|
|
|
|
item.numStr =
|
|
|
|
item.tableNumC.text;
|
|
|
|
xuantaiData[xuantaiSelIndex]
|
|
|
|
.tableSum +=
|
|
|
|
int.parse(item
|
|
|
|
.tableNumC.text);
|
|
|
|
.tableNumC
|
|
|
|
.text ==
|
|
|
|
''
|
|
|
|
? '0'
|
|
|
|
: item.tableNumC
|
|
|
|
.text);
|
|
|
|
|
|
|
|
setState(() {});
|
|
|
|
}
|
|
|
|
|
|
|
|
setState(() {});
|
|
|
|
},
|
|
|
|
onEditingComplete: () {
|
|
|
|
// print('fff');
|
|
...
|
...
|
@@ -1906,23 +2297,42 @@ class _FeastCreatePageState extends State<FeastCreatePage> { |
|
|
|
.color_E6000000,
|
|
|
|
rTitle: "删除",
|
|
|
|
rCallback: () {
|
|
|
|
if (xuantaiData[
|
|
|
|
xuantaiSelIndex]
|
|
|
|
.tableSum >
|
|
|
|
0) {
|
|
|
|
if (xuantaiData[xuantaiSelIndex]
|
|
|
|
.tableSum >
|
|
|
|
0 &&
|
|
|
|
xuantaiData[xuantaiSelIndex]
|
|
|
|
.tids[index]
|
|
|
|
.tableNumC
|
|
|
|
.text !=
|
|
|
|
'') {
|
|
|
|
xuantaiData[xuantaiSelIndex]
|
|
|
|
.tableSum -=
|
|
|
|
int.parse(xuantaiData[
|
|
|
|
xuantaiSelIndex]
|
|
|
|
.tids[index]
|
|
|
|
.tableNumC
|
|
|
|
.text);
|
|
|
|
xuantaiSelIndex]
|
|
|
|
.tids[index]
|
|
|
|
.tableNumC
|
|
|
|
.text ==
|
|
|
|
''
|
|
|
|
? '0'
|
|
|
|
: xuantaiData[
|
|
|
|
xuantaiSelIndex]
|
|
|
|
.tids[index]
|
|
|
|
.tableNumC
|
|
|
|
.text);
|
|
|
|
}
|
|
|
|
|
|
|
|
xuantaiData[xuantaiSelIndex]
|
|
|
|
.tableList
|
|
|
|
.removeWhere((element) =>
|
|
|
|
element.id ==
|
|
|
|
xuantaiData[
|
|
|
|
xuantaiSelIndex]
|
|
|
|
.tids[index]
|
|
|
|
.tid);
|
|
|
|
xuantaiData[xuantaiSelIndex]
|
|
|
|
.tids
|
|
|
|
.removeAt(index);
|
|
|
|
print('eeeeeee');
|
|
|
|
|
|
|
|
setState(() {});
|
|
|
|
// _delGuestInfocDay(model.cday[index].id);
|
|
|
|
});
|
|
...
|
...
|
@@ -1950,121 +2360,172 @@ class _FeastCreatePageState extends State<FeastCreatePage> { |
|
|
|
onPressed: () async {
|
|
|
|
FocusScope.of(context)
|
|
|
|
.requestFocus(FocusNode()); //点击空白处隐藏键盘
|
|
|
|
if (xuantaiData[xuantaiSelIndex]
|
|
|
|
.dateTimeShowxt ==
|
|
|
|
'请选择') {
|
|
|
|
Utils.showToast('请选择宴会日期');
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (xuantaiData[xuantaiSelIndex].cdShow ==
|
|
|
|
'请选择') {
|
|
|
|
Utils.showToast('请选择餐段');
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (xuantaiData[xuantaiSelIndex].qsDateShow ==
|
|
|
|
'暂未选择') {
|
|
|
|
Utils.showToast('请选择起始时间');
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (xuantaiData[xuantaiSelIndex].cdShow ==
|
|
|
|
'不带餐') {
|
|
|
|
Map temp = {};
|
|
|
|
if (xuantaiData[xuantaiSelIndex]
|
|
|
|
.tableList !=
|
|
|
|
null &&
|
|
|
|
xuantaiData[xuantaiSelIndex]
|
|
|
|
.tableList
|
|
|
|
.length >
|
|
|
|
0) {
|
|
|
|
temp = await NavigatorUtil
|
|
|
|
.goFeastSelectTablePage(context,
|
|
|
|
object: {
|
|
|
|
'object':
|
|
|
|
xuantaiData[xuantaiSelIndex]
|
|
|
|
.tableList
|
|
|
|
});
|
|
|
|
} else {
|
|
|
|
temp = await NavigatorUtil
|
|
|
|
.goFeastSelectTablePage(
|
|
|
|
context,
|
|
|
|
);
|
|
|
|
}
|
|
|
|
// if (xuantaiData[xuantaiSelIndex].cdShow ==
|
|
|
|
// '不带餐') {
|
|
|
|
// Map temp = {};
|
|
|
|
// if (xuantaiData[xuantaiSelIndex]
|
|
|
|
// .tableList !=
|
|
|
|
// null &&
|
|
|
|
// xuantaiData[xuantaiSelIndex]
|
|
|
|
// .tableList
|
|
|
|
// .length >
|
|
|
|
// 0) {
|
|
|
|
// temp = await NavigatorUtil
|
|
|
|
// .goFeastSelectTablePage(context,
|
|
|
|
// object: {
|
|
|
|
// 'object':
|
|
|
|
// xuantaiData[xuantaiSelIndex]
|
|
|
|
// .tableList
|
|
|
|
// });
|
|
|
|
// } else {
|
|
|
|
// temp = await NavigatorUtil
|
|
|
|
// .goFeastSelectTablePage(
|
|
|
|
// context,
|
|
|
|
// );
|
|
|
|
// }
|
|
|
|
|
|
|
|
// if (temp == null) {
|
|
|
|
// } else if (temp['object'].length == 0) {
|
|
|
|
// } else {
|
|
|
|
// xuantaiData[xuantaiSelIndex].tids = [];
|
|
|
|
// xuantaiData[xuantaiSelIndex].tableList =
|
|
|
|
// temp['object'];
|
|
|
|
|
|
|
|
// for (t.TableList item
|
|
|
|
// in xuantaiData[xuantaiSelIndex]
|
|
|
|
// .tableList) {
|
|
|
|
// item.selected = true;
|
|
|
|
// Tids tids = Tids();
|
|
|
|
// tids.tid = item.id;
|
|
|
|
// tids.name = item.name ?? "";
|
|
|
|
// xuantaiData[xuantaiSelIndex]
|
|
|
|
// .tids
|
|
|
|
// .add(tids);
|
|
|
|
// }
|
|
|
|
// setState(() {});
|
|
|
|
// }
|
|
|
|
// } else {
|
|
|
|
// if (xuantaiData[xuantaiSelIndex]
|
|
|
|
// .dateTimeShowxt ==
|
|
|
|
// '请选择') {
|
|
|
|
// Utils.showToast('请选择宴会日期');
|
|
|
|
// return;
|
|
|
|
// }
|
|
|
|
//带餐
|
|
|
|
int ddate = xuantaiData[xuantaiSelIndex]
|
|
|
|
.dateTimext
|
|
|
|
.millisecondsSinceEpoch;
|
|
|
|
String ddateSolt = dsoltList[
|
|
|
|
xuantaiData[xuantaiSelIndex]
|
|
|
|
.cdSelIndex]
|
|
|
|
.id;
|
|
|
|
|
|
|
|
if (temp == null) {
|
|
|
|
} else if (temp['object'].length == 0) {
|
|
|
|
} else {
|
|
|
|
xuantaiData[xuantaiSelIndex].tids = [];
|
|
|
|
xuantaiData[xuantaiSelIndex].tableList =
|
|
|
|
temp['object'];
|
|
|
|
|
|
|
|
for (t.TableList item
|
|
|
|
in xuantaiData[xuantaiSelIndex]
|
|
|
|
.tableList) {
|
|
|
|
item.selected = true;
|
|
|
|
Tids tids = Tids();
|
|
|
|
tids.tid = item.id;
|
|
|
|
tids.name = item.name ?? "";
|
|
|
|
xuantaiData[xuantaiSelIndex]
|
|
|
|
.tids
|
|
|
|
.add(tids);
|
|
|
|
}
|
|
|
|
setState(() {});
|
|
|
|
}
|
|
|
|
Map temp = {};
|
|
|
|
if (xuantaiData[xuantaiSelIndex].tableList !=
|
|
|
|
null &&
|
|
|
|
xuantaiData[xuantaiSelIndex]
|
|
|
|
.tableList
|
|
|
|
.length >
|
|
|
|
0) {
|
|
|
|
temp =
|
|
|
|
await NavigatorUtil.goSelectTableFPage(
|
|
|
|
context, '', ddate, ddateSolt,
|
|
|
|
canChoose: true,
|
|
|
|
hmS: xuantaiData[xuantaiSelIndex]
|
|
|
|
.startDate,
|
|
|
|
hmE: xuantaiData[xuantaiSelIndex]
|
|
|
|
.endDate,
|
|
|
|
source: '1',
|
|
|
|
ridFeast:
|
|
|
|
xuantaiData[xuantaiSelIndex]
|
|
|
|
.rid,
|
|
|
|
object: {
|
|
|
|
'object': xuantaiData[xuantaiSelIndex]
|
|
|
|
.tableList
|
|
|
|
});
|
|
|
|
} else {
|
|
|
|
if (xuantaiData[xuantaiSelIndex]
|
|
|
|
.dateTimeShowxt ==
|
|
|
|
'请选择') {
|
|
|
|
Utils.showToast('请选择宴会日期');
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
//带餐
|
|
|
|
int ddate = xuantaiData[xuantaiSelIndex]
|
|
|
|
.dateTimext
|
|
|
|
.millisecondsSinceEpoch;
|
|
|
|
String ddateSolt = dsoltList[
|
|
|
|
xuantaiData[xuantaiSelIndex]
|
|
|
|
.cdSelIndex]
|
|
|
|
.id;
|
|
|
|
temp =
|
|
|
|
await NavigatorUtil.goSelectTableFPage(
|
|
|
|
context,
|
|
|
|
'',
|
|
|
|
ddate,
|
|
|
|
ddateSolt,
|
|
|
|
hmS: xuantaiData[xuantaiSelIndex]
|
|
|
|
.startDate,
|
|
|
|
hmE: xuantaiData[xuantaiSelIndex].endDate,
|
|
|
|
source: '1',
|
|
|
|
ridFeast:
|
|
|
|
xuantaiData[xuantaiSelIndex].rid,
|
|
|
|
canChoose: true,
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
Map temp = {};
|
|
|
|
if (xuantaiData[xuantaiSelIndex]
|
|
|
|
.tableList !=
|
|
|
|
null &&
|
|
|
|
xuantaiData[xuantaiSelIndex]
|
|
|
|
.tableList
|
|
|
|
.length >
|
|
|
|
0) {
|
|
|
|
temp = await NavigatorUtil
|
|
|
|
.goSelectTableFPage(
|
|
|
|
context, '', ddate, ddateSolt,
|
|
|
|
canChoose: true,
|
|
|
|
object: {
|
|
|
|
'object':
|
|
|
|
xuantaiData[xuantaiSelIndex]
|
|
|
|
.tableList
|
|
|
|
});
|
|
|
|
} else {
|
|
|
|
temp = await NavigatorUtil
|
|
|
|
.goSelectTableFPage(
|
|
|
|
context,
|
|
|
|
'',
|
|
|
|
ddate,
|
|
|
|
ddateSolt,
|
|
|
|
canChoose: true,
|
|
|
|
);
|
|
|
|
}
|
|
|
|
if (temp == null) {
|
|
|
|
} else if (temp['object'].length == 0) {
|
|
|
|
print('----------');
|
|
|
|
xuantaiData[xuantaiSelIndex].tableList = [];
|
|
|
|
xuantaiData[xuantaiSelIndex].tids = [];
|
|
|
|
xuantaiData[xuantaiSelIndex].tableSum = 0;
|
|
|
|
|
|
|
|
if (temp == null) {
|
|
|
|
} else if (temp['object'].length == 0) {
|
|
|
|
} else {
|
|
|
|
xuantaiData[xuantaiSelIndex].tids = [];
|
|
|
|
xuantaiData[xuantaiSelIndex].tableList =
|
|
|
|
temp['object'];
|
|
|
|
|
|
|
|
for (t.TableList item
|
|
|
|
in xuantaiData[xuantaiSelIndex]
|
|
|
|
.tableList) {
|
|
|
|
item.selected = true;
|
|
|
|
Tids tids = Tids();
|
|
|
|
tids.tid = item.id;
|
|
|
|
tids.name = item.name ?? "";
|
|
|
|
xuantaiData[xuantaiSelIndex]
|
|
|
|
.tids
|
|
|
|
.add(tids);
|
|
|
|
setState(() {});
|
|
|
|
} else {
|
|
|
|
// xuantaiData[xuantaiSelIndex].tids = [];
|
|
|
|
xuantaiData[xuantaiSelIndex].tableList =
|
|
|
|
temp['object'];
|
|
|
|
xuantaiData[xuantaiSelIndex].tableSum = 0;
|
|
|
|
List<Tids> tidsTemp = [];
|
|
|
|
for (t.TableList item
|
|
|
|
in xuantaiData[xuantaiSelIndex]
|
|
|
|
.tableList) {
|
|
|
|
item.selected = true;
|
|
|
|
|
|
|
|
Tids tids = Tids();
|
|
|
|
tids.tid = item.id;
|
|
|
|
tids.name = item.name ?? "";
|
|
|
|
List<Tids> temp =
|
|
|
|
xuantaiData[xuantaiSelIndex]
|
|
|
|
.tids
|
|
|
|
.where((element) =>
|
|
|
|
element.tid == tids.tid)
|
|
|
|
.toList();
|
|
|
|
if (temp != null && temp.length > 0) {
|
|
|
|
tids.numStr = temp[0].tableNumC.text;
|
|
|
|
tids.tableNumC.text = temp[0].numStr;
|
|
|
|
}
|
|
|
|
setState(() {});
|
|
|
|
tidsTemp.add(tids);
|
|
|
|
}
|
|
|
|
xuantaiData[xuantaiSelIndex].tids =
|
|
|
|
tidsTemp;
|
|
|
|
xuantaiData[xuantaiSelIndex]
|
|
|
|
.tids
|
|
|
|
.forEach((element) {
|
|
|
|
xuantaiData[xuantaiSelIndex].tableSum +=
|
|
|
|
int.parse(element.numStr == '' ||
|
|
|
|
element.numStr == null
|
|
|
|
? '0'
|
|
|
|
: element.numStr);
|
|
|
|
});
|
|
|
|
|
|
|
|
setState(() {});
|
|
|
|
}
|
|
|
|
// }
|
|
|
|
},
|
|
|
|
),
|
|
|
|
VEmptyView(52),
|
|
...
|
...
|
@@ -3224,7 +3685,10 @@ class _FeastCreatePageState extends State<FeastCreatePage> { |
|
|
|
total = sum + double.parse(costInfoModel.serviceC.text);
|
|
|
|
} else {
|
|
|
|
//选中百分比
|
|
|
|
if (int.parse(costInfoModel.serviceC.text) > 100) {
|
|
|
|
if (int.parse(costInfoModel.serviceC.text == ''
|
|
|
|
? '0'
|
|
|
|
: costInfoModel.serviceC.text) >
|
|
|
|
100) {
|
|
|
|
Utils.showToast('请输入小于100的数字');
|
|
|
|
|
|
|
|
return;
|
|
...
|
...
|
@@ -3251,7 +3715,10 @@ class _FeastCreatePageState extends State<FeastCreatePage> { |
|
|
|
total -= double.parse(costInfoModel.discountC.text);
|
|
|
|
} else {
|
|
|
|
//选中百分比
|
|
|
|
if (int.parse(costInfoModel.discountC.text) > 100) {
|
|
|
|
if (int.parse(costInfoModel.discountC.text == ''
|
|
|
|
? '0'
|
|
|
|
: costInfoModel.discountC.text) >
|
|
|
|
100) {
|
|
|
|
Utils.showToast('请输入小于100的数字');
|
|
|
|
|
|
|
|
return;
|
|
...
|
...
|
@@ -4646,6 +5113,8 @@ class _FeastCreatePageState extends State<FeastCreatePage> { |
|
|
|
userModel = Provider.of<UserModel>(context, listen: false);
|
|
|
|
_uploadImageProvider =
|
|
|
|
Provider.of<UploadImageProvider>(context, listen: true);
|
|
|
|
|
|
|
|
_chooseTableModel = Provider.of<ChooseTableModel>(context, listen: false);
|
|
|
|
return KeyboardDismissOnTap(
|
|
|
|
child: Scaffold(
|
|
|
|
backgroundColor: MyColours.color_ffffff,
|
...
|
...
|
|