Commit 544d47cb566799ec04c16b15bd43ee34a75a737b

Authored by wdn127929
1 parent 62bf481a

菜单点菜and排菜页购物车数据处理

@@ -12,6 +12,7 @@ class MenuModel { @@ -12,6 +12,7 @@ class MenuModel {
12 String classType; 12 String classType;
13 List<MenuSunModel> cookbooklist; 13 List<MenuSunModel> cookbooklist;
14 int allSum; //总共选中菜数量 14 int allSum; //总共选中菜数量
  15 + bool isChange = false; //是否发生数量变化
15 16
16 MenuModel( 17 MenuModel(
17 {this.id, 18 {this.id,
@@ -89,7 +89,7 @@ class _PlanDishSunPageState extends State<PlanDishSunPage> { @@ -89,7 +89,7 @@ class _PlanDishSunPageState extends State<PlanDishSunPage> {
89 89
90 @override 90 @override
91 Widget build(BuildContext context) { 91 Widget build(BuildContext context) {
92 - planDishProvider = Provider.of<PlanDishProvider>(context, listen: true); 92 + planDishProvider = Provider.of<PlanDishProvider>(context, listen: true);
93 return Container( 93 return Container(
94 child: Consumer<CouponProvider>(builder: (context, model, _) { 94 child: Consumer<CouponProvider>(builder: (context, model, _) {
95 if (widget.pageState != PageState.Success) { 95 if (widget.pageState != PageState.Success) {
@@ -124,6 +124,9 @@ class _PlanDishSunPageState extends State<PlanDishSunPage> { @@ -124,6 +124,9 @@ class _PlanDishSunPageState extends State<PlanDishSunPage> {
124 bool needRefresh = 124 bool needRefresh =
125 await NavigatorUtil.goPlanDishEditPage(context, 125 await NavigatorUtil.goPlanDishEditPage(context,
126 isEdit: true, 126 isEdit: true,
  127 + isMine: widget.data[index].type == '2'
  128 + ? true
  129 + : false,
127 sunList: widget.data[index], 130 sunList: widget.data[index],
128 onlyShow: !canedit); 131 onlyShow: !canedit);
129 }, 132 },
  1 +import 'dart:convert';
  2 +
1 import 'package:flutter/material.dart'; 3 import 'package:flutter/material.dart';
2 import 'package:one_key/models/cookbook_model.dart'; 4 import 'package:one_key/models/cookbook_model.dart';
3 import 'package:one_key/models/plan_cook_list_model.dart'; 5 import 'package:one_key/models/plan_cook_list_model.dart';
@@ -65,18 +67,22 @@ class _OrderAdvanceEidtPageState extends State<OrderAdvanceEidtPage> { @@ -65,18 +67,22 @@ class _OrderAdvanceEidtPageState extends State<OrderAdvanceEidtPage> {
65 .then((results) { 67 .then((results) {
66 print(results[0]); 68 print(results[0]);
67 if (results[0] && results[1]) { 69 if (results[0] && results[1]) {
68 - _planDishProvider.menuModelForManager  
69 - .addAll(_planDishProvider.menuModel); 70 + _planDishProvider.menuModelForManager =
  71 + List.from(_planDishProvider.menuModel);
  72 +
70 //成功 73 //成功
71 MenuModel menuModelSetMeal = MenuModel(); 74 MenuModel menuModelSetMeal = MenuModel();
72 menuModelSetMeal.className = '套餐'; 75 menuModelSetMeal.className = '套餐';
  76 + menuModelSetMeal.isChange = false;
73 List<MenuSunModel> cookList = []; 77 List<MenuSunModel> cookList = [];
74 - List<SunListPlan> storeList = _planDishProvider.storeList; 78 + List<SunListPlan> storeList = _planDishProvider.storeListTemp;
  79 +
75 storeList.forEach((element) { 80 storeList.forEach((element) {
76 MenuSunModel menuSunModel = MenuSunModel(); 81 MenuSunModel menuSunModel = MenuSunModel();
77 menuSunModel.id = element.id; 82 menuSunModel.id = element.id;
78 menuSunModel.name = element.pname; 83 menuSunModel.name = element.pname;
79 - menuSunModel.price = element.menuPrice; 84 + // menuSunModel.price = element.menuPrice;
  85 + menuSunModel.price = element.planPrice;
80 menuSunModel.member_price = element.memberPrice; 86 menuSunModel.member_price = element.memberPrice;
81 menuSunModel.unit = '份'; 87 menuSunModel.unit = '份';
82 // menuSunModel.amount = element.amount; 88 // menuSunModel.amount = element.amount;
@@ -91,8 +97,9 @@ class _OrderAdvanceEidtPageState extends State<OrderAdvanceEidtPage> { @@ -91,8 +97,9 @@ class _OrderAdvanceEidtPageState extends State<OrderAdvanceEidtPage> {
91 97
92 MenuModel menuModelPlanDish = MenuModel(); 98 MenuModel menuModelPlanDish = MenuModel();
93 menuModelPlanDish.className = '我的排菜'; 99 menuModelPlanDish.className = '我的排菜';
  100 + menuModelPlanDish.isChange = false;
94 List<MenuSunModel> cookListPlanDish = []; 101 List<MenuSunModel> cookListPlanDish = [];
95 - List<SunListPlan> mineList = _planDishProvider.mineList; 102 + List<SunListPlan> mineList = _planDishProvider.mineListTemp;
96 mineList.forEach((element) { 103 mineList.forEach((element) {
97 MenuSunModel menuSunModel = MenuSunModel(); 104 MenuSunModel menuSunModel = MenuSunModel();
98 menuSunModel.id = element.id; 105 menuSunModel.id = element.id;
@@ -109,6 +116,7 @@ class _OrderAdvanceEidtPageState extends State<OrderAdvanceEidtPage> { @@ -109,6 +116,7 @@ class _OrderAdvanceEidtPageState extends State<OrderAdvanceEidtPage> {
109 116
110 _planDishProvider.menuModelForManager 117 _planDishProvider.menuModelForManager
111 .insert(1, menuModelPlanDish); //添加排菜 118 .insert(1, menuModelPlanDish); //添加排菜
  119 +
112 setState(() {}); 120 setState(() {});
113 } else { 121 } else {
114 if (!results[0]) { 122 if (!results[0]) {
@@ -122,6 +130,70 @@ class _OrderAdvanceEidtPageState extends State<OrderAdvanceEidtPage> { @@ -122,6 +130,70 @@ class _OrderAdvanceEidtPageState extends State<OrderAdvanceEidtPage> {
122 }); 130 });
123 } 131 }
124 132
  133 + _initMenuModelForManagerData() {
  134 + _planDishProvider.menuModelForManager.forEach((element) {
  135 + if (element.className == '套餐' || element.className == '我的排菜') {
  136 + List<SunListPlan> olddata = element.className == '套餐'
  137 + ? _planDishProvider.storeList
  138 + : _planDishProvider.mineList;
  139 + element.cookbooklist.forEach((newdata) {
  140 + olddata.forEach((store) {
  141 + if (store.id == newdata.id) {
  142 + if (newdata.amount == 0) {
  143 + //同一个套餐
  144 + if (newdata.cookList.length == 0) {
  145 + newdata.cookList = store.cookList;
  146 + } else {
  147 + store.cookList.forEach((storeCook) {
  148 + String id = storeCook.id;
  149 + newdata.cookList.forEach((cooklist) {
  150 + if (cooklist.id == storeCook.id) {
  151 + id = '';
  152 + //同一分类
  153 + if (cooklist.cookbooklist.length == 0) {
  154 + cooklist.cookbooklist = storeCook.cookbooklist;
  155 + } else {
  156 + cooklist.cookbooklist.forEach((value1) {
  157 + storeCook.cookbooklist.forEach((value2) {
  158 + //同一菜品
  159 + if (value1.id == value2.id) {
  160 + value1.amount = value2.amount;
  161 + }
  162 + });
  163 + });
  164 + }
  165 + }
  166 + });
  167 + if (id != '') {
  168 + //该菜品分类已经不存在
  169 + // 还原数据
  170 + newdata.cookList.add(storeCook);
  171 + }
  172 + });
  173 + }
  174 + }
  175 + }
  176 + });
  177 + });
  178 + } else if (element.className == '临时加菜') {
  179 + } else {
  180 + //单菜
  181 + // bool hasmMenu = element.cookbooklist.any(((value) => value.amount > 0));
  182 + // if (hasmMenu) {
  183 + // //单品此类有选中菜品
  184 +
  185 + // element.cookbooklist.forEach((value) {
  186 + // if (value.amount > 0) {
  187 + // // priceSum += double.parse(value.price) * value.amount;
  188 + // // memberPriceSum += double.parse(value.member_price) * value.amount;
  189 + // }
  190 + // });
  191 + // }
  192 + }
  193 + // planDishC.text = priceSum.toString();
  194 + });
  195 + }
  196 +
125 ///菜品数据 197 ///菜品数据
126 198
127 Future<bool> _getCookbookByClass({bool showLoading = true}) async { 199 Future<bool> _getCookbookByClass({bool showLoading = true}) async {
@@ -268,6 +340,103 @@ class _OrderAdvanceEidtPageState extends State<OrderAdvanceEidtPage> { @@ -268,6 +340,103 @@ class _OrderAdvanceEidtPageState extends State<OrderAdvanceEidtPage> {
268 // } 340 // }
269 } 341 }
270 342
  343 + //把数量置空
  344 + _clearAmount() {
  345 + _planDishProvider.menuModelForManager.forEach((element) {
  346 + if (element.className == '套餐' || element.className == '我的排菜') {
  347 + element.cookbooklist.forEach((newdata) {
  348 + newdata.amount = 0;
  349 +
  350 + newdata.cookList.forEach((cooklist) {
  351 + //同一分类
  352 + cooklist.cookbooklist.forEach((value1) {
  353 + value1.amount = 0;
  354 + });
  355 + });
  356 + });
  357 + } else if (element.className == '临时加菜') {
  358 + } else {
  359 + //单菜
  360 + element.cookbooklist.forEach((value) {
  361 + value.amount = 0;
  362 + });
  363 + }
  364 + });
  365 + }
  366 +
  367 + //计算价格
  368 + _calculatePrice() {
  369 + priceSum = 0;
  370 + memberPriceSum = 0;
  371 + _planDishProvider.menuModelForManager.forEach((element) {
  372 + if (element.className == '套餐' || element.className == '我的排菜') {
  373 + List<SunListPlan> olddata = element.className == '套餐'
  374 + ? _planDishProvider.storeList
  375 + : _planDishProvider.mineList;
  376 + element.cookbooklist.forEach((newdata) {
  377 + olddata.forEach((store) {
  378 + if (store.id == newdata.id) {
  379 + if (newdata.amount > 0) {
  380 + bool isChange = false; //套餐数量是否发生变化
  381 + //同一个套餐
  382 + newdata.cookList.forEach((cooklist) {
  383 + store.cookList.forEach((storeCook) {
  384 + if (cooklist.id == storeCook.id) {
  385 + //同一分类
  386 + cooklist.cookbooklist.forEach((value1) {
  387 + storeCook.cookbooklist.forEach((value2) {
  388 + if (value1.id == value2.id) {
  389 + if (value1.amount != value2.amount) {
  390 + isChange = true;
  391 + }
  392 + }
  393 + });
  394 + });
  395 + }
  396 + });
  397 + });
  398 + //当前套餐/排菜数量已经发生变化
  399 + if (!isChange) {
  400 + priceSum += double.parse(store.planPrice) * newdata.amount;
  401 + memberPriceSum +=
  402 + double.parse(store.memberPrice) * newdata.amount;
  403 + } else {
  404 + //单品
  405 + newdata.cookList.forEach((cooklist) {
  406 + //同一分类
  407 + cooklist.cookbooklist.forEach((value1) {
  408 + priceSum += double.parse(value1.price) *
  409 + value1.amount *
  410 + newdata.amount;
  411 + memberPriceSum += double.parse(value1.member_price) *
  412 + value1.amount *
  413 + newdata.amount;
  414 + });
  415 + });
  416 + }
  417 + }
  418 + }
  419 + });
  420 + });
  421 + } else if (element.className == '临时加菜') {
  422 + } else {
  423 + //单菜
  424 + bool hasmMenu = element.cookbooklist.any(((value) => value.amount > 0));
  425 + if (hasmMenu) {
  426 + //单品此类有选中菜品
  427 +
  428 + element.cookbooklist.forEach((value) {
  429 + if (value.amount > 0) {
  430 + priceSum += double.parse(value.price) * value.amount;
  431 + memberPriceSum += double.parse(value.member_price) * value.amount;
  432 + }
  433 + });
  434 + }
  435 + }
  436 + planDishC.text = priceSum.toString();
  437 + });
  438 + }
  439 +
271 @override 440 @override
272 Widget build(BuildContext context) { 441 Widget build(BuildContext context) {
273 _planDishProvider = Provider.of<PlanDishProvider>(context, listen: true); 442 _planDishProvider = Provider.of<PlanDishProvider>(context, listen: true);
@@ -506,16 +675,38 @@ class _OrderAdvanceEidtPageState extends State<OrderAdvanceEidtPage> { @@ -506,16 +675,38 @@ class _OrderAdvanceEidtPageState extends State<OrderAdvanceEidtPage> {
506 0) { 675 0) {
507 setState(() { 676 setState(() {
508 menuSunModel.amount--; 677 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}'; 678 + _calculatePrice();
  679 + if (_planDishProvider
  680 + .menuModelForManager[
  681 + _selectIndex]
  682 + .className ==
  683 + '套餐' ||
  684 + _planDishProvider
  685 + .menuModelForManager[
  686 + _selectIndex] ==
  687 + '我的排菜') {
  688 + // _calculatePrice();
  689 + //套餐菜品总个数
  690 + //遍历套餐下的菜品分类
  691 + menuSunModel.cookList
  692 + .forEach(
  693 + (element) {
  694 + //遍历菜品
  695 + element.cookbooklist
  696 + .forEach(
  697 + (cook) {
  698 + carSum -=
  699 + cook.amount;
  700 + });
  701 + });
  702 + } else {
  703 + carSum--;
  704 + }
  705 + if (menuSunModel
  706 + .amount ==
  707 + 0) {
  708 + _initMenuModelForManagerData();
  709 + }
519 }); 710 });
520 } 711 }
521 }, 712 },
@@ -614,12 +805,35 @@ class _OrderAdvanceEidtPageState extends State<OrderAdvanceEidtPage> { @@ -614,12 +805,35 @@ class _OrderAdvanceEidtPageState extends State<OrderAdvanceEidtPage> {
614 onTap: () { 805 onTap: () {
615 setState(() { 806 setState(() {
616 menuSunModel.amount++; 807 menuSunModel.amount++;
617 - carSum++;  
618 - priceSum += double.parse(  
619 - menuSunModel.price);  
620 - memberPriceSum += double.parse(  
621 - menuSunModel.member_price);  
622 - planDishC.text = '${priceSum}'; 808 +
  809 + // priceSum += double.parse(
  810 + // menuSunModel.price);
  811 + // memberPriceSum += double.parse(
  812 + // menuSunModel.member_price);
  813 + // planDishC.text = '${priceSum}';
  814 + _calculatePrice();
  815 + if (_planDishProvider
  816 + .menuModelForManager[
  817 + _selectIndex]
  818 + .className ==
  819 + '套餐' ||
  820 + _planDishProvider
  821 + .menuModelForManager[
  822 + _selectIndex] ==
  823 + '我的排菜') {
  824 + //套餐菜品总个数
  825 + //遍历套餐下的菜品分类
  826 + menuSunModel.cookList
  827 + .forEach((element) {
  828 + //遍历菜品
  829 + element.cookbooklist
  830 + .forEach((cook) {
  831 + carSum += cook.amount;
  832 + });
  833 + });
  834 + } else {
  835 + carSum++;
  836 + }
623 }); 837 });
624 }, 838 },
625 child: Container( 839 child: Container(
@@ -811,17 +1025,113 @@ class _OrderAdvanceEidtPageState extends State<OrderAdvanceEidtPage> { @@ -811,17 +1025,113 @@ class _OrderAdvanceEidtPageState extends State<OrderAdvanceEidtPage> {
811 isBold: false, 1025 isBold: false,
812 borderColor: MyColours.color_438E93, 1026 borderColor: MyColours.color_438E93,
813 textColor: MyColours.color_438E93, 1027 textColor: MyColours.color_438E93,
814 - onPressed: () { 1028 + onPressed: () async {
815 // _planDishProvider.menuModel.forEach((element) { 1029 // _planDishProvider.menuModel.forEach((element) {
816 // _planDishProvider.menuModelForManager 1030 // _planDishProvider.menuModelForManager
817 // .forEach((value) {}); 1031 // .forEach((value) {});
818 // }); 1032 // });
819 1033
820 - NavigatorUtil.goOrderEditListShowPage(context,  
821 - object: {  
822 - 'object':  
823 - _planDishProvider.menuModelForManager  
824 - }); 1034 + // Map temp;
  1035 + // if (menuModel == null) {
  1036 + Map temp = await NavigatorUtil
  1037 + .goOrderEditListShowPage(context, object: {
  1038 + 'object': _planDishProvider.menuModelForManager,
  1039 + }, object1: {
  1040 + 'object1': _planDishProvider.storeList
  1041 + }, object2: {
  1042 + 'object2': _planDishProvider.mineList
  1043 + });
  1044 + // } else {
  1045 + // temp =
  1046 + // await NavigatorUtil.goPlanNewDishPage(
  1047 + // context,
  1048 + // object: {'object': menuModel},
  1049 + // planDishPrice: dishPriceC.text);
  1050 + // }
  1051 +
  1052 + if (temp != null) {
  1053 + print(_planDishProvider.storeList);
  1054 + List<MenuSunModel> dataLocalShowMore =
  1055 + temp['more']; //二级菜单
  1056 + List<MenuModel> dataLocalShowOne =
  1057 + temp['one']; //一级菜单
  1058 +
  1059 + // 刷新页面***************
  1060 +
  1061 + print(dataLocalShowMore);
  1062 + print(dataLocalShowOne);
  1063 + print(_planDishProvider.menuModelForManager);
  1064 +
  1065 + int carSumTemp = 0;
  1066 + _clearAmount();
  1067 +
  1068 + _planDishProvider.menuModelForManager
  1069 + .forEach((element) {
  1070 + if (element.className == '套餐' ||
  1071 + element.className == '我的排菜') {
  1072 + dataLocalShowMore.forEach((value) {
  1073 + element.cookbooklist.forEach((elementCook) {
  1074 + if (value.id == elementCook.id) {
  1075 + //同一个套餐
  1076 + // elementCook.cookList = value.cookList;
  1077 + elementCook.amount = value.moreSum;
  1078 + elementCook.cookList
  1079 + .forEach((oldValue) {
  1080 + oldValue.cookbooklist
  1081 + .forEach((oldCook) {
  1082 + oldCook.amount = 0;
  1083 + });
  1084 + value.cookList.forEach((newValue) {
  1085 + if (newValue.id == oldValue.id) {
  1086 + //同一个分类
  1087 +
  1088 + oldValue.cookbooklist
  1089 + .forEach((oldCook) {
  1090 + // oldCook.amount =
  1091 + // newValue.allSum;
  1092 +
  1093 + newValue.cookbooklist
  1094 + .forEach((newCook) {
  1095 + if (oldCook.id ==
  1096 + newCook.id) {
  1097 + //同一个菜品
  1098 + oldCook.amount =
  1099 + newCook.amount;
  1100 + carSumTemp +=
  1101 + newCook.amount;
  1102 + }
  1103 + });
  1104 + });
  1105 + }
  1106 + });
  1107 + });
  1108 + }
  1109 + });
  1110 + });
  1111 + } else {
  1112 + //单品
  1113 + print(dataLocalShowOne);
  1114 + dataLocalShowOne.forEach((one) {
  1115 + if (element.id == one.id) {
  1116 + //同一分类
  1117 + element.cookbooklist.forEach((old) {
  1118 + one.cookbooklist.forEach((newvalue) {
  1119 + if (old.id == newvalue.id) {
  1120 + old.amount = newvalue.amount;
  1121 + }
  1122 + });
  1123 + });
  1124 + }
  1125 + });
  1126 + }
  1127 + });
  1128 +
  1129 + carSum = carSumTemp;
  1130 + print((_planDishProvider.storeList));
  1131 + _calculatePrice();
  1132 + _initMenuModelForManagerData();
  1133 + setState(() {});
  1134 + }
825 }, 1135 },
826 ), 1136 ),
827 RoundButton( 1137 RoundButton(
@@ -11,13 +11,17 @@ import '../../../widgets/h_empty_view.dart'; @@ -11,13 +11,17 @@ import '../../../widgets/h_empty_view.dart';
11 import '../../../widgets/round_button.dart'; 11 import '../../../widgets/round_button.dart';
12 import '../../../widgets/v_empty_view.dart'; 12 import '../../../widgets/v_empty_view.dart';
13 import '../../models/cookbook_model.dart'; 13 import '../../models/cookbook_model.dart';
  14 +import '../../models/plan_cook_list_model.dart';
14 import '../../provider/plan_dish_provider.dart'; 15 import '../../provider/plan_dish_provider.dart';
15 import '../../route/navigator_util.dart'; 16 import '../../route/navigator_util.dart';
16 import '../../utils/dialog_util.dart'; 17 import '../../utils/dialog_util.dart';
17 18
18 class OrderEditListShowPage extends StatefulWidget { 19 class OrderEditListShowPage extends StatefulWidget {
  20 + final List<SunListPlan> storeList; //套餐元数据
  21 + final List<SunListPlan> mineList; //我的排菜元数据
19 final List<MenuModel> data; 22 final List<MenuModel> data;
20 - OrderEditListShowPage({Key key, this.data}) : super(key: key); 23 + OrderEditListShowPage({Key key, this.data, this.storeList, this.mineList})
  24 + : super(key: key);
21 25
22 @override 26 @override
23 _OrderEditListShowPageState createState() => _OrderEditListShowPageState(); 27 _OrderEditListShowPageState createState() => _OrderEditListShowPageState();
@@ -58,15 +62,25 @@ class _OrderEditListShowPageState extends State<OrderEditListShowPage> { @@ -58,15 +62,25 @@ class _OrderEditListShowPageState extends State<OrderEditListShowPage> {
58 @override 62 @override
59 void initState() { 63 void initState() {
60 super.initState(); 64 super.initState();
61 -  
62 65
63 if (widget.data != null) { 66 if (widget.data != null) {
64 widget.data.forEach((element) { 67 widget.data.forEach((element) {
65 if (element.className == '套餐' || element.className == '我的排菜') { 68 if (element.className == '套餐' || element.className == '我的排菜') {
66 - //如果是套餐,则看cooklist有没有选中的 69 + // //如果是套餐,则看cooklist有没有选中的
  70 + // bool isChange = false; //套餐或者排菜数量是否选中
  71 + // if (element.className == '套餐') {
  72 + // isChange = _isChange(widget.storeList);
  73 + // } else {
  74 + // // isChange = _isChange(widget.storeList);
  75 + // }
67 76
68 element.cookbooklist.forEach((value) { 77 element.cookbooklist.forEach((value) {
69 if (value.amount > 0) { 78 if (value.amount > 0) {
  79 + // if (!isChange) {
  80 + // priceSum += double.parse(value.price) * value.amount;
  81 + // memberPriceSum +=
  82 + // double.parse(value.member_price) * value.amount;
  83 + // }
70 //选中了该套餐 84 //选中了该套餐
71 //把套餐中没有选中的菜品踢出去 85 //把套餐中没有选中的菜品踢出去
72 MenuSunModel menuSunModel = MenuSunModel(); 86 MenuSunModel menuSunModel = MenuSunModel();
@@ -82,11 +96,15 @@ class _OrderEditListShowPageState extends State<OrderEditListShowPage> { @@ -82,11 +96,15 @@ class _OrderEditListShowPageState extends State<OrderEditListShowPage> {
82 96
83 if (cookSun.amount > 0) { 97 if (cookSun.amount > 0) {
84 //当前菜品已选择 98 //当前菜品已选择
85 - moreSum += cookSun.amount; 99 + // moreSum += cookSun.amount;
86 cookSum += cookSun.amount; 100 cookSum += cookSun.amount;
87 - priceSum += double.parse(cookSun.price) * cookSun.amount;  
88 - memberPriceSum +=  
89 - double.parse(cookSun.member_price) * cookSun.amount; 101 +
  102 + // if (isChange) {
  103 + // priceSum += double.parse(cookSun.price) * cookSun.amount;
  104 + // memberPriceSum +=
  105 + // double.parse(cookSun.member_price) * cookSun.amount;
  106 + // }
  107 +
90 carSum += cookSun.amount; 108 carSum += cookSun.amount;
91 cooklistSun.add(cookSun); 109 cooklistSun.add(cookSun);
92 } 110 }
@@ -98,7 +116,9 @@ class _OrderEditListShowPageState extends State<OrderEditListShowPage> { @@ -98,7 +116,9 @@ class _OrderEditListShowPageState extends State<OrderEditListShowPage> {
98 value.cookList = moreMenu; 116 value.cookList = moreMenu;
99 } 117 }
100 }); 118 });
101 - value.moreSum = moreSum; 119 + value.moreSum = value.amount;
  120 + value.channel =
  121 + element.className == '套餐' ? '1' : '2'; // 1套餐----2排菜
102 dataLocalShowMore.add(value); 122 dataLocalShowMore.add(value);
103 } 123 }
104 }); 124 });
@@ -132,9 +152,9 @@ class _OrderEditListShowPageState extends State<OrderEditListShowPage> { @@ -132,9 +152,9 @@ class _OrderEditListShowPageState extends State<OrderEditListShowPage> {
132 element.cookbooklist.forEach((value) { 152 element.cookbooklist.forEach((value) {
133 if (value.amount > 0) { 153 if (value.amount > 0) {
134 allSum += value.amount; 154 allSum += value.amount;
135 - priceSum += double.parse(value.price) * value.amount;  
136 - memberPriceSum +=  
137 - double.parse(value.member_price) * value.amount; 155 + // priceSum += double.parse(value.price) * value.amount;
  156 + // memberPriceSum +=
  157 + // double.parse(value.member_price) * value.amount;
138 carSum += value.amount; 158 carSum += value.amount;
139 cookbooklist.add(value); 159 cookbooklist.add(value);
140 } 160 }
@@ -144,15 +164,154 @@ class _OrderEditListShowPageState extends State<OrderEditListShowPage> { @@ -144,15 +164,154 @@ class _OrderEditListShowPageState extends State<OrderEditListShowPage> {
144 dataLocalShowOne.add(menuModel); 164 dataLocalShowOne.add(menuModel);
145 } 165 }
146 } 166 }
147 - planDishC.text = priceSum.toString(); 167 + // planDishC.text = priceSum.toString();
148 }); 168 });
149 } 169 }
  170 + _calculatePrice();
150 print(dataLocalShowMore); 171 print(dataLocalShowMore);
151 print(dataLocalShowOne); 172 print(dataLocalShowOne);
152 } 173 }
153 174
154 - _calculateMore() {}  
155 - _calculateOne() {} 175 + //计算价格
  176 + _calculatePrice() {
  177 + priceSum = 0;
  178 + memberPriceSum = 0;
  179 + dataLocalShowMore.forEach((element) {
  180 + if (element.channel == '1' || element.channel == '2') {
  181 + List<SunListPlan> olddata =
  182 + element.channel == '1' ? widget.storeList : widget.mineList;
  183 + olddata.forEach((store) {
  184 + if (element.amount > 0) {
  185 + if (store.id == element.id) {
  186 + bool isChange = false; //套餐数量是否发生变化
  187 + //同一个套餐
  188 + store.cookList.forEach((storeCook) {
  189 + if (store.cookList.length != element.cookList.length) {
  190 + isChange = true;
  191 + }
  192 + element.cookList.forEach((cooklist) {
  193 + if (cooklist.id == storeCook.id) {
  194 + if (cooklist.cookbooklist.length !=
  195 + storeCook.cookbooklist.length) {
  196 + isChange = true;
  197 + }
  198 + //同一分类
  199 + cooklist.cookbooklist.forEach((value1) {
  200 + storeCook.cookbooklist.forEach((value2) {
  201 + if (value1.id == value2.id) {
  202 + if (value1.amount != value2.amount) {
  203 + isChange = true;
  204 + }
  205 + }
  206 + });
  207 + });
  208 + }
  209 + });
  210 + });
  211 + //当前套餐/排菜数量已经发生变化
  212 + if (!isChange) {
  213 + priceSum += double.parse(store.planPrice) * element.amount;
  214 + memberPriceSum +=
  215 + double.parse(store.memberPrice) * element.amount;
  216 + } else {
  217 + //单品
  218 + element.cookList.forEach((cooklist) {
  219 + //同一分类
  220 + cooklist.cookbooklist.forEach((value1) {
  221 + priceSum += double.parse(value1.price) *
  222 + value1.amount *
  223 + element.amount;
  224 + memberPriceSum += double.parse(value1.member_price) *
  225 + value1.amount *
  226 + element.amount;
  227 + });
  228 + });
  229 + }
  230 + }
  231 + }
  232 + });
  233 + } else if (element.channel == '3') {
  234 + //店内常点
  235 + } else {
  236 + // //单菜
  237 + // bool hasmMenu = element.cookbooklist.any(((value) => value.amount > 0));
  238 + // if (hasmMenu) {
  239 + // //单品此类有选中菜品
  240 +
  241 + // element.cookbooklist.forEach((value) {
  242 + // if (value.amount > 0) {
  243 + // priceSum += double.parse(value.price) * value.amount;
  244 + // memberPriceSum += double.parse(value.member_price) * value.amount;
  245 + // }
  246 + // });
  247 + // }
  248 + }
  249 + });
  250 +
  251 + //单菜品价格
  252 + dataLocalShowOne.forEach((element) {
  253 +//单菜
  254 + bool hasmMenu = element.cookbooklist.any(((value) => value.amount > 0));
  255 + if (hasmMenu) {
  256 + //单品此类有选中菜品
  257 +
  258 + element.cookbooklist.forEach((value) {
  259 + if (value.amount > 0) {
  260 + priceSum += double.parse(value.price) * value.amount;
  261 + memberPriceSum += double.parse(value.member_price) * value.amount;
  262 + }
  263 + });
  264 + }
  265 + });
  266 + planDishC.text = priceSum.toString();
  267 + }
  268 +
  269 + // _calculateMore(List<MenuSunModel>dataLocalShowMore) {
  270 +
  271 + // }
  272 + // _calculateOne() {}
  273 +
  274 + //判断当前套餐或者排菜数量是否发生变化
  275 + // _isChange(List<SunListPlan> olddata) {
  276 + // bool isChange = false; //套餐数量是否发生变化
  277 + // dataLocalShowMore.forEach((element) {
  278 + // if (element.name == '套餐') {
  279 + // //套餐是否发生变化
  280 + // element.cookList.forEach((cooklist) {
  281 + // cooklist.cookbooklist.forEach((cook) {
  282 + // olddata.forEach((store) {
  283 + // if (cooklist.id == store.id) {
  284 + // store.cookList.forEach((storecooklist) {
  285 + // storecooklist.cookbooklist.forEach((storecook) {
  286 + // if (cook.amount != storecook.amount) {
  287 + // //数量发生变化
  288 + // isChange = true;
  289 + // }
  290 + // });
  291 + // });
  292 + // }
  293 + // });
  294 + // });
  295 + // });
  296 + // }
  297 + // });
  298 + // print(isChange);
  299 + // return isChange;
  300 + // }
  301 +
  302 + // //计算价格
  303 + // _calculateMore(){
  304 + // if(_isChange(widget.storeList)){
  305 + // //套餐数量发生变化
  306 + // // 单个菜品价格计算
  307 + // priceSum += double.parse(cookSun.price) * cookSun.amount;
  308 + // memberPriceSum +=
  309 + // double.parse(cookSun.member_price) * cookSun.amount;
  310 + // }else{
  311 + // //套餐价
  312 + // priceSum = widget.storeList
  313 + // }
  314 + // }
156 315
157 @override 316 @override
158 Widget build(BuildContext context) { 317 Widget build(BuildContext context) {
@@ -288,7 +447,7 @@ class _OrderEditListShowPageState extends State<OrderEditListShowPage> { @@ -288,7 +447,7 @@ class _OrderEditListShowPageState extends State<OrderEditListShowPage> {
288 ), 447 ),
289 Spacer(), 448 Spacer(),
290 Text( 449 Text(
291 - '${menuSunModelF.moreSum}道', 450 + '${menuSunModelF.moreSum}份',
292 style: TextStyle( 451 style: TextStyle(
293 fontSize: font(14), 452 fontSize: font(14),
294 color: MyColours 453 color: MyColours
@@ -296,17 +455,43 @@ class _OrderEditListShowPageState extends State<OrderEditListShowPage> { @@ -296,17 +455,43 @@ class _OrderEditListShowPageState extends State<OrderEditListShowPage> {
296 ), 455 ),
297 ), 456 ),
298 InkWell( 457 InkWell(
  458 + onTap: () {
  459 + //弹框确认是否删除
  460 + DialogUtil
  461 + .cupertinoAlertDialog(
  462 + context,
  463 + title: "",
  464 + content:
  465 + "确定要删除此套餐下所有菜品吗?",
  466 + rTitle: "确定",
  467 + rCallback:
  468 + () {
  469 + //遍历将要被删除的列表,计算页面显示数值
  470 +
  471 + carSum -=
  472 + menuSunModelF
  473 + .moreSum;
  474 + dataLocalShowMore
  475 + .removeAt(
  476 + indexMore);
  477 +
  478 + _calculatePrice();
  479 +
  480 + setState(() {});
  481 + });
  482 + },
299 child: Container( 483 child: Container(
300 - // color: Colors.red,  
301 - padding: EdgeInsets.only(  
302 - left: w(20),  
303 - right: w(18)),  
304 - child: Image.asset(  
305 - Utils.getImgPath(  
306 - 'f_delete_red'),  
307 - width: w(17),  
308 - ),  
309 - )) 484 + // color: Colors.red,
  485 + padding:
  486 + EdgeInsets.only(
  487 + left: w(20),
  488 + right: w(18)),
  489 + child: Image.asset(
  490 + Utils.getImgPath(
  491 + 'f_delete_red'),
  492 + width: w(17),
  493 + ),
  494 + ))
310 ], 495 ],
311 )) 496 ))
312 ], 497 ],
@@ -400,10 +585,11 @@ class _OrderEditListShowPageState extends State<OrderEditListShowPage> { @@ -400,10 +585,11 @@ class _OrderEditListShowPageState extends State<OrderEditListShowPage> {
400 // carSum += element.amount; 585 // carSum += element.amount;
401 586
402 menuModel.allSum -= element.amount; 587 menuModel.allSum -= element.amount;
403 - menuSunModelF.moreSum -= element.amount;  
404 - priceSum -= double.parse(element.price) * element.amount;  
405 - planDishC.text = priceSum.toString();  
406 - memberPriceSum -= double.parse(element.member_price) * element.amount; 588 + // menuSunModelF.moreSum -= element.amount;
  589 + // priceSum -= double.parse(element.price) * element.amount;
  590 + // planDishC.text = priceSum.toString();
  591 + // memberPriceSum -= double.parse(element.member_price) * element.amount;
  592 +
407 carSum -= element.amount; 593 carSum -= element.amount;
408 }); 594 });
409 dataLocalShowMore[indexMore].cookList.removeAt(indexF); 595 dataLocalShowMore[indexMore].cookList.removeAt(indexF);
@@ -413,6 +599,8 @@ class _OrderEditListShowPageState extends State<OrderEditListShowPage> { @@ -413,6 +599,8 @@ class _OrderEditListShowPageState extends State<OrderEditListShowPage> {
413 dataLocalShowMore.removeAt(indexMore); 599 dataLocalShowMore.removeAt(indexMore);
414 } 600 }
415 601
  602 + _calculatePrice();
  603 +
416 setState(() {}); 604 setState(() {});
417 }); 605 });
418 }, 606 },
@@ -521,19 +709,20 @@ class _OrderEditListShowPageState extends State<OrderEditListShowPage> { @@ -521,19 +709,20 @@ class _OrderEditListShowPageState extends State<OrderEditListShowPage> {
521 709
522 menuModel 710 menuModel
523 .allSum--; 711 .allSum--;
524 - menuSunModelF  
525 - .moreSum--;  
526 - priceSum -=  
527 - double.parse(  
528 - menuSunModel  
529 - .price);  
530 - planDishC.text =  
531 - priceSum  
532 - .toString();  
533 - memberPriceSum -=  
534 - double.parse(  
535 - menuSunModel  
536 - .member_price); 712 + // menuSunModelF
  713 + // .moreSum--;
  714 + // priceSum -=
  715 + // double.parse(
  716 + // menuSunModel
  717 + // .price);
  718 + // planDishC.text =
  719 + // priceSum
  720 + // .toString();
  721 + // memberPriceSum -=
  722 + // double.parse(
  723 + // menuSunModel
  724 + // .member_price);
  725 + _calculatePrice();
537 carSum--; 726 carSum--;
538 if (menuSunModel 727 if (menuSunModel
539 .amount == 728 .amount ==
@@ -670,25 +859,26 @@ class _OrderEditListShowPageState extends State<OrderEditListShowPage> { @@ -670,25 +859,26 @@ class _OrderEditListShowPageState extends State<OrderEditListShowPage> {
670 menuSunModel 859 menuSunModel
671 .amount; 860 .amount;
672 861
673 - menuSunModelF  
674 - .moreSum -=  
675 - menuSunModel  
676 - .amount;  
677 - priceSum -= double.parse(  
678 - menuSunModel  
679 - .price) *  
680 - menuSunModel  
681 - .amount; 862 + // menuSunModelF
  863 + // .moreSum -=
  864 + // menuSunModel
  865 + // .amount;
  866 + // priceSum -= double.parse(
  867 + // menuSunModel
  868 + // .price) *
  869 + // menuSunModel
  870 + // .amount;
682 871
683 - planDishC  
684 - .text =  
685 - priceSum  
686 - .toString();  
687 - memberPriceSum -= double.parse(  
688 - menuSunModel  
689 - .member_price) *  
690 - menuSunModel  
691 - .amount; 872 + // planDishC
  873 + // .text =
  874 + // priceSum
  875 + // .toString();
  876 + // memberPriceSum -= double.parse(
  877 + // menuSunModel
  878 + // .member_price) *
  879 + // menuSunModel
  880 + // .amount;
  881 + // _calculatePrice();
692 carSum -= 882 carSum -=
693 menuSunModel 883 menuSunModel
694 .amount; 884 .amount;
@@ -734,20 +924,20 @@ class _OrderEditListShowPageState extends State<OrderEditListShowPage> { @@ -734,20 +924,20 @@ class _OrderEditListShowPageState extends State<OrderEditListShowPage> {
734 // menuSunModel 924 // menuSunModel
735 // .amount += 925 // .amount +=
736 // input; 926 // input;
737 - menuSunModelF  
738 - .moreSum +=  
739 - input;  
740 - priceSum +=  
741 - double.parse(menuSunModel.price) *  
742 - input;  
743 -  
744 - planDishC  
745 - .text =  
746 - priceSum  
747 - .toString();  
748 - memberPriceSum +=  
749 - double.parse(menuSunModel.member_price) *  
750 - input; 927 + // menuSunModelF
  928 + // .moreSum +=
  929 + // input;
  930 + // priceSum +=
  931 + // double.parse(menuSunModel.price) *
  932 + // input;
  933 +
  934 + // planDishC
  935 + // .text =
  936 + // priceSum
  937 + // .toString();
  938 + // memberPriceSum +=
  939 + // double.parse(menuSunModel.member_price) *
  940 + // input;
751 carSum += 941 carSum +=
752 input; 942 input;
753 } 943 }
@@ -756,6 +946,7 @@ class _OrderEditListShowPageState extends State<OrderEditListShowPage> { @@ -756,6 +946,7 @@ class _OrderEditListShowPageState extends State<OrderEditListShowPage> {
756 .amount = 946 .amount =
757 int.parse( 947 int.parse(
758 value); 948 value);
  949 + _calculatePrice();
759 setState( 950 setState(
760 () {}); 951 () {});
761 } 952 }
@@ -783,19 +974,20 @@ class _OrderEditListShowPageState extends State<OrderEditListShowPage> { @@ -783,19 +974,20 @@ class _OrderEditListShowPageState extends State<OrderEditListShowPage> {
783 '${menuSunModel.amount}'; 974 '${menuSunModel.amount}';
784 menuModel 975 menuModel
785 .allSum++; 976 .allSum++;
786 - menuSunModelF  
787 - .moreSum++;  
788 - priceSum +=  
789 - double.parse(  
790 - menuSunModel  
791 - .price);  
792 - planDishC.text =  
793 - priceSum  
794 - .toString();  
795 - memberPriceSum +=  
796 - double.parse(  
797 - menuSunModel  
798 - .member_price); 977 + // menuSunModelF
  978 + // .moreSum++;
  979 + // priceSum +=
  980 + // double.parse(
  981 + // menuSunModel
  982 + // .price);
  983 + // planDishC.text =
  984 + // priceSum
  985 + // .toString();
  986 + // memberPriceSum +=
  987 + // double.parse(
  988 + // menuSunModel
  989 + // .member_price);
  990 + _calculatePrice();
799 carSum++; 991 carSum++;
800 setState(() {}); 992 setState(() {});
801 }, 993 },
@@ -905,20 +1097,21 @@ class _OrderEditListShowPageState extends State<OrderEditListShowPage> { @@ -905,20 +1097,21 @@ class _OrderEditListShowPageState extends State<OrderEditListShowPage> {
905 1097
906 // element 1098 // element
907 // .amount; 1099 // .amount;
908 - priceSum -= double.parse(  
909 - element  
910 - .price) *  
911 - element  
912 - .amount;  
913 - planDishC  
914 - .text =  
915 - priceSum  
916 - .toString();  
917 - memberPriceSum -= double.parse(  
918 - element  
919 - .member_price) *  
920 - element  
921 - .amount; 1100 + // priceSum -= double.parse(
  1101 + // element
  1102 + // .price) *
  1103 + // element
  1104 + // .amount;
  1105 + // planDishC
  1106 + // .text =
  1107 + // priceSum
  1108 + // .toString();
  1109 + // memberPriceSum -= double.parse(
  1110 + // element
  1111 + // .member_price) *
  1112 + // element
  1113 + // .amount;
  1114 + _calculatePrice();
922 carSum -= 1115 carSum -=
923 element 1116 element
924 .amount; 1117 .amount;
@@ -1020,13 +1213,14 @@ class _OrderEditListShowPageState extends State<OrderEditListShowPage> { @@ -1020,13 +1213,14 @@ class _OrderEditListShowPageState extends State<OrderEditListShowPage> {
1020 menuModel.allSum--; 1213 menuModel.allSum--;
1021 carSum--; 1214 carSum--;
1022 1215
1023 - priceSum -= double.parse(  
1024 - menuSunModel.price);  
1025 - planDishC.text =  
1026 - priceSum.toString();  
1027 - memberPriceSum -=  
1028 - double.parse(menuSunModel  
1029 - .member_price); 1216 + // priceSum -= double.parse(
  1217 + // menuSunModel.price);
  1218 + // planDishC.text =
  1219 + // priceSum.toString();
  1220 + // memberPriceSum -=
  1221 + // double.parse(menuSunModel
  1222 + // .member_price);
  1223 + _calculatePrice();
1030 if (menuSunModel.amount == 1224 if (menuSunModel.amount ==
1031 0) { 1225 0) {
1032 //把当前菜品从列表中去除 1226 //把当前菜品从列表中去除
@@ -1119,17 +1313,18 @@ class _OrderEditListShowPageState extends State<OrderEditListShowPage> { @@ -1119,17 +1313,18 @@ class _OrderEditListShowPageState extends State<OrderEditListShowPage> {
1119 menuModel.allSum -= 1313 menuModel.allSum -=
1120 menuSunModel.amount; 1314 menuSunModel.amount;
1121 1315
1122 - priceSum -= double.parse(  
1123 - menuSunModel  
1124 - .price) *  
1125 - menuSunModel.amount; 1316 + // priceSum -= double.parse(
  1317 + // menuSunModel
  1318 + // .price) *
  1319 + // menuSunModel.amount;
1126 1320
1127 - planDishC.text =  
1128 - priceSum.toString();  
1129 - memberPriceSum -= double  
1130 - .parse(menuSunModel  
1131 - .member_price) *  
1132 - menuSunModel.amount; 1321 + // planDishC.text =
  1322 + // priceSum.toString();
  1323 + // memberPriceSum -= double
  1324 + // .parse(menuSunModel
  1325 + // .member_price) *
  1326 + // menuSunModel.amount;
  1327 + // _calculatePrice();
1133 carSum -= 1328 carSum -=
1134 menuSunModel.amount; 1329 menuSunModel.amount;
1135 1330
@@ -1156,22 +1351,24 @@ class _OrderEditListShowPageState extends State<OrderEditListShowPage> { @@ -1156,22 +1351,24 @@ class _OrderEditListShowPageState extends State<OrderEditListShowPage> {
1156 menuModel.allSum += 1351 menuModel.allSum +=
1157 input; 1352 input;
1158 1353
1159 - priceSum += double.parse(  
1160 - menuSunModel  
1161 - .price) *  
1162 - input; 1354 + // priceSum += double.parse(
  1355 + // menuSunModel
  1356 + // .price) *
  1357 + // input;
  1358 +
  1359 + // planDishC.text =
  1360 + // priceSum.toString();
  1361 + // memberPriceSum += double
  1362 + // .parse(menuSunModel
  1363 + // .member_price) *
  1364 + // input;
1163 1365
1164 - planDishC.text =  
1165 - priceSum.toString();  
1166 - memberPriceSum += double  
1167 - .parse(menuSunModel  
1168 - .member_price) *  
1169 - input;  
1170 carSum += input; 1366 carSum += input;
1171 } 1367 }
1172 1368
1173 menuSunModel.amount = 1369 menuSunModel.amount =
1174 int.parse(value); 1370 int.parse(value);
  1371 + _calculatePrice();
1175 setState(() {}); 1372 setState(() {});
1176 } 1373 }
1177 }, 1374 },
@@ -1194,13 +1391,14 @@ class _OrderEditListShowPageState extends State<OrderEditListShowPage> { @@ -1194,13 +1391,14 @@ class _OrderEditListShowPageState extends State<OrderEditListShowPage> {
1194 menuModel.allSum++; 1391 menuModel.allSum++;
1195 carSum++; 1392 carSum++;
1196 1393
1197 - priceSum += double.parse(  
1198 - menuSunModel.price);  
1199 - planDishC.text =  
1200 - priceSum.toString();  
1201 - memberPriceSum +=  
1202 - double.parse(menuSunModel  
1203 - .member_price); 1394 + // priceSum += double.parse(
  1395 + // menuSunModel.price);
  1396 + // planDishC.text =
  1397 + // priceSum.toString();
  1398 + // memberPriceSum +=
  1399 + // double.parse(menuSunModel
  1400 + // .member_price);
  1401 + _calculatePrice();
1204 1402
1205 setState(() {}); 1403 setState(() {});
1206 }, 1404 },
@@ -1458,7 +1656,14 @@ class _OrderEditListShowPageState extends State<OrderEditListShowPage> { @@ -1458,7 +1656,14 @@ class _OrderEditListShowPageState extends State<OrderEditListShowPage> {
1458 fontSize: 36, 1656 fontSize: 36,
1459 isBold: false, 1657 isBold: false,
1460 onPressed: () { 1658 onPressed: () {
1461 - Navigator.pop(context); 1659 + // List<MenuSunModel> dataLocalShowMore = []; //二级菜单
  1660 + // List<MenuModel> dataLocalShowOne = []; //一级菜单
  1661 + Map data = {
  1662 + 'more': dataLocalShowMore,
  1663 + 'one': dataLocalShowOne,
  1664 + };
  1665 +
  1666 + Navigator.of(context).pop(data);
1462 // NavigatorUtil.goOrderEditListShowPage(context); 1667 // NavigatorUtil.goOrderEditListShowPage(context);
1463 }, 1668 },
1464 ), 1669 ),
@@ -21,11 +21,14 @@ class PlanDishProvider extends ChangeNotifier { @@ -21,11 +21,14 @@ 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 + List<MenuModel> menuModelForManager = []; //经理点菜菜品数据
25 25
26 List<SunListPlan> allList = []; //排菜套餐列表--全部 26 List<SunListPlan> allList = []; //排菜套餐列表--全部
27 List<SunListPlan> storeList = []; //排菜套餐列表--店铺 27 List<SunListPlan> storeList = []; //排菜套餐列表--店铺
28 List<SunListPlan> mineList = []; //排菜套餐列表--我的 28 List<SunListPlan> mineList = []; //排菜套餐列表--我的
  29 +
  30 + List<SunListPlan> storeListTemp = []; //排菜套餐列表--店铺
  31 + List<SunListPlan> mineListTemp = []; //排菜套餐列表--我的
29 // List<CookbookCategorySunModel> categorySunModel; //菜品分类数据 32 // List<CookbookCategorySunModel> categorySunModel; //菜品分类数据
30 // List<CookbookSpecSunModel> specSunModel; //计价单位 33 // List<CookbookSpecSunModel> specSunModel; //计价单位
31 34
@@ -137,13 +140,17 @@ class PlanDishProvider extends ChangeNotifier { @@ -137,13 +140,17 @@ class PlanDishProvider extends ChangeNotifier {
137 if (baseResp != null && baseResp.code == Constant.status_success) { 140 if (baseResp != null && baseResp.code == Constant.status_success) {
138 PlanCookListSunModel planCookListSunModel = 141 PlanCookListSunModel planCookListSunModel =
139 PlanCookListModel.fromJson(baseResp.responseData).data; 142 PlanCookListModel.fromJson(baseResp.responseData).data;
140 - storeList = [];  
141 - mineList = []; 143 + PlanCookListSunModel planCookListSunModel1 =
  144 + PlanCookListModel.fromJson(baseResp.responseData).data;
  145 +
142 allList = []; 146 allList = [];
143 - storeList.addAll(planCookListSunModel.packageList);  
144 - mineList.addAll(planCookListSunModel.plancookList); 147 +
  148 + storeList = List.from(planCookListSunModel.packageList);
  149 + mineList = List.from(planCookListSunModel.plancookList);
145 allList.addAll(storeList); 150 allList.addAll(storeList);
146 allList.addAll(mineList); 151 allList.addAll(mineList);
  152 + storeListTemp = planCookListSunModel1.packageList;
  153 + mineListTemp = planCookListSunModel1.plancookList;
147 if (storeList.length == 0) { 154 if (storeList.length == 0) {
148 pageStateStore = PageState.Empty; 155 pageStateStore = PageState.Empty;
149 } else { 156 } else {
@@ -1266,7 +1266,7 @@ class NavigatorUtil { @@ -1266,7 +1266,7 @@ class NavigatorUtil {
1266 ///经理排菜-编辑列表展示 1266 ///经理排菜-编辑列表展示
1267 1267
1268 static Future<dynamic> goOrderEditListShowPage(BuildContext context, 1268 static Future<dynamic> goOrderEditListShowPage(BuildContext context,
1269 - {replace = false, Map object}) { 1269 + {replace = false, Map object, Map object1, Map object2}) {
1270 // if (invoice != null) { 1270 // if (invoice != null) {
1271 // return _navigateTo(context, 1271 // return _navigateTo(context,
1272 // "${Routes.order_advance_home_page}?invoice=${FluroConvertUtils.object2string(invoice)}", 1272 // "${Routes.order_advance_home_page}?invoice=${FluroConvertUtils.object2string(invoice)}",
@@ -1274,7 +1274,7 @@ class NavigatorUtil { @@ -1274,7 +1274,7 @@ class NavigatorUtil {
1274 // } 1274 // }
1275 if (object != null) { 1275 if (object != null) {
1276 return _navigateTo(context, 1276 return _navigateTo(context,
1277 - "${Routes.order_edit_list_show_page}?object=${FluroConvertUtils.object2string(object)}"); 1277 + "${Routes.order_edit_list_show_page}?object=${FluroConvertUtils.object2string(object)}&object1=${FluroConvertUtils.object2string(object1)}&object2=${FluroConvertUtils.object2string(object2)}");
1278 } 1278 }
1279 return _navigateTo(context, "${Routes.order_edit_list_show_page}", 1279 return _navigateTo(context, "${Routes.order_edit_list_show_page}",
1280 replace: replace); 1280 replace: replace);
@@ -2023,8 +2023,39 @@ var orderEditListShowPageHandle = new Handler( @@ -2023,8 +2023,39 @@ var orderEditListShowPageHandle = new Handler(
2023 res.add(MenuModel.fromJson2(item)); 2023 res.add(MenuModel.fromJson2(item));
2024 } 2024 }
2025 } 2025 }
  2026 + List<SunListPlan> storeList = [];
  2027 + if (params.keys.contains('object1')) {
  2028 + Map object = FluroConvertUtils.string2map(params["object1"].first);
  2029 + List temp = object['object1'];
  2030 + // SunListPlan plan = SunListPlan();
  2031 + // plan.
  2032 + // planDishPrice = params["planDishPrice"].first;
  2033 +
  2034 + for (var item in temp) {
  2035 + // MenuModel menuModel = MenuModel.fromJson2(item);
  2036 + // res.add(menuModel);
  2037 + // print(res);
  2038 + storeList.add(SunListPlan.fromJson(item));
  2039 + }
  2040 + }
  2041 + List<SunListPlan> mineList = [];
  2042 + if (params.keys.contains('object2')) {
  2043 + Map object = FluroConvertUtils.string2map(params["object2"].first);
  2044 + List temp = object['object2'];
  2045 + // SunListPlan plan = SunListPlan();
  2046 + // plan.
  2047 + // planDishPrice = params["planDishPrice"].first;
  2048 +
  2049 + for (var item in temp) {
  2050 + // MenuModel menuModel = MenuModel.fromJson2(item);
  2051 + // res.add(menuModel);
  2052 + // print(res);
  2053 + mineList.add(SunListPlan.fromJson(item));
  2054 + }
  2055 + }
2026 2056
2027 - return OrderEditListShowPage(data: res); 2057 + return OrderEditListShowPage(
  2058 + data: res, storeList: storeList, mineList: mineList);
2028 }); 2059 });
2029 2060
2030 ///经理排菜--类型选择 2061 ///经理排菜--类型选择