Showing
12 changed files
with
222 additions
and
143 deletions
| @@ -81,6 +81,7 @@ class CookById { | @@ -81,6 +81,7 @@ class CookById { | ||
| 81 | String spec; | 81 | String spec; |
| 82 | String isTrim; | 82 | String isTrim; |
| 83 | String status; | 83 | String status; |
| 84 | + String numStr; | ||
| 84 | 85 | ||
| 85 | CookById( | 86 | CookById( |
| 86 | {this.id, | 87 | {this.id, |
| @@ -90,7 +91,8 @@ class CookById { | @@ -90,7 +91,8 @@ class CookById { | ||
| 90 | this.cname, | 91 | this.cname, |
| 91 | this.spec, | 92 | this.spec, |
| 92 | this.isTrim, | 93 | this.isTrim, |
| 93 | - this.status}); | 94 | + this.status, |
| 95 | + this.numStr}); | ||
| 94 | 96 | ||
| 95 | CookById.fromJson(Map<String, dynamic> json) { | 97 | CookById.fromJson(Map<String, dynamic> json) { |
| 96 | id = json['id']; | 98 | id = json['id']; |
| @@ -101,6 +103,7 @@ class CookById { | @@ -101,6 +103,7 @@ class CookById { | ||
| 101 | spec = json['spec']; | 103 | spec = json['spec']; |
| 102 | isTrim = json['is_trim']; | 104 | isTrim = json['is_trim']; |
| 103 | status = json['status']; | 105 | status = json['status']; |
| 106 | + numStr = json['num']; | ||
| 104 | } | 107 | } |
| 105 | 108 | ||
| 106 | Map<String, dynamic> toJson() { | 109 | Map<String, dynamic> toJson() { |
| @@ -113,6 +116,8 @@ class CookById { | @@ -113,6 +116,8 @@ class CookById { | ||
| 113 | data['spec'] = this.spec; | 116 | data['spec'] = this.spec; |
| 114 | data['is_trim'] = this.isTrim; | 117 | data['is_trim'] = this.isTrim; |
| 115 | data['status'] = this.status; | 118 | data['status'] = this.status; |
| 119 | + data['num'] = this.numStr; | ||
| 120 | + | ||
| 116 | return data; | 121 | return data; |
| 117 | } | 122 | } |
| 118 | } | 123 | } |
| @@ -27,7 +27,6 @@ class SetMeaByIdModel { | @@ -27,7 +27,6 @@ class SetMeaByIdModel { | ||
| 27 | } | 27 | } |
| 28 | } | 28 | } |
| 29 | 29 | ||
| 30 | - | ||
| 31 | class SetMeaByIdSunModel { | 30 | class SetMeaByIdSunModel { |
| 32 | String id; | 31 | String id; |
| 33 | String sid; | 32 | String sid; |
| @@ -132,6 +131,7 @@ class Cook { | @@ -132,6 +131,7 @@ class Cook { | ||
| 132 | String spec; | 131 | String spec; |
| 133 | String isTrim; | 132 | String isTrim; |
| 134 | String status; | 133 | String status; |
| 134 | + String numStr; | ||
| 135 | TextEditingController numC = TextEditingController(); //数量 | 135 | TextEditingController numC = TextEditingController(); //数量 |
| 136 | TextEditingController nameC = TextEditingController(); //菜名 | 136 | TextEditingController nameC = TextEditingController(); //菜名 |
| 137 | 137 | ||
| @@ -154,6 +154,7 @@ class Cook { | @@ -154,6 +154,7 @@ class Cook { | ||
| 154 | spec = json['spec']; | 154 | spec = json['spec']; |
| 155 | isTrim = json['is_trim']; | 155 | isTrim = json['is_trim']; |
| 156 | status = json['status']; | 156 | status = json['status']; |
| 157 | + numStr = json['num']; | ||
| 157 | } | 158 | } |
| 158 | 159 | ||
| 159 | Map<String, dynamic> toJson() { | 160 | Map<String, dynamic> toJson() { |
| @@ -166,6 +167,7 @@ class Cook { | @@ -166,6 +167,7 @@ class Cook { | ||
| 166 | data['spec'] = this.spec; | 167 | data['spec'] = this.spec; |
| 167 | data['is_trim'] = this.isTrim; | 168 | data['is_trim'] = this.isTrim; |
| 168 | data['status'] = this.status; | 169 | data['status'] = this.status; |
| 170 | + data['num'] = this.numStr; | ||
| 169 | return data; | 171 | return data; |
| 170 | } | 172 | } |
| 171 | } | 173 | } |
| @@ -334,8 +334,9 @@ class HttpUrl { | @@ -334,8 +334,9 @@ class HttpUrl { | ||
| 334 | static const String set_cookbook_by_id = | 334 | static const String set_cookbook_by_id = |
| 335 | "?service=App.Cookbook.SetCookbookById"; //修改菜品 | 335 | "?service=App.Cookbook.SetCookbookById"; //修改菜品 |
| 336 | 336 | ||
| 337 | - static const String merge_tables = | ||
| 338 | - "?service=App.Tables.MergeTables"; // 合并桌位 | ||
| 339 | - | 337 | + static const String merge_tables = "?service=App.Tables.MergeTables"; // 合并桌位 |
| 338 | + | ||
| 339 | + static const String set_cookbook_class_by_id = | ||
| 340 | + "?service=App.Cookbook.SetCookbookClassById"; // 修改菜品分类 | ||
| 340 | 341 | ||
| 341 | } | 342 | } |
| @@ -215,7 +215,7 @@ class _FeastMenuPageState extends State<FeastMenuPage> { | @@ -215,7 +215,7 @@ class _FeastMenuPageState extends State<FeastMenuPage> { | ||
| 215 | Container( | 215 | Container( |
| 216 | width: h(36), | 216 | width: h(36), |
| 217 | child: Text( | 217 | child: Text( |
| 218 | - '${setmeal.spec}', | 218 | + '${setmeal.numStr ?? ''}${setmeal.spec}', |
| 219 | overflow: TextOverflow.ellipsis, | 219 | overflow: TextOverflow.ellipsis, |
| 220 | maxLines: 1, | 220 | maxLines: 1, |
| 221 | style: TextStyle( | 221 | style: TextStyle( |
| @@ -247,8 +247,10 @@ class _FeastMenuPageState extends State<FeastMenuPage> { | @@ -247,8 +247,10 @@ class _FeastMenuPageState extends State<FeastMenuPage> { | ||
| 247 | Expanded( | 247 | Expanded( |
| 248 | child: | 248 | child: |
| 249 | _textfield('菜名', setmeal.nameC, null)), | 249 | _textfield('菜名', setmeal.nameC, null)), |
| 250 | - // HEmptyView(16), | ||
| 251 | - // _textfield('数量', null, null, width: w(56)) | 250 | + HEmptyView(16), |
| 251 | + _textfield('数量', setmeal.numC, null, | ||
| 252 | + inputType: TextInputType.number, | ||
| 253 | + width: w(56)) | ||
| 252 | ], | 254 | ], |
| 253 | )) | 255 | )) |
| 254 | ], | 256 | ], |
| @@ -366,6 +368,7 @@ class _FeastMenuPageState extends State<FeastMenuPage> { | @@ -366,6 +368,7 @@ class _FeastMenuPageState extends State<FeastMenuPage> { | ||
| 366 | // 'cname': element.nameC.text | 368 | // 'cname': element.nameC.text |
| 367 | // }); | 369 | // }); |
| 368 | element.cname = element.nameC.text; | 370 | element.cname = element.nameC.text; |
| 371 | + element.numStr = element.numC.text; | ||
| 369 | temp.add(element); | 372 | temp.add(element); |
| 370 | } else { | 373 | } else { |
| 371 | temp.add(element); | 374 | temp.add(element); |
| @@ -226,7 +226,7 @@ class _FeastMenuShowPageState extends State<FeastMenuShowPage> { | @@ -226,7 +226,7 @@ class _FeastMenuShowPageState extends State<FeastMenuShowPage> { | ||
| 226 | Container( | 226 | Container( |
| 227 | width: h(36), | 227 | width: h(36), |
| 228 | child: Text( | 228 | child: Text( |
| 229 | - '${setmeal.spec}', | 229 | + '${setmeal.numStr ?? ''}${setmeal.spec}', |
| 230 | overflow: TextOverflow.ellipsis, | 230 | overflow: TextOverflow.ellipsis, |
| 231 | maxLines: 1, | 231 | maxLines: 1, |
| 232 | style: TextStyle( | 232 | style: TextStyle( |
| @@ -45,7 +45,8 @@ class _FeastDishPageState extends State<FeastDishPage> { | @@ -45,7 +45,8 @@ class _FeastDishPageState extends State<FeastDishPage> { | ||
| 45 | } | 45 | } |
| 46 | 46 | ||
| 47 | ///添加宴会套餐菜品分类 | 47 | ///添加宴会套餐菜品分类 |
| 48 | - _setSetmealCook(String name, String per, String trim, {String cookid}) async { | 48 | + _setSetmealCook(String name, String per, String trim, String numStr, |
| 49 | + {String cookid}) async { | ||
| 49 | Map<String, String> params = { | 50 | Map<String, String> params = { |
| 50 | "sid": Provider.of<UserModel>(context, listen: false).user.sellerid, | 51 | "sid": Provider.of<UserModel>(context, listen: false).user.sellerid, |
| 51 | 'cname': name, | 52 | 'cname': name, |
| @@ -53,7 +54,7 @@ class _FeastDishPageState extends State<FeastDishPage> { | @@ -53,7 +54,7 @@ class _FeastDishPageState extends State<FeastDishPage> { | ||
| 53 | 'cid': widget.classId, | 54 | 'cid': widget.classId, |
| 54 | 'spec': per, | 55 | 'spec': per, |
| 55 | 'is_trim': trim, | 56 | 'is_trim': trim, |
| 56 | - // 'num': numStr | 57 | + 'num': numStr |
| 57 | }; | 58 | }; |
| 58 | if (cookid != null) { | 59 | if (cookid != null) { |
| 59 | params['id'] = cookid; | 60 | params['id'] = cookid; |
| @@ -102,13 +103,13 @@ class _FeastDishPageState extends State<FeastDishPage> { | @@ -102,13 +103,13 @@ class _FeastDishPageState extends State<FeastDishPage> { | ||
| 102 | String per = map['per']; | 103 | String per = map['per']; |
| 103 | String name = map['name']; | 104 | String name = map['name']; |
| 104 | String can = map['can']; | 105 | String can = map['can']; |
| 105 | - // String numStr = map['num']; | 106 | + String numStr = map['num']; |
| 106 | 107 | ||
| 107 | print(can); | 108 | print(can); |
| 108 | - _setSetmealCook(name, per, can); | 109 | + _setSetmealCook(name, per, can, numStr); |
| 109 | }); | 110 | }); |
| 110 | }, | 111 | }, |
| 111 | - text: '添加一项', | 112 | + text: '添加菜品', |
| 112 | fontSize: 32, | 113 | fontSize: 32, |
| 113 | isBold: false, | 114 | isBold: false, |
| 114 | height: h(32), | 115 | height: h(32), |
| @@ -138,7 +139,7 @@ class _FeastDishPageState extends State<FeastDishPage> { | @@ -138,7 +139,7 @@ class _FeastDishPageState extends State<FeastDishPage> { | ||
| 138 | Container( | 139 | Container( |
| 139 | width: w(36), | 140 | width: w(36), |
| 140 | child: Text( | 141 | child: Text( |
| 141 | - cook.spec, | 142 | + '${cook.numStr ?? ''}${cook.spec}', |
| 142 | style: TextStyle( | 143 | style: TextStyle( |
| 143 | fontSize: font(16), color: MyColours.color_515151), | 144 | fontSize: font(16), color: MyColours.color_515151), |
| 144 | )), | 145 | )), |
| @@ -160,13 +161,14 @@ class _FeastDishPageState extends State<FeastDishPage> { | @@ -160,13 +161,14 @@ class _FeastDishPageState extends State<FeastDishPage> { | ||
| 160 | DialogUtil.feastDishEditDialog(context, | 161 | DialogUtil.feastDishEditDialog(context, |
| 161 | content: cook.cname, | 162 | content: cook.cname, |
| 162 | per: cook.spec, | 163 | per: cook.spec, |
| 163 | - can: cook.isTrim == '1' ? true : false, onTap: (Map map) { | 164 | + can: cook.isTrim == '1' ? true : false, |
| 165 | + numStr: cook.numStr, onTap: (Map map) { | ||
| 164 | String per = map['per']; | 166 | String per = map['per']; |
| 165 | String name = map['name']; | 167 | String name = map['name']; |
| 166 | - // String numStr = map['num']; | 168 | + String numStr = map['num']; |
| 167 | String can = map['can']; | 169 | String can = map['can']; |
| 168 | print(can); | 170 | print(can); |
| 169 | - _setSetmealCook(name, per, can, cookid: cook.id); | 171 | + _setSetmealCook(name, per, can, numStr, cookid: cook.id); |
| 170 | }); | 172 | }); |
| 171 | }, | 173 | }, |
| 172 | child: Text( | 174 | child: Text( |
| @@ -34,8 +34,8 @@ class _FeastManageHomePageState extends State<FeastManageHomePage> { | @@ -34,8 +34,8 @@ class _FeastManageHomePageState extends State<FeastManageHomePage> { | ||
| 34 | margin: EdgeInsets.only(top: w(12)), | 34 | margin: EdgeInsets.only(top: w(12)), |
| 35 | decoration: BoxDecoration( | 35 | decoration: BoxDecoration( |
| 36 | border: Border( | 36 | border: Border( |
| 37 | - bottom: | ||
| 38 | - BorderSide(width: w(0.5), color: MyColours.color_E7E7E7))), | 37 | + bottom: BorderSide( |
| 38 | + width: w(0.5), color: MyColours.color_E7E7E7))), | ||
| 39 | child: Row( | 39 | child: Row( |
| 40 | children: [ | 40 | children: [ |
| 41 | Text( | 41 | Text( |
| @@ -85,7 +85,7 @@ class _FeastManageHomePageState extends State<FeastManageHomePage> { | @@ -85,7 +85,7 @@ class _FeastManageHomePageState extends State<FeastManageHomePage> { | ||
| 85 | feastManegeItem('宴会员工', onTap: () { | 85 | feastManegeItem('宴会员工', onTap: () { |
| 86 | NavigatorUtil.goFeastPersonalPage(context); | 86 | NavigatorUtil.goFeastPersonalPage(context); |
| 87 | }), | 87 | }), |
| 88 | - feastManegeItem('套餐管理', onTap: () { | 88 | + feastManegeItem('宴会套餐管理', onTap: () { |
| 89 | NavigatorUtil.goFeastSetmealManagePage(context); | 89 | NavigatorUtil.goFeastSetmealManagePage(context); |
| 90 | }), | 90 | }), |
| 91 | feastManegeItem('酒水管理', onTap: () { | 91 | feastManegeItem('酒水管理', onTap: () { |
| @@ -225,7 +225,10 @@ class _FeastSetmealManageEditPageState | @@ -225,7 +225,10 @@ class _FeastSetmealManageEditPageState | ||
| 225 | child: Row( | 225 | child: Row( |
| 226 | children: [ | 226 | children: [ |
| 227 | Text( | 227 | Text( |
| 228 | - data.className, | 228 | + '${data.className} ' + |
| 229 | + (data.cook == null || data.cook.length == 0 | ||
| 230 | + ? '' | ||
| 231 | + : '(${data.cook.length}道)'), | ||
| 229 | style: | 232 | style: |
| 230 | TextStyle(fontSize: font(16), color: MyColours.color_E5000000), | 233 | TextStyle(fontSize: font(16), color: MyColours.color_E5000000), |
| 231 | ), | 234 | ), |
| @@ -19,7 +19,7 @@ import '../../../widgets/round_button.dart'; | @@ -19,7 +19,7 @@ import '../../../widgets/round_button.dart'; | ||
| 19 | import '../../../widgets/system_app_bar.dart'; | 19 | import '../../../widgets/system_app_bar.dart'; |
| 20 | 20 | ||
| 21 | /** | 21 | /** |
| 22 | - * 套餐管理 | 22 | + * 宴会套餐管理 |
| 23 | */ | 23 | */ |
| 24 | 24 | ||
| 25 | class FeastSetmealManagePage extends StatefulWidget { | 25 | class FeastSetmealManagePage extends StatefulWidget { |
| @@ -55,8 +55,7 @@ class _FeastSetmealManagePageState extends State<FeastSetmealManagePage> { | @@ -55,8 +55,7 @@ class _FeastSetmealManagePageState extends State<FeastSetmealManagePage> { | ||
| 55 | await feastModel.getSetmeal(context, isShowLoading: isShowLoading); | 55 | await feastModel.getSetmeal(context, isShowLoading: isShowLoading); |
| 56 | } | 56 | } |
| 57 | 57 | ||
| 58 | - _setSetmeal( | ||
| 59 | - String mealName, String price, String bargaining) async { | 58 | + _setSetmeal(String mealName, String price, String bargaining) async { |
| 60 | Map<String, String> params = { | 59 | Map<String, String> params = { |
| 61 | "sid": Provider.of<UserModel>(context, listen: false).user.sellerid, | 60 | "sid": Provider.of<UserModel>(context, listen: false).user.sellerid, |
| 62 | 'meal_name': mealName, | 61 | 'meal_name': mealName, |
| @@ -183,7 +182,7 @@ class _FeastSetmealManagePageState extends State<FeastSetmealManagePage> { | @@ -183,7 +182,7 @@ class _FeastSetmealManagePageState extends State<FeastSetmealManagePage> { | ||
| 183 | 182 | ||
| 184 | /// 这里必须禁止重绘 | 183 | /// 这里必须禁止重绘 |
| 185 | appBar: SystemAppBar( | 184 | appBar: SystemAppBar( |
| 186 | - '套餐管理', | 185 | + '宴会套餐', |
| 187 | needWhite: true, | 186 | needWhite: true, |
| 188 | bgColor: MyColours.color_438E93, | 187 | bgColor: MyColours.color_438E93, |
| 189 | titleColor: MyColours.color_F6F6F6, | 188 | titleColor: MyColours.color_F6F6F6, |
| @@ -15,6 +15,12 @@ import 'package:one_key/widgets/page_exception.dart'; | @@ -15,6 +15,12 @@ import 'package:one_key/widgets/page_exception.dart'; | ||
| 15 | import 'package:one_key/widgets/system_app_bar.dart'; | 15 | import 'package:one_key/widgets/system_app_bar.dart'; |
| 16 | import 'package:provider/provider.dart'; | 16 | import 'package:provider/provider.dart'; |
| 17 | 17 | ||
| 18 | +/*** | ||
| 19 | + * | ||
| 20 | + * | ||
| 21 | + * 分类管理 | ||
| 22 | + */ | ||
| 23 | + | ||
| 18 | class MenuCategoryPage extends StatefulWidget { | 24 | class MenuCategoryPage extends StatefulWidget { |
| 19 | MenuCategoryPage({Key key}) : super(key: key); | 25 | MenuCategoryPage({Key key}) : super(key: key); |
| 20 | 26 | ||
| @@ -47,6 +53,23 @@ class _MenuCategoryPageState extends State<MenuCategoryPage> { | @@ -47,6 +53,23 @@ class _MenuCategoryPageState extends State<MenuCategoryPage> { | ||
| 47 | } | 53 | } |
| 48 | } | 54 | } |
| 49 | 55 | ||
| 56 | + ///添加菜品分类 | ||
| 57 | + _setCookbookClassById(String name, String id, | ||
| 58 | + {bool showLoading = true}) async { | ||
| 59 | + Map<String, String> params = { | ||
| 60 | + "sellerid": Provider.of<UserModel>(context, listen: false).user.sellerid, | ||
| 61 | + 'id': id, | ||
| 62 | + 'class_name': name | ||
| 63 | + }; | ||
| 64 | + | ||
| 65 | + bool sucess = await menuManageProvider.setCookbookClassById(context, params, | ||
| 66 | + showLoading: showLoading); | ||
| 67 | + if (sucess) { | ||
| 68 | + EventBus().emit('menu_manage_page'); | ||
| 69 | + _getCookbookBySellerId(showLoading: false); | ||
| 70 | + } | ||
| 71 | + } | ||
| 72 | + | ||
| 50 | ///获取分类数据 | 73 | ///获取分类数据 |
| 51 | _getCookbookBySellerId({bool showLoading = true}) async { | 74 | _getCookbookBySellerId({bool showLoading = true}) async { |
| 52 | Map<String, String> params = { | 75 | Map<String, String> params = { |
| @@ -73,69 +96,77 @@ class _MenuCategoryPageState extends State<MenuCategoryPage> { | @@ -73,69 +96,77 @@ class _MenuCategoryPageState extends State<MenuCategoryPage> { | ||
| 73 | } | 96 | } |
| 74 | 97 | ||
| 75 | ///表头 | 98 | ///表头 |
| 76 | - Widget _tableItem(CookbookCategorySunModel model, int index, | ||
| 77 | - TableItemType type, IntCallback callback) { | ||
| 78 | - return InkWell( | ||
| 79 | - onTap: () { | ||
| 80 | - callback(index); | ||
| 81 | - }, | ||
| 82 | - child: Container( | ||
| 83 | - padding: EdgeInsets.only(left: ScreenUtil().setWidth(30)), | ||
| 84 | - height: ScreenUtil().setWidth(130), | ||
| 85 | - color: type == TableItemType.TableItemTypeHeader | ||
| 86 | - ? Color.fromRGBO(235, 234, 239, 1) | ||
| 87 | - : MyColours.color_fefefe, | ||
| 88 | - child: Row( | ||
| 89 | - children: [ | ||
| 90 | - Container( | ||
| 91 | - width: ScreenUtil().setWidth(85 * 2), | ||
| 92 | - height: double.infinity, | ||
| 93 | - child: Row( | ||
| 94 | - children: [ | ||
| 95 | - // HEmptyView(20), | ||
| 96 | - Expanded( | ||
| 97 | - child: Text( | ||
| 98 | - type == TableItemType.TableItemTypeHeader | ||
| 99 | - ? '序号' | ||
| 100 | - : '${index + 1}', | ||
| 101 | - textAlign: TextAlign.center, | ||
| 102 | - style: TextStyle( | ||
| 103 | - fontSize: ScreenUtil().setSp(28), | ||
| 104 | - color: MyColours.color_333333), | ||
| 105 | - )), | ||
| 106 | - HEmptyView(30), | ||
| 107 | - ], | ||
| 108 | - ), | ||
| 109 | - ), | ||
| 110 | - Expanded( | ||
| 111 | - child: Container( | ||
| 112 | - alignment: Alignment.center, | ||
| 113 | - width: ScreenUtil().setWidth(87 * 2), | ||
| 114 | - height: double.infinity, | 99 | + Widget _tableItem( |
| 100 | + CookbookCategorySunModel model, | ||
| 101 | + int index, | ||
| 102 | + TableItemType type, | ||
| 103 | + IntCallback callback, | ||
| 104 | + IntCallback callbackDel, | ||
| 105 | + ) { | ||
| 106 | + return Container( | ||
| 107 | + padding: EdgeInsets.only(left: ScreenUtil().setWidth(30)), | ||
| 108 | + height: ScreenUtil().setWidth(130), | ||
| 109 | + color: type == TableItemType.TableItemTypeHeader | ||
| 110 | + ? Color.fromRGBO(235, 234, 239, 1) | ||
| 111 | + : MyColours.color_fefefe, | ||
| 112 | + child: Row( | ||
| 113 | + children: [ | ||
| 114 | + Container( | ||
| 115 | + width: ScreenUtil().setWidth(85 * 2), | ||
| 116 | + height: double.infinity, | ||
| 117 | + child: Row( | ||
| 118 | + children: [ | ||
| 119 | + // HEmptyView(20), | ||
| 120 | + Expanded( | ||
| 115 | child: Text( | 121 | child: Text( |
| 116 | - type == TableItemType.TableItemTypeHeader | ||
| 117 | - ? '分类名称' | ||
| 118 | - : model.className, | ||
| 119 | - style: TextStyle( | ||
| 120 | - fontSize: ScreenUtil().setSp(28), | ||
| 121 | - color: MyColours.color_333333), | ||
| 122 | - ))), | ||
| 123 | - Container( | ||
| 124 | - alignment: Alignment.center, | ||
| 125 | - width: ScreenUtil().setWidth(116 * 2), | ||
| 126 | - height: double.infinity, | ||
| 127 | - child: Text( | ||
| 128 | type == TableItemType.TableItemTypeHeader | 122 | type == TableItemType.TableItemTypeHeader |
| 129 | - ? '操作' | ||
| 130 | - : model.className == '10道必点菜' | ||
| 131 | - ? '' | ||
| 132 | - : '删除', | 123 | + ? '序号' |
| 124 | + : '${index + 1}', | ||
| 125 | + textAlign: TextAlign.center, | ||
| 133 | style: TextStyle( | 126 | style: TextStyle( |
| 134 | fontSize: ScreenUtil().setSp(28), | 127 | fontSize: ScreenUtil().setSp(28), |
| 135 | color: MyColours.color_333333), | 128 | color: MyColours.color_333333), |
| 136 | )), | 129 | )), |
| 137 | - ], | ||
| 138 | - ), | 130 | + HEmptyView(30), |
| 131 | + ], | ||
| 132 | + ), | ||
| 133 | + ), | ||
| 134 | + Expanded( | ||
| 135 | + child: InkWell( | ||
| 136 | + onTap: () { | ||
| 137 | + callback(index); | ||
| 138 | + }, | ||
| 139 | + child: Container( | ||
| 140 | + alignment: Alignment.center, | ||
| 141 | + width: ScreenUtil().setWidth(87 * 2), | ||
| 142 | + height: double.infinity, | ||
| 143 | + child: Text( | ||
| 144 | + type == TableItemType.TableItemTypeHeader | ||
| 145 | + ? '分类名称' | ||
| 146 | + : model.className, | ||
| 147 | + style: TextStyle( | ||
| 148 | + fontSize: ScreenUtil().setSp(28), | ||
| 149 | + color: MyColours.color_333333), | ||
| 150 | + )))), | ||
| 151 | + InkWell( | ||
| 152 | + onTap: () { | ||
| 153 | + callbackDel(index); | ||
| 154 | + }, | ||
| 155 | + child: Container( | ||
| 156 | + alignment: Alignment.center, | ||
| 157 | + width: ScreenUtil().setWidth(116 * 2), | ||
| 158 | + height: double.infinity, | ||
| 159 | + child: Text( | ||
| 160 | + type == TableItemType.TableItemTypeHeader | ||
| 161 | + ? '操作' | ||
| 162 | + : model.className == '10道必点菜' | ||
| 163 | + ? '' | ||
| 164 | + : '删除', | ||
| 165 | + style: TextStyle( | ||
| 166 | + fontSize: ScreenUtil().setSp(28), | ||
| 167 | + color: MyColours.color_333333), | ||
| 168 | + ))), | ||
| 169 | + ], | ||
| 139 | ), | 170 | ), |
| 140 | ); | 171 | ); |
| 141 | } | 172 | } |
| @@ -181,21 +212,33 @@ class _MenuCategoryPageState extends State<MenuCategoryPage> { | @@ -181,21 +212,33 @@ class _MenuCategoryPageState extends State<MenuCategoryPage> { | ||
| 181 | children: [ | 212 | children: [ |
| 182 | //表头 | 213 | //表头 |
| 183 | _tableItem(model.categorySunModel[0], 0, | 214 | _tableItem(model.categorySunModel[0], 0, |
| 184 | - TableItemType.TableItemTypeHeader, (index) {}), | 215 | + TableItemType.TableItemTypeHeader, (index) {}, (index) {}), |
| 185 | Expanded( | 216 | Expanded( |
| 186 | child: ListView.builder( | 217 | child: ListView.builder( |
| 187 | itemCount: model.categorySunModel.length, | 218 | itemCount: model.categorySunModel.length, |
| 188 | itemBuilder: (BuildContext context, int index) { | 219 | itemBuilder: (BuildContext context, int index) { |
| 220 | + CookbookCategorySunModel sunModel = | ||
| 221 | + model.categorySunModel[index]; | ||
| 189 | return Column(children: [ | 222 | return Column(children: [ |
| 190 | - _tableItem(model.categorySunModel[index], index, | 223 | + _tableItem(sunModel, index, |
| 191 | TableItemType.TableItemTypeBody, (index) { | 224 | TableItemType.TableItemTypeBody, (index) { |
| 192 | - if (model.categorySunModel[index].className != | ||
| 193 | - '10道必点菜') { | 225 | + if (sunModel.className != '10道必点菜') { |
| 226 | + DialogUtil.textfeildAlertDialog(context, | ||
| 227 | + title: '修改分类', | ||
| 228 | + text: sunModel.className, | ||
| 229 | + hintText: '输入分类名称', | ||
| 230 | + lenghtLimit: true, | ||
| 231 | + toast: '请输入分类名称', rCallback: (name) { | ||
| 232 | + _setCookbookClassById(name, sunModel.id, | ||
| 233 | + showLoading: true); | ||
| 234 | + }); | ||
| 235 | + } | ||
| 236 | + }, (index) { | ||
| 237 | + if (sunModel.className != '10道必点菜') { | ||
| 194 | DialogUtil.cupertinoAlertDialog(context, | 238 | DialogUtil.cupertinoAlertDialog(context, |
| 195 | title: '', | 239 | title: '', |
| 196 | content: '删除后,该分类下所有菜品都将删除', rCallback: () { | 240 | content: '删除后,该分类下所有菜品都将删除', rCallback: () { |
| 197 | - _delCookbookById( | ||
| 198 | - model.categorySunModel[index].id); | 241 | + _delCookbookById(sunModel.id); |
| 199 | }); | 242 | }); |
| 200 | } | 243 | } |
| 201 | }), | 244 | }), |
| @@ -190,8 +190,7 @@ class MenuManageProvider extends ChangeNotifier { | @@ -190,8 +190,7 @@ class MenuManageProvider extends ChangeNotifier { | ||
| 190 | return false; | 190 | return false; |
| 191 | } | 191 | } |
| 192 | 192 | ||
| 193 | - | ||
| 194 | -///修改菜品 | 193 | + ///修改菜品 |
| 195 | Future<bool> setCookbookById(BuildContext context, Map<String, String> params, | 194 | Future<bool> setCookbookById(BuildContext context, Map<String, String> params, |
| 196 | {showLoading = false}) async { | 195 | {showLoading = false}) async { |
| 197 | BaseResp<dynamic> baseResp = await DioUtil() | 196 | BaseResp<dynamic> baseResp = await DioUtil() |
| @@ -211,6 +210,28 @@ class MenuManageProvider extends ChangeNotifier { | @@ -211,6 +210,28 @@ class MenuManageProvider extends ChangeNotifier { | ||
| 211 | return false; | 210 | return false; |
| 212 | } | 211 | } |
| 213 | 212 | ||
| 213 | + ///修改菜品分类 | ||
| 214 | + | ||
| 215 | + Future<bool> setCookbookClassById( | ||
| 216 | + BuildContext context, Map<String, String> params, | ||
| 217 | + {showLoading = false}) async { | ||
| 218 | + BaseResp<dynamic> baseResp = await DioUtil() | ||
| 219 | + .request<dynamic>(context, Method.get, HttpUrl.set_cookbook_class_by_id, | ||
| 220 | + data: params, showLoading: showLoading) | ||
| 221 | + .catchError((error) { | ||
| 222 | + print(error.toString()); | ||
| 223 | + }); | ||
| 224 | + | ||
| 225 | + if (baseResp != null && baseResp.code == Constant.status_success) { | ||
| 226 | + if (baseResp.data['data'] != '') { | ||
| 227 | + return true; | ||
| 228 | + } | ||
| 229 | + } else { | ||
| 230 | + Utils.showToast(baseResp.msg ?? ""); | ||
| 231 | + } | ||
| 232 | + return false; | ||
| 233 | + } | ||
| 234 | + | ||
| 214 | ///添加菜品分类信息 | 235 | ///添加菜品分类信息 |
| 215 | 236 | ||
| 216 | Future<bool> addCookbookClass( | 237 | Future<bool> addCookbookClass( |
| @@ -718,7 +718,7 @@ class DialogUtil { | @@ -718,7 +718,7 @@ class DialogUtil { | ||
| 718 | child: Container( | 718 | child: Container( |
| 719 | padding: EdgeInsets.symmetric( | 719 | padding: EdgeInsets.symmetric( |
| 720 | horizontal: ScreenUtil().setWidth(50)), | 720 | horizontal: ScreenUtil().setWidth(50)), |
| 721 | - height: ScreenUtil().setWidth(421 * 2), | 721 | + // height: ScreenUtil().setWidth(421 * 2), |
| 722 | decoration: BoxDecoration( | 722 | decoration: BoxDecoration( |
| 723 | borderRadius: | 723 | borderRadius: |
| 724 | BorderRadius.circular(ScreenUtil().setWidth(16))), | 724 | BorderRadius.circular(ScreenUtil().setWidth(16))), |
| @@ -788,54 +788,54 @@ class DialogUtil { | @@ -788,54 +788,54 @@ class DialogUtil { | ||
| 788 | )) | 788 | )) |
| 789 | ])), | 789 | ])), |
| 790 | VEmptyView(32), | 790 | VEmptyView(32), |
| 791 | - // Padding( | ||
| 792 | - // padding: EdgeInsets.symmetric(horizontal: w(16)), | ||
| 793 | - // child: Row(children: [ | ||
| 794 | - // Text( | ||
| 795 | - // '菜品数量', | ||
| 796 | - // style: TextStyle( | ||
| 797 | - // fontSize: ScreenUtil().setSp(32), | ||
| 798 | - // color: MyColours.color_000000), | ||
| 799 | - // ), | ||
| 800 | - // HEmptyView(24), | ||
| 801 | - // Expanded( | ||
| 802 | - // child: Container( | ||
| 803 | - // height: ScreenUtil().setWidth(48 * 2), | ||
| 804 | - // decoration: BoxDecoration( | ||
| 805 | - // color: MyColours.color_f3f3f3, | ||
| 806 | - // borderRadius: BorderRadius.circular( | ||
| 807 | - // ScreenUtil().setWidth(8))), | ||
| 808 | - // padding: | ||
| 809 | - // EdgeInsets.symmetric(horizontal: w(12)), | ||
| 810 | - // child: TextField( | ||
| 811 | - // controller: numC, | ||
| 812 | - // maxLines: 1, | ||
| 813 | - // style: TextStyle( | ||
| 814 | - // fontSize: ScreenUtil().setSp(32), | ||
| 815 | - // color: MyColours.color_515151), | ||
| 816 | - // decoration: InputDecoration( | ||
| 817 | - // contentPadding: EdgeInsets.only( | ||
| 818 | - // bottom: ScreenUtil() | ||
| 819 | - // .setWidth(40)), //设置文字内容与边框距离 | 791 | + Padding( |
| 792 | + padding: EdgeInsets.symmetric(horizontal: w(16)), | ||
| 793 | + child: Row(children: [ | ||
| 794 | + Text( | ||
| 795 | + '菜品数量', | ||
| 796 | + style: TextStyle( | ||
| 797 | + fontSize: ScreenUtil().setSp(32), | ||
| 798 | + color: MyColours.color_000000), | ||
| 799 | + ), | ||
| 800 | + HEmptyView(24), | ||
| 801 | + Expanded( | ||
| 802 | + child: Container( | ||
| 803 | + height: ScreenUtil().setWidth(48 * 2), | ||
| 804 | + decoration: BoxDecoration( | ||
| 805 | + color: MyColours.color_f3f3f3, | ||
| 806 | + borderRadius: BorderRadius.circular( | ||
| 807 | + ScreenUtil().setWidth(8))), | ||
| 808 | + padding: | ||
| 809 | + EdgeInsets.symmetric(horizontal: w(12)), | ||
| 810 | + child: TextField( | ||
| 811 | + controller: numC, | ||
| 812 | + maxLines: 1, | ||
| 813 | + style: TextStyle( | ||
| 814 | + fontSize: ScreenUtil().setSp(32), | ||
| 815 | + color: MyColours.color_515151), | ||
| 816 | + decoration: InputDecoration( | ||
| 817 | + contentPadding: EdgeInsets.only( | ||
| 818 | + bottom: ScreenUtil() | ||
| 819 | + .setWidth(40)), //设置文字内容与边框距离 | ||
| 820 | 820 | ||
| 821 | - // border: OutlineInputBorder( | ||
| 822 | - // borderSide: BorderSide.none), | ||
| 823 | - // hintText: '请输入', | ||
| 824 | - // hintStyle: TextStyle( | ||
| 825 | - // color: MyColours.color_66000000, | ||
| 826 | - // fontSize: ScreenUtil().setSp(32), | ||
| 827 | - // ), | ||
| 828 | - // ), | ||
| 829 | - // onChanged: (value) {}, | ||
| 830 | - // onEditingComplete: () { | ||
| 831 | - // FocusScope.of(context).requestFocus( | ||
| 832 | - // FocusNode()); //点击空白处隐藏键盘 | ||
| 833 | - // }, | ||
| 834 | - // keyboardType: TextInputType.text, | ||
| 835 | - // ), | ||
| 836 | - // )) | ||
| 837 | - // ])), | ||
| 838 | - // VEmptyView(32), | 821 | + border: OutlineInputBorder( |
| 822 | + borderSide: BorderSide.none), | ||
| 823 | + hintText: '请输入', | ||
| 824 | + hintStyle: TextStyle( | ||
| 825 | + color: MyColours.color_66000000, | ||
| 826 | + fontSize: ScreenUtil().setSp(32), | ||
| 827 | + ), | ||
| 828 | + ), | ||
| 829 | + onChanged: (value) {}, | ||
| 830 | + onEditingComplete: () { | ||
| 831 | + FocusScope.of(context).requestFocus( | ||
| 832 | + FocusNode()); //点击空白处隐藏键盘 | ||
| 833 | + }, | ||
| 834 | + keyboardType: TextInputType.text, | ||
| 835 | + ), | ||
| 836 | + )) | ||
| 837 | + ])), | ||
| 838 | + VEmptyView(32), | ||
| 839 | Padding( | 839 | Padding( |
| 840 | padding: EdgeInsets.symmetric(horizontal: w(16)), | 840 | padding: EdgeInsets.symmetric(horizontal: w(16)), |
| 841 | child: Row(children: [ | 841 | child: Row(children: [ |
| @@ -975,11 +975,11 @@ class DialogUtil { | @@ -975,11 +975,11 @@ class DialogUtil { | ||
| 975 | 975 | ||
| 976 | return; | 976 | return; |
| 977 | } | 977 | } |
| 978 | - // if (numC.text.trim() == '') { | ||
| 979 | - // Utils.showToast('请输入菜品数量!'); | 978 | + if (numC.text.trim() == '') { |
| 979 | + Utils.showToast('请输入菜品数量!'); | ||
| 980 | 980 | ||
| 981 | - // return; | ||
| 982 | - // } | 981 | + return; |
| 982 | + } | ||
| 983 | if (perC.text.trim() == '') { | 983 | if (perC.text.trim() == '') { |
| 984 | Utils.showToast('请输入${pricetitle}!'); | 984 | Utils.showToast('请输入${pricetitle}!'); |
| 985 | return; | 985 | return; |
-
Please register or login to post a comment