Commit 6d1074920f7dd935ded74038cc6b2443b5d74932

Authored by wdn127929
1 parent 221ea277

菜单数据

  1 +import 'package:flutter/material.dart';
  2 +
1 ///菜单 3 ///菜单
2 4
3 class MenuModel { 5 class MenuModel {
@@ -82,6 +84,8 @@ class MenuSunModel { @@ -82,6 +84,8 @@ class MenuSunModel {
82 int isSpec; 84 int isSpec;
83 List practice; 85 List practice;
84 86
  87 + int amount = 0; //菜品数量
  88 +
85 MenuSunModel({ 89 MenuSunModel({
86 this.id, 90 this.id,
87 this.sellerid, 91 this.sellerid,
@@ -2,6 +2,7 @@ import 'package:flutter/material.dart'; @@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
2 import 'package:flutter_screenutil/flutter_screenutil.dart'; 2 import 'package:flutter_screenutil/flutter_screenutil.dart';
3 import 'package:one_key/provider/plan_dish_provider.dart'; 3 import 'package:one_key/provider/plan_dish_provider.dart';
4 4
  5 +import '../../../models/cookbook_model.dart';
5 import '../../../res/colors.dart'; 6 import '../../../res/colors.dart';
6 import '../../../utils/screen_util.dart'; 7 import '../../../utils/screen_util.dart';
7 import '../../../widgets/round_button.dart'; 8 import '../../../widgets/round_button.dart';
@@ -423,8 +424,7 @@ class _PlanDishEidtPageState extends State<PlanDishEidtPage> { @@ -423,8 +424,7 @@ class _PlanDishEidtPageState extends State<PlanDishEidtPage> {
423 if (value != null) { 424 if (value != null) {
424 setState(() { 425 setState(() {
425 labelSelIndex = value.first; 426 labelSelIndex = value.first;
426 - labelShow =  
427 - labelList[labelSelIndex]; 427 + labelShow = labelList[labelSelIndex];
428 }); 428 });
429 } 429 }
430 }, 430 },
@@ -661,13 +661,28 @@ class _PlanDishEidtPageState extends State<PlanDishEidtPage> { @@ -661,13 +661,28 @@ class _PlanDishEidtPageState extends State<PlanDishEidtPage> {
661 color: MyColours.color_DBDBDB), 661 color: MyColours.color_DBDBDB),
662 VEmptyView(24), 662 VEmptyView(24),
663 _select('菜品', '编辑', () async { 663 _select('菜品', '编辑', () async {
664 - // Map temp =  
665 - // await NavigatorUtil.godishToPersonnalPage(  
666 - // context, uids);  
667 - // if (temp != null && temp['object'] != null) {  
668 - // uids = temp['object'];  
669 - // }  
670 - NavigatorUtil.goPlanNewDishPage(context); 664 + Map temp =
  665 + await NavigatorUtil.goPlanNewDishPage(
  666 + context);
  667 + if (temp != null) {
  668 + int priceSum = temp['priceSum'];
  669 + int memberPriceSum = temp['memberPriceSum'];
  670 + String planDishSum = temp['planDishSum'];
  671 + List<MenuModel> menuModel =
  672 + temp['menu']; //菜品数据
  673 + print(priceSum);
  674 + print(memberPriceSum);
  675 + print(planDishSum);
  676 + print(menuModel);
  677 +
  678 + // 刷新页面***************
  679 +
  680 +
  681 +
  682 +
  683 +
  684 +
  685 + }
671 }), 686 }),
672 _explain('券说明', '点击上面右侧的“编辑”,开始选菜吧!'), 687 _explain('券说明', '点击上面右侧的“编辑”,开始选菜吧!'),
673 VEmptyView(20), 688 VEmptyView(20),
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/provider/plan_dish_provider.dart'; 3 import 'package:one_key/provider/plan_dish_provider.dart';
3 import 'package:one_key/utils/screen_util.dart'; 4 import 'package:one_key/utils/screen_util.dart';
4 import 'package:one_key/widgets/h_empty_view.dart'; 5 import 'package:one_key/widgets/h_empty_view.dart';
@@ -9,6 +10,7 @@ import 'package:provider/provider.dart'; @@ -9,6 +10,7 @@ import 'package:provider/provider.dart';
9 import 'package:scrollable_positioned_list/scrollable_positioned_list.dart'; 10 import 'package:scrollable_positioned_list/scrollable_positioned_list.dart';
10 11
11 import '../../../constant/state.dart'; 12 import '../../../constant/state.dart';
  13 +import '../../../provider/user_model.dart';
12 import '../../../res/colors.dart'; 14 import '../../../res/colors.dart';
13 import '../../../route/navigator_util.dart'; 15 import '../../../route/navigator_util.dart';
14 import '../../../utils/utils.dart'; 16 import '../../../utils/utils.dart';
@@ -39,19 +41,27 @@ class _PlanNewDishPageState extends State<PlanNewDishPage> { @@ -39,19 +41,27 @@ class _PlanNewDishPageState extends State<PlanNewDishPage> {
39 ItemPositionsListener.create(); 41 ItemPositionsListener.create();
40 42
41 PlanDishProvider _planDishProvider; 43 PlanDishProvider _planDishProvider;
  44 + int carSum = 0; //购物车显示菜品总个数
  45 + double priceSum = 0; //总计
  46 + double memberPriceSum = 0; //会员价
  47 + TextEditingController planDishC = TextEditingController(); //排菜价
  48 + List<MenuSunModel> selectMenu = [];
42 49
43 @override 50 @override
44 void initState() { 51 void initState() {
45 super.initState(); 52 super.initState();
46 WidgetsBinding.instance.addPostFrameCallback((_) async { 53 WidgetsBinding.instance.addPostFrameCallback((_) async {
47 - _getMenuData(); 54 + _getCookbookByClass(showLoading: false);
48 }); 55 });
49 } 56 }
50 57
51 - ///接口  
52 - _getMenuData() {  
53 - // Map<String, dynamic> params = {"sellerid": int.parse(widget.sellerID)};  
54 - // _storeMenuProvider.getStoreMenu(context, params); 58 + _getCookbookByClass({bool showLoading = true}) async {
  59 + Map<String, String> params = {
  60 + "sellerid": Provider.of<UserModel>(context, listen: false).user.sellerid,
  61 + };
  62 +
  63 + await _planDishProvider.getCookbookByClass(context, params,
  64 + showLoading: showLoading);
55 } 65 }
56 66
57 Widget list(List data) => ScrollablePositionedList.builder( 67 Widget list(List data) => ScrollablePositionedList.builder(
@@ -140,11 +150,16 @@ class _PlanNewDishPageState extends State<PlanNewDishPage> { @@ -140,11 +150,16 @@ class _PlanNewDishPageState extends State<PlanNewDishPage> {
140 @override 150 @override
141 Widget build(BuildContext context) { 151 Widget build(BuildContext context) {
142 _planDishProvider = Provider.of<PlanDishProvider>(context, listen: true); 152 _planDishProvider = Provider.of<PlanDishProvider>(context, listen: true);
  153 + // _planDishProvider.menuModel.forEach((element) {
  154 + // element.cookbooklist.forEach((value) {
  155 + // carSum += value.amount;
  156 + // });
  157 + // });
143 return Scaffold( 158 return Scaffold(
144 backgroundColor: MyColours.color_ffffff, 159 backgroundColor: MyColours.color_ffffff,
145 appBar: SystemAppBar('经理排菜'), 160 appBar: SystemAppBar('经理排菜'),
146 body: Consumer<PlanDishProvider>(builder: (context, model, child) { 161 body: Consumer<PlanDishProvider>(builder: (context, model, child) {
147 - if (model.pageStateMy == PageState.Success) { 162 + if (model.pageState == PageState.Success) {
148 return Column( 163 return Column(
149 children: [ 164 children: [
150 MyDivider( 165 MyDivider(
@@ -154,6 +169,7 @@ class _PlanNewDishPageState extends State<PlanNewDishPage> { @@ -154,6 +169,7 @@ class _PlanNewDishPageState extends State<PlanNewDishPage> {
154 ), 169 ),
155 Expanded( 170 Expanded(
156 child: Row( 171 child: Row(
  172 + crossAxisAlignment: CrossAxisAlignment.start,
157 children: [ 173 children: [
158 ValueListenableBuilder<Iterable<ItemPosition>>( 174 ValueListenableBuilder<Iterable<ItemPosition>>(
159 valueListenable: itemPositionsListener.itemPositions, 175 valueListenable: itemPositionsListener.itemPositions,
@@ -198,9 +214,16 @@ class _PlanNewDishPageState extends State<PlanNewDishPage> { @@ -198,9 +214,16 @@ class _PlanNewDishPageState extends State<PlanNewDishPage> {
198 child: ListView.builder( 214 child: ListView.builder(
199 // itemCount: 215 // itemCount:
200 // _storeMenuProvider.menulist.length, 216 // _storeMenuProvider.menulist.length,
201 - itemCount: 100, 217 + itemCount:
  218 + _planDishProvider.menuModel.length,
202 itemBuilder: 219 itemBuilder:
203 (BuildContext context, int index) { 220 (BuildContext context, int index) {
  221 + MenuModel menuModel =
  222 + _planDishProvider.menuModel[index];
  223 + int sum = 0;
  224 + menuModel.cookbooklist.forEach((element) {
  225 + sum += element.amount;
  226 + });
204 return InkWell( 227 return InkWell(
205 onTap: () { 228 onTap: () {
206 isTap = true; 229 isTap = true;
@@ -236,7 +259,7 @@ class _PlanNewDishPageState extends State<PlanNewDishPage> { @@ -236,7 +259,7 @@ class _PlanNewDishPageState extends State<PlanNewDishPage> {
236 child: Text( 259 child: Text(
237 // _storeMenuProvider 260 // _storeMenuProvider
238 // .menulist[index].className, 261 // .menulist[index].className,
239 - '热菜', 262 + menuModel.className,
240 maxLines: 2, 263 maxLines: 2,
241 overflow: TextOverflow.ellipsis, 264 overflow: TextOverflow.ellipsis,
242 style: TextStyle( 265 style: TextStyle(
@@ -248,29 +271,34 @@ class _PlanNewDishPageState extends State<PlanNewDishPage> { @@ -248,29 +271,34 @@ class _PlanNewDishPageState extends State<PlanNewDishPage> {
248 .color_999999), 271 .color_999999),
249 ), 272 ),
250 ), 273 ),
251 - Positioned(  
252 - top: w(2),  
253 - right: w(2),  
254 - child: Container(  
255 - // width: w(16),  
256 - constraints: BoxConstraints(  
257 - minWidth: w(16)),  
258 - height: w(16),  
259 - alignment: Alignment.center,  
260 - decoration: BoxDecoration(  
261 - borderRadius:  
262 - BorderRadius.circular(  
263 - r(8)),  
264 - color: MyColours  
265 - .color_E34D59),  
266 - child: Text(  
267 - '23',  
268 - style: TextStyle(  
269 - fontSize: font(10),  
270 - color: MyColours  
271 - .color_F6F6F6),  
272 - ),  
273 - )) 274 + sum > 0
  275 + ? Positioned(
  276 + top: w(2),
  277 + right: w(2),
  278 + child: Container(
  279 + // width: w(16),
  280 + constraints:
  281 + BoxConstraints(
  282 + minWidth: w(16)),
  283 + height: w(16),
  284 + alignment:
  285 + Alignment.center,
  286 + decoration: BoxDecoration(
  287 + borderRadius:
  288 + BorderRadius
  289 + .circular(
  290 + r(8)),
  291 + color: MyColours
  292 + .color_E34D59),
  293 + child: Text(
  294 + '${sum}',
  295 + style: TextStyle(
  296 + fontSize: font(10),
  297 + color: MyColours
  298 + .color_F6F6F6),
  299 + ),
  300 + ))
  301 + : SizedBox()
274 ], 302 ],
275 ), 303 ),
276 ); 304 );
@@ -284,9 +312,16 @@ class _PlanNewDishPageState extends State<PlanNewDishPage> { @@ -284,9 +312,16 @@ class _PlanNewDishPageState extends State<PlanNewDishPage> {
284 child: ListView.builder( 312 child: ListView.builder(
285 shrinkWrap: true, 313 shrinkWrap: true,
286 // physics: NeverScrollableScrollPhysics(), 314 // physics: NeverScrollableScrollPhysics(),
287 - itemCount: 10, 315 + itemCount: _planDishProvider
  316 + .menuModel[_selectIndex]
  317 + .cookbooklist
  318 + .length,
288 itemBuilder: 319 itemBuilder:
289 (BuildContext context, int index) { 320 (BuildContext context, int index) {
  321 + MenuSunModel menuSunModel =
  322 + _planDishProvider
  323 + .menuModel[_selectIndex]
  324 + .cookbooklist[index];
290 return Container( 325 return Container(
291 padding: 326 padding:
292 EdgeInsets.symmetric(vertical: w(16)), 327 EdgeInsets.symmetric(vertical: w(16)),
@@ -309,7 +344,7 @@ class _PlanNewDishPageState extends State<PlanNewDishPage> { @@ -309,7 +344,7 @@ class _PlanNewDishPageState extends State<PlanNewDishPage> {
309 BoxConstraints( 344 BoxConstraints(
310 maxWidth: w(100)), 345 maxWidth: w(100)),
311 child: Text( 346 child: Text(
312 - '菜菜菜', 347 + menuSunModel.name,
313 maxLines: 10, 348 maxLines: 10,
314 overflow: TextOverflow 349 overflow: TextOverflow
315 .ellipsis, 350 .ellipsis,
@@ -320,22 +355,23 @@ class _PlanNewDishPageState extends State<PlanNewDishPage> { @@ -320,22 +355,23 @@ class _PlanNewDishPageState extends State<PlanNewDishPage> {
320 color: MyColours 355 color: MyColours
321 .color_515151), 356 .color_515151),
322 )), 357 )),
323 - HEmptyView(8),  
324 - _laduWidget() 358 + // HEmptyView(8),
  359 + // _laduWidget()
325 ], 360 ],
326 ), 361 ),
327 VEmptyView(24), 362 VEmptyView(24),
328 Row( 363 Row(
329 children: [ 364 children: [
330 Text( 365 Text(
331 - '858.0元/份', 366 + '${menuSunModel.price}元/${menuSunModel.unit}',
332 style: TextStyle( 367 style: TextStyle(
333 fontSize: font(12), 368 fontSize: font(12),
334 color: MyColours 369 color: MyColours
335 .color_999999), 370 .color_999999),
336 ), 371 ),
  372 + HEmptyView(48),
337 Text( 373 Text(
338 - '824.0元/份', 374 + '${menuSunModel.member_price}元/${menuSunModel.unit}',
339 style: TextStyle( 375 style: TextStyle(
340 fontSize: font(10), 376 fontSize: font(10),
341 color: MyColours 377 color: MyColours
@@ -346,75 +382,130 @@ class _PlanNewDishPageState extends State<PlanNewDishPage> { @@ -346,75 +382,130 @@ class _PlanNewDishPageState extends State<PlanNewDishPage> {
346 ], 382 ],
347 )), 383 )),
348 // Spacer(), 384 // Spacer(),
349 - Image.asset(  
350 - Utils.getImgPath('plan_dish_minus'),  
351 - width: w(16),  
352 - ), 385 + menuSunModel.amount != null &&
  386 + menuSunModel.amount > 0
  387 + ? InkWell(
  388 + onTap: () {
  389 + if (menuSunModel.amount >
  390 + 0) {
  391 + setState(() {
  392 + menuSunModel.amount--;
  393 + carSum--;
  394 + priceSum -=
  395 + double.parse(
  396 + menuSunModel
  397 + .price);
  398 + memberPriceSum -= double
  399 + .parse(menuSunModel
  400 + .member_price);
  401 + planDishC.text =
  402 + '${priceSum}';
  403 + });
  404 + }
  405 + },
  406 + child: Image.asset(
  407 + Utils.getImgPath(
  408 + 'plan_dish_minus'),
  409 + width: w(16),
  410 + ))
  411 + : SizedBox(),
353 HEmptyView(8), 412 HEmptyView(8),
354 - Container(  
355 - width: w(32),  
356 - height: w(16),  
357 - decoration: BoxDecoration(  
358 - borderRadius:  
359 - BorderRadius.circular(  
360 - r(5)),  
361 - border: Border.all(  
362 - width: w(1),  
363 - color: MyColours  
364 - .color_999999)),  
365 - // constraints: BoxConstraints(minWidth: w(20)),  
366 - child: TextField(  
367 - maxLines: 1,  
368 - // controller:  
369 - // focusNode: _focusNode,  
370 - // autofocus: true,  
371 -  
372 - style: TextStyle(  
373 - color:  
374 - MyColours.color_438E93,  
375 - fontSize: font(12)),  
376 - textAlign: TextAlign.center,  
377 - // textAlignVertical: TextAlignVertical.center,  
378 - decoration: InputDecoration(  
379 - hintText: "人数",  
380 - hintStyle: TextStyle(  
381 - color:  
382 - MyColours.color_999999,  
383 - fontSize: font(12), 413 + menuSunModel.amount != null &&
  414 + menuSunModel.amount > 0
  415 + ? Container(
  416 + constraints: BoxConstraints(
  417 + minWidth: w(32),
  418 + ),
  419 + // width: w(32),
  420 + height: w(16),
  421 + decoration: BoxDecoration(
  422 + borderRadius:
  423 + BorderRadius.circular(
  424 + r(5)),
  425 + border: Border.all(
  426 + width: w(1),
  427 + color: MyColours
  428 + .color_999999)),
  429 + alignment: Alignment.center,
  430 + // constraints: BoxConstraints(minWidth: w(20)),
  431 + child: Text(
  432 + '${menuSunModel.amount}',
  433 + style: TextStyle(
  434 + color: MyColours
  435 + .color_438E93,
  436 + fontSize: font(12)),
384 ), 437 ),
385 - // isCollapsed:  
386 - // true, //重点,相当于高度包裹的意思,必须设置为true,不然有默认奇妙的最小高度  
387 - border: OutlineInputBorder(  
388 - borderSide:  
389 - BorderSide.none),  
390 - contentPadding:  
391 - EdgeInsets.zero,  
392 - ),  
393 - keyboardType:  
394 - TextInputType.number,  
395 - textInputAction:  
396 - TextInputAction.done, 438 + // child: TextField(
  439 + // maxLines: 1,
  440 + // // controller:
  441 + // // focusNode: _focusNode,
  442 + // // autofocus: true,
397 443
398 - onChanged: (value) {  
399 - // setState(() {});  
400 - // _searchSellerLocation();  
401 - // customerProvider.searchData(value);  
402 - },  
403 - onEditingComplete: () {  
404 - FocusScope.of(context)  
405 - .requestFocus(  
406 - FocusNode()); //点击空白处隐藏键盘  
407 - // contantShowModel.searchData(  
408 - // contantShowModel.controller.text);  
409 - // _searchSellerLocation();  
410 - // _focusNode.unfocus();  
411 - },  
412 - )), 444 + // style: TextStyle(
  445 + // color: MyColours
  446 + // .color_438E93,
  447 + // fontSize: font(12)),
  448 + // textAlign: TextAlign.center,
  449 + // // textAlignVertical: TextAlignVertical.center,
  450 + // decoration: InputDecoration(
  451 + // hintText: "人数",
  452 + // hintStyle: TextStyle(
  453 + // color: MyColours
  454 + // .color_999999,
  455 + // fontSize: font(12),
  456 + // ),
  457 + // // isCollapsed:
  458 + // // true, //重点,相当于高度包裹的意思,必须设置为true,不然有默认奇妙的最小高度
  459 + // border:
  460 + // OutlineInputBorder(
  461 + // borderSide:
  462 + // BorderSide
  463 + // .none),
  464 + // contentPadding:
  465 + // EdgeInsets.zero,
  466 + // ),
  467 + // keyboardType:
  468 + // TextInputType.number,
  469 + // textInputAction:
  470 + // TextInputAction.done,
  471 +
  472 + // onChanged: (value) {
  473 + // // setState(() {});
  474 + // // _searchSellerLocation();
  475 + // // customerProvider.searchData(value);
  476 + // },
  477 + // onEditingComplete: () {
  478 + // FocusScope.of(context)
  479 + // .requestFocus(
  480 + // FocusNode()); //点击空白处隐藏键盘
  481 + // // contantShowModel.searchData(
  482 + // // contantShowModel.controller.text);
  483 + // // _searchSellerLocation();
  484 + // // _focusNode.unfocus();
  485 + // },
  486 + // )
  487 + )
  488 + : SizedBox(),
413 HEmptyView(8), 489 HEmptyView(8),
414 - Image.asset(  
415 - Utils.getImgPath('plan_dish_add'),  
416 - width: w(16),  
417 - ), 490 + InkWell(
  491 + onTap: () {
  492 + setState(() {
  493 + menuSunModel.amount++;
  494 + carSum++;
  495 + priceSum += double.parse(
  496 + menuSunModel.price);
  497 + memberPriceSum +=
  498 + double.parse(menuSunModel
  499 + .member_price);
  500 + planDishC.text =
  501 + '${priceSum}';
  502 + });
  503 + },
  504 + child: Image.asset(
  505 + Utils.getImgPath(
  506 + 'plan_dish_add'),
  507 + width: w(16),
  508 + )),
418 ], 509 ],
419 ), 510 ),
420 ); 511 );
@@ -438,24 +529,28 @@ class _PlanNewDishPageState extends State<PlanNewDishPage> { @@ -438,24 +529,28 @@ class _PlanNewDishPageState extends State<PlanNewDishPage> {
438 Utils.getImgPath('plan_dish_car'), 529 Utils.getImgPath('plan_dish_car'),
439 width: w(35), 530 width: w(35),
440 ), 531 ),
441 - Positioned(  
442 - top: w(-3),  
443 - right: w(-4),  
444 - child: Container(  
445 - // width: w(16),  
446 - constraints: BoxConstraints(minWidth: w(16)),  
447 - height: w(16),  
448 - alignment: Alignment.center,  
449 - decoration: BoxDecoration(  
450 - borderRadius: BorderRadius.circular(r(8)),  
451 - color: MyColours.color_E34D59),  
452 - child: Text(  
453 - '23',  
454 - style: TextStyle(  
455 - fontSize: font(10),  
456 - color: MyColours.color_F6F6F6),  
457 - ),  
458 - )) 532 + carSum > 0
  533 + ? Positioned(
  534 + top: w(-3),
  535 + right: w(-4),
  536 + child: Container(
  537 + // width: w(16),
  538 + constraints:
  539 + BoxConstraints(minWidth: w(16)),
  540 + height: w(16),
  541 + alignment: Alignment.center,
  542 + decoration: BoxDecoration(
  543 + borderRadius:
  544 + BorderRadius.circular(r(8)),
  545 + color: MyColours.color_E34D59),
  546 + child: Text(
  547 + '${carSum}',
  548 + style: TextStyle(
  549 + fontSize: font(10),
  550 + color: MyColours.color_F6F6F6),
  551 + ),
  552 + ))
  553 + : SizedBox()
459 ], 554 ],
460 ), 555 ),
461 HEmptyView(66), 556 HEmptyView(66),
@@ -471,7 +566,7 @@ class _PlanNewDishPageState extends State<PlanNewDishPage> { @@ -471,7 +566,7 @@ class _PlanNewDishPageState extends State<PlanNewDishPage> {
471 color: MyColours.color_515151), 566 color: MyColours.color_515151),
472 ), 567 ),
473 Text( 568 Text(
474 - '0.00', 569 + '${priceSum}',
475 style: TextStyle( 570 style: TextStyle(
476 fontSize: font(12), 571 fontSize: font(12),
477 color: MyColours.color_000000), 572 color: MyColours.color_000000),
@@ -494,7 +589,7 @@ class _PlanNewDishPageState extends State<PlanNewDishPage> { @@ -494,7 +589,7 @@ class _PlanNewDishPageState extends State<PlanNewDishPage> {
494 color: MyColours.color_515151), 589 color: MyColours.color_515151),
495 ), 590 ),
496 Text( 591 Text(
497 - '0.00', 592 + '${memberPriceSum}',
498 style: TextStyle( 593 style: TextStyle(
499 fontSize: font(12), 594 fontSize: font(12),
500 color: MyColours.color_000000), 595 color: MyColours.color_000000),
@@ -525,7 +620,7 @@ class _PlanNewDishPageState extends State<PlanNewDishPage> { @@ -525,7 +620,7 @@ class _PlanNewDishPageState extends State<PlanNewDishPage> {
525 // constraints: BoxConstraints(minWidth: w(20)), 620 // constraints: BoxConstraints(minWidth: w(20)),
526 child: TextField( 621 child: TextField(
527 maxLines: 1, 622 maxLines: 1,
528 - // controller: 623 + controller: planDishC,
529 // focusNode: _focusNode, 624 // focusNode: _focusNode,
530 // autofocus: true, 625 // autofocus: true,
531 626
@@ -585,7 +680,19 @@ class _PlanNewDishPageState extends State<PlanNewDishPage> { @@ -585,7 +680,19 @@ class _PlanNewDishPageState extends State<PlanNewDishPage> {
585 fontSize: 36, 680 fontSize: 36,
586 isBold: false, 681 isBold: false,
587 onPressed: () { 682 onPressed: () {
588 - Navigator.pop(context); 683 + // _planDishProvider.menuModel.forEach((element) {
  684 + // element.cookbooklist.forEach((value) {
  685 + // selectMenu.add(value);
  686 + // });
  687 +
  688 + // });
  689 + Map data = {
  690 + 'priceSum': priceSum,
  691 + 'memberPriceSum': memberPriceSum,
  692 + 'planDishSum': planDishC.text,
  693 + 'menu': _planDishProvider.menuModel
  694 + };
  695 + Navigator.of(context).pop(data);
589 }, 696 },
590 ), 697 ),
591 ) 698 )
@@ -597,6 +704,7 @@ class _PlanNewDishPageState extends State<PlanNewDishPage> { @@ -597,6 +704,7 @@ class _PlanNewDishPageState extends State<PlanNewDishPage> {
597 emptyMsg: '暂时没有菜单哦', 704 emptyMsg: '暂时没有菜单哦',
598 callback: () { 705 callback: () {
599 // _getMenuData(); 706 // _getMenuData();
  707 + _getCookbookByClass(showLoading: true);
600 }, 708 },
601 ); 709 );
602 } 710 }
@@ -13,10 +13,10 @@ import '../net/http_url.dart'; @@ -13,10 +13,10 @@ import '../net/http_url.dart';
13 * 预排菜 13 * 预排菜
14 */ 14 */
15 class PlanDishProvider extends ChangeNotifier { 15 class PlanDishProvider extends ChangeNotifier {
16 - PageState pageState = PageState.Success; 16 + PageState pageState = PageState.Loading;
17 PageState pageStateStore = PageState.Success; 17 PageState pageStateStore = PageState.Success;
18 PageState pageStateMine = PageState.Success; 18 PageState pageStateMine = PageState.Success;
19 - PageState pageStateMy = PageState.Success; 19 + PageState pageStateMy = PageState.Loading;
20 20
21 List<MenuModel> menuModel; //菜品数据 21 List<MenuModel> menuModel; //菜品数据
22 // List<CookbookCategorySunModel> categorySunModel; //菜品分类数据 22 // List<CookbookCategorySunModel> categorySunModel; //菜品分类数据