Commit 7bcbc529b2f44d3678e59f6c0650ecc52a1e5a3a

Authored by wdn127929
1 parent 82eff5ab

宴会套餐部分修改+菜品管理分类修改

... ... @@ -81,6 +81,7 @@ class CookById {
String spec;
String isTrim;
String status;
String numStr;
CookById(
{this.id,
... ... @@ -90,7 +91,8 @@ class CookById {
this.cname,
this.spec,
this.isTrim,
this.status});
this.status,
this.numStr});
CookById.fromJson(Map<String, dynamic> json) {
id = json['id'];
... ... @@ -101,6 +103,7 @@ class CookById {
spec = json['spec'];
isTrim = json['is_trim'];
status = json['status'];
numStr = json['num'];
}
Map<String, dynamic> toJson() {
... ... @@ -113,6 +116,8 @@ class CookById {
data['spec'] = this.spec;
data['is_trim'] = this.isTrim;
data['status'] = this.status;
data['num'] = this.numStr;
return data;
}
}
... ...
... ... @@ -27,7 +27,6 @@ class SetMeaByIdModel {
}
}
class SetMeaByIdSunModel {
String id;
String sid;
... ... @@ -132,6 +131,7 @@ class Cook {
String spec;
String isTrim;
String status;
String numStr;
TextEditingController numC = TextEditingController(); //数量
TextEditingController nameC = TextEditingController(); //菜名
... ... @@ -154,6 +154,7 @@ class Cook {
spec = json['spec'];
isTrim = json['is_trim'];
status = json['status'];
numStr = json['num'];
}
Map<String, dynamic> toJson() {
... ... @@ -166,6 +167,7 @@ class Cook {
data['spec'] = this.spec;
data['is_trim'] = this.isTrim;
data['status'] = this.status;
data['num'] = this.numStr;
return data;
}
}
... ...
... ... @@ -334,8 +334,9 @@ class HttpUrl {
static const String set_cookbook_by_id =
"?service=App.Cookbook.SetCookbookById"; //修改菜品
static const String merge_tables =
"?service=App.Tables.MergeTables"; // 合并桌位
static const String merge_tables = "?service=App.Tables.MergeTables"; // 合并桌位
static const String set_cookbook_class_by_id =
"?service=App.Cookbook.SetCookbookClassById"; // 修改菜品分类
}
... ...
... ... @@ -215,7 +215,7 @@ class _FeastMenuPageState extends State<FeastMenuPage> {
Container(
width: h(36),
child: Text(
'${setmeal.spec}',
'${setmeal.numStr ?? ''}${setmeal.spec}',
overflow: TextOverflow.ellipsis,
maxLines: 1,
style: TextStyle(
... ... @@ -247,8 +247,10 @@ class _FeastMenuPageState extends State<FeastMenuPage> {
Expanded(
child:
_textfield('菜名', setmeal.nameC, null)),
// HEmptyView(16),
// _textfield('数量', null, null, width: w(56))
HEmptyView(16),
_textfield('数量', setmeal.numC, null,
inputType: TextInputType.number,
width: w(56))
],
))
],
... ... @@ -366,6 +368,7 @@ class _FeastMenuPageState extends State<FeastMenuPage> {
// 'cname': element.nameC.text
// });
element.cname = element.nameC.text;
element.numStr = element.numC.text;
temp.add(element);
} else {
temp.add(element);
... ...
... ... @@ -226,7 +226,7 @@ class _FeastMenuShowPageState extends State<FeastMenuShowPage> {
Container(
width: h(36),
child: Text(
'${setmeal.spec}',
'${setmeal.numStr ?? ''}${setmeal.spec}',
overflow: TextOverflow.ellipsis,
maxLines: 1,
style: TextStyle(
... ...
... ... @@ -45,7 +45,8 @@ class _FeastDishPageState extends State<FeastDishPage> {
}
///添加宴会套餐菜品分类
_setSetmealCook(String name, String per, String trim, {String cookid}) async {
_setSetmealCook(String name, String per, String trim, String numStr,
{String cookid}) async {
Map<String, String> params = {
"sid": Provider.of<UserModel>(context, listen: false).user.sellerid,
'cname': name,
... ... @@ -53,7 +54,7 @@ class _FeastDishPageState extends State<FeastDishPage> {
'cid': widget.classId,
'spec': per,
'is_trim': trim,
// 'num': numStr
'num': numStr
};
if (cookid != null) {
params['id'] = cookid;
... ... @@ -102,13 +103,13 @@ class _FeastDishPageState extends State<FeastDishPage> {
String per = map['per'];
String name = map['name'];
String can = map['can'];
// String numStr = map['num'];
String numStr = map['num'];
print(can);
_setSetmealCook(name, per, can);
_setSetmealCook(name, per, can, numStr);
});
},
text: '添加一项',
text: '添加菜品',
fontSize: 32,
isBold: false,
height: h(32),
... ... @@ -138,7 +139,7 @@ class _FeastDishPageState extends State<FeastDishPage> {
Container(
width: w(36),
child: Text(
cook.spec,
'${cook.numStr ?? ''}${cook.spec}',
style: TextStyle(
fontSize: font(16), color: MyColours.color_515151),
)),
... ... @@ -160,13 +161,14 @@ class _FeastDishPageState extends State<FeastDishPage> {
DialogUtil.feastDishEditDialog(context,
content: cook.cname,
per: cook.spec,
can: cook.isTrim == '1' ? true : false, onTap: (Map map) {
can: cook.isTrim == '1' ? true : false,
numStr: cook.numStr, onTap: (Map map) {
String per = map['per'];
String name = map['name'];
// String numStr = map['num'];
String numStr = map['num'];
String can = map['can'];
print(can);
_setSetmealCook(name, per, can, cookid: cook.id);
_setSetmealCook(name, per, can, numStr, cookid: cook.id);
});
},
child: Text(
... ...
... ... @@ -34,8 +34,8 @@ class _FeastManageHomePageState extends State<FeastManageHomePage> {
margin: EdgeInsets.only(top: w(12)),
decoration: BoxDecoration(
border: Border(
bottom:
BorderSide(width: w(0.5), color: MyColours.color_E7E7E7))),
bottom: BorderSide(
width: w(0.5), color: MyColours.color_E7E7E7))),
child: Row(
children: [
Text(
... ... @@ -85,7 +85,7 @@ class _FeastManageHomePageState extends State<FeastManageHomePage> {
feastManegeItem('宴会员工', onTap: () {
NavigatorUtil.goFeastPersonalPage(context);
}),
feastManegeItem('套餐管理', onTap: () {
feastManegeItem('宴会套餐管理', onTap: () {
NavigatorUtil.goFeastSetmealManagePage(context);
}),
feastManegeItem('酒水管理', onTap: () {
... ...
... ... @@ -225,7 +225,10 @@ class _FeastSetmealManageEditPageState
child: Row(
children: [
Text(
data.className,
'${data.className} ' +
(data.cook == null || data.cook.length == 0
? ''
: '(${data.cook.length}道)'),
style:
TextStyle(fontSize: font(16), color: MyColours.color_E5000000),
),
... ...
... ... @@ -19,7 +19,7 @@ import '../../../widgets/round_button.dart';
import '../../../widgets/system_app_bar.dart';
/**
* 套餐管理
* 宴会套餐管理
*/
class FeastSetmealManagePage extends StatefulWidget {
... ... @@ -55,8 +55,7 @@ class _FeastSetmealManagePageState extends State<FeastSetmealManagePage> {
await feastModel.getSetmeal(context, isShowLoading: isShowLoading);
}
_setSetmeal(
String mealName, String price, String bargaining) async {
_setSetmeal(String mealName, String price, String bargaining) async {
Map<String, String> params = {
"sid": Provider.of<UserModel>(context, listen: false).user.sellerid,
'meal_name': mealName,
... ... @@ -183,7 +182,7 @@ class _FeastSetmealManagePageState extends State<FeastSetmealManagePage> {
/// 这里必须禁止重绘
appBar: SystemAppBar(
'套餐管理',
'宴会套餐',
needWhite: true,
bgColor: MyColours.color_438E93,
titleColor: MyColours.color_F6F6F6,
... ...
... ... @@ -15,6 +15,12 @@ import 'package:one_key/widgets/page_exception.dart';
import 'package:one_key/widgets/system_app_bar.dart';
import 'package:provider/provider.dart';
/***
*
*
* 分类管理
*/
class MenuCategoryPage extends StatefulWidget {
MenuCategoryPage({Key key}) : super(key: key);
... ... @@ -47,6 +53,23 @@ class _MenuCategoryPageState extends State<MenuCategoryPage> {
}
}
///添加菜品分类
_setCookbookClassById(String name, String id,
{bool showLoading = true}) async {
Map<String, String> params = {
"sellerid": Provider.of<UserModel>(context, listen: false).user.sellerid,
'id': id,
'class_name': name
};
bool sucess = await menuManageProvider.setCookbookClassById(context, params,
showLoading: showLoading);
if (sucess) {
EventBus().emit('menu_manage_page');
_getCookbookBySellerId(showLoading: false);
}
}
///获取分类数据
_getCookbookBySellerId({bool showLoading = true}) async {
Map<String, String> params = {
... ... @@ -73,69 +96,77 @@ class _MenuCategoryPageState extends State<MenuCategoryPage> {
}
///表头
Widget _tableItem(CookbookCategorySunModel model, int index,
TableItemType type, IntCallback callback) {
return InkWell(
onTap: () {
callback(index);
},
child: Container(
padding: EdgeInsets.only(left: ScreenUtil().setWidth(30)),
height: ScreenUtil().setWidth(130),
color: type == TableItemType.TableItemTypeHeader
? Color.fromRGBO(235, 234, 239, 1)
: MyColours.color_fefefe,
child: Row(
children: [
Container(
width: ScreenUtil().setWidth(85 * 2),
height: double.infinity,
child: Row(
children: [
// HEmptyView(20),
Expanded(
child: Text(
type == TableItemType.TableItemTypeHeader
? '序号'
: '${index + 1}',
textAlign: TextAlign.center,
style: TextStyle(
fontSize: ScreenUtil().setSp(28),
color: MyColours.color_333333),
)),
HEmptyView(30),
],
),
),
Expanded(
child: Container(
alignment: Alignment.center,
width: ScreenUtil().setWidth(87 * 2),
height: double.infinity,
Widget _tableItem(
CookbookCategorySunModel model,
int index,
TableItemType type,
IntCallback callback,
IntCallback callbackDel,
) {
return Container(
padding: EdgeInsets.only(left: ScreenUtil().setWidth(30)),
height: ScreenUtil().setWidth(130),
color: type == TableItemType.TableItemTypeHeader
? Color.fromRGBO(235, 234, 239, 1)
: MyColours.color_fefefe,
child: Row(
children: [
Container(
width: ScreenUtil().setWidth(85 * 2),
height: double.infinity,
child: Row(
children: [
// HEmptyView(20),
Expanded(
child: Text(
type == TableItemType.TableItemTypeHeader
? '分类名称'
: model.className,
style: TextStyle(
fontSize: ScreenUtil().setSp(28),
color: MyColours.color_333333),
))),
Container(
alignment: Alignment.center,
width: ScreenUtil().setWidth(116 * 2),
height: double.infinity,
child: Text(
type == TableItemType.TableItemTypeHeader
? '操作'
: model.className == '10道必点菜'
? ''
: '删除',
? '序号'
: '${index + 1}',
textAlign: TextAlign.center,
style: TextStyle(
fontSize: ScreenUtil().setSp(28),
color: MyColours.color_333333),
)),
],
),
HEmptyView(30),
],
),
),
Expanded(
child: InkWell(
onTap: () {
callback(index);
},
child: Container(
alignment: Alignment.center,
width: ScreenUtil().setWidth(87 * 2),
height: double.infinity,
child: Text(
type == TableItemType.TableItemTypeHeader
? '分类名称'
: model.className,
style: TextStyle(
fontSize: ScreenUtil().setSp(28),
color: MyColours.color_333333),
)))),
InkWell(
onTap: () {
callbackDel(index);
},
child: Container(
alignment: Alignment.center,
width: ScreenUtil().setWidth(116 * 2),
height: double.infinity,
child: Text(
type == TableItemType.TableItemTypeHeader
? '操作'
: model.className == '10道必点菜'
? ''
: '删除',
style: TextStyle(
fontSize: ScreenUtil().setSp(28),
color: MyColours.color_333333),
))),
],
),
);
}
... ... @@ -181,21 +212,33 @@ class _MenuCategoryPageState extends State<MenuCategoryPage> {
children: [
//表头
_tableItem(model.categorySunModel[0], 0,
TableItemType.TableItemTypeHeader, (index) {}),
TableItemType.TableItemTypeHeader, (index) {}, (index) {}),
Expanded(
child: ListView.builder(
itemCount: model.categorySunModel.length,
itemBuilder: (BuildContext context, int index) {
CookbookCategorySunModel sunModel =
model.categorySunModel[index];
return Column(children: [
_tableItem(model.categorySunModel[index], index,
_tableItem(sunModel, index,
TableItemType.TableItemTypeBody, (index) {
if (model.categorySunModel[index].className !=
'10道必点菜') {
if (sunModel.className != '10道必点菜') {
DialogUtil.textfeildAlertDialog(context,
title: '修改分类',
text: sunModel.className,
hintText: '输入分类名称',
lenghtLimit: true,
toast: '请输入分类名称', rCallback: (name) {
_setCookbookClassById(name, sunModel.id,
showLoading: true);
});
}
}, (index) {
if (sunModel.className != '10道必点菜') {
DialogUtil.cupertinoAlertDialog(context,
title: '',
content: '删除后,该分类下所有菜品都将删除', rCallback: () {
_delCookbookById(
model.categorySunModel[index].id);
_delCookbookById(sunModel.id);
});
}
}),
... ...
... ... @@ -190,8 +190,7 @@ class MenuManageProvider extends ChangeNotifier {
return false;
}
///修改菜品
///修改菜品
Future<bool> setCookbookById(BuildContext context, Map<String, String> params,
{showLoading = false}) async {
BaseResp<dynamic> baseResp = await DioUtil()
... ... @@ -211,6 +210,28 @@ class MenuManageProvider extends ChangeNotifier {
return false;
}
///修改菜品分类
Future<bool> setCookbookClassById(
BuildContext context, Map<String, String> params,
{showLoading = false}) async {
BaseResp<dynamic> baseResp = await DioUtil()
.request<dynamic>(context, Method.get, HttpUrl.set_cookbook_class_by_id,
data: params, showLoading: showLoading)
.catchError((error) {
print(error.toString());
});
if (baseResp != null && baseResp.code == Constant.status_success) {
if (baseResp.data['data'] != '') {
return true;
}
} else {
Utils.showToast(baseResp.msg ?? "");
}
return false;
}
///添加菜品分类信息
Future<bool> addCookbookClass(
... ...
... ... @@ -718,7 +718,7 @@ class DialogUtil {
child: Container(
padding: EdgeInsets.symmetric(
horizontal: ScreenUtil().setWidth(50)),
height: ScreenUtil().setWidth(421 * 2),
// height: ScreenUtil().setWidth(421 * 2),
decoration: BoxDecoration(
borderRadius:
BorderRadius.circular(ScreenUtil().setWidth(16))),
... ... @@ -788,54 +788,54 @@ class DialogUtil {
))
])),
VEmptyView(32),
// Padding(
// padding: EdgeInsets.symmetric(horizontal: w(16)),
// child: Row(children: [
// Text(
// '菜品数量',
// style: TextStyle(
// fontSize: ScreenUtil().setSp(32),
// color: MyColours.color_000000),
// ),
// HEmptyView(24),
// Expanded(
// child: Container(
// height: ScreenUtil().setWidth(48 * 2),
// decoration: BoxDecoration(
// color: MyColours.color_f3f3f3,
// borderRadius: BorderRadius.circular(
// ScreenUtil().setWidth(8))),
// padding:
// EdgeInsets.symmetric(horizontal: w(12)),
// child: TextField(
// controller: numC,
// maxLines: 1,
// style: TextStyle(
// fontSize: ScreenUtil().setSp(32),
// color: MyColours.color_515151),
// decoration: InputDecoration(
// contentPadding: EdgeInsets.only(
// bottom: ScreenUtil()
// .setWidth(40)), //设置文字内容与边框距离
Padding(
padding: EdgeInsets.symmetric(horizontal: w(16)),
child: Row(children: [
Text(
'菜品数量',
style: TextStyle(
fontSize: ScreenUtil().setSp(32),
color: MyColours.color_000000),
),
HEmptyView(24),
Expanded(
child: Container(
height: ScreenUtil().setWidth(48 * 2),
decoration: BoxDecoration(
color: MyColours.color_f3f3f3,
borderRadius: BorderRadius.circular(
ScreenUtil().setWidth(8))),
padding:
EdgeInsets.symmetric(horizontal: w(12)),
child: TextField(
controller: numC,
maxLines: 1,
style: TextStyle(
fontSize: ScreenUtil().setSp(32),
color: MyColours.color_515151),
decoration: InputDecoration(
contentPadding: EdgeInsets.only(
bottom: ScreenUtil()
.setWidth(40)), //设置文字内容与边框距离
// border: OutlineInputBorder(
// borderSide: BorderSide.none),
// hintText: '请输入',
// hintStyle: TextStyle(
// color: MyColours.color_66000000,
// fontSize: ScreenUtil().setSp(32),
// ),
// ),
// onChanged: (value) {},
// onEditingComplete: () {
// FocusScope.of(context).requestFocus(
// FocusNode()); //点击空白处隐藏键盘
// },
// keyboardType: TextInputType.text,
// ),
// ))
// ])),
// VEmptyView(32),
border: OutlineInputBorder(
borderSide: BorderSide.none),
hintText: '请输入',
hintStyle: TextStyle(
color: MyColours.color_66000000,
fontSize: ScreenUtil().setSp(32),
),
),
onChanged: (value) {},
onEditingComplete: () {
FocusScope.of(context).requestFocus(
FocusNode()); //点击空白处隐藏键盘
},
keyboardType: TextInputType.text,
),
))
])),
VEmptyView(32),
Padding(
padding: EdgeInsets.symmetric(horizontal: w(16)),
child: Row(children: [
... ... @@ -975,11 +975,11 @@ class DialogUtil {
return;
}
// if (numC.text.trim() == '') {
// Utils.showToast('请输入菜品数量!');
if (numC.text.trim() == '') {
Utils.showToast('请输入菜品数量!');
// return;
// }
return;
}
if (perC.text.trim() == '') {
Utils.showToast('请输入${pricetitle}!');
return;
... ...