|
...
|
...
|
@@ -9,6 +9,7 @@ import 'package:flutter_screenutil/flutter_screenutil.dart'; |
|
|
|
import 'package:one_key/models/cookbook_one_model.dart';
|
|
|
|
import 'package:one_key/models/get_banquet_deposit_model.dart';
|
|
|
|
import 'package:one_key/models/sessions_model.dart';
|
|
|
|
import 'package:one_key/models/setmeal_model.dart';
|
|
|
|
import 'package:one_key/route/navigator_util.dart';
|
|
|
|
import 'package:one_key/widgets/MyDivider.dart';
|
|
|
|
import 'package:one_key/widgets/round_button.dart';
|
|
...
|
...
|
@@ -39,6 +40,7 @@ import '../../widgets/system_app_bar.dart'; |
|
|
|
import '../online_check/img_picker_widget_f.dart';
|
|
|
|
import '../table/area_item_table.dart';
|
|
|
|
import 'package:one_key/models/table_list.dart' as t;
|
|
|
|
import 'package:flutter_keyboard_visibility/flutter_keyboard_visibility.dart';
|
|
|
|
|
|
|
|
class FeastCreatePage extends StatefulWidget {
|
|
|
|
final GetBanquetByIdNewSunModel banquetDetail;
|
|
...
|
...
|
@@ -84,7 +86,7 @@ class _FeastCreatePageState extends State<FeastCreatePage> { |
|
|
|
int xuantaiSelIndex = 0;
|
|
|
|
List<DsoltXt> dsoltList = [];
|
|
|
|
UserModel userModel;
|
|
|
|
Map<String, List<CookByIdSetmeal>> dataMenu = {};
|
|
|
|
Map<String, List<Cook>> dataMenu = {};
|
|
|
|
Map<String, String> invoice; //发票
|
|
|
|
String morning;
|
|
|
|
String noon;
|
|
...
|
...
|
@@ -109,6 +111,10 @@ class _FeastCreatePageState extends State<FeastCreatePage> { |
|
|
|
_getData();
|
|
|
|
});
|
|
|
|
bus.on("feast_deposit_list", (arg) {
|
|
|
|
if (widget.banquetDetail != null) {
|
|
|
|
bus.emit('feast_detail_page'); //编辑之后刷新宴会详情页面
|
|
|
|
bus.emit('feast_home_page'); //编辑之后刷新宴会首页
|
|
|
|
}
|
|
|
|
_getBanquetDeposit();
|
|
|
|
});
|
|
|
|
bus.on("feast_qy_list", (arg) {
|
|
...
|
...
|
@@ -297,6 +303,11 @@ class _FeastCreatePageState extends State<FeastCreatePage> { |
|
|
|
feastModel.rid = null;
|
|
|
|
feastModel.type = null;
|
|
|
|
feastModel.reserve = null;
|
|
|
|
//清空图片,选台图片不常驻,不需要清空
|
|
|
|
_uploadImageProvider.feastRemarkImageList = []; //意向
|
|
|
|
_uploadImageProvider.feastRemarkDjImageList = []; //定金
|
|
|
|
_uploadImageProvider.feastRemarkContractImageList = []; //合同
|
|
|
|
_uploadImageProvider.feastRemarkInvoiceImageList = []; //发票
|
|
|
|
}
|
|
|
|
|
|
|
|
initSetXuanTaiModel({int index}) {
|
|
...
|
...
|
@@ -951,6 +962,10 @@ class _FeastCreatePageState extends State<FeastCreatePage> { |
|
|
|
bool success = await feastModel.createBanquet(context, pramas);
|
|
|
|
if (success) {
|
|
|
|
Utils.showToast('保存成功');
|
|
|
|
if (widget.banquetDetail != null) {
|
|
|
|
bus.emit('feast_detail_page'); //编辑之后刷新宴会详情页面
|
|
|
|
bus.emit('feast_home_page'); //编辑之后刷新宴会首页
|
|
|
|
}
|
|
|
|
|
|
|
|
return true;
|
|
|
|
} else {
|
|
...
|
...
|
@@ -1254,27 +1269,79 @@ class _FeastCreatePageState extends State<FeastCreatePage> { |
|
|
|
'spare': mealValue.spare,
|
|
|
|
'name': mealValue.name
|
|
|
|
};
|
|
|
|
List cooklist = []; //菜单数据
|
|
|
|
Map cooklist = {}; //菜单数据
|
|
|
|
if (mealValue.dataMenu != null && mealValue.dataMenu.length > 0) {
|
|
|
|
//修改过菜单的数据
|
|
|
|
|
|
|
|
mealValue.dataMenu.forEach((key, value) {
|
|
|
|
List<Map<String, String>> cooks = []; //菜品分类下面的多个菜品信息
|
|
|
|
value.forEach((element) {
|
|
|
|
Map mapMenu = {'cname': element.cname};
|
|
|
|
cooklist.add(mapMenu);
|
|
|
|
Map<String, String> cook = {
|
|
|
|
'id': element.id,
|
|
|
|
'sid': element.sid,
|
|
|
|
'cid': element.cid,
|
|
|
|
'mid': element.mid,
|
|
|
|
'cname': element.cname,
|
|
|
|
'spec': element.spec,
|
|
|
|
'is_trim': element.isTrim,
|
|
|
|
'status': element.status,
|
|
|
|
};
|
|
|
|
cooks.add(cook);
|
|
|
|
});
|
|
|
|
cooklist[key] = cooks;
|
|
|
|
});
|
|
|
|
|
|
|
|
// Map tempMap = {};
|
|
|
|
// mealValue.dataMenu.forEach((key, value) {
|
|
|
|
// value.forEach((element) {
|
|
|
|
// Map mapMenu = {'cname': element.cname};
|
|
|
|
// cooklist.add(mapMenu);
|
|
|
|
// });
|
|
|
|
// });
|
|
|
|
} else {
|
|
|
|
// 套餐菜单原数据
|
|
|
|
Map<String, List<Cook>> data = {}; //原始菜品数据
|
|
|
|
List<String> classNames = [];
|
|
|
|
feastModel.setmealData.forEach((element) {
|
|
|
|
if (element.id == mealValue.setmealId) {
|
|
|
|
//找到当前套餐map
|
|
|
|
element.cook.forEach((element) {
|
|
|
|
Map mapMenu = {'cname': element.cname};
|
|
|
|
cooklist.add(mapMenu);
|
|
|
|
});
|
|
|
|
// element.cook.forEach((element) {
|
|
|
|
// Map mapMenu = {'cname': element.cname};
|
|
|
|
// cooklist.add(mapMenu);
|
|
|
|
// });
|
|
|
|
for (Classify item in element.classify) {
|
|
|
|
// Map<String, List<CookByIdSetmeal>> map = {};
|
|
|
|
String cid = item.id;
|
|
|
|
String className = item.className;
|
|
|
|
|
|
|
|
List<Cook> temp = [];
|
|
|
|
for (Cook itemCook in element.cook) {
|
|
|
|
if (cid == itemCook.cid) {
|
|
|
|
temp.add(itemCook);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
classNames.add(className);
|
|
|
|
data[className] = temp;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
data.forEach((key, value) {
|
|
|
|
List<Map<String, String>> cooks = []; //菜品分类下面的多个菜品信息
|
|
|
|
value.forEach((element) {
|
|
|
|
Map<String, String> cook = {
|
|
|
|
'id': element.id,
|
|
|
|
'sid': element.sid,
|
|
|
|
'cid': element.cid,
|
|
|
|
'mid': element.mid,
|
|
|
|
'cname': element.cname,
|
|
|
|
'spec': element.spec,
|
|
|
|
'isTrim': element.isTrim,
|
|
|
|
'status': element.status,
|
|
|
|
};
|
|
|
|
cooks.add(cook);
|
|
|
|
});
|
|
|
|
cooklist[key] = cooks;
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
mapMeal['cooklist'] = cooklist; //菜单
|
|
...
|
...
|
@@ -1348,6 +1415,10 @@ class _FeastCreatePageState extends State<FeastCreatePage> { |
|
|
|
});
|
|
|
|
print(xuantaiData);
|
|
|
|
Utils.showToast('保存成功');
|
|
|
|
if (widget.banquetDetail != null) {
|
|
|
|
bus.emit('feast_detail_page'); //编辑之后刷新宴会详情页面
|
|
|
|
bus.emit('feast_home_page'); //编辑之后刷新宴会首页
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
} else {
|
|
|
|
return false;
|
|
...
|
...
|
@@ -2465,7 +2536,7 @@ class _FeastCreatePageState extends State<FeastCreatePage> { |
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
/// 选台保存接口
|
|
|
|
/// 担保人保存接口
|
|
|
|
Future<bool> dbSave() async {
|
|
|
|
if (djDBRIndex == null) {
|
|
|
|
Utils.showToast('请选择担保人');
|
|
...
|
...
|
@@ -2495,6 +2566,10 @@ class _FeastCreatePageState extends State<FeastCreatePage> { |
|
|
|
};
|
|
|
|
bool success = await feastModel.setWarrant(context, pramas);
|
|
|
|
if (success) {
|
|
|
|
if (widget.banquetDetail != null) {
|
|
|
|
bus.emit('feast_detail_page'); //编辑之后刷新宴会详情页面
|
|
|
|
bus.emit('feast_home_page'); //编辑之后刷新宴会首页
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
} else {
|
|
|
|
return false;
|
|
...
|
...
|
@@ -4391,6 +4466,10 @@ class _FeastCreatePageState extends State<FeastCreatePage> { |
|
|
|
if (results[0] && results[1] && results[2]) {
|
|
|
|
//成功
|
|
|
|
Utils.showToast('保存成功');
|
|
|
|
if (widget.banquetDetail != null) {
|
|
|
|
bus.emit('feast_detail_page'); //编辑之后刷新宴会详情页面
|
|
|
|
}
|
|
|
|
bus.emit('feast_home_page'); //编辑之后刷新宴会首页
|
|
|
|
} else {
|
|
|
|
if (!results[0]) {
|
|
|
|
// Utils.showToast('');
|
|
...
|
...
|
@@ -4522,7 +4601,8 @@ class _FeastCreatePageState extends State<FeastCreatePage> { |
|
|
|
userModel = Provider.of<UserModel>(context, listen: false);
|
|
|
|
_uploadImageProvider =
|
|
|
|
Provider.of<UploadImageProvider>(context, listen: true);
|
|
|
|
return Scaffold(
|
|
|
|
return KeyboardDismissOnTap(
|
|
|
|
child: Scaffold(
|
|
|
|
backgroundColor: MyColours.color_ffffff,
|
|
|
|
appBar: SystemAppBar(
|
|
|
|
'新建宴会',
|
|
...
|
...
|
@@ -4539,6 +4619,6 @@ class _FeastCreatePageState extends State<FeastCreatePage> { |
|
|
|
? xtWidget()
|
|
|
|
: selectMenu == '定金'
|
|
|
|
? djWidget()
|
|
|
|
: qyWidget());
|
|
|
|
: qyWidget()));
|
|
|
|
}
|
|
|
|
} |
...
|
...
|
|