Showing
12 changed files
with
731 additions
and
346 deletions
| @@ -12,14 +12,14 @@ if (flutterRoot == null) { | @@ -12,14 +12,14 @@ if (flutterRoot == null) { | ||
| 12 | } | 12 | } |
| 13 | 13 | ||
| 14 | 14 | ||
| 15 | -def flutterVersionCode = "423" | 15 | +def flutterVersionCode = "430" |
| 16 | if (flutterVersionCode == null) { | 16 | if (flutterVersionCode == null) { |
| 17 | - flutterVersionCode = '423' | 17 | + flutterVersionCode = '430' |
| 18 | } | 18 | } |
| 19 | 19 | ||
| 20 | -def flutterVersionName = "4.2.3" | 20 | +def flutterVersionName = "4.3.0" |
| 21 | if (flutterVersionName == null) { | 21 | if (flutterVersionName == null) { |
| 22 | - flutterVersionName = '4.2.3' | 22 | + flutterVersionName = '4.3.0' |
| 23 | } | 23 | } |
| 24 | apply plugin: 'com.android.application' | 24 | apply plugin: 'com.android.application' |
| 25 | apply plugin: 'kotlin-android' | 25 | apply plugin: 'kotlin-android' |
| @@ -99,6 +99,7 @@ class MenuSunModel { | @@ -99,6 +99,7 @@ class MenuSunModel { | ||
| 99 | List spec; | 99 | List spec; |
| 100 | int isSpec; | 100 | int isSpec; |
| 101 | List practice; | 101 | List practice; |
| 102 | + List<MenuModel> cookList; | ||
| 102 | 103 | ||
| 103 | int amount; //菜品数量 | 104 | int amount; //菜品数量 |
| 104 | 105 | ||
| @@ -160,6 +161,7 @@ class MenuSunModel { | @@ -160,6 +161,7 @@ class MenuSunModel { | ||
| 160 | spec = json['spec']; | 161 | spec = json['spec']; |
| 161 | isSpec = json['isSpec']; | 162 | isSpec = json['isSpec']; |
| 162 | practice = json['practice']; | 163 | practice = json['practice']; |
| 164 | + amount = 0; | ||
| 163 | } | 165 | } |
| 164 | 166 | ||
| 165 | MenuSunModel.fromJson2(Map<String, dynamic> json) { | 167 | MenuSunModel.fromJson2(Map<String, dynamic> json) { |
| @@ -189,7 +191,7 @@ class MenuSunModel { | @@ -189,7 +191,7 @@ class MenuSunModel { | ||
| 189 | spec = json['spec']; | 191 | spec = json['spec']; |
| 190 | isSpec = json['isSpec']; | 192 | isSpec = json['isSpec']; |
| 191 | practice = json['practice']; | 193 | practice = json['practice']; |
| 192 | - amount = json['amount']??0; | 194 | + amount = json['amount'] ?? 0; |
| 193 | } | 195 | } |
| 194 | 196 | ||
| 195 | Map<String, dynamic> toJson() { | 197 | Map<String, dynamic> toJson() { |
| 1 | import 'dart:convert'; | 1 | import 'dart:convert'; |
| 2 | 2 | ||
| 3 | +import 'package:common_utils/common_utils.dart'; | ||
| 4 | +import 'package:flutter/material.dart'; | ||
| 3 | import 'package:one_key/models/cookbook_model.dart'; | 5 | import 'package:one_key/models/cookbook_model.dart'; |
| 4 | 6 | ||
| 5 | class PlanCookListModel { | 7 | class PlanCookListModel { |
| @@ -76,6 +78,12 @@ class SunListPlan { | @@ -76,6 +78,12 @@ class SunListPlan { | ||
| 76 | String isDel; | 78 | String isDel; |
| 77 | String cdate; | 79 | String cdate; |
| 78 | 80 | ||
| 81 | + String get cdateStr { | ||
| 82 | + DateTime dateTime = | ||
| 83 | + DateTime.fromMillisecondsSinceEpoch(int.parse(cdate) * 1000); | ||
| 84 | + return DateUtil.formatDate(dateTime, format: DateFormats.y_mo_d); | ||
| 85 | + } | ||
| 86 | + | ||
| 79 | SunListPlan( | 87 | SunListPlan( |
| 80 | {this.id, | 88 | {this.id, |
| 81 | this.sellerid, | 89 | this.sellerid, |
| @@ -103,9 +111,8 @@ class SunListPlan { | @@ -103,9 +111,8 @@ class SunListPlan { | ||
| 103 | memberPrice = json1['member_price']; | 111 | memberPrice = json1['member_price']; |
| 104 | planPrice = json1['plan_price']; | 112 | planPrice = json1['plan_price']; |
| 105 | // cookList = json1['cook_list']; | 113 | // cookList = json1['cook_list']; |
| 106 | - | ||
| 107 | - if (json1['cook_list'] != null) { | ||
| 108 | - cookList = <MenuModel>[]; | 114 | + cookList = <MenuModel>[]; |
| 115 | + if (json1['cook_list'] != null && json1['cook_list'] != 'null') { | ||
| 109 | if (json1['cook_list'] is List) { | 116 | if (json1['cook_list'] is List) { |
| 110 | json1['cook_list'].forEach((v) { | 117 | json1['cook_list'].forEach((v) { |
| 111 | cookList.add(new MenuModel.fromJson2(v)); | 118 | cookList.add(new MenuModel.fromJson2(v)); |
| @@ -343,5 +343,9 @@ class HttpUrl { | @@ -343,5 +343,9 @@ class HttpUrl { | ||
| 343 | 343 | ||
| 344 | static const String get_plan_cook_list = | 344 | static const String get_plan_cook_list = |
| 345 | "?service=App.PlanCook.GetPlanCookList"; // 排菜/套餐列表 | 345 | "?service=App.PlanCook.GetPlanCookList"; // 排菜/套餐列表 |
| 346 | + static const String del_plan_cook = | ||
| 347 | + "?service=App.PlanCook.DelPlanCook"; // 删除排菜/套餐列表 | ||
| 348 | + | ||
| 349 | + | ||
| 346 | 350 | ||
| 347 | } | 351 | } |
| @@ -15,6 +15,7 @@ import 'package:one_key/widgets/system_app_bar.dart'; | @@ -15,6 +15,7 @@ import 'package:one_key/widgets/system_app_bar.dart'; | ||
| 15 | import 'package:one_key/widgets/v_empty_view.dart'; | 15 | import 'package:one_key/widgets/v_empty_view.dart'; |
| 16 | import 'package:provider/provider.dart'; | 16 | import 'package:provider/provider.dart'; |
| 17 | 17 | ||
| 18 | +import '../../../models/plan_cook_list_model.dart'; | ||
| 18 | import '../../../provider/plan_dish_provider.dart'; | 19 | import '../../../provider/plan_dish_provider.dart'; |
| 19 | 20 | ||
| 20 | /** | 21 | /** |
| @@ -33,7 +34,7 @@ class MyPlanDishHomePage extends StatefulWidget { | @@ -33,7 +34,7 @@ class MyPlanDishHomePage extends StatefulWidget { | ||
| 33 | class _MyPlanDishHomePageState extends State<MyPlanDishHomePage> | 34 | class _MyPlanDishHomePageState extends State<MyPlanDishHomePage> |
| 34 | with TickerProviderStateMixin { | 35 | with TickerProviderStateMixin { |
| 35 | EasyRefreshController _controller = EasyRefreshController(); | 36 | EasyRefreshController _controller = EasyRefreshController(); |
| 36 | - CouponProvider couponProvider; | 37 | + PlanDishProvider planDishProvider; |
| 37 | TabController tabController; | 38 | TabController tabController; |
| 38 | 39 | ||
| 39 | // ///获取优惠券列表数据 | 40 | // ///获取优惠券列表数据 |
| @@ -81,25 +82,52 @@ class _MyPlanDishHomePageState extends State<MyPlanDishHomePage> | @@ -81,25 +82,52 @@ class _MyPlanDishHomePageState extends State<MyPlanDishHomePage> | ||
| 81 | // _couponNetworkData(tabController.index); | 82 | // _couponNetworkData(tabController.index); |
| 82 | // selectIndex = tabController.index; | 83 | // selectIndex = tabController.index; |
| 83 | // setState(() {}); | 84 | // setState(() {}); |
| 85 | + // if (tabController.index == 0) { | ||
| 86 | + // planDishProvider.pageStateHome = PageState.Loading; | ||
| 87 | + // } else if (tabController.index == 1) { | ||
| 88 | + // planDishProvider.pageStateStore = PageState.Loading; | ||
| 89 | + // } else if (tabController.index == 2) { | ||
| 90 | + // planDishProvider.pageStateMine = PageState.Loading; | ||
| 91 | + // } | ||
| 92 | + | ||
| 93 | + // planDishProvider.notifyListeners(); | ||
| 94 | + // _getPlanCookList(isShowLoading: false); | ||
| 84 | } | 95 | } |
| 85 | }); | 96 | }); |
| 86 | WidgetsBinding.instance.addPostFrameCallback((_) { | 97 | WidgetsBinding.instance.addPostFrameCallback((_) { |
| 87 | // _couponNetworkData(0); | 98 | // _couponNetworkData(0); |
| 99 | + _getPlanCookList(isShowLoading: false); | ||
| 88 | }); | 100 | }); |
| 89 | // bus.on("refresh_coupon_list_f", (arg) { | 101 | // bus.on("refresh_coupon_list_f", (arg) { |
| 90 | // _couponNetworkData(tabController.index); | 102 | // _couponNetworkData(tabController.index); |
| 91 | // }); | 103 | // }); |
| 104 | + bus.on('refresh_dish_plan_home_list', (arg) { | ||
| 105 | + _getPlanCookList(isShowLoading: false); | ||
| 106 | + }); | ||
| 92 | } | 107 | } |
| 93 | 108 | ||
| 94 | @override | 109 | @override |
| 95 | void dispose() { | 110 | void dispose() { |
| 96 | - bus.off("refresh_coupon_list_f"); | ||
| 97 | super.dispose(); | 111 | super.dispose(); |
| 112 | + bus.off('refresh_dish_plan_home_list'); | ||
| 113 | + } | ||
| 114 | + | ||
| 115 | + ///排菜/套餐列表 | ||
| 116 | + | ||
| 117 | + _getPlanCookList({bool isShowLoading = true}) async { | ||
| 118 | + Map<String, String> params = { | ||
| 119 | + "uid": Provider.of<UserModel>(context, listen: false).user.openid, | ||
| 120 | + // 'is_time': '0' | ||
| 121 | + "sellerid": Provider.of<UserModel>(context, listen: false).user.sellerid, | ||
| 122 | + }; | ||
| 123 | + await planDishProvider.getPlanCookList(context, params, | ||
| 124 | + showLoading: isShowLoading); | ||
| 98 | } | 125 | } |
| 99 | 126 | ||
| 100 | @override | 127 | @override |
| 101 | Widget build(BuildContext context) { | 128 | Widget build(BuildContext context) { |
| 102 | - couponProvider = Provider.of<CouponProvider>(context, listen: true); | 129 | + planDishProvider = Provider.of<PlanDishProvider>(context, listen: true); |
| 130 | + | ||
| 103 | return Scaffold( | 131 | return Scaffold( |
| 104 | backgroundColor: MyColours.color_f3f3f3, | 132 | backgroundColor: MyColours.color_f3f3f3, |
| 105 | appBar: SystemAppBar('排菜与套餐', onTap: () { | 133 | appBar: SystemAppBar('排菜与套餐', onTap: () { |
| @@ -161,13 +189,25 @@ class _MyPlanDishHomePageState extends State<MyPlanDishHomePage> | @@ -161,13 +189,25 @@ class _MyPlanDishHomePageState extends State<MyPlanDishHomePage> | ||
| 161 | children: [ | 189 | children: [ |
| 162 | ChangeNotifierProvider<PlanDishProvider>( | 190 | ChangeNotifierProvider<PlanDishProvider>( |
| 163 | create: (_) => PlanDishProvider(), | 191 | create: (_) => PlanDishProvider(), |
| 164 | - child: PlanDishSunPage(index: 0)), | 192 | + child: PlanDishSunPage( |
| 193 | + index: 0, | ||
| 194 | + data: planDishProvider.allList, | ||
| 195 | + pageState: planDishProvider.pageStateHome, | ||
| 196 | + )), | ||
| 165 | ChangeNotifierProvider<PlanDishProvider>( | 197 | ChangeNotifierProvider<PlanDishProvider>( |
| 166 | create: (_) => PlanDishProvider(), | 198 | create: (_) => PlanDishProvider(), |
| 167 | - child: PlanDishSunPage(index: 1)), | 199 | + child: PlanDishSunPage( |
| 200 | + index: 1, | ||
| 201 | + data: planDishProvider.storeList, | ||
| 202 | + pageState: planDishProvider.pageStateStore, | ||
| 203 | + )), | ||
| 168 | ChangeNotifierProvider<PlanDishProvider>( | 204 | ChangeNotifierProvider<PlanDishProvider>( |
| 169 | create: (_) => PlanDishProvider(), | 205 | create: (_) => PlanDishProvider(), |
| 170 | - child: PlanDishSunPage(index: 2)), | 206 | + child: PlanDishSunPage( |
| 207 | + index: 2, | ||
| 208 | + data: planDishProvider.mineList, | ||
| 209 | + pageState: planDishProvider.pageStateMine, | ||
| 210 | + )), | ||
| 171 | ], | 211 | ], |
| 172 | ), | 212 | ), |
| 173 | ), | 213 | ), |
| @@ -206,8 +246,9 @@ class _MyPlanDishHomePageState extends State<MyPlanDishHomePage> | @@ -206,8 +246,9 @@ class _MyPlanDishHomePageState extends State<MyPlanDishHomePage> | ||
| 206 | userModel.user.role_name == '店长') { | 246 | userModel.user.role_name == '店长') { |
| 207 | NavigatorUtil.goPlanDishCreateSelectTypePage(context); | 247 | NavigatorUtil.goPlanDishCreateSelectTypePage(context); |
| 208 | } else { | 248 | } else { |
| 209 | - bool needRefresh = | ||
| 210 | - await NavigatorUtil.goPlanDishEditPage(context); | 249 | + bool needRefresh = await NavigatorUtil.goPlanDishEditPage( |
| 250 | + context, | ||
| 251 | + isMine: true,isEdit: true); | ||
| 211 | print(needRefresh); | 252 | print(needRefresh); |
| 212 | if (needRefresh != null && needRefresh) { | 253 | if (needRefresh != null && needRefresh) { |
| 213 | // bus.emit('refresh_coupon_list_f'); | 254 | // bus.emit('refresh_coupon_list_f'); |
| @@ -39,11 +39,16 @@ import 'package:provider/provider.dart'; | @@ -39,11 +39,16 @@ import 'package:provider/provider.dart'; | ||
| 39 | */ | 39 | */ |
| 40 | 40 | ||
| 41 | class PlanDishEidtPage extends StatefulWidget { | 41 | class PlanDishEidtPage extends StatefulWidget { |
| 42 | + final bool onlyShow; | ||
| 42 | final bool isMine; | 43 | final bool isMine; |
| 43 | final bool isEdit; | 44 | final bool isEdit; |
| 44 | final SunListPlan sunListPlan; | 45 | final SunListPlan sunListPlan; |
| 45 | PlanDishEidtPage( | 46 | PlanDishEidtPage( |
| 46 | - {Key key, this.isMine = false, this.isEdit = true, this.sunListPlan}) | 47 | + {Key key, |
| 48 | + this.isMine = false, | ||
| 49 | + this.isEdit = true, | ||
| 50 | + this.sunListPlan, | ||
| 51 | + this.onlyShow = false}) | ||
| 47 | : super(key: key); | 52 | : super(key: key); |
| 48 | 53 | ||
| 49 | @override | 54 | @override |
| @@ -88,12 +93,16 @@ class _PlanDishEidtPageState extends State<PlanDishEidtPage> { | @@ -88,12 +93,16 @@ class _PlanDishEidtPageState extends State<PlanDishEidtPage> { | ||
| 88 | labelShow = labelList[labelSelIndex]; | 93 | labelShow = labelList[labelSelIndex]; |
| 89 | } | 94 | } |
| 90 | if (widget.sunListPlan != null) { | 95 | if (widget.sunListPlan != null) { |
| 91 | - _dishNameEditControl.text = widget.sunListPlan.pname; | 96 | + if (widget.isEdit) { |
| 97 | + _dishNameEditControl.text = widget.sunListPlan.pname; | ||
| 98 | + } else {} | ||
| 99 | + | ||
| 92 | if (widget.sunListPlan.type == '1') { | 100 | if (widget.sunListPlan.type == '1') { |
| 93 | labelShow = '店内通用套餐'; | 101 | labelShow = '店内通用套餐'; |
| 94 | } else { | 102 | } else { |
| 95 | labelShow = '自定义排菜单'; | 103 | labelShow = '自定义排菜单'; |
| 96 | } | 104 | } |
| 105 | + labelSelIndex = labelList.indexOf(labelShow); | ||
| 97 | swichState = widget.sunListPlan.status == '1' ? true : false; | 106 | swichState = widget.sunListPlan.status == '1' ? true : false; |
| 98 | pNumC.text = widget.sunListPlan.pnum; | 107 | pNumC.text = widget.sunListPlan.pnum; |
| 99 | pNum = int.parse(widget.sunListPlan.pnum); | 108 | pNum = int.parse(widget.sunListPlan.pnum); |
| @@ -144,11 +153,17 @@ class _PlanDishEidtPageState extends State<PlanDishEidtPage> { | @@ -144,11 +153,17 @@ class _PlanDishEidtPageState extends State<PlanDishEidtPage> { | ||
| 144 | //创建新券 客户经理创建活动 | 153 | //创建新券 客户经理创建活动 |
| 145 | _createNewdish() async { | 154 | _createNewdish() async { |
| 146 | FocusScope.of(context).requestFocus(FocusNode()); //点击空白处隐藏键盘 | 155 | FocusScope.of(context).requestFocus(FocusNode()); //点击空白处隐藏键盘 |
| 156 | + String type; | ||
| 157 | + if (widget.isEdit) { | ||
| 158 | + type = widget.isMine ? "2" : "1"; | ||
| 159 | + } else { | ||
| 160 | + type = labelSelIndex == 0 ? '1' : '2'; | ||
| 161 | + } | ||
| 147 | Map<String, String> params = { | 162 | Map<String, String> params = { |
| 148 | 'sellerid': Provider.of<UserModel>(context, listen: false).user.sellerid, | 163 | 'sellerid': Provider.of<UserModel>(context, listen: false).user.sellerid, |
| 149 | "uid": Provider.of<UserModel>(context, listen: false).user.openid, | 164 | "uid": Provider.of<UserModel>(context, listen: false).user.openid, |
| 150 | "pname": _dishNameEditControl.text.trim(), | 165 | "pname": _dishNameEditControl.text.trim(), |
| 151 | - 'type': widget.isMine ? "2" : "1", | 166 | + 'type': type, |
| 152 | "status": swichState ? "1" : "0", | 167 | "status": swichState ? "1" : "0", |
| 153 | 'pnum': pNumC.text, | 168 | 'pnum': pNumC.text, |
| 154 | "menu_price": priceSum, | 169 | "menu_price": priceSum, |
| @@ -156,7 +171,7 @@ class _PlanDishEidtPageState extends State<PlanDishEidtPage> { | @@ -156,7 +171,7 @@ class _PlanDishEidtPageState extends State<PlanDishEidtPage> { | ||
| 156 | "plan_price": dishPriceC.text, | 171 | "plan_price": dishPriceC.text, |
| 157 | "cook_list": json.encode(menuModel), | 172 | "cook_list": json.encode(menuModel), |
| 158 | }; | 173 | }; |
| 159 | - if (widget.sunListPlan != null) { | 174 | + if (widget.sunListPlan != null && widget.isEdit) { |
| 160 | params['id'] = widget.sunListPlan.id; | 175 | params['id'] = widget.sunListPlan.id; |
| 161 | } | 176 | } |
| 162 | // if (!widget.isMine) { | 177 | // if (!widget.isMine) { |
| @@ -200,6 +215,7 @@ class _PlanDishEidtPageState extends State<PlanDishEidtPage> { | @@ -200,6 +215,7 @@ class _PlanDishEidtPageState extends State<PlanDishEidtPage> { | ||
| 200 | textAlign: TextAlign.right, | 215 | textAlign: TextAlign.right, |
| 201 | textAlignVertical: TextAlignVertical.bottom, | 216 | textAlignVertical: TextAlignVertical.bottom, |
| 202 | maxLines: 1, | 217 | maxLines: 1, |
| 218 | + enabled: widget.onlyShow ? false : true, | ||
| 203 | // //光标颜色 | 219 | // //光标颜色 |
| 204 | // cursorColor: | 220 | // cursorColor: |
| 205 | // widget.isSelect ? Colors.white : MyColours.color_199095, | 221 | // widget.isSelect ? Colors.white : MyColours.color_199095, |
| @@ -261,18 +277,22 @@ class _PlanDishEidtPageState extends State<PlanDishEidtPage> { | @@ -261,18 +277,22 @@ class _PlanDishEidtPageState extends State<PlanDishEidtPage> { | ||
| 261 | ), | 277 | ), |
| 262 | HEmptyView(20), | 278 | HEmptyView(20), |
| 263 | Spacer(), | 279 | Spacer(), |
| 264 | - Text(hintText, | ||
| 265 | - style: TextStyle( | ||
| 266 | - color: hintText == '点击选择' | ||
| 267 | - ? MyColours.color_999999 | ||
| 268 | - : MyColours.color_515151, | ||
| 269 | - fontSize: ScreenUtil().setSp(32), | ||
| 270 | - )), | 280 | + widget.onlyShow |
| 281 | + ? SizedBox() | ||
| 282 | + : Text(hintText, | ||
| 283 | + style: TextStyle( | ||
| 284 | + color: widget.onlyShow || hintText == '点击选择' | ||
| 285 | + ? MyColours.color_999999 | ||
| 286 | + : MyColours.color_515151, | ||
| 287 | + fontSize: ScreenUtil().setSp(32), | ||
| 288 | + )), | ||
| 271 | HEmptyView(20), | 289 | HEmptyView(20), |
| 272 | - Image.asset( | ||
| 273 | - Utils.getImgPath('arrow_right_new'), | ||
| 274 | - width: ScreenUtil().setWidth(20), | ||
| 275 | - ), | 290 | + widget.onlyShow |
| 291 | + ? SizedBox() | ||
| 292 | + : Image.asset( | ||
| 293 | + Utils.getImgPath('arrow_right_new'), | ||
| 294 | + width: ScreenUtil().setWidth(20), | ||
| 295 | + ), | ||
| 276 | // HEmptyView(32), | 296 | // HEmptyView(32), |
| 277 | ], | 297 | ], |
| 278 | ), | 298 | ), |
| @@ -463,7 +483,8 @@ class _PlanDishEidtPageState extends State<PlanDishEidtPage> { | @@ -463,7 +483,8 @@ class _PlanDishEidtPageState extends State<PlanDishEidtPage> { | ||
| 463 | child: Column( | 483 | child: Column( |
| 464 | children: [ | 484 | children: [ |
| 465 | VEmptyView(40), | 485 | VEmptyView(40), |
| 466 | - _textfield('排菜名称 *', '点击输入排菜套餐名称'), | 486 | + _textfield(widget.onlyShow ? '排菜名称' : '排菜名称 *', |
| 487 | + '点击输入排菜套餐名称'), | ||
| 467 | MyDivider(double.infinity, w(1), | 488 | MyDivider(double.infinity, w(1), |
| 468 | color: MyColours.color_DBDBDB), | 489 | color: MyColours.color_DBDBDB), |
| 469 | InkWell( | 490 | InkWell( |
| @@ -541,9 +562,11 @@ class _PlanDishEidtPageState extends State<PlanDishEidtPage> { | @@ -541,9 +562,11 @@ class _PlanDishEidtPageState extends State<PlanDishEidtPage> { | ||
| 541 | MyDivider(double.infinity, w(1), | 562 | MyDivider(double.infinity, w(1), |
| 542 | color: MyColours.color_DBDBDB), | 563 | color: MyColours.color_DBDBDB), |
| 543 | _canUse('是否启用', swichState, () { | 564 | _canUse('是否启用', swichState, () { |
| 544 | - setState(() { | ||
| 545 | - swichState = !swichState; | ||
| 546 | - }); | 565 | + if (!widget.onlyShow) { |
| 566 | + setState(() { | ||
| 567 | + swichState = !swichState; | ||
| 568 | + }); | ||
| 569 | + } | ||
| 547 | }), | 570 | }), |
| 548 | MyDivider(double.infinity, w(1), | 571 | MyDivider(double.infinity, w(1), |
| 549 | color: MyColours.color_DBDBDB), | 572 | color: MyColours.color_DBDBDB), |
| @@ -563,24 +586,27 @@ class _PlanDishEidtPageState extends State<PlanDishEidtPage> { | @@ -563,24 +586,27 @@ class _PlanDishEidtPageState extends State<PlanDishEidtPage> { | ||
| 563 | ), | 586 | ), |
| 564 | ), | 587 | ), |
| 565 | Spacer(), | 588 | Spacer(), |
| 566 | - InkWell( | ||
| 567 | - onTap: () { | ||
| 568 | - if (pNum == 0) { | ||
| 569 | - return; | ||
| 570 | - } | ||
| 571 | - pNum--; | ||
| 572 | - pNumC.text = '${pNum}'; | ||
| 573 | - }, | ||
| 574 | - child: Container( | ||
| 575 | - height: w(48), | ||
| 576 | - padding: EdgeInsets.symmetric( | ||
| 577 | - horizontal: w(23)), | ||
| 578 | - child: Image.asset( | ||
| 579 | - Utils.getImgPath('plan_dish_minus'), | ||
| 580 | - width: w(16), | ||
| 581 | - ), | ||
| 582 | - ), | ||
| 583 | - ), | 589 | + widget.onlyShow |
| 590 | + ? SizedBox() | ||
| 591 | + : InkWell( | ||
| 592 | + onTap: () { | ||
| 593 | + if (pNum == 0) { | ||
| 594 | + return; | ||
| 595 | + } | ||
| 596 | + pNum--; | ||
| 597 | + pNumC.text = '${pNum}'; | ||
| 598 | + }, | ||
| 599 | + child: Container( | ||
| 600 | + height: w(48), | ||
| 601 | + padding: EdgeInsets.symmetric( | ||
| 602 | + horizontal: w(23)), | ||
| 603 | + child: Image.asset( | ||
| 604 | + Utils.getImgPath( | ||
| 605 | + 'plan_dish_minus'), | ||
| 606 | + width: w(16), | ||
| 607 | + ), | ||
| 608 | + ), | ||
| 609 | + ), | ||
| 584 | Container( | 610 | Container( |
| 585 | // constraints: BoxConstraints( | 611 | // constraints: BoxConstraints( |
| 586 | // minWidth: w(34), | 612 | // minWidth: w(34), |
| @@ -600,13 +626,17 @@ class _PlanDishEidtPageState extends State<PlanDishEidtPage> { | @@ -600,13 +626,17 @@ class _PlanDishEidtPageState extends State<PlanDishEidtPage> { | ||
| 600 | controller: pNumC, | 626 | controller: pNumC, |
| 601 | // focusNode: _focusNode, | 627 | // focusNode: _focusNode, |
| 602 | // autofocus: true, | 628 | // autofocus: true, |
| 629 | + enabled: | ||
| 630 | + widget.onlyShow ? false : true, | ||
| 603 | inputFormatters: [ | 631 | inputFormatters: [ |
| 604 | FilteringTextInputFormatter.allow( | 632 | FilteringTextInputFormatter.allow( |
| 605 | RegExp(r'[0-9]')), | 633 | RegExp(r'[0-9]')), |
| 606 | ], | 634 | ], |
| 607 | 635 | ||
| 608 | style: TextStyle( | 636 | style: TextStyle( |
| 609 | - color: MyColours.color_438E93, | 637 | + color: widget.onlyShow |
| 638 | + ? MyColours.color_515151 | ||
| 639 | + : MyColours.color_438E93, | ||
| 610 | fontSize: font(16)), | 640 | fontSize: font(16)), |
| 611 | textAlign: TextAlign.center, | 641 | textAlign: TextAlign.center, |
| 612 | // textAlignVertical: TextAlignVertical.center, | 642 | // textAlignVertical: TextAlignVertical.center, |
| @@ -654,20 +684,24 @@ class _PlanDishEidtPageState extends State<PlanDishEidtPage> { | @@ -654,20 +684,24 @@ class _PlanDishEidtPageState extends State<PlanDishEidtPage> { | ||
| 654 | // _focusNode.unfocus(); | 684 | // _focusNode.unfocus(); |
| 655 | }, | 685 | }, |
| 656 | )), | 686 | )), |
| 657 | - InkWell( | ||
| 658 | - onTap: () { | ||
| 659 | - pNum++; | ||
| 660 | - pNumC.text = '${pNum}'; | ||
| 661 | - }, | ||
| 662 | - child: Container( | ||
| 663 | - height: w(48), | ||
| 664 | - padding: EdgeInsets.only(left: w(23)), | ||
| 665 | - child: Image.asset( | ||
| 666 | - Utils.getImgPath('plan_dish_add'), | ||
| 667 | - width: w(16), | ||
| 668 | - ), | ||
| 669 | - ), | ||
| 670 | - ), | 687 | + widget.onlyShow |
| 688 | + ? SizedBox() | ||
| 689 | + : InkWell( | ||
| 690 | + onTap: () { | ||
| 691 | + pNum++; | ||
| 692 | + pNumC.text = '${pNum}'; | ||
| 693 | + }, | ||
| 694 | + child: Container( | ||
| 695 | + height: w(48), | ||
| 696 | + padding: EdgeInsets.only( | ||
| 697 | + left: w(23)), | ||
| 698 | + child: Image.asset( | ||
| 699 | + Utils.getImgPath( | ||
| 700 | + 'plan_dish_add'), | ||
| 701 | + width: w(16), | ||
| 702 | + ), | ||
| 703 | + ), | ||
| 704 | + ), | ||
| 671 | ], | 705 | ], |
| 672 | )), | 706 | )), |
| 673 | MyDivider(double.infinity, w(1), | 707 | MyDivider(double.infinity, w(1), |
| @@ -690,7 +724,9 @@ class _PlanDishEidtPageState extends State<PlanDishEidtPage> { | @@ -690,7 +724,9 @@ class _PlanDishEidtPageState extends State<PlanDishEidtPage> { | ||
| 690 | Text( | 724 | Text( |
| 691 | '${priceSum}元/${memberPriceSum}元', | 725 | '${priceSum}元/${memberPriceSum}元', |
| 692 | style: TextStyle( | 726 | style: TextStyle( |
| 693 | - color: MyColours.color_99515151, | 727 | + color: widget.onlyShow |
| 728 | + ? MyColours.color_515151 | ||
| 729 | + : MyColours.color_99515151, | ||
| 694 | fontSize: ScreenUtil().setSp(32)), | 730 | fontSize: ScreenUtil().setSp(32)), |
| 695 | ), | 731 | ), |
| 696 | ])), | 732 | ])), |
| @@ -714,7 +750,7 @@ class _PlanDishEidtPageState extends State<PlanDishEidtPage> { | @@ -714,7 +750,7 @@ class _PlanDishEidtPageState extends State<PlanDishEidtPage> { | ||
| 714 | controller: dishPriceC, | 750 | controller: dishPriceC, |
| 715 | // focusNode: _focusNode, | 751 | // focusNode: _focusNode, |
| 716 | // autofocus: true, | 752 | // autofocus: true, |
| 717 | - | 753 | + enabled: widget.onlyShow ? false : true, |
| 718 | style: TextStyle( | 754 | style: TextStyle( |
| 719 | color: MyColours.color_515151, | 755 | color: MyColours.color_515151, |
| 720 | fontSize: font(16)), | 756 | fontSize: font(16)), |
| @@ -763,96 +799,143 @@ class _PlanDishEidtPageState extends State<PlanDishEidtPage> { | @@ -763,96 +799,143 @@ class _PlanDishEidtPageState extends State<PlanDishEidtPage> { | ||
| 763 | color: MyColours.color_DBDBDB), | 799 | color: MyColours.color_DBDBDB), |
| 764 | VEmptyView(24), | 800 | VEmptyView(24), |
| 765 | _select('菜品', '编辑', () async { | 801 | _select('菜品', '编辑', () async { |
| 766 | - FocusScope.of(context) | ||
| 767 | - .requestFocus(FocusNode()); //点击空白处隐藏键盘 | ||
| 768 | - Map temp; | ||
| 769 | - if (menuModel == null) { | ||
| 770 | - temp = await NavigatorUtil.goPlanNewDishPage( | ||
| 771 | - context, | ||
| 772 | - ); | ||
| 773 | - } else { | ||
| 774 | - temp = await NavigatorUtil.goPlanNewDishPage( | 802 | + if (widget.onlyShow) { |
| 803 | + FocusScope.of(context) | ||
| 804 | + .requestFocus(FocusNode()); //点击空白处隐藏键盘 | ||
| 805 | + Map temp; | ||
| 806 | + if (menuModel == null) { | ||
| 807 | + temp = | ||
| 808 | + await NavigatorUtil.goPlanNewDishPage( | ||
| 775 | context, | 809 | context, |
| 776 | - object: {'object': menuModel}, | ||
| 777 | - planDishPrice: dishPriceC.text); | ||
| 778 | - } | 810 | + ); |
| 811 | + } else { | ||
| 812 | + temp = | ||
| 813 | + await NavigatorUtil.goPlanNewDishPage( | ||
| 814 | + context, | ||
| 815 | + object: {'object': menuModel}, | ||
| 816 | + planDishPrice: dishPriceC.text); | ||
| 817 | + } | ||
| 779 | 818 | ||
| 780 | - if (temp != null) { | ||
| 781 | - double priceSumTemp = temp['priceSum']; | ||
| 782 | - double memberPriceSumTemp = | ||
| 783 | - temp['memberPriceSum']; | ||
| 784 | - String planDishSum = temp['planDishSum']; | ||
| 785 | - menuModel = temp['menu']; //菜品数据 | ||
| 786 | - print(priceSum); | ||
| 787 | - print(memberPriceSum); | ||
| 788 | - print(planDishSum); | ||
| 789 | - print(menuModel); | 819 | + if (temp != null) { |
| 820 | + double priceSumTemp = temp['priceSum']; | ||
| 821 | + double memberPriceSumTemp = | ||
| 822 | + temp['memberPriceSum']; | ||
| 823 | + String planDishSum = temp['planDishSum']; | ||
| 824 | + menuModel = temp['menu']; //菜品数据 | ||
| 825 | + print(priceSum); | ||
| 826 | + print(memberPriceSum); | ||
| 827 | + print(planDishSum); | ||
| 828 | + print(menuModel); | ||
| 790 | 829 | ||
| 791 | - // 刷新页面*************** | ||
| 792 | - priceSum = priceSumTemp.toString(); | ||
| 793 | - memberPriceSum = | ||
| 794 | - memberPriceSumTemp.toString(); | ||
| 795 | - dishPriceC.text = planDishSum; | ||
| 796 | - String dish = ''; | ||
| 797 | - menuModel.forEach((element) { | ||
| 798 | - element.cookbooklist.forEach((cookbook) { | ||
| 799 | - if (cookbook.amount > 0) { | ||
| 800 | - dish += cookbook.name + '、'; | ||
| 801 | - } | 830 | + // 刷新页面*************** |
| 831 | + priceSum = priceSumTemp.toString(); | ||
| 832 | + memberPriceSum = | ||
| 833 | + memberPriceSumTemp.toString(); | ||
| 834 | + dishPriceC.text = planDishSum; | ||
| 835 | + String dish = ''; | ||
| 836 | + menuModel.forEach((element) { | ||
| 837 | + element.cookbooklist.forEach((cookbook) { | ||
| 838 | + if (cookbook.amount > 0) { | ||
| 839 | + dish += cookbook.name + '、'; | ||
| 840 | + } | ||
| 841 | + }); | ||
| 802 | }); | 842 | }); |
| 803 | - }); | ||
| 804 | - if (dish.endsWith('、')) { | ||
| 805 | - dish = dish.substring(0, dish.length - 1); | 843 | + if (dish.endsWith('、')) { |
| 844 | + dish = dish.substring(0, dish.length - 1); | ||
| 845 | + } | ||
| 846 | + _dishExplainEditControl.text = dish; | ||
| 806 | } | 847 | } |
| 807 | - _dishExplainEditControl.text = dish; | ||
| 808 | } | 848 | } |
| 809 | }), | 849 | }), |
| 810 | - _explain('券说明', '点击上面右侧的“编辑”,开始选菜吧!'), | 850 | + widget.onlyShow |
| 851 | + ? Container( | ||
| 852 | + width: double.infinity, | ||
| 853 | + // height: ScreenUtil().setWidth(380), | ||
| 854 | + // padding: EdgeInsets.symmetric( | ||
| 855 | + // // horizontal: w(16), | ||
| 856 | + // vertical: ScreenUtil().setWidth(20)), | ||
| 857 | + // decoration: BoxDecoration( | ||
| 858 | + // borderRadius: | ||
| 859 | + // BorderRadius.circular(r(5)), | ||
| 860 | + // border: Border.all( | ||
| 861 | + // width: w(1), | ||
| 862 | + // color: MyColours.color_DBDBDB)), | ||
| 863 | + child: Text( | ||
| 864 | + _dishExplainEditControl.text, | ||
| 865 | + style: TextStyle( | ||
| 866 | + fontSize: ScreenUtil().setSp(32), | ||
| 867 | + color: MyColours.color_999999), | ||
| 868 | + )) | ||
| 869 | + : _explain('券说明', '点击上面右侧的“编辑”,开始选菜吧!'), | ||
| 811 | VEmptyView(20), | 870 | VEmptyView(20), |
| 812 | ], | 871 | ], |
| 813 | ))), | 872 | ))), |
| 814 | ), | 873 | ), |
| 815 | VEmptyView(20), | 874 | VEmptyView(20), |
| 816 | - RoundButton( | ||
| 817 | - onPressed: () { | ||
| 818 | - // if (_dishNameEditControl.text.trim().length == 0) { | ||
| 819 | - // Utils.showToast('请填写券名称'); | ||
| 820 | - // return; | ||
| 821 | - // } | ||
| 822 | - // if (_dishRequireEditControl.text.trim().length == 0) { | ||
| 823 | - // Utils.showToast('请填写券要求'); | ||
| 824 | - // return; | ||
| 825 | - // } | ||
| 826 | - // if (fromDate == '点击选择') { | ||
| 827 | - // Utils.showToast('请选择有效期起始时间'); | ||
| 828 | - // return; | ||
| 829 | - // } | ||
| 830 | - // if (endDate == '点击选择') { | ||
| 831 | - // Utils.showToast('请选择有效期结束时间'); | ||
| 832 | - // return; | ||
| 833 | - // } | ||
| 834 | - // if (DateUtil.getDateTime(endDate) | ||
| 835 | - // .compareTo(DateUtil.getDateTime(fromDate)) < | ||
| 836 | - // 0) { | ||
| 837 | - // Utils.showToast('有效期结束时间不能早于起始时间'); | ||
| 838 | - // return; | ||
| 839 | - // } | ||
| 840 | - // // ***参数*** | ||
| 841 | - // // _dishNameEditControl.text | ||
| 842 | - // // _dishRequireEditControl.text | ||
| 843 | - // // fromDate | ||
| 844 | - // // endDate | ||
| 845 | - // // _dishExplainEditControl.text | ||
| 846 | - // // swichState | ||
| 847 | - _createNewdish(); | ||
| 848 | - }, | ||
| 849 | - text: '保存', | ||
| 850 | - fontSize: 24, | ||
| 851 | - isBold: false, | ||
| 852 | - height: ScreenUtil().setWidth(37 * 2), | ||
| 853 | - width: ScreenUtil().setWidth(130 * 2), | ||
| 854 | - radius: ScreenUtil().setWidth(22), | ||
| 855 | - ), | 875 | + widget.onlyShow |
| 876 | + ? Container( | ||
| 877 | + padding: EdgeInsets.only( | ||
| 878 | + top: w(12), | ||
| 879 | + bottom: w(25), | ||
| 880 | + left: w(45), | ||
| 881 | + right: w(45)), | ||
| 882 | + child: RoundButton( | ||
| 883 | + onPressed: () { | ||
| 884 | + Navigator.pop(context); | ||
| 885 | + }, | ||
| 886 | + text: '返回', | ||
| 887 | + fontSize: 32, | ||
| 888 | + isBold: false, | ||
| 889 | + height: ScreenUtil().setWidth(43 * 2), | ||
| 890 | + // width: ScreenUtil().setWidth(130 * 2), | ||
| 891 | + radius: ScreenUtil().setWidth(10), | ||
| 892 | + )) | ||
| 893 | + : Container( | ||
| 894 | + padding: EdgeInsets.only( | ||
| 895 | + top: w(12), | ||
| 896 | + bottom: w(25), | ||
| 897 | + left: w(45), | ||
| 898 | + right: w(45)), | ||
| 899 | + child: RoundButton( | ||
| 900 | + onPressed: () { | ||
| 901 | + if (_dishNameEditControl.text.trim().length == 0) { | ||
| 902 | + Utils.showToast('请输入排菜套餐名称'); | ||
| 903 | + return; | ||
| 904 | + } | ||
| 905 | + // if (_dishRequireEditControl.text.trim().length == 0) { | ||
| 906 | + // Utils.showToast('请填写券要求'); | ||
| 907 | + // return; | ||
| 908 | + // } | ||
| 909 | + // if (fromDate == '点击选择') { | ||
| 910 | + // Utils.showToast('请选择有效期起始时间'); | ||
| 911 | + // return; | ||
| 912 | + // } | ||
| 913 | + // if (endDate == '点击选择') { | ||
| 914 | + // Utils.showToast('请选择有效期结束时间'); | ||
| 915 | + // return; | ||
| 916 | + // } | ||
| 917 | + // if (DateUtil.getDateTime(endDate) | ||
| 918 | + // .compareTo(DateUtil.getDateTime(fromDate)) < | ||
| 919 | + // 0) { | ||
| 920 | + // Utils.showToast('有效期结束时间不能早于起始时间'); | ||
| 921 | + // return; | ||
| 922 | + // } | ||
| 923 | + // // ***参数*** | ||
| 924 | + // // _dishNameEditControl.text | ||
| 925 | + // // _dishRequireEditControl.text | ||
| 926 | + // // fromDate | ||
| 927 | + // // endDate | ||
| 928 | + // // _dishExplainEditControl.text | ||
| 929 | + // // swichState | ||
| 930 | + _createNewdish(); | ||
| 931 | + }, | ||
| 932 | + text: '保存', | ||
| 933 | + fontSize: 32, | ||
| 934 | + isBold: false, | ||
| 935 | + height: ScreenUtil().setWidth(43 * 2), | ||
| 936 | + // width: ScreenUtil().setWidth(130 * 2), | ||
| 937 | + radius: ScreenUtil().setWidth(10), | ||
| 938 | + )), | ||
| 856 | VEmptyView(32) | 939 | VEmptyView(32) |
| 857 | ]))), | 940 | ]))), |
| 858 | ); | 941 | ); |
| @@ -207,7 +207,7 @@ class _PlanDishItemState extends State<PlanDishItem> { | @@ -207,7 +207,7 @@ class _PlanDishItemState extends State<PlanDishItem> { | ||
| 207 | // ? '被领取:${sunModel.receiveNum}张 已核销:${sunModel.useNum}张' | 207 | // ? '被领取:${sunModel.receiveNum}张 已核销:${sunModel.useNum}张' |
| 208 | // : '创建人:${sunModel.nickname ?? sunModel.uid} 被领取:${sunModel.receiveNum}张' | 208 | // : '创建人:${sunModel.nickname ?? sunModel.uid} 被领取:${sunModel.receiveNum}张' |
| 209 | // : '被领取:${sunModel.receiveNum}张', | 209 | // : '被领取:${sunModel.receiveNum}张', |
| 210 | - '更新时间:2022-11-08', | 210 | + '更新时间:${widget.sunList.cdateStr}', |
| 211 | maxLines: 1, | 211 | maxLines: 1, |
| 212 | overflow: TextOverflow.ellipsis, | 212 | overflow: TextOverflow.ellipsis, |
| 213 | style: TextStyle( | 213 | style: TextStyle( |
| @@ -215,7 +215,7 @@ class _PlanDishItemState extends State<PlanDishItem> { | @@ -215,7 +215,7 @@ class _PlanDishItemState extends State<PlanDishItem> { | ||
| 215 | fontSize: ScreenUtil().setSp(20))), | 215 | fontSize: ScreenUtil().setSp(20))), |
| 216 | Spacer(), | 216 | Spacer(), |
| 217 | //私,则是自己的,可删除 | 217 | //私,则是自己的,可删除 |
| 218 | - true || | 218 | + widget.sunList.type == '2' || |
| 219 | userModel.user.role_name == '管理员' || | 219 | userModel.user.role_name == '管理员' || |
| 220 | userModel.user.role_name == '店长' | 220 | userModel.user.role_name == '店长' |
| 221 | ? RoundButton( | 221 | ? RoundButton( |
| @@ -232,18 +232,22 @@ class _PlanDishItemState extends State<PlanDishItem> { | @@ -232,18 +232,22 @@ class _PlanDishItemState extends State<PlanDishItem> { | ||
| 232 | ) | 232 | ) |
| 233 | : SizedBox(), | 233 | : SizedBox(), |
| 234 | HEmptyView(34), | 234 | HEmptyView(34), |
| 235 | - RoundButton( | ||
| 236 | - width: ScreenUtil().setWidth(50 * 2), | ||
| 237 | - height: ScreenUtil().setWidth(20 * 2), | ||
| 238 | - radius: ScreenUtil().setWidth(10), | ||
| 239 | - text: '复用', | ||
| 240 | - fontSize: 24, | ||
| 241 | - textColor: MyColours.color_438E93, | ||
| 242 | - borderColor: MyColours.color_438E93, | ||
| 243 | - gradientStart: MyColours.color_ffffff, | ||
| 244 | - gradientEnd: MyColours.color_ffffff, | ||
| 245 | - onPressed: widget.onPressedReUse, | ||
| 246 | - ) | 235 | + widget.sunList.type == '2' || |
| 236 | + userModel.user.role_name == '管理员' || | ||
| 237 | + userModel.user.role_name == '店长' | ||
| 238 | + ? RoundButton( | ||
| 239 | + width: ScreenUtil().setWidth(50 * 2), | ||
| 240 | + height: ScreenUtil().setWidth(20 * 2), | ||
| 241 | + radius: ScreenUtil().setWidth(10), | ||
| 242 | + text: '复用', | ||
| 243 | + fontSize: 24, | ||
| 244 | + textColor: MyColours.color_438E93, | ||
| 245 | + borderColor: MyColours.color_438E93, | ||
| 246 | + gradientStart: MyColours.color_ffffff, | ||
| 247 | + gradientEnd: MyColours.color_ffffff, | ||
| 248 | + onPressed: widget.onPressedReUse, | ||
| 249 | + ) | ||
| 250 | + : SizedBox() | ||
| 247 | ], | 251 | ], |
| 248 | )) | 252 | )) |
| 249 | ]))); | 253 | ]))); |
| @@ -21,7 +21,10 @@ import '../../../utils/dialog_util.dart'; | @@ -21,7 +21,10 @@ import '../../../utils/dialog_util.dart'; | ||
| 21 | 21 | ||
| 22 | class PlanDishSunPage extends StatefulWidget { | 22 | class PlanDishSunPage extends StatefulWidget { |
| 23 | final int index; | 23 | final int index; |
| 24 | - PlanDishSunPage({Key key, this.index}) : super(key: key); | 24 | + final List<SunListPlan> data; |
| 25 | + final PageState pageState; | ||
| 26 | + PlanDishSunPage({Key key, this.index, this.data, this.pageState}) | ||
| 27 | + : super(key: key); | ||
| 25 | 28 | ||
| 26 | @override | 29 | @override |
| 27 | _PlanDishSunPageState createState() => _PlanDishSunPageState(); | 30 | _PlanDishSunPageState createState() => _PlanDishSunPageState(); |
| @@ -29,8 +32,9 @@ class PlanDishSunPage extends StatefulWidget { | @@ -29,8 +32,9 @@ class PlanDishSunPage extends StatefulWidget { | ||
| 29 | 32 | ||
| 30 | class _PlanDishSunPageState extends State<PlanDishSunPage> { | 33 | class _PlanDishSunPageState extends State<PlanDishSunPage> { |
| 31 | EasyRefreshController _controller = EasyRefreshController(); | 34 | EasyRefreshController _controller = EasyRefreshController(); |
| 32 | - PlanDishProvider planDishProvider; | 35 | + |
| 33 | List<PersonnelManageSunModel> authUserLists = []; | 36 | List<PersonnelManageSunModel> authUserLists = []; |
| 37 | + PlanDishProvider planDishProvider; | ||
| 34 | 38 | ||
| 35 | @override | 39 | @override |
| 36 | void initState() { | 40 | void initState() { |
| @@ -38,41 +42,30 @@ class _PlanDishSunPageState extends State<PlanDishSunPage> { | @@ -38,41 +42,30 @@ class _PlanDishSunPageState extends State<PlanDishSunPage> { | ||
| 38 | super.initState(); | 42 | super.initState(); |
| 39 | 43 | ||
| 40 | WidgetsBinding.instance.addPostFrameCallback((_) { | 44 | WidgetsBinding.instance.addPostFrameCallback((_) { |
| 41 | - if (widget.index == 0) { | ||
| 42 | - planDishProvider.pageStateHome = PageState.Loading; | ||
| 43 | - } else if (widget.index == 1) { | ||
| 44 | - planDishProvider.pageStateStore = PageState.Loading; | ||
| 45 | - } else if (widget.index == 2) { | ||
| 46 | - planDishProvider.pageStateMine = PageState.Loading; | ||
| 47 | - } | ||
| 48 | - planDishProvider.notifyListeners(); | ||
| 49 | - _getPlanCookList(widget.index, isShowLoading: false); | 45 | + // if (widget.index == 0) { |
| 46 | + // planDishProvider.pageStateHome = PageState.Loading; | ||
| 47 | + // } else if (widget.index == 1) { | ||
| 48 | + // planDishProvider.pageStateStore = PageState.Loading; | ||
| 49 | + // } else if (widget.index == 2) { | ||
| 50 | + // planDishProvider.pageStateMine = PageState.Loading; | ||
| 51 | + // } | ||
| 52 | + // planDishProvider.notifyListeners(); | ||
| 53 | + // _getPlanCookList(widget.index, isShowLoading: false); | ||
| 50 | 54 | ||
| 51 | // bus.on("refresh_coupon_list_f", (arg) { | 55 | // bus.on("refresh_coupon_list_f", (arg) { |
| 52 | // _couponNetworkData(widget.index); | 56 | // _couponNetworkData(widget.index); |
| 53 | // }); | 57 | // }); |
| 54 | }); | 58 | }); |
| 55 | - bus.on('refresh_dish_plan_home_list', (arg) { | ||
| 56 | - _getPlanCookList(widget.index, isShowLoading: false); | ||
| 57 | - }); | ||
| 58 | } | 59 | } |
| 59 | 60 | ||
| 60 | - @override | ||
| 61 | - void dispose() { | ||
| 62 | - super.dispose(); | ||
| 63 | - bus.off('refresh_dish_plan_home_list'); | ||
| 64 | - } | ||
| 65 | - | ||
| 66 | - ///排菜/套餐列表 | ||
| 67 | - | ||
| 68 | - _getPlanCookList(int index, {bool isShowLoading = true}) async { | ||
| 69 | - Map<String, String> params = { | ||
| 70 | - "uid": Provider.of<UserModel>(context, listen: false).user.openid, | ||
| 71 | - // 'is_time': '0' | ||
| 72 | - "sellerid": Provider.of<UserModel>(context, listen: false).user.sellerid, | ||
| 73 | - }; | ||
| 74 | - await planDishProvider.getPlanCookList(context, params, | ||
| 75 | - showLoading: isShowLoading); | 61 | + delPlanCook(String id) async { |
| 62 | + Map<String, String> params = {"id": id}; | ||
| 63 | + bool success = | ||
| 64 | + await planDishProvider.delPlanCook(context, params, showLoading: true); | ||
| 65 | + if (success) { | ||
| 66 | + // _getPlanCookList(widget.index, isShowLoading: true); | ||
| 67 | + bus.emit('refresh_dish_plan_home_list'); | ||
| 68 | + } | ||
| 76 | } | 69 | } |
| 77 | 70 | ||
| 78 | ///修改活动信息 | 71 | ///修改活动信息 |
| @@ -96,24 +89,12 @@ class _PlanDishSunPageState extends State<PlanDishSunPage> { | @@ -96,24 +89,12 @@ class _PlanDishSunPageState extends State<PlanDishSunPage> { | ||
| 96 | 89 | ||
| 97 | @override | 90 | @override |
| 98 | Widget build(BuildContext context) { | 91 | Widget build(BuildContext context) { |
| 99 | - planDishProvider = Provider.of<PlanDishProvider>(context, listen: true); | ||
| 100 | - PageState pageState; | ||
| 101 | - List<SunListPlan> data = []; | ||
| 102 | - if (widget.index == 0) { | ||
| 103 | - pageState = planDishProvider.pageStateHome; | ||
| 104 | - data = planDishProvider.allList; | ||
| 105 | - } else if (widget.index == 1) { | ||
| 106 | - pageState = planDishProvider.pageStateStore; | ||
| 107 | - data = planDishProvider.storeList; | ||
| 108 | - } else if (widget.index == 2) { | ||
| 109 | - pageState = planDishProvider.pageStateMine; | ||
| 110 | - data = planDishProvider.mineList; | ||
| 111 | - } | 92 | + planDishProvider = Provider.of<PlanDishProvider>(context, listen: true); |
| 112 | return Container( | 93 | return Container( |
| 113 | child: Consumer<CouponProvider>(builder: (context, model, _) { | 94 | child: Consumer<CouponProvider>(builder: (context, model, _) { |
| 114 | - if (pageState != PageState.Success) { | 95 | + if (widget.pageState != PageState.Success) { |
| 115 | return ExceptionPage( | 96 | return ExceptionPage( |
| 116 | - pageState: pageState, | 97 | + pageState: widget.pageState, |
| 117 | callback: () { | 98 | callback: () { |
| 118 | // offset = 0; | 99 | // offset = 0; |
| 119 | // getMessage(showLoading: true); | 100 | // getMessage(showLoading: true); |
| @@ -122,7 +103,7 @@ class _PlanDishSunPageState extends State<PlanDishSunPage> { | @@ -122,7 +103,7 @@ class _PlanDishSunPageState extends State<PlanDishSunPage> { | ||
| 122 | emptyMsg: "暂时没有列表信息哦,", | 103 | emptyMsg: "暂时没有列表信息哦,", |
| 123 | emptyImg: "empty_search", | 104 | emptyImg: "empty_search", |
| 124 | showMsg: "加载中,请稍后...", | 105 | showMsg: "加载中,请稍后...", |
| 125 | - needEmpty: true, | 106 | + // needEmpty: true, |
| 126 | ); | 107 | ); |
| 127 | } else { | 108 | } else { |
| 128 | return EasyRefresh.custom( | 109 | return EasyRefresh.custom( |
| @@ -134,13 +115,21 @@ class _PlanDishSunPageState extends State<PlanDishSunPage> { | @@ -134,13 +115,21 @@ class _PlanDishSunPageState extends State<PlanDishSunPage> { | ||
| 134 | (BuildContext context, int index) { | 115 | (BuildContext context, int index) { |
| 135 | return InkWell( | 116 | return InkWell( |
| 136 | onTap: () async { | 117 | onTap: () async { |
| 118 | + UserModel userModel = | ||
| 119 | + Provider.of<UserModel>(context, listen: false); | ||
| 120 | + bool canedit = widget.data[index].type == '0' || | ||
| 121 | + userModel.user.role_name == '管理员' || | ||
| 122 | + userModel.user.role_name == '店长'; | ||
| 123 | + | ||
| 137 | bool needRefresh = | 124 | bool needRefresh = |
| 138 | await NavigatorUtil.goPlanDishEditPage(context, | 125 | await NavigatorUtil.goPlanDishEditPage(context, |
| 139 | - isEdit: true, sunList: data[index]); | 126 | + isEdit: true, |
| 127 | + sunList: widget.data[index], | ||
| 128 | + onlyShow: !canedit); | ||
| 140 | }, | 129 | }, |
| 141 | child: PlanDishItem( | 130 | child: PlanDishItem( |
| 142 | // from: 'quan', | 131 | // from: 'quan', |
| 143 | - sunList: data[index], | 132 | + sunList: widget.data[index], |
| 144 | // showBtn: true, | 133 | // showBtn: true, |
| 145 | onPressedDel: () { | 134 | onPressedDel: () { |
| 146 | //弹框确认是否删除 | 135 | //弹框确认是否删除 |
| @@ -149,16 +138,16 @@ class _PlanDishSunPageState extends State<PlanDishSunPage> { | @@ -149,16 +138,16 @@ class _PlanDishSunPageState extends State<PlanDishSunPage> { | ||
| 149 | content: "确定要将该排菜删除吗?删除后将无法再次使用该排菜。", | 138 | content: "确定要将该排菜删除吗?删除后将无法再次使用该排菜。", |
| 150 | rTitle: "确定", rCallback: () { | 139 | rTitle: "确定", rCallback: () { |
| 151 | // Navigator.pop(context); | 140 | // Navigator.pop(context); |
| 152 | - // _delGuestInfocDay(model.cday[index].id); | 141 | + delPlanCook(widget.data[index].id); |
| 153 | }); | 142 | }); |
| 154 | }, | 143 | }, |
| 155 | onPressedReUse: () async { | 144 | onPressedReUse: () async { |
| 156 | bool needRefresh = | 145 | bool needRefresh = |
| 157 | await NavigatorUtil.goPlanDishEditPage(context, | 146 | await NavigatorUtil.goPlanDishEditPage(context, |
| 158 | - isMine: false, isEdit: false); | 147 | + isEdit: false, sunList: widget.data[index]); |
| 159 | }, | 148 | }, |
| 160 | )); | 149 | )); |
| 161 | - }, childCount: data.length), | 150 | + }, childCount: widget.data.length), |
| 162 | ), | 151 | ), |
| 163 | // SliverList( | 152 | // SliverList( |
| 164 | // delegate: SliverChildBuilderDelegate( | 153 | // delegate: SliverChildBuilderDelegate( |
| 1 | import 'package:flutter/material.dart'; | 1 | import 'package:flutter/material.dart'; |
| 2 | import 'package:one_key/models/cookbook_model.dart'; | 2 | import 'package:one_key/models/cookbook_model.dart'; |
| 3 | +import 'package:one_key/models/plan_cook_list_model.dart'; | ||
| 3 | import 'package:one_key/provider/plan_dish_provider.dart'; | 4 | import 'package:one_key/provider/plan_dish_provider.dart'; |
| 4 | import 'package:one_key/utils/screen_util.dart'; | 5 | import 'package:one_key/utils/screen_util.dart'; |
| 5 | import 'package:one_key/widgets/h_empty_view.dart'; | 6 | import 'package:one_key/widgets/h_empty_view.dart'; |
| @@ -16,6 +17,7 @@ import '../../../utils/utils.dart'; | @@ -16,6 +17,7 @@ import '../../../utils/utils.dart'; | ||
| 16 | import '../../../widgets/MyDivider.dart'; | 17 | import '../../../widgets/MyDivider.dart'; |
| 17 | import '../../../widgets/page_exception.dart'; | 18 | import '../../../widgets/page_exception.dart'; |
| 18 | import '../../../widgets/round_button.dart'; | 19 | import '../../../widgets/round_button.dart'; |
| 20 | +import '../../models/cookbook_model.dart'; | ||
| 19 | import '../../provider/user_model.dart'; | 21 | import '../../provider/user_model.dart'; |
| 20 | 22 | ||
| 21 | const scrollDuration = Duration(microseconds: 500); | 23 | const scrollDuration = Duration(microseconds: 500); |
| @@ -42,27 +44,145 @@ class _OrderAdvanceEidtPageState extends State<OrderAdvanceEidtPage> { | @@ -42,27 +44,145 @@ class _OrderAdvanceEidtPageState extends State<OrderAdvanceEidtPage> { | ||
| 42 | 44 | ||
| 43 | PlanDishProvider _planDishProvider; | 45 | PlanDishProvider _planDishProvider; |
| 44 | 46 | ||
| 47 | + int carSum = 0; //购物车显示菜品总个数 | ||
| 48 | + double priceSum = 0; //总计 | ||
| 49 | + double memberPriceSum = 0; //会员价 | ||
| 50 | + TextEditingController planDishC = TextEditingController(); //排菜价 | ||
| 51 | + List<MenuSunModel> selectMenu = []; | ||
| 52 | + | ||
| 45 | @override | 53 | @override |
| 46 | void initState() { | 54 | void initState() { |
| 47 | super.initState(); | 55 | super.initState(); |
| 56 | + | ||
| 48 | WidgetsBinding.instance.addPostFrameCallback((_) async { | 57 | WidgetsBinding.instance.addPostFrameCallback((_) async { |
| 49 | - _getCookbookByClass(showLoading: false); | 58 | + _getPageMenuData(); |
| 50 | }); | 59 | }); |
| 51 | } | 60 | } |
| 52 | 61 | ||
| 53 | - _getCookbookByClass({bool showLoading = true}) async { | 62 | + _getPageMenuData() async { |
| 63 | + Future.wait<bool>( | ||
| 64 | + [_getCookbookByClass(showLoading: true), _getPlanCookList()]) | ||
| 65 | + .then((results) { | ||
| 66 | + print(results[0]); | ||
| 67 | + if (results[0] && results[1]) { | ||
| 68 | + _planDishProvider.menuModelForManager | ||
| 69 | + .addAll(_planDishProvider.menuModel); | ||
| 70 | + //成功 | ||
| 71 | + MenuModel menuModelSetMeal = MenuModel(); | ||
| 72 | + menuModelSetMeal.className = '套餐'; | ||
| 73 | + List<MenuSunModel> cookList = []; | ||
| 74 | + List<SunListPlan> storeList = _planDishProvider.storeList; | ||
| 75 | + storeList.forEach((element) { | ||
| 76 | + MenuSunModel menuSunModel = MenuSunModel(); | ||
| 77 | + menuSunModel.id = element.id; | ||
| 78 | + menuSunModel.name = element.pname; | ||
| 79 | + menuSunModel.price = element.menuPrice; | ||
| 80 | + menuSunModel.member_price = element.memberPrice; | ||
| 81 | + menuSunModel.unit = '份'; | ||
| 82 | + // menuSunModel.amount = element.amount; | ||
| 83 | + menuSunModel.cookList = element.cookList; | ||
| 84 | + | ||
| 85 | + cookList.add(menuSunModel); | ||
| 86 | + }); | ||
| 87 | + menuModelSetMeal.cookbooklist = cookList; | ||
| 88 | + | ||
| 89 | + _planDishProvider.menuModelForManager | ||
| 90 | + .insert(0, menuModelSetMeal); //添加套餐 | ||
| 91 | + | ||
| 92 | + MenuModel menuModelPlanDish = MenuModel(); | ||
| 93 | + menuModelPlanDish.className = '我的排菜'; | ||
| 94 | + List<MenuSunModel> cookListPlanDish = []; | ||
| 95 | + List<SunListPlan> mineList = _planDishProvider.mineList; | ||
| 96 | + mineList.forEach((element) { | ||
| 97 | + MenuSunModel menuSunModel = MenuSunModel(); | ||
| 98 | + menuSunModel.id = element.id; | ||
| 99 | + menuSunModel.name = element.pname; | ||
| 100 | + menuSunModel.price = element.menuPrice; | ||
| 101 | + menuSunModel.member_price = element.memberPrice; | ||
| 102 | + menuSunModel.unit = '份'; | ||
| 103 | + // menuSunModel.amount = element.amount; | ||
| 104 | + menuSunModel.cookList = element.cookList; | ||
| 105 | + | ||
| 106 | + cookListPlanDish.add(menuSunModel); | ||
| 107 | + }); | ||
| 108 | + menuModelPlanDish.cookbooklist = cookListPlanDish; | ||
| 109 | + | ||
| 110 | + _planDishProvider.menuModelForManager | ||
| 111 | + .insert(1, menuModelPlanDish); //添加排菜 | ||
| 112 | + setState(() {}); | ||
| 113 | + } else { | ||
| 114 | + if (!results[0]) { | ||
| 115 | + // Utils.showToast(''); | ||
| 116 | + } else { | ||
| 117 | + // Utils.showToast(''); | ||
| 118 | + } | ||
| 119 | + } | ||
| 120 | + }).catchError((e) { | ||
| 121 | + print(e); | ||
| 122 | + }); | ||
| 123 | + } | ||
| 124 | + | ||
| 125 | + ///菜品数据 | ||
| 126 | + | ||
| 127 | + Future<bool> _getCookbookByClass({bool showLoading = true}) async { | ||
| 54 | Map<String, String> params = { | 128 | Map<String, String> params = { |
| 55 | "sellerid": Provider.of<UserModel>(context, listen: false).user.sellerid, | 129 | "sellerid": Provider.of<UserModel>(context, listen: false).user.sellerid, |
| 56 | }; | 130 | }; |
| 57 | 131 | ||
| 58 | - await _planDishProvider.getCookbookByClass(context, params, | 132 | + bool success = await _planDishProvider.getCookbookByClass(context, params, |
| 59 | showLoading: showLoading); | 133 | showLoading: showLoading); |
| 134 | + if (success) { | ||
| 135 | + return true; | ||
| 136 | + } else { | ||
| 137 | + return false; | ||
| 138 | + } | ||
| 139 | + // print(widget.data); | ||
| 140 | + | ||
| 141 | + // if (widget.data.length > 0) { | ||
| 142 | + // widget.data.forEach((old) { | ||
| 143 | + // _planDishProvider.menuModel.forEach((element) { | ||
| 144 | + // if (old.id == element.id) { | ||
| 145 | + // element.cookbooklist.forEach((value) { | ||
| 146 | + // old.cookbooklist.forEach((oldCook) { | ||
| 147 | + // if (oldCook.id == value.id) { | ||
| 148 | + // value.amount = oldCook.amount; | ||
| 149 | + // if (oldCook.amount > 0) { | ||
| 150 | + // carSum += oldCook.amount; | ||
| 151 | + // priceSum += double.parse(oldCook.price) * oldCook.amount; | ||
| 152 | + // memberPriceSum += | ||
| 153 | + // double.parse(oldCook.member_price) * oldCook.amount; | ||
| 154 | + // } | ||
| 155 | + // } | ||
| 156 | + // }); | ||
| 157 | + // }); | ||
| 158 | + // } | ||
| 159 | + // }); | ||
| 160 | + // }); | ||
| 161 | + // if (widget.planDishPrice != '' && widget.planDishPrice != null) { | ||
| 162 | + // planDishC.text = widget.planDishPrice; | ||
| 163 | + // } else { | ||
| 164 | + // planDishC.text = '${priceSum}'; | ||
| 165 | + // } | ||
| 166 | + | ||
| 167 | + // setState(() {}); | ||
| 168 | + // } | ||
| 60 | } | 169 | } |
| 61 | 170 | ||
| 62 | - ///接口 | ||
| 63 | - _getMenuData() { | ||
| 64 | - // Map<String, dynamic> params = {"sellerid": int.parse(widget.sellerID)}; | ||
| 65 | - // _storeMenuProvider.getStoreMenu(context, params); | 171 | + ///排菜/套餐列表 |
| 172 | + | ||
| 173 | + Future<bool> _getPlanCookList({bool isShowLoading = true}) async { | ||
| 174 | + Map<String, String> params = { | ||
| 175 | + "uid": Provider.of<UserModel>(context, listen: false).user.openid, | ||
| 176 | + // 'is_time': '0' | ||
| 177 | + "sellerid": Provider.of<UserModel>(context, listen: false).user.sellerid, | ||
| 178 | + }; | ||
| 179 | + bool success = await _planDishProvider.getPlanCookList(context, params, | ||
| 180 | + showLoading: isShowLoading); | ||
| 181 | + if (success) { | ||
| 182 | + return true; | ||
| 183 | + } else { | ||
| 184 | + return false; | ||
| 185 | + } | ||
| 66 | } | 186 | } |
| 67 | 187 | ||
| 68 | Widget list(List data) => ScrollablePositionedList.builder( | 188 | Widget list(List data) => ScrollablePositionedList.builder( |
| @@ -206,14 +326,20 @@ class _OrderAdvanceEidtPageState extends State<OrderAdvanceEidtPage> { | @@ -206,14 +326,20 @@ class _OrderAdvanceEidtPageState extends State<OrderAdvanceEidtPage> { | ||
| 206 | return Container( | 326 | return Container( |
| 207 | height: double.infinity, | 327 | height: double.infinity, |
| 208 | color: MyColours.color_F9F9F9, | 328 | color: MyColours.color_F9F9F9, |
| 209 | - width: ScreenUtil().setWidth(85 * 2), | 329 | + width: ScreenUtil().setWidth(90 * 2), |
| 210 | child: ListView.builder( | 330 | child: ListView.builder( |
| 211 | // itemCount: | 331 | // itemCount: |
| 212 | // _storeMenuProvider.menulist.length, | 332 | // _storeMenuProvider.menulist.length, |
| 213 | - itemCount: | ||
| 214 | - _planDishProvider.menuModel.length, | 333 | + itemCount: _planDishProvider |
| 334 | + .menuModelForManager.length, | ||
| 215 | itemBuilder: | 335 | itemBuilder: |
| 216 | (BuildContext context, int index) { | 336 | (BuildContext context, int index) { |
| 337 | + MenuModel menuModel = _planDishProvider | ||
| 338 | + .menuModelForManager[index]; | ||
| 339 | + int sum = 0; | ||
| 340 | + menuModel.cookbooklist.forEach((element) { | ||
| 341 | + sum += element.amount; | ||
| 342 | + }); | ||
| 217 | return InkWell( | 343 | return InkWell( |
| 218 | onTap: () { | 344 | onTap: () { |
| 219 | isTap = true; | 345 | isTap = true; |
| @@ -249,8 +375,7 @@ class _OrderAdvanceEidtPageState extends State<OrderAdvanceEidtPage> { | @@ -249,8 +375,7 @@ class _OrderAdvanceEidtPageState extends State<OrderAdvanceEidtPage> { | ||
| 249 | child: Text( | 375 | child: Text( |
| 250 | // _storeMenuProvider | 376 | // _storeMenuProvider |
| 251 | // .menulist[index].className, | 377 | // .menulist[index].className, |
| 252 | - _planDishProvider | ||
| 253 | - .menuModel[index].className, | 378 | + menuModel.className, |
| 254 | maxLines: 2, | 379 | maxLines: 2, |
| 255 | overflow: TextOverflow.ellipsis, | 380 | overflow: TextOverflow.ellipsis, |
| 256 | style: TextStyle( | 381 | style: TextStyle( |
| @@ -262,29 +387,34 @@ class _OrderAdvanceEidtPageState extends State<OrderAdvanceEidtPage> { | @@ -262,29 +387,34 @@ class _OrderAdvanceEidtPageState extends State<OrderAdvanceEidtPage> { | ||
| 262 | .color_999999), | 387 | .color_999999), |
| 263 | ), | 388 | ), |
| 264 | ), | 389 | ), |
| 265 | - Positioned( | ||
| 266 | - top: w(2), | ||
| 267 | - right: w(2), | ||
| 268 | - child: Container( | ||
| 269 | - // width: w(16), | ||
| 270 | - constraints: BoxConstraints( | ||
| 271 | - minWidth: w(16)), | ||
| 272 | - height: w(16), | ||
| 273 | - alignment: Alignment.center, | ||
| 274 | - decoration: BoxDecoration( | ||
| 275 | - borderRadius: | ||
| 276 | - BorderRadius.circular( | ||
| 277 | - r(8)), | ||
| 278 | - color: MyColours | ||
| 279 | - .color_E34D59), | ||
| 280 | - child: Text( | ||
| 281 | - '23', | ||
| 282 | - style: TextStyle( | ||
| 283 | - fontSize: font(10), | ||
| 284 | - color: MyColours | ||
| 285 | - .color_F6F6F6), | ||
| 286 | - ), | ||
| 287 | - )) | 390 | + sum > 0 |
| 391 | + ? Positioned( | ||
| 392 | + top: w(2), | ||
| 393 | + right: w(2), | ||
| 394 | + child: Container( | ||
| 395 | + // width: w(16), | ||
| 396 | + constraints: | ||
| 397 | + BoxConstraints( | ||
| 398 | + minWidth: w(16)), | ||
| 399 | + height: w(16), | ||
| 400 | + alignment: | ||
| 401 | + Alignment.center, | ||
| 402 | + decoration: BoxDecoration( | ||
| 403 | + borderRadius: | ||
| 404 | + BorderRadius | ||
| 405 | + .circular( | ||
| 406 | + r(8)), | ||
| 407 | + color: MyColours | ||
| 408 | + .color_E34D59), | ||
| 409 | + child: Text( | ||
| 410 | + '${sum}', | ||
| 411 | + style: TextStyle( | ||
| 412 | + fontSize: font(10), | ||
| 413 | + color: MyColours | ||
| 414 | + .color_F6F6F6), | ||
| 415 | + ), | ||
| 416 | + )) | ||
| 417 | + : SizedBox() | ||
| 288 | ], | 418 | ], |
| 289 | ), | 419 | ), |
| 290 | ); | 420 | ); |
| @@ -299,14 +429,14 @@ class _OrderAdvanceEidtPageState extends State<OrderAdvanceEidtPage> { | @@ -299,14 +429,14 @@ class _OrderAdvanceEidtPageState extends State<OrderAdvanceEidtPage> { | ||
| 299 | shrinkWrap: true, | 429 | shrinkWrap: true, |
| 300 | // physics: NeverScrollableScrollPhysics(), | 430 | // physics: NeverScrollableScrollPhysics(), |
| 301 | itemCount: _planDishProvider | 431 | itemCount: _planDishProvider |
| 302 | - .menuModel[_selectIndex] | 432 | + .menuModelForManager[_selectIndex] |
| 303 | .cookbooklist | 433 | .cookbooklist |
| 304 | .length, | 434 | .length, |
| 305 | itemBuilder: | 435 | itemBuilder: |
| 306 | (BuildContext context, int index) { | 436 | (BuildContext context, int index) { |
| 307 | MenuSunModel menuSunModel = | 437 | MenuSunModel menuSunModel = |
| 308 | _planDishProvider | 438 | _planDishProvider |
| 309 | - .menuModel[_selectIndex] | 439 | + .menuModelForManager[_selectIndex] |
| 310 | .cookbooklist[index]; | 440 | .cookbooklist[index]; |
| 311 | return Container( | 441 | return Container( |
| 312 | padding: | 442 | padding: |
| @@ -341,8 +471,8 @@ class _OrderAdvanceEidtPageState extends State<OrderAdvanceEidtPage> { | @@ -341,8 +471,8 @@ class _OrderAdvanceEidtPageState extends State<OrderAdvanceEidtPage> { | ||
| 341 | color: MyColours | 471 | color: MyColours |
| 342 | .color_515151), | 472 | .color_515151), |
| 343 | )), | 473 | )), |
| 344 | - HEmptyView(8), | ||
| 345 | - _laduWidget() | 474 | + // HEmptyView(8), |
| 475 | + // _laduWidget() | ||
| 346 | ], | 476 | ], |
| 347 | ), | 477 | ), |
| 348 | VEmptyView(24), | 478 | VEmptyView(24), |
| @@ -368,74 +498,140 @@ class _OrderAdvanceEidtPageState extends State<OrderAdvanceEidtPage> { | @@ -368,74 +498,140 @@ class _OrderAdvanceEidtPageState extends State<OrderAdvanceEidtPage> { | ||
| 368 | ], | 498 | ], |
| 369 | )), | 499 | )), |
| 370 | // Spacer(), | 500 | // Spacer(), |
| 371 | - Image.asset( | ||
| 372 | - Utils.getImgPath('plan_dish_minus'), | ||
| 373 | - width: w(16), | ||
| 374 | - ), | 501 | + menuSunModel.amount != null && |
| 502 | + menuSunModel.amount > 0 | ||
| 503 | + ? InkWell( | ||
| 504 | + onTap: () { | ||
| 505 | + if (menuSunModel.amount > | ||
| 506 | + 0) { | ||
| 507 | + setState(() { | ||
| 508 | + menuSunModel.amount--; | ||
| 509 | + carSum--; | ||
| 510 | + priceSum -= | ||
| 511 | + double.parse( | ||
| 512 | + menuSunModel | ||
| 513 | + .price); | ||
| 514 | + memberPriceSum -= double | ||
| 515 | + .parse(menuSunModel | ||
| 516 | + .member_price); | ||
| 517 | + planDishC.text = | ||
| 518 | + '${priceSum}'; | ||
| 519 | + }); | ||
| 520 | + } | ||
| 521 | + }, | ||
| 522 | + child: Container( | ||
| 523 | + height: w(48), | ||
| 524 | + padding: | ||
| 525 | + EdgeInsets.symmetric( | ||
| 526 | + horizontal: w(8)), | ||
| 527 | + child: Image.asset( | ||
| 528 | + Utils.getImgPath( | ||
| 529 | + 'plan_dish_minus'), | ||
| 530 | + width: w(16), | ||
| 531 | + ), | ||
| 532 | + ), | ||
| 533 | + ) | ||
| 534 | + : SizedBox(), | ||
| 375 | HEmptyView(8), | 535 | HEmptyView(8), |
| 376 | - Container( | ||
| 377 | - width: w(32), | ||
| 378 | - height: w(16), | ||
| 379 | - decoration: BoxDecoration( | ||
| 380 | - borderRadius: | ||
| 381 | - BorderRadius.circular( | ||
| 382 | - r(5)), | ||
| 383 | - border: Border.all( | ||
| 384 | - width: w(1), | ||
| 385 | - color: MyColours | ||
| 386 | - .color_999999)), | ||
| 387 | - // constraints: BoxConstraints(minWidth: w(20)), | ||
| 388 | - child: TextField( | ||
| 389 | - maxLines: 1, | ||
| 390 | - // controller: | ||
| 391 | - // focusNode: _focusNode, | ||
| 392 | - // autofocus: true, | ||
| 393 | - | ||
| 394 | - style: TextStyle( | ||
| 395 | - color: | ||
| 396 | - MyColours.color_438E93, | ||
| 397 | - fontSize: font(12)), | ||
| 398 | - textAlign: TextAlign.center, | ||
| 399 | - // textAlignVertical: TextAlignVertical.center, | ||
| 400 | - decoration: InputDecoration( | ||
| 401 | - hintText: "人数", | ||
| 402 | - hintStyle: TextStyle( | ||
| 403 | - color: | ||
| 404 | - MyColours.color_999999, | ||
| 405 | - fontSize: font(12), | 536 | + menuSunModel.amount != null && |
| 537 | + menuSunModel.amount > 0 | ||
| 538 | + ? Container( | ||
| 539 | + constraints: BoxConstraints( | ||
| 540 | + minWidth: w(32), | ||
| 406 | ), | 541 | ), |
| 407 | - // isCollapsed: | ||
| 408 | - // true, //重点,相当于高度包裹的意思,必须设置为true,不然有默认奇妙的最小高度 | ||
| 409 | - border: OutlineInputBorder( | ||
| 410 | - borderSide: | ||
| 411 | - BorderSide.none), | ||
| 412 | - contentPadding: | ||
| 413 | - EdgeInsets.zero, | ||
| 414 | - ), | ||
| 415 | - keyboardType: | ||
| 416 | - TextInputType.number, | ||
| 417 | - textInputAction: | ||
| 418 | - TextInputAction.done, | ||
| 419 | - | ||
| 420 | - onChanged: (value) { | ||
| 421 | - // setState(() {}); | ||
| 422 | - // _searchSellerLocation(); | ||
| 423 | - // customerProvider.searchData(value); | ||
| 424 | - }, | ||
| 425 | - onEditingComplete: () { | ||
| 426 | - FocusScope.of(context) | ||
| 427 | - .requestFocus( | ||
| 428 | - FocusNode()); //点击空白处隐藏键盘 | ||
| 429 | - // contantShowModel.searchData( | ||
| 430 | - // contantShowModel.controller.text); | ||
| 431 | - // _searchSellerLocation(); | ||
| 432 | - // _focusNode.unfocus(); | ||
| 433 | - }, | ||
| 434 | - )), | 542 | + // width: w(32), |
| 543 | + height: w(16), | ||
| 544 | + decoration: BoxDecoration( | ||
| 545 | + borderRadius: | ||
| 546 | + BorderRadius.circular( | ||
| 547 | + r(5)), | ||
| 548 | + border: Border.all( | ||
| 549 | + width: w(1), | ||
| 550 | + color: MyColours | ||
| 551 | + .color_999999)), | ||
| 552 | + alignment: Alignment.center, | ||
| 553 | + // constraints: BoxConstraints(minWidth: w(20)), | ||
| 554 | + child: Text( | ||
| 555 | + '${menuSunModel.amount}', | ||
| 556 | + style: TextStyle( | ||
| 557 | + color: MyColours | ||
| 558 | + .color_438E93, | ||
| 559 | + fontSize: font(12)), | ||
| 560 | + ), | ||
| 561 | + // child: TextField( | ||
| 562 | + // maxLines: 1, | ||
| 563 | + // // controller: | ||
| 564 | + // // focusNode: _focusNode, | ||
| 565 | + // // autofocus: true, | ||
| 566 | + | ||
| 567 | + // style: TextStyle( | ||
| 568 | + // color: MyColours | ||
| 569 | + // .color_438E93, | ||
| 570 | + // fontSize: font(12)), | ||
| 571 | + // textAlign: TextAlign.center, | ||
| 572 | + // // textAlignVertical: TextAlignVertical.center, | ||
| 573 | + // decoration: InputDecoration( | ||
| 574 | + // hintText: "人数", | ||
| 575 | + // hintStyle: TextStyle( | ||
| 576 | + // color: MyColours | ||
| 577 | + // .color_999999, | ||
| 578 | + // fontSize: font(12), | ||
| 579 | + // ), | ||
| 580 | + // // isCollapsed: | ||
| 581 | + // // true, //重点,相当于高度包裹的意思,必须设置为true,不然有默认奇妙的最小高度 | ||
| 582 | + // border: | ||
| 583 | + // OutlineInputBorder( | ||
| 584 | + // borderSide: | ||
| 585 | + // BorderSide | ||
| 586 | + // .none), | ||
| 587 | + // contentPadding: | ||
| 588 | + // EdgeInsets.zero, | ||
| 589 | + // ), | ||
| 590 | + // keyboardType: | ||
| 591 | + // TextInputType.number, | ||
| 592 | + // textInputAction: | ||
| 593 | + // TextInputAction.done, | ||
| 594 | + | ||
| 595 | + // onChanged: (value) { | ||
| 596 | + // // setState(() {}); | ||
| 597 | + // // _searchSellerLocation(); | ||
| 598 | + // // customerProvider.searchData(value); | ||
| 599 | + // }, | ||
| 600 | + // onEditingComplete: () { | ||
| 601 | + // FocusScope.of(context) | ||
| 602 | + // .requestFocus( | ||
| 603 | + // FocusNode()); //点击空白处隐藏键盘 | ||
| 604 | + // // contantShowModel.searchData( | ||
| 605 | + // // contantShowModel.controller.text); | ||
| 606 | + // // _searchSellerLocation(); | ||
| 607 | + // // _focusNode.unfocus(); | ||
| 608 | + // }, | ||
| 609 | + // ) | ||
| 610 | + ) | ||
| 611 | + : SizedBox(), | ||
| 435 | HEmptyView(8), | 612 | HEmptyView(8), |
| 436 | - Image.asset( | ||
| 437 | - Utils.getImgPath('plan_dish_add'), | ||
| 438 | - width: w(16), | 613 | + InkWell( |
| 614 | + onTap: () { | ||
| 615 | + setState(() { | ||
| 616 | + menuSunModel.amount++; | ||
| 617 | + carSum++; | ||
| 618 | + priceSum += double.parse( | ||
| 619 | + menuSunModel.price); | ||
| 620 | + memberPriceSum += double.parse( | ||
| 621 | + menuSunModel.member_price); | ||
| 622 | + planDishC.text = '${priceSum}'; | ||
| 623 | + }); | ||
| 624 | + }, | ||
| 625 | + child: Container( | ||
| 626 | + height: w(48), | ||
| 627 | + padding: | ||
| 628 | + EdgeInsets.only(left: w(8)), | ||
| 629 | + child: Image.asset( | ||
| 630 | + Utils.getImgPath( | ||
| 631 | + 'plan_dish_add'), | ||
| 632 | + width: w(16), | ||
| 633 | + ), | ||
| 634 | + ), | ||
| 439 | ), | 635 | ), |
| 440 | ], | 636 | ], |
| 441 | ), | 637 | ), |
| @@ -460,24 +656,28 @@ class _OrderAdvanceEidtPageState extends State<OrderAdvanceEidtPage> { | @@ -460,24 +656,28 @@ class _OrderAdvanceEidtPageState extends State<OrderAdvanceEidtPage> { | ||
| 460 | Utils.getImgPath('plan_dish_car'), | 656 | Utils.getImgPath('plan_dish_car'), |
| 461 | width: w(35), | 657 | width: w(35), |
| 462 | ), | 658 | ), |
| 463 | - Positioned( | ||
| 464 | - top: w(-3), | ||
| 465 | - right: w(-4), | ||
| 466 | - child: Container( | ||
| 467 | - // width: w(16), | ||
| 468 | - constraints: BoxConstraints(minWidth: w(16)), | ||
| 469 | - height: w(16), | ||
| 470 | - alignment: Alignment.center, | ||
| 471 | - decoration: BoxDecoration( | ||
| 472 | - borderRadius: BorderRadius.circular(r(8)), | ||
| 473 | - color: MyColours.color_E34D59), | ||
| 474 | - child: Text( | ||
| 475 | - '23', | ||
| 476 | - style: TextStyle( | ||
| 477 | - fontSize: font(10), | ||
| 478 | - color: MyColours.color_F6F6F6), | ||
| 479 | - ), | ||
| 480 | - )) | 659 | + carSum > 0 |
| 660 | + ? Positioned( | ||
| 661 | + top: w(-3), | ||
| 662 | + right: w(-4), | ||
| 663 | + child: Container( | ||
| 664 | + // width: w(16), | ||
| 665 | + constraints: | ||
| 666 | + BoxConstraints(minWidth: w(16)), | ||
| 667 | + height: w(16), | ||
| 668 | + alignment: Alignment.center, | ||
| 669 | + decoration: BoxDecoration( | ||
| 670 | + borderRadius: | ||
| 671 | + BorderRadius.circular(r(8)), | ||
| 672 | + color: MyColours.color_E34D59), | ||
| 673 | + child: Text( | ||
| 674 | + '${carSum}', | ||
| 675 | + style: TextStyle( | ||
| 676 | + fontSize: font(10), | ||
| 677 | + color: MyColours.color_F6F6F6), | ||
| 678 | + ), | ||
| 679 | + )) | ||
| 680 | + : SizedBox() | ||
| 481 | ], | 681 | ], |
| 482 | ), | 682 | ), |
| 483 | HEmptyView(66), | 683 | HEmptyView(66), |
| @@ -493,7 +693,7 @@ class _OrderAdvanceEidtPageState extends State<OrderAdvanceEidtPage> { | @@ -493,7 +693,7 @@ class _OrderAdvanceEidtPageState extends State<OrderAdvanceEidtPage> { | ||
| 493 | color: MyColours.color_515151), | 693 | color: MyColours.color_515151), |
| 494 | ), | 694 | ), |
| 495 | Text( | 695 | Text( |
| 496 | - '0.00', | 696 | + '${priceSum}', |
| 497 | style: TextStyle( | 697 | style: TextStyle( |
| 498 | fontSize: font(12), | 698 | fontSize: font(12), |
| 499 | color: MyColours.color_000000), | 699 | color: MyColours.color_000000), |
| @@ -516,7 +716,7 @@ class _OrderAdvanceEidtPageState extends State<OrderAdvanceEidtPage> { | @@ -516,7 +716,7 @@ class _OrderAdvanceEidtPageState extends State<OrderAdvanceEidtPage> { | ||
| 516 | color: MyColours.color_515151), | 716 | color: MyColours.color_515151), |
| 517 | ), | 717 | ), |
| 518 | Text( | 718 | Text( |
| 519 | - '0.00', | 719 | + '${memberPriceSum}', |
| 520 | style: TextStyle( | 720 | style: TextStyle( |
| 521 | fontSize: font(12), | 721 | fontSize: font(12), |
| 522 | color: MyColours.color_000000), | 722 | color: MyColours.color_000000), |
| @@ -547,7 +747,7 @@ class _OrderAdvanceEidtPageState extends State<OrderAdvanceEidtPage> { | @@ -547,7 +747,7 @@ class _OrderAdvanceEidtPageState extends State<OrderAdvanceEidtPage> { | ||
| 547 | // constraints: BoxConstraints(minWidth: w(20)), | 747 | // constraints: BoxConstraints(minWidth: w(20)), |
| 548 | child: TextField( | 748 | child: TextField( |
| 549 | maxLines: 1, | 749 | maxLines: 1, |
| 550 | - // controller: | 750 | + controller: planDishC, |
| 551 | // focusNode: _focusNode, | 751 | // focusNode: _focusNode, |
| 552 | // autofocus: true, | 752 | // autofocus: true, |
| 553 | 753 | ||
| @@ -612,6 +812,10 @@ class _OrderAdvanceEidtPageState extends State<OrderAdvanceEidtPage> { | @@ -612,6 +812,10 @@ class _OrderAdvanceEidtPageState extends State<OrderAdvanceEidtPage> { | ||
| 612 | borderColor: MyColours.color_438E93, | 812 | borderColor: MyColours.color_438E93, |
| 613 | textColor: MyColours.color_438E93, | 813 | textColor: MyColours.color_438E93, |
| 614 | onPressed: () { | 814 | onPressed: () { |
| 815 | + _planDishProvider.menuModel.forEach((element) { | ||
| 816 | + _planDishProvider.menuModelForManager | ||
| 817 | + .forEach((value) {}); | ||
| 818 | + }); | ||
| 615 | NavigatorUtil.goOrderEditListShowPage(context); | 819 | NavigatorUtil.goOrderEditListShowPage(context); |
| 616 | }, | 820 | }, |
| 617 | ), | 821 | ), |
| @@ -21,6 +21,7 @@ class PlanDishProvider extends ChangeNotifier { | @@ -21,6 +21,7 @@ class PlanDishProvider extends ChangeNotifier { | ||
| 21 | PageState pageStateMy = PageState.Loading; | 21 | PageState pageStateMy = PageState.Loading; |
| 22 | 22 | ||
| 23 | List<MenuModel> menuModel; //菜品数据 | 23 | List<MenuModel> menuModel; //菜品数据 |
| 24 | + List<MenuModel> menuModelForManager = []; //经理点菜菜品数据 | ||
| 24 | 25 | ||
| 25 | List<SunListPlan> allList = []; //排菜套餐列表--全部 | 26 | List<SunListPlan> allList = []; //排菜套餐列表--全部 |
| 26 | List<SunListPlan> storeList = []; //排菜套餐列表--店铺 | 27 | List<SunListPlan> storeList = []; //排菜套餐列表--店铺 |
| @@ -53,6 +54,7 @@ class PlanDishProvider extends ChangeNotifier { | @@ -53,6 +54,7 @@ class PlanDishProvider extends ChangeNotifier { | ||
| 53 | } | 54 | } |
| 54 | } | 55 | } |
| 55 | notifyListeners(); | 56 | notifyListeners(); |
| 57 | + return false; | ||
| 56 | }); | 58 | }); |
| 57 | menuModel = []; | 59 | menuModel = []; |
| 58 | 60 | ||
| @@ -67,11 +69,14 @@ class PlanDishProvider extends ChangeNotifier { | @@ -67,11 +69,14 @@ class PlanDishProvider extends ChangeNotifier { | ||
| 67 | print(menuModel); | 69 | print(menuModel); |
| 68 | pageState = PageState.Success; | 70 | pageState = PageState.Success; |
| 69 | } | 71 | } |
| 72 | + notifyListeners(); | ||
| 73 | + return true; | ||
| 70 | } else { | 74 | } else { |
| 71 | Utils.showToast(baseResp.msg ?? ""); | 75 | Utils.showToast(baseResp.msg ?? ""); |
| 72 | pageState = PageState.ConnectivityError; | 76 | pageState = PageState.ConnectivityError; |
| 77 | + notifyListeners(); | ||
| 78 | + return false; | ||
| 73 | } | 79 | } |
| 74 | - notifyListeners(); | ||
| 75 | } | 80 | } |
| 76 | 81 | ||
| 77 | ///添加排菜/套餐 | 82 | ///添加排菜/套餐 |
| @@ -95,6 +100,27 @@ class PlanDishProvider extends ChangeNotifier { | @@ -95,6 +100,27 @@ class PlanDishProvider extends ChangeNotifier { | ||
| 95 | } | 100 | } |
| 96 | } | 101 | } |
| 97 | 102 | ||
| 103 | + ///删除排菜/套餐列表 | ||
| 104 | + | ||
| 105 | + Future<bool> delPlanCook(BuildContext context, Map<String, String> params, | ||
| 106 | + {showLoading = false}) async { | ||
| 107 | + BaseResp<dynamic> baseResp = await DioUtil() | ||
| 108 | + .request<dynamic>(context, Method.get, HttpUrl.del_plan_cook, | ||
| 109 | + data: params, showLoading: showLoading) | ||
| 110 | + .catchError((error) { | ||
| 111 | + print(error.toString()); | ||
| 112 | + if (error is MyError) {} | ||
| 113 | + return false; | ||
| 114 | + }); | ||
| 115 | + | ||
| 116 | + if (baseResp != null && baseResp.code == Constant.status_success) { | ||
| 117 | + return true; | ||
| 118 | + } else { | ||
| 119 | + Utils.showToast(baseResp.msg ?? ""); | ||
| 120 | + return false; | ||
| 121 | + } | ||
| 122 | + } | ||
| 123 | + | ||
| 98 | ///排菜/套餐列表 | 124 | ///排菜/套餐列表 |
| 99 | 125 | ||
| 100 | Future<bool> getPlanCookList(BuildContext context, Map<String, String> params, | 126 | Future<bool> getPlanCookList(BuildContext context, Map<String, String> params, |
| @@ -111,13 +137,29 @@ class PlanDishProvider extends ChangeNotifier { | @@ -111,13 +137,29 @@ class PlanDishProvider extends ChangeNotifier { | ||
| 111 | if (baseResp != null && baseResp.code == Constant.status_success) { | 137 | if (baseResp != null && baseResp.code == Constant.status_success) { |
| 112 | PlanCookListSunModel planCookListSunModel = | 138 | PlanCookListSunModel planCookListSunModel = |
| 113 | PlanCookListModel.fromJson(baseResp.responseData).data; | 139 | PlanCookListModel.fromJson(baseResp.responseData).data; |
| 140 | + storeList = []; | ||
| 141 | + mineList = []; | ||
| 142 | + allList = []; | ||
| 114 | storeList.addAll(planCookListSunModel.packageList); | 143 | storeList.addAll(planCookListSunModel.packageList); |
| 115 | mineList.addAll(planCookListSunModel.plancookList); | 144 | mineList.addAll(planCookListSunModel.plancookList); |
| 116 | allList.addAll(storeList); | 145 | allList.addAll(storeList); |
| 117 | allList.addAll(mineList); | 146 | allList.addAll(mineList); |
| 118 | - pageStateHome = PageState.Success; | ||
| 119 | - pageStateStore = PageState.Success; | ||
| 120 | - pageStateMine = PageState.Success; | 147 | + if (storeList.length == 0) { |
| 148 | + pageStateStore = PageState.Empty; | ||
| 149 | + } else { | ||
| 150 | + pageStateStore = PageState.Success; | ||
| 151 | + } | ||
| 152 | + if (mineList.length == 0) { | ||
| 153 | + pageStateMine = PageState.Empty; | ||
| 154 | + } else { | ||
| 155 | + pageStateMine = PageState.Success; | ||
| 156 | + } | ||
| 157 | + if (allList.length == 0) { | ||
| 158 | + pageStateHome = PageState.Empty; | ||
| 159 | + } else { | ||
| 160 | + pageStateHome = PageState.Success; | ||
| 161 | + } | ||
| 162 | + | ||
| 121 | notifyListeners(); | 163 | notifyListeners(); |
| 122 | return true; | 164 | return true; |
| 123 | } else { | 165 | } else { |
| @@ -1304,7 +1304,11 @@ class NavigatorUtil { | @@ -1304,7 +1304,11 @@ class NavigatorUtil { | ||
| 1304 | ///经理排菜- 编辑页 | 1304 | ///经理排菜- 编辑页 |
| 1305 | 1305 | ||
| 1306 | static Future<dynamic> goPlanDishEditPage(BuildContext context, | 1306 | static Future<dynamic> goPlanDishEditPage(BuildContext context, |
| 1307 | - {replace = false, bool isMine, bool isEdit, SunListPlan sunList}) { | 1307 | + {replace = false, |
| 1308 | + bool isMine, | ||
| 1309 | + bool isEdit, | ||
| 1310 | + SunListPlan sunList, | ||
| 1311 | + bool onlyShow}) { | ||
| 1308 | // if (invoice != null) { | 1312 | // if (invoice != null) { |
| 1309 | // return _navigateTo(context, | 1313 | // return _navigateTo(context, |
| 1310 | // "${Routes.plan_dish_edit_page}?invoice=${FluroConvertUtils.object2string(invoice)}", | 1314 | // "${Routes.plan_dish_edit_page}?invoice=${FluroConvertUtils.object2string(invoice)}", |
| @@ -1312,11 +1316,11 @@ class NavigatorUtil { | @@ -1312,11 +1316,11 @@ class NavigatorUtil { | ||
| 1312 | // } | 1316 | // } |
| 1313 | if (sunList != null) { | 1317 | if (sunList != null) { |
| 1314 | return _navigateTo(context, | 1318 | return _navigateTo(context, |
| 1315 | - "${Routes.plan_dish_edit_page}?sunList=${FluroConvertUtils.object2string(sunList)}&isMine=${isMine}&isEdit=${isEdit}", | 1319 | + "${Routes.plan_dish_edit_page}?sunList=${FluroConvertUtils.object2string(sunList)}&isMine=${isMine}&isEdit=${isEdit}&onlyShow=${onlyShow}", |
| 1316 | replace: replace); | 1320 | replace: replace); |
| 1317 | } | 1321 | } |
| 1318 | return _navigateTo(context, | 1322 | return _navigateTo(context, |
| 1319 | - "${Routes.plan_dish_edit_page}?isMine=${isMine}&isEdit=${isEdit}", | 1323 | + "${Routes.plan_dish_edit_page}?isMine=${isMine}&isEdit=${isEdit}&onlyShow=${onlyShow}", |
| 1320 | replace: replace); | 1324 | replace: replace); |
| 1321 | } | 1325 | } |
| 1322 | } | 1326 | } |
| @@ -2051,6 +2051,8 @@ var planDishEidtPageHandle = new Handler( | @@ -2051,6 +2051,8 @@ var planDishEidtPageHandle = new Handler( | ||
| 2051 | // } | 2051 | // } |
| 2052 | bool isMine = FluroConvertUtils.string2bool(params["isMine"].first); | 2052 | bool isMine = FluroConvertUtils.string2bool(params["isMine"].first); |
| 2053 | bool isEdit = FluroConvertUtils.string2bool(params["isEdit"].first); | 2053 | bool isEdit = FluroConvertUtils.string2bool(params["isEdit"].first); |
| 2054 | + bool onlyShow = FluroConvertUtils.string2bool(params["onlyShow"].first); | ||
| 2055 | + | ||
| 2054 | SunListPlan sunListPlan; | 2056 | SunListPlan sunListPlan; |
| 2055 | 2057 | ||
| 2056 | if (params.keys.contains('sunList')) { | 2058 | if (params.keys.contains('sunList')) { |
| @@ -2061,5 +2063,8 @@ var planDishEidtPageHandle = new Handler( | @@ -2061,5 +2063,8 @@ var planDishEidtPageHandle = new Handler( | ||
| 2061 | return ChangeNotifierProvider<PlanDishProvider>( | 2063 | return ChangeNotifierProvider<PlanDishProvider>( |
| 2062 | create: (_) => PlanDishProvider(), | 2064 | create: (_) => PlanDishProvider(), |
| 2063 | child: PlanDishEidtPage( | 2065 | child: PlanDishEidtPage( |
| 2064 | - isMine: isMine, isEdit: isEdit, sunListPlan: sunListPlan)); | 2066 | + isMine: isMine, |
| 2067 | + isEdit: isEdit, | ||
| 2068 | + sunListPlan: sunListPlan, | ||
| 2069 | + onlyShow: onlyShow)); | ||
| 2065 | }); | 2070 | }); |
-
Please register or login to post a comment