|
...
|
...
|
@@ -16,6 +16,7 @@ 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';
|
|
...
|
...
|
@@ -24,6 +25,7 @@ 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';
|
|
...
|
...
|
@@ -108,6 +110,7 @@ class _FeastCreatePageState extends State<FeastCreatePage> { |
|
|
|
ChooseTableModel _chooseTableModel;
|
|
|
|
List<Notebook> noteBooks;
|
|
|
|
Map<String, Notebook> tableMap = {}; //记录已预订桌位对应的订单
|
|
|
|
List<TableOuter> tableOuterList = []; //区域-桌位列表
|
|
|
|
|
|
|
|
@override
|
|
|
|
void initState() {
|
|
...
|
...
|
@@ -262,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; //宴会备注图片信息列表----选台
|
|
...
|
...
|
@@ -1326,6 +1332,60 @@ class _FeastCreatePageState extends State<FeastCreatePage> { |
|
|
|
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 = {
|
|
...
|
...
|
@@ -1354,15 +1414,6 @@ class _FeastCreatePageState extends State<FeastCreatePage> { |
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
// banquetByDateData.map((e) => null)
|
|
|
|
// String banquetKey = '';
|
|
|
|
// if (widget.ddate_slot == '1') {
|
|
|
|
// banquetKey = '早餐';
|
|
|
|
// } else if (widget.ddate_slot == '2') {
|
|
|
|
// banquetKey = '午餐';
|
|
|
|
// } else if (widget.ddate_slot == '3') {
|
|
|
|
// banquetKey = '晚餐';
|
|
|
|
// }
|
|
|
|
|
|
|
|
Map<String, List<FeastBoardSunModel>> banquetData = {};
|
|
|
|
banquetByDateDataTemp.forEach((element) {
|
|
...
|
...
|
@@ -1400,26 +1451,26 @@ class _FeastCreatePageState extends State<FeastCreatePage> { |
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
List<String> tidsWidget = xuantaiData[xuantaiSelIndex]
|
|
|
|
.tableList
|
|
|
|
.map((element) => element.id)
|
|
|
|
.toList();
|
|
|
|
print(tidsWidget);
|
|
|
|
// 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);
|
|
|
|
}
|
|
|
|
// 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);
|
|
|
|
});
|
|
...
|
...
|
@@ -1517,7 +1568,10 @@ class _FeastCreatePageState extends State<FeastCreatePage> { |
|
|
|
xuantaiData[xuantaiSelIndex].tableSum = 0;
|
|
|
|
|
|
|
|
xuantaiData[xuantaiSelIndex].tids.forEach((element) {
|
|
|
|
xuantaiData[xuantaiSelIndex].tableSum += element.numStr;
|
|
|
|
xuantaiData[xuantaiSelIndex].tableSum += int.parse(
|
|
|
|
element.numStr == '' || element.numStr == null
|
|
|
|
? '0'
|
|
|
|
: element.numStr);
|
|
|
|
});
|
|
|
|
|
|
|
|
setState(() {});
|
|
...
|
...
|
@@ -1973,7 +2027,12 @@ class _FeastCreatePageState extends State<FeastCreatePage> { |
|
|
|
xuantaiData[xuantaiSelIndex].dateTimeShowxt =
|
|
|
|
createDateText(context, day);
|
|
|
|
});
|
|
|
|
_getReserveList();
|
|
|
|
if (xuantaiData[xuantaiSelIndex].startDate != '' &&
|
|
|
|
xuantaiData[xuantaiSelIndex].endDate != '' &&
|
|
|
|
xuantaiData[xuantaiSelIndex].tableList !=
|
|
|
|
null) {
|
|
|
|
_getTableList();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}),
|
|
...
|
...
|
@@ -1986,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;
|
|
...
|
...
|
@@ -2038,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(
|
|
...
|
...
|
@@ -2170,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');
|
|
...
|
...
|
@@ -2221,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);
|
|
|
|
});
|
|
...
|
...
|
@@ -2358,6 +2453,9 @@ class _FeastCreatePageState extends State<FeastCreatePage> { |
|
|
|
hmE: xuantaiData[xuantaiSelIndex]
|
|
|
|
.endDate,
|
|
|
|
source: '1',
|
|
|
|
ridFeast:
|
|
|
|
xuantaiData[xuantaiSelIndex]
|
|
|
|
.rid,
|
|
|
|
object: {
|
|
|
|
'object': xuantaiData[xuantaiSelIndex]
|
|
|
|
.tableList
|
|
...
|
...
|
@@ -2373,28 +2471,58 @@ class _FeastCreatePageState extends State<FeastCreatePage> { |
|
|
|
.startDate,
|
|
|
|
hmE: xuantaiData[xuantaiSelIndex].endDate,
|
|
|
|
source: '1',
|
|
|
|
ridFeast:
|
|
|
|
xuantaiData[xuantaiSelIndex].rid,
|
|
|
|
canChoose: true,
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (temp == null) {
|
|
|
|
} else if (temp['object'].length == 0) {
|
|
|
|
} else {
|
|
|
|
print('----------');
|
|
|
|
xuantaiData[xuantaiSelIndex].tableList = [];
|
|
|
|
xuantaiData[xuantaiSelIndex].tids = [];
|
|
|
|
xuantaiData[xuantaiSelIndex].tableSum = 0;
|
|
|
|
|
|
|
|
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 ?? "";
|
|
|
|
xuantaiData[xuantaiSelIndex]
|
|
|
|
.tids
|
|
|
|
.add(tids);
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
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(() {});
|
|
|
|
}
|
|
|
|
// }
|
|
...
|
...
|
@@ -3557,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;
|
|
...
|
...
|
@@ -3584,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;
|
...
|
...
|
|