Commit 0ea1d788d7d6d0b07920b15b95710bee86014049

Authored by wdn127929
1 parent 0705ecbb

排菜套餐

@@ -19,6 +19,8 @@ class MenuModel { @@ -19,6 +19,8 @@ class MenuModel {
19 bool isChange = false; //是否发生数量变化 19 bool isChange = false; //是否发生数量变化
20 20
21 List<dynamic> cookbooklistShow; 21 List<dynamic> cookbooklistShow;
  22 + int outAllNum;
  23 + int allsumPreviewShow = 0;
22 24
23 MenuModel( 25 MenuModel(
24 {this.id, 26 {this.id,
@@ -28,7 +30,8 @@ class MenuModel { @@ -28,7 +30,8 @@ class MenuModel {
28 this.order, 30 this.order,
29 this.status, 31 this.status,
30 this.classType, 32 this.classType,
31 - this.cookbooklist}); 33 + this.cookbooklist,
  34 + this.outAllNum});
32 35
33 MenuModel.fromJson(Map<String, dynamic> json) { 36 MenuModel.fromJson(Map<String, dynamic> json) {
34 id = json['id']; 37 id = json['id'];
@@ -63,6 +66,44 @@ class MenuModel { @@ -63,6 +66,44 @@ class MenuModel {
63 }); 66 });
64 } 67 }
65 } 68 }
  69 + MenuModel.fromJson3(Map<String, dynamic> json) {
  70 + id = json['id'];
  71 + outAllNum = json['out_all_num'] ?? 1;
  72 + sellerid = json['sellerid'];
  73 + className = json['class_name'];
  74 + classLabel = json['class_label'];
  75 + order = json['order'];
  76 + status = json['status'];
  77 + classType = json['class_type'];
  78 + allSum = json['allSum'] * outAllNum ?? 0;
  79 +
  80 + if (json['cookbooklist'] != null) {
  81 + cookbooklist = [];
  82 + json['cookbooklist'].forEach((v) {
  83 + v['out_all_num'] = outAllNum;
  84 + cookbooklist.add(new MenuSunModel.fromJson4(v));
  85 + });
  86 + }
  87 + }
  88 + MenuModel.fromJson5(Map<String, dynamic> json) {
  89 + id = json['id'];
  90 + outAllNum = json['out_all_num'] ?? 1;
  91 + sellerid = json['sellerid'];
  92 + className = json['class_name'];
  93 + classLabel = json['class_label'];
  94 + order = json['order'];
  95 + status = json['status'];
  96 + classType = json['class_type'];
  97 + allSum = json['allSum'] ?? 0;
  98 + if (json['cookbooklist'] != null) {
  99 + cookbooklist = [];
  100 + json['cookbooklist'].forEach((v) {
  101 + v['out_all_num'] = outAllNum;
  102 + cookbooklist.add(new MenuSunModel.fromJson5(v));
  103 + });
  104 + }
  105 + outAllNum = json['out_all_num'] ?? 1;
  106 + }
66 107
67 Map<String, dynamic> toJson() { 108 Map<String, dynamic> toJson() {
68 final Map<String, dynamic> data = new Map<String, dynamic>(); 109 final Map<String, dynamic> data = new Map<String, dynamic>();
@@ -77,6 +118,7 @@ class MenuModel { @@ -77,6 +118,7 @@ class MenuModel {
77 if (this.cookbooklist != null) { 118 if (this.cookbooklist != null) {
78 data['cookbooklist'] = this.cookbooklist.map((v) => v.toJson()).toList(); 119 data['cookbooklist'] = this.cookbooklist.map((v) => v.toJson()).toList();
79 } 120 }
  121 + data['out_all_num'] = this.outAllNum;
80 return data; 122 return data;
81 } 123 }
82 } 124 }
@@ -468,6 +510,205 @@ class MenuSunModel { @@ -468,6 +510,205 @@ class MenuSunModel {
468 // amounttemp += v.amount; 510 // amounttemp += v.amount;
469 amountHasOrderList.add(v); 511 amountHasOrderList.add(v);
470 } 512 }
  513 + // amount = amounttemp;
  514 + });
  515 + // }
  516 +
  517 + }
  518 + if (json['cookList'] != null) {
  519 + cookList = [];
  520 + json['cookList'].forEach((v) {
  521 + cookList.add(new MenuModel.fromJson2(v));
  522 + });
  523 + }
  524 + taste = json['taste'];
  525 + cooks = json['cooks'];
  526 + json['cook_style'] != null && json['cook_style'] != ''
  527 + ? json['cook_style'] is DishCookStyle
  528 + ? json['cook_style']
  529 + : cookStyle = DishCookStyle.fromJson(json['cook_style'] is Map
  530 + ? json['cook_style']
  531 + : convert.json.decode(json['cook_style']))
  532 + : cookStyle = DishCookStyle.fromJson({
  533 + // 'image_type': image != null && image != '' ? '1' : '2',
  534 + 'image_type': '1',
  535 + 'name_type': '3'
  536 + });
  537 + }
  538 +
  539 + MenuSunModel.fromJson4(Map<String, dynamic> json) {
  540 + id = json['id'];
  541 + sellerid = json['sellerid'];
  542 + mid = json['mid'];
  543 + lid = json['lid'];
  544 + unit = json['unit'];
  545 + name = json['name'];
  546 + price = json['price'];
  547 + member_price = json['member_price'];
  548 + first_name = json['first_name'];
  549 + search_code = json['search_code'];
  550 + channel = json['channel'];
  551 + dishesvideo = json['dishesvideo'];
  552 + dishesgif = json['dishesgif'];
  553 + status = json['status'];
  554 + setup = json['setup'];
  555 + give = json['give'];
  556 + clear_num = json['clear_num'];
  557 + record_num = json['record_num'];
  558 + image = json['image'];
  559 + is_weigh = json['is_weigh'];
  560 + desc = json['desc'];
  561 + order_o = json['order_o'];
  562 + cdate = json['cdate'];
  563 + if (json['spec'] != null) {
  564 + spec = [];
  565 + json['spec'].forEach((v) {
  566 + if (v is Map) {
  567 + spec.add(new SpecModel.fromJson(v));
  568 + } else if (v is SpecModel) {
  569 + spec.add(v);
  570 + }
  571 + });
  572 + }
  573 + if (spec != null) {
  574 + specCan = [];
  575 + spec.forEach((v) {
  576 + if (v.status == '1') {
  577 + specCan.add(v);
  578 + }
  579 + });
  580 + }
  581 + isSpec = json['isSpec'];
  582 + // practice = json['practice'];
  583 + if (json['practice'] != null) {
  584 + practice = [];
  585 + // if (json['practice'].length > 0 && json['practice'][0] is String) {
  586 + // } else {
  587 + json['practice'].forEach((v) {
  588 + if (v is Map) {
  589 + practice.add(new PracticeModel.fromJson(v));
  590 + } else if (v is PracticeModel) {
  591 + practice.add(v);
  592 + }
  593 + });
  594 + // }
  595 + }
  596 + amount = json['amount'] ?? 0;
  597 + amountC.text = amount.toString();
  598 + int amounttemp = 0;
  599 + if (json['amountHasOrderList'] != null) {
  600 + amountHasOrderList = [];
  601 + // if (json['practice'].length > 0 && json['practice'][0] is String) {
  602 + // } else {
  603 + json['amountHasOrderList'].forEach((v) {
  604 + if (v is Map) {
  605 + amounttemp += v['amount'];
  606 + amountHasOrderList.add(new AmountHasOrder.fromJson(v));
  607 + } else if (v is AmountHasOrder) {
  608 + amounttemp += v.amount;
  609 + amountHasOrderList.add(v);
  610 + }
  611 + amount = amounttemp * json['out_all_num'];
  612 + });
  613 + // }
  614 +
  615 + }
  616 + if (json['cookList'] != null) {
  617 + cookList = [];
  618 + json['cookList'].forEach((v) {
  619 + cookList.add(new MenuModel.fromJson2(v));
  620 + });
  621 + }
  622 + taste = json['taste'];
  623 + cooks = json['cooks'];
  624 + json['cook_style'] != null && json['cook_style'] != ''
  625 + ? json['cook_style'] is DishCookStyle
  626 + ? json['cook_style']
  627 + : cookStyle = DishCookStyle.fromJson(json['cook_style'] is Map
  628 + ? json['cook_style']
  629 + : convert.json.decode(json['cook_style']))
  630 + : cookStyle = DishCookStyle.fromJson({
  631 + // 'image_type': image != null && image != '' ? '1' : '2',
  632 + 'image_type': '1',
  633 + 'name_type': '3'
  634 + });
  635 + }
  636 +
  637 + MenuSunModel.fromJson5(Map<String, dynamic> json) {
  638 + id = json['id'];
  639 +
  640 + sellerid = json['sellerid'];
  641 + mid = json['mid'];
  642 + lid = json['lid'];
  643 + unit = json['unit'];
  644 + name = json['name'];
  645 + price = json['price'];
  646 + member_price = json['member_price'];
  647 + first_name = json['first_name'];
  648 + search_code = json['search_code'];
  649 + channel = json['channel'];
  650 + dishesvideo = json['dishesvideo'];
  651 + dishesgif = json['dishesgif'];
  652 + status = json['status'];
  653 + setup = json['setup'];
  654 + give = json['give'];
  655 + clear_num = json['clear_num'];
  656 + record_num = json['record_num'];
  657 + image = json['image'];
  658 + is_weigh = json['is_weigh'];
  659 + desc = json['desc'];
  660 + order_o = json['order_o'];
  661 + cdate = json['cdate'];
  662 + if (json['spec'] != null) {
  663 + spec = [];
  664 + json['spec'].forEach((v) {
  665 + if (v is Map) {
  666 + spec.add(new SpecModel.fromJson(v));
  667 + } else if (v is SpecModel) {
  668 + spec.add(v);
  669 + }
  670 + });
  671 + }
  672 + if (spec != null) {
  673 + specCan = [];
  674 + spec.forEach((v) {
  675 + if (v.status == '1') {
  676 + specCan.add(v);
  677 + }
  678 + });
  679 + }
  680 + isSpec = json['isSpec'];
  681 + // practice = json['practice'];
  682 + if (json['practice'] != null) {
  683 + practice = [];
  684 + // if (json['practice'].length > 0 && json['practice'][0] is String) {
  685 + // } else {
  686 + json['practice'].forEach((v) {
  687 + if (v is Map) {
  688 + practice.add(new PracticeModel.fromJson(v));
  689 + } else if (v is PracticeModel) {
  690 + practice.add(v);
  691 + }
  692 + });
  693 + // }
  694 + }
  695 + amount = json['amount'] ?? 0;
  696 + amountC.text = amount.toString();
  697 + int amounttemp = 0;
  698 + if (json['amountHasOrderList'] != null) {
  699 + amountHasOrderList = [];
  700 + // if (json['practice'].length > 0 && json['practice'][0] is String) {
  701 + // } else {
  702 + json['amountHasOrderList'].forEach((v) {
  703 + if (v is Map) {
  704 + // amounttemp += v['amount'];
  705 + amountHasOrderList.add(new AmountHasOrder.fromJson(v));
  706 + } else if (v is AmountHasOrder) {
  707 + // amounttemp += v.amount;
  708 + amountHasOrderList.add(v);
  709 + }
  710 + // amount = amounttemp;
  711 + // amount = amounttemp * json['out_all_num'];
471 }); 712 });
472 // } 713 // }
473 714
@@ -88,7 +88,10 @@ class _OrderAdvanceEidtPageState extends State<OrderAdvanceEidtPage> { @@ -88,7 +88,10 @@ class _OrderAdvanceEidtPageState extends State<OrderAdvanceEidtPage> {
88 _planDishProvider.menuModelForManager.forEach((element) { 88 _planDishProvider.menuModelForManager.forEach((element) {
89 if (element.className == '临时加菜') { 89 if (element.className == '临时加菜') {
90 element.cookbooklist.forEach((old) { 90 element.cookbooklist.forEach((old) {
91 - carSum -= old.amount; 91 + if (old.name != '临时菜') {
  92 + carSum -= old.amount;
  93 + }
  94 +
92 // if (old.amountHasOrderList != null && 95 // if (old.amountHasOrderList != null &&
93 // old.amountHasOrderList.length > 0) { 96 // old.amountHasOrderList.length > 0) {
94 // carSum -= old.amountHasOrderList[0].amount; 97 // carSum -= old.amountHasOrderList[0].amount;
@@ -146,8 +149,42 @@ class _OrderAdvanceEidtPageState extends State<OrderAdvanceEidtPage> { @@ -146,8 +149,42 @@ class _OrderAdvanceEidtPageState extends State<OrderAdvanceEidtPage> {
146 newvalue.cookbooklist.forEach((newcook) { 149 newvalue.cookbooklist.forEach((newcook) {
147 if (oldcook.id == newcook.id) { 150 if (oldcook.id == newcook.id) {
148 //同一个菜 151 //同一个菜
149 - oldcook.amount = newcook.amount;  
150 - carSum += newcook.amount; 152 + oldcook.amountHasOrderList = newcook.amountHasOrderList;
  153 + newcook.amountHasOrderList.forEach((element1) {
  154 + carSum += element1.amount;
  155 + });
  156 +
  157 + // if (oldcook.amountHasOrderList[0].practiceModel != null &&
  158 + // newcook.amountHasOrderList[0].practiceModel != null &&
  159 + // oldcook.amountHasOrderList[0].specModel != null &&
  160 + // newcook.amountHasOrderList[0].specModel != null) {
  161 + // if (oldcook.amountHasOrderList[0].practiceModel
  162 + // .practice ==
  163 + // newcook.amountHasOrderList[0].practiceModel
  164 + // .practice &&
  165 + // oldcook.amountHasOrderList[0].specModel.specid ==
  166 + // newcook
  167 + // .amountHasOrderList[0].specModel.specid) {
  168 + // oldcook.amountHasOrderList[0].amount =
  169 + // newcook.amountHasOrderList[0].amount;
  170 + // carSum += newcook.amountHasOrderList[0].amount;
  171 + // }
  172 + // } else if (oldcook.amountHasOrderList[0].practiceModel ==
  173 + // null &&
  174 + // oldcook.amountHasOrderList[0].specModel != null) {
  175 + // if (oldcook.amountHasOrderList[0].specModel.specid ==
  176 + // newcook.amountHasOrderList[0].specModel.specid) {
  177 + // if (oldcook.amount !=
  178 + // newcook.amountHasOrderList[0].amount) {
  179 + // has = true;
  180 + // oldcook.amount +=
  181 + // newcook.amountHasOrderList[0].amount;
  182 + // oldcook.amountHasOrderList =
  183 + // newcook.amountHasOrderList;
  184 + // show.allSum += newcook.amountHasOrderList[0].amount;
  185 + // }
  186 + // }
  187 + // }
151 } 188 }
152 }); 189 });
153 }); 190 });
@@ -189,7 +226,7 @@ class _OrderAdvanceEidtPageState extends State<OrderAdvanceEidtPage> { @@ -189,7 +226,7 @@ class _OrderAdvanceEidtPageState extends State<OrderAdvanceEidtPage> {
189 widget.planCookByRidSunModel.packageList.forEach((package) { 226 widget.planCookByRidSunModel.packageList.forEach((package) {
190 if (package.id == menuSunModel.id) { 227 if (package.id == menuSunModel.id) {
191 //同一个套餐 228 //同一个套餐
192 - menuSunModel.amount = package.amount; 229 + menuSunModel.amountHasOrderList = package.amountHasOrderList;
193 menuSunModel.cookList.forEach((oldcooklist) { 230 menuSunModel.cookList.forEach((oldcooklist) {
194 package.cookList.forEach((newcooklist) { 231 package.cookList.forEach((newcooklist) {
195 if (oldcooklist.id == newcooklist.id) { 232 if (oldcooklist.id == newcooklist.id) {
@@ -197,13 +234,54 @@ class _OrderAdvanceEidtPageState extends State<OrderAdvanceEidtPage> { @@ -197,13 +234,54 @@ class _OrderAdvanceEidtPageState extends State<OrderAdvanceEidtPage> {
197 oldcooklist.cookbooklist.forEach((oldcook) { 234 oldcooklist.cookbooklist.forEach((oldcook) {
198 newcooklist.cookbooklist.forEach((newcook) { 235 newcooklist.cookbooklist.forEach((newcook) {
199 if (oldcook.id == newcook.id) { 236 if (oldcook.id == newcook.id) {
200 - // oldcook.amount = newcook.amount;  
201 - // carSum += newcook.amount;  
202 oldcook.amountHasOrderList = 237 oldcook.amountHasOrderList =
203 newcook.amountHasOrderList; 238 newcook.amountHasOrderList;
204 newcook.amountHasOrderList.forEach((element) { 239 newcook.amountHasOrderList.forEach((element) {
205 - carSum += element.amount; 240 + carSum += element.amount *
  241 + package.amountHasOrderList[0].amount;
206 }); 242 });
  243 + // oldcook.amount = newcook.amount;
  244 + // carSum += newcook.amount;
  245 +
  246 + // if (oldcook.amountHasOrderList[0]
  247 + // .practiceModel !=
  248 + // null &&
  249 + // newcook.amountHasOrderList[0].practiceModel !=
  250 + // null &&
  251 + // oldcook.amountHasOrderList[0].specModel !=
  252 + // null &&
  253 + // newcook.amountHasOrderList[0].specModel !=
  254 + // null) {
  255 + // if (oldcook.amountHasOrderList[0].practiceModel
  256 + // .practice ==
  257 + // newcook.amountHasOrderList[0]
  258 + // .practiceModel.practice &&
  259 + // oldcook.amountHasOrderList[0].specModel
  260 + // .specid ==
  261 + // newcook.amountHasOrderList[0].specModel
  262 + // .specid) {
  263 + // oldcook.amountHasOrderList =
  264 + // newcook.amountHasOrderList;
  265 + // newcook.amountHasOrderList.forEach((element) {
  266 + // carSum += element.amount;
  267 + // });
  268 + // }
  269 + // } else if (oldcook.amountHasOrderList[0]
  270 + // .practiceModel ==
  271 + // null &&
  272 + // oldcook.amountHasOrderList[0].specModel !=
  273 + // null) {
  274 + // if (oldcook.amountHasOrderList[0].specModel
  275 + // .specid ==
  276 + // newcook.amountHasOrderList[0].specModel
  277 + // .specid) {
  278 + // oldcook.amountHasOrderList =
  279 + // newcook.amountHasOrderList;
  280 + // newcook.amountHasOrderList.forEach((element) {
  281 + // carSum += element.amount;
  282 + // });
  283 + // }
  284 + // }
207 } 285 }
208 }); 286 });
209 }); 287 });
@@ -265,13 +343,54 @@ class _OrderAdvanceEidtPageState extends State<OrderAdvanceEidtPage> { @@ -265,13 +343,54 @@ class _OrderAdvanceEidtPageState extends State<OrderAdvanceEidtPage> {
265 oldcooklist.cookbooklist.forEach((oldcook) { 343 oldcooklist.cookbooklist.forEach((oldcook) {
266 newcooklist.cookbooklist.forEach((newcook) { 344 newcooklist.cookbooklist.forEach((newcook) {
267 if (oldcook.id == newcook.id) { 345 if (oldcook.id == newcook.id) {
268 - // oldcook.amount = newcook.amount;  
269 - // carSum += newcook.amount;  
270 oldcook.amountHasOrderList = 346 oldcook.amountHasOrderList =
271 newcook.amountHasOrderList; 347 newcook.amountHasOrderList;
272 - newcook.amountHasOrderList.forEach((element) {  
273 - carSum += element.amount; 348 + newcook.amountHasOrderList.forEach((element1) {
  349 + carSum += element1.amount *
  350 + package.amountHasOrderList[0].amount;
274 }); 351 });
  352 + // oldcook.amount = newcook.amount;
  353 + // carSum += newcook.amount;
  354 +
  355 + // if (oldcook
  356 + // .amountHasOrderList[0].practiceModel !=
  357 + // null &&
  358 + // newcook.amountHasOrderList[0].practiceModel !=
  359 + // null &&
  360 + // oldcook.amountHasOrderList[0].specModel !=
  361 + // null &&
  362 + // newcook.amountHasOrderList[0].specModel !=
  363 + // null) {
  364 + // if (oldcook.amountHasOrderList[0].practiceModel
  365 + // .practice ==
  366 + // newcook.amountHasOrderList[0]
  367 + // .practiceModel.practice &&
  368 + // oldcook.amountHasOrderList[0].specModel
  369 + // .specid ==
  370 + // newcook.amountHasOrderList[0].specModel
  371 + // .specid) {
  372 + // oldcook.amountHasOrderList[0].amount =
  373 + // newcook.amountHasOrderList[0].amount;
  374 + // newcook.amountHasOrderList.forEach((element) {
  375 + // carSum += element.amount;
  376 + // });
  377 + // }
  378 + // } else if (oldcook
  379 + // .amountHasOrderList[0].practiceModel ==
  380 + // null &&
  381 + // oldcook.amountHasOrderList[0].specModel !=
  382 + // null) {
  383 + // if (oldcook
  384 + // .amountHasOrderList[0].specModel.specid ==
  385 + // newcook
  386 + // .amountHasOrderList[0].specModel.specid) {
  387 + // oldcook.amountHasOrderList[0].amount =
  388 + // newcook.amountHasOrderList[0].amount;
  389 + // newcook.amountHasOrderList.forEach((element) {
  390 + // carSum += element.amount;
  391 + // });
  392 + // }
  393 + // }
275 } 394 }
276 }); 395 });
277 }); 396 });
@@ -321,7 +440,7 @@ class _OrderAdvanceEidtPageState extends State<OrderAdvanceEidtPage> { @@ -321,7 +440,7 @@ class _OrderAdvanceEidtPageState extends State<OrderAdvanceEidtPage> {
321 widget.planCookByRidSunModel.planList.forEach((package) { 440 widget.planCookByRidSunModel.planList.forEach((package) {
322 if (package.id == menuSunModel.id) { 441 if (package.id == menuSunModel.id) {
323 //同一个排菜 442 //同一个排菜
324 - menuSunModel.amount = package.amount; 443 + menuSunModel.amountHasOrderList = package.amountHasOrderList;
325 menuSunModel.cookList.forEach((oldcooklist) { 444 menuSunModel.cookList.forEach((oldcooklist) {
326 package.cookList.forEach((newcooklist) { 445 package.cookList.forEach((newcooklist) {
327 if (oldcooklist.id == newcooklist.id) { 446 if (oldcooklist.id == newcooklist.id) {
@@ -329,13 +448,54 @@ class _OrderAdvanceEidtPageState extends State<OrderAdvanceEidtPage> { @@ -329,13 +448,54 @@ class _OrderAdvanceEidtPageState extends State<OrderAdvanceEidtPage> {
329 oldcooklist.cookbooklist.forEach((oldcook) { 448 oldcooklist.cookbooklist.forEach((oldcook) {
330 newcooklist.cookbooklist.forEach((newcook) { 449 newcooklist.cookbooklist.forEach((newcook) {
331 if (oldcook.id == newcook.id) { 450 if (oldcook.id == newcook.id) {
332 - // oldcook.amount = newcook.amount;  
333 - // carSum += newcook.amount;  
334 oldcook.amountHasOrderList = 451 oldcook.amountHasOrderList =
335 newcook.amountHasOrderList; 452 newcook.amountHasOrderList;
336 - newcook.amountHasOrderList.forEach((element) {  
337 - carSum += element.amount; 453 + newcook.amountHasOrderList.forEach((element1) {
  454 + carSum += element1.amount *
  455 + package.amountHasOrderList[0].amount;
338 }); 456 });
  457 + // oldcook.amount = newcook.amount;
  458 + // carSum += newcook.amount;
  459 +
  460 + // if (oldcook.amountHasOrderList[0]
  461 + // .practiceModel !=
  462 + // null &&
  463 + // newcook.amountHasOrderList[0].practiceModel !=
  464 + // null &&
  465 + // oldcook.amountHasOrderList[0].specModel !=
  466 + // null &&
  467 + // newcook.amountHasOrderList[0].specModel !=
  468 + // null) {
  469 + // if (oldcook.amountHasOrderList[0].practiceModel
  470 + // .practice ==
  471 + // newcook.amountHasOrderList[0]
  472 + // .practiceModel.practice &&
  473 + // oldcook.amountHasOrderList[0].specModel
  474 + // .specid ==
  475 + // newcook.amountHasOrderList[0].specModel
  476 + // .specid) {
  477 + // oldcook.amountHasOrderList[0].amount =
  478 + // newcook.amountHasOrderList[0].amount;
  479 + // newcook.amountHasOrderList.forEach((element) {
  480 + // carSum += element.amount;
  481 + // });
  482 + // }
  483 + // } else if (oldcook.amountHasOrderList[0]
  484 + // .practiceModel ==
  485 + // null &&
  486 + // oldcook.amountHasOrderList[0].specModel !=
  487 + // null) {
  488 + // if (oldcook.amountHasOrderList[0].specModel
  489 + // .specid ==
  490 + // newcook.amountHasOrderList[0].specModel
  491 + // .specid) {
  492 + // oldcook.amountHasOrderList[0].amount =
  493 + // newcook.amountHasOrderList[0].amount;
  494 + // newcook.amountHasOrderList.forEach((element) {
  495 + // carSum += element.amount;
  496 + // });
  497 + // }
  498 + // }
339 } 499 }
340 }); 500 });
341 }); 501 });
@@ -402,7 +562,8 @@ class _OrderAdvanceEidtPageState extends State<OrderAdvanceEidtPage> { @@ -402,7 +562,8 @@ class _OrderAdvanceEidtPageState extends State<OrderAdvanceEidtPage> {
402 } 562 }
403 _planDishProvider.pageStateMenu = PageState.ConnectivityError; 563 _planDishProvider.pageStateMenu = PageState.ConnectivityError;
404 } 564 }
405 - if (widget.planCookByRidSunModel.status == '1' || 565 + if (widget.planCookByRidSunModel == null ||
  566 + widget.planCookByRidSunModel.status == '1' ||
406 widget.planCookByRidSunModel.status == null) { 567 widget.planCookByRidSunModel.status == null) {
407 isCar = true; 568 isCar = true;
408 } else { 569 } else {
@@ -423,7 +584,8 @@ class _OrderAdvanceEidtPageState extends State<OrderAdvanceEidtPage> { @@ -423,7 +584,8 @@ class _OrderAdvanceEidtPageState extends State<OrderAdvanceEidtPage> {
423 olddata.forEach((store) { 584 olddata.forEach((store) {
424 if (store.id == newdata.id) { 585 if (store.id == newdata.id) {
425 if (newdata.amountHasOrderList == null || 586 if (newdata.amountHasOrderList == null ||
426 - newdata.amountHasOrderList.length == 0) { 587 + newdata.amountHasOrderList.length == 0 ||
  588 + newdata.amountHasOrderList[0].amount == 0) {
427 //同一个套餐 589 //同一个套餐
428 if (newdata.cookList.length == 0) { 590 if (newdata.cookList.length == 0) {
429 newdata.cookList = store.cookList; 591 newdata.cookList = store.cookList;
@@ -442,8 +604,33 @@ class _OrderAdvanceEidtPageState extends State<OrderAdvanceEidtPage> { @@ -442,8 +604,33 @@ class _OrderAdvanceEidtPageState extends State<OrderAdvanceEidtPage> {
442 //同一菜品 604 //同一菜品
443 if (value1.id == value2.id) { 605 if (value1.id == value2.id) {
444 // value1.amount = value2.amount; 606 // value1.amount = value2.amount;
445 - value1.amountHasOrderList =  
446 - value2.amountHasOrderList; 607 + value1.amountHasOrderList.forEach((value1son) {
  608 + value2.amountHasOrderList
  609 + .forEach((value2son) {
  610 + if (value1son.practiceModel != null &&
  611 + value2son.practiceModel != null &&
  612 + value1son.specModel != null &&
  613 + value2son.specModel != null) {
  614 + if (value1son.practiceModel.practice ==
  615 + value2son
  616 + .practiceModel.practice &&
  617 + value1son.specModel.specid ==
  618 + value2son.specModel.specid) {
  619 + value1son.amount = value2son.amount;
  620 + }
  621 + } else if (value1son.practiceModel ==
  622 + null &&
  623 + value1son.specModel != null) {
  624 + if (value1son.specModel.specid ==
  625 + value2son.specModel.specid) {
  626 + value1son.amount = value2son.amount;
  627 + }
  628 + }
  629 + });
  630 + });
  631 + // value1.amountHasOrderList =
  632 + // value2.amountHasOrderList;
  633 + print(_planDishProvider.menuModelForManager);
447 } 634 }
448 }); 635 });
449 }); 636 });
@@ -467,7 +654,8 @@ class _OrderAdvanceEidtPageState extends State<OrderAdvanceEidtPage> { @@ -467,7 +654,8 @@ class _OrderAdvanceEidtPageState extends State<OrderAdvanceEidtPage> {
467 olddata.forEach((store) { 654 olddata.forEach((store) {
468 if (store.id == newdata.id) { 655 if (store.id == newdata.id) {
469 if (newdata.amountHasOrderList == null || 656 if (newdata.amountHasOrderList == null ||
470 - newdata.amountHasOrderList.length == 0) { 657 + newdata.amountHasOrderList.length == 0 ||
  658 + newdata.amountHasOrderList[0].amount == 0) {
471 //同一个套餐 659 //同一个套餐
472 if (newdata.cookList.length == 0) { 660 if (newdata.cookList.length == 0) {
473 newdata.cookList = store.cookList; 661 newdata.cookList = store.cookList;
@@ -486,8 +674,33 @@ class _OrderAdvanceEidtPageState extends State<OrderAdvanceEidtPage> { @@ -486,8 +674,33 @@ class _OrderAdvanceEidtPageState extends State<OrderAdvanceEidtPage> {
486 //同一菜品 674 //同一菜品
487 if (value1.id == value2.id) { 675 if (value1.id == value2.id) {
488 // value1.amount = value2.amount; 676 // value1.amount = value2.amount;
489 - value1.amountHasOrderList =  
490 - value2.amountHasOrderList; 677 + value1.amountHasOrderList.forEach((value1son) {
  678 + value2.amountHasOrderList
  679 + .forEach((value2son) {
  680 + if (value1son.practiceModel != null &&
  681 + value2son.practiceModel != null &&
  682 + value1son.specModel != null &&
  683 + value2son.specModel != null) {
  684 + if (value1son.practiceModel.practice ==
  685 + value2son
  686 + .practiceModel.practice &&
  687 + value1son.specModel.specid ==
  688 + value2son.specModel.specid) {
  689 + value1son.amount = value2son.amount;
  690 + }
  691 + } else if (value1son.practiceModel ==
  692 + null &&
  693 + value1son.specModel != null) {
  694 + if (value1son.specModel.specid ==
  695 + value2son.specModel.specid) {
  696 + value1son.amount = value2son.amount;
  697 + }
  698 + }
  699 + });
  700 + });
  701 + // value1.amountHasOrderList =
  702 + // value2.amountHasOrderList;
  703 + print(_planDishProvider.menuModelForManager);
491 } 704 }
492 }); 705 });
493 }); 706 });
@@ -507,6 +720,68 @@ class _OrderAdvanceEidtPageState extends State<OrderAdvanceEidtPage> { @@ -507,6 +720,68 @@ class _OrderAdvanceEidtPageState extends State<OrderAdvanceEidtPage> {
507 }); 720 });
508 } else if (element.className == '临时加菜') { 721 } else if (element.className == '临时加菜') {
509 } else { 722 } else {
  723 + List<MenuModel> olddata = _planDishProvider.menuModelOld;
  724 + print(element);
  725 +
  726 + olddata.forEach((old) {
  727 + if (element.id == old.id) {
  728 + // if (element.cookbooklist == null ||
  729 + // element.cookbooklist.length == 0) {
  730 + List<MenuSunModel> temp = element.cookbooklist;
  731 + element.cookbooklist = old.cookbooklist;
  732 +
  733 + // } else {
  734 +
  735 + // List<MenuSunModel> temp = old.cookbooklist;
  736 + temp.forEach((value2) {
  737 + if (value2.amountHasOrderList != null &&
  738 + value2.amountHasOrderList.length > 0) {
  739 + //有选中
  740 + element.cookbooklist.forEach((value1) {
  741 + // if (value1.id == value2.id) {
  742 + // value1.amountHasOrderList = value2.amountHasOrderList;
  743 + if (value1.id == value2.id) {
  744 + // if (value1.amountHasOrderList.length == 0) {
  745 + value1.amountHasOrderList = value2.amountHasOrderList;
  746 + // } else {
  747 + // value1.amountHasOrderList.forEach((value1son) {
  748 + // value2.amountHasOrderList.forEach((value2son) {
  749 + // if (value1son.practiceModel != null &&
  750 + // value2son.practiceModel != null &&
  751 + // value1son.specModel != null &&
  752 + // value2son.specModel != null) {
  753 + // if (value1son.practiceModel.practice ==
  754 + // value2son.practiceModel.practice &&
  755 + // value1son.specModel.specid ==
  756 + // value2son.specModel.specid) {
  757 + // value1son.amount = value2son.amount;
  758 + // }
  759 + // } else if (value1son.practiceModel == null &&
  760 + // value1son.specModel != null) {
  761 + // if (value1son.specModel.specid ==
  762 + // value2son.specModel.specid) {
  763 + // value1son.amount = value2son.amount;
  764 + // }
  765 + // }
  766 + // });
  767 + // });
  768 +
  769 + // }
  770 +
  771 + // value1.amount = value2.amount;
  772 +
  773 + // value1.amountHasOrderList =
  774 + // value2.amountHasOrderList;
  775 + print(_planDishProvider.menuModelForManager);
  776 + // }
  777 + }
  778 + });
  779 + }
  780 + });
  781 + // }
  782 + }
  783 + });
  784 +
510 //单菜 785 //单菜
511 // bool hasmMenu = element.cookbooklist.any(((value) => value.amount > 0)); 786 // bool hasmMenu = element.cookbooklist.any(((value) => value.amount > 0));
512 // if (hasmMenu) { 787 // if (hasmMenu) {
@@ -522,6 +797,7 @@ class _OrderAdvanceEidtPageState extends State<OrderAdvanceEidtPage> { @@ -522,6 +797,7 @@ class _OrderAdvanceEidtPageState extends State<OrderAdvanceEidtPage> {
522 } 797 }
523 // planDishC.text = priceSum.toString(); 798 // planDishC.text = priceSum.toString();
524 }); 799 });
  800 + print(_planDishProvider.menuModelForManager);
525 } 801 }
526 802
527 ///菜品数据 803 ///菜品数据
@@ -700,12 +976,21 @@ class _OrderAdvanceEidtPageState extends State<OrderAdvanceEidtPage> { @@ -700,12 +976,21 @@ class _OrderAdvanceEidtPageState extends State<OrderAdvanceEidtPage> {
700 element.className == '店内常点') { 976 element.className == '店内常点') {
701 element.cookbooklist.forEach((newdata) { 977 element.cookbooklist.forEach((newdata) {
702 // newdata.amount = 0; 978 // newdata.amount = 0;
703 - newdata.amountHasOrderList = []; 979 + if (newdata.amountHasOrderList != null) {
  980 + newdata.amountHasOrderList.forEach((element) {
  981 + element.amount = 0;
  982 + });
  983 + }
  984 +
704 newdata.cookList.forEach((cooklist) { 985 newdata.cookList.forEach((cooklist) {
705 //同一分类 986 //同一分类
706 cooklist.cookbooklist.forEach((value1) { 987 cooklist.cookbooklist.forEach((value1) {
707 // value1.amount = 0; 988 // value1.amount = 0;
708 - value1.amountHasOrderList = []; 989 + if (value1.amountHasOrderList != null) {
  990 + value1.amountHasOrderList.forEach((element1) {
  991 + element1.amount = 0;
  992 + });
  993 + }
709 }); 994 });
710 }); 995 });
711 }); 996 });
@@ -713,13 +998,21 @@ class _OrderAdvanceEidtPageState extends State<OrderAdvanceEidtPage> { @@ -713,13 +998,21 @@ class _OrderAdvanceEidtPageState extends State<OrderAdvanceEidtPage> {
713 //临时加菜 998 //临时加菜
714 element.cookbooklist.forEach((value) { 999 element.cookbooklist.forEach((value) {
715 // value.amount = 0; 1000 // value.amount = 0;
716 - value.amountHasOrderList = []; 1001 + if (value.amountHasOrderList != null) {
  1002 + value.amountHasOrderList.forEach((element1) {
  1003 + element1.amount = 0;
  1004 + });
  1005 + }
717 }); 1006 });
718 } else { 1007 } else {
719 //单菜 1008 //单菜
720 element.cookbooklist.forEach((value) { 1009 element.cookbooklist.forEach((value) {
721 // value.amount = 0; 1010 // value.amount = 0;
722 - value.amountHasOrderList = []; 1011 + if (value.amountHasOrderList != null) {
  1012 + value.amountHasOrderList.forEach((element1) {
  1013 + element1.amount = 0;
  1014 + });
  1015 + }
723 }); 1016 });
724 } 1017 }
725 }); 1018 });
@@ -744,7 +1037,9 @@ class _OrderAdvanceEidtPageState extends State<OrderAdvanceEidtPage> { @@ -744,7 +1037,9 @@ class _OrderAdvanceEidtPageState extends State<OrderAdvanceEidtPage> {
744 if (element.className == '套餐') { 1037 if (element.className == '套餐') {
745 List<MenuSunModel> packagelist = []; 1038 List<MenuSunModel> packagelist = [];
746 element.cookbooklist.forEach((cooklist) { 1039 element.cookbooklist.forEach((cooklist) {
747 - if (cooklist.amountHasOrderList.length > 0) { 1040 + if (cooklist.amountHasOrderList != null &&
  1041 + cooklist.amountHasOrderList.length > 0 &&
  1042 + cooklist.amountHasOrderList[0].amount > 0) {
748 packagelist.add(cooklist); 1043 packagelist.add(cooklist);
749 } 1044 }
750 }); 1045 });
@@ -756,7 +1051,9 @@ class _OrderAdvanceEidtPageState extends State<OrderAdvanceEidtPage> { @@ -756,7 +1051,9 @@ class _OrderAdvanceEidtPageState extends State<OrderAdvanceEidtPage> {
756 } else if (element.className == '我的排菜') { 1051 } else if (element.className == '我的排菜') {
757 List<MenuSunModel> planlist = []; 1052 List<MenuSunModel> planlist = [];
758 element.cookbooklist.forEach((cooklist) { 1053 element.cookbooklist.forEach((cooklist) {
759 - if (cooklist.amountHasOrderList.length > 0) { 1054 + if (cooklist.amountHasOrderList != null &&
  1055 + cooklist.amountHasOrderList.length > 0 &&
  1056 + cooklist.amountHasOrderList[0].amount > 0) {
760 planlist.add(cooklist); 1057 planlist.add(cooklist);
761 } 1058 }
762 }); 1059 });
@@ -768,7 +1065,9 @@ class _OrderAdvanceEidtPageState extends State<OrderAdvanceEidtPage> { @@ -768,7 +1065,9 @@ class _OrderAdvanceEidtPageState extends State<OrderAdvanceEidtPage> {
768 } else if (element.className == '店内常点') { 1065 } else if (element.className == '店内常点') {
769 List<MenuSunModel> oftenlist = []; 1066 List<MenuSunModel> oftenlist = [];
770 element.cookbooklist.forEach((cooklist) { 1067 element.cookbooklist.forEach((cooklist) {
771 - if (cooklist.amountHasOrderList.length > 0) { 1068 + if (cooklist.amountHasOrderList != null &&
  1069 + cooklist.amountHasOrderList.length > 0 &&
  1070 + cooklist.amountHasOrderList[0].amount > 0) {
772 oftenlist.add(cooklist); 1071 oftenlist.add(cooklist);
773 } 1072 }
774 }); 1073 });
@@ -796,6 +1095,10 @@ class _OrderAdvanceEidtPageState extends State<OrderAdvanceEidtPage> { @@ -796,6 +1095,10 @@ class _OrderAdvanceEidtPageState extends State<OrderAdvanceEidtPage> {
796 cooklistdata.add(element); 1095 cooklistdata.add(element);
797 if (cooklistdata.length > 0) { 1096 if (cooklistdata.length > 0) {
798 cooklistdata.forEach((cooklist) { 1097 cooklistdata.forEach((cooklist) {
  1098 + cooklist.cookbooklist.forEach((element) {
  1099 + element.amountHasOrderList
  1100 + .removeWhere((element) => element.amount == 0);
  1101 + });
799 cooklist.cookbooklist.removeWhere((element) => 1102 cooklist.cookbooklist.removeWhere((element) =>
800 element.amountHasOrderList == null || 1103 element.amountHasOrderList == null ||
801 element.amountHasOrderList.length == 0); 1104 element.amountHasOrderList.length == 0);
@@ -908,12 +1211,21 @@ class _OrderAdvanceEidtPageState extends State<OrderAdvanceEidtPage> { @@ -908,12 +1211,21 @@ class _OrderAdvanceEidtPageState extends State<OrderAdvanceEidtPage> {
908 newdata.cookList.forEach((cooklist) { 1211 newdata.cookList.forEach((cooklist) {
909 //同一分类 1212 //同一分类
910 cooklist.cookbooklist.forEach((value1) { 1213 cooklist.cookbooklist.forEach((value1) {
911 - priceSum += double.parse(value1.price) *  
912 - value1.amount *  
913 - newdata.amountHasOrderList[0].amount;  
914 - memberPriceSum += double.parse(value1.member_price) *  
915 - value1.amount *  
916 - newdata.amountHasOrderList[0].amount; 1214 + if (value1.amountHasOrderList != null &&
  1215 + value1.amountHasOrderList.length > 0) {
  1216 + value1.amountHasOrderList.forEach((element1) {
  1217 + priceSum += double.parse(element1.specModel.price) *
  1218 + newdata.amountHasOrderList[0].amount *
  1219 + element1.amount;
  1220 + memberPriceSum += double.parse(
  1221 + element1.specModel.memberPrice == '0' ||
  1222 + element1.specModel.memberPrice == null
  1223 + ? element1.specModel.price
  1224 + : element1.specModel.memberPrice) *
  1225 + newdata.amountHasOrderList[0].amount *
  1226 + element1.amount;
  1227 + });
  1228 + }
917 }); 1229 });
918 }); 1230 });
919 } 1231 }
@@ -991,12 +1303,21 @@ class _OrderAdvanceEidtPageState extends State<OrderAdvanceEidtPage> { @@ -991,12 +1303,21 @@ class _OrderAdvanceEidtPageState extends State<OrderAdvanceEidtPage> {
991 newdata.cookList.forEach((cooklist) { 1303 newdata.cookList.forEach((cooklist) {
992 //同一分类 1304 //同一分类
993 cooklist.cookbooklist.forEach((value1) { 1305 cooklist.cookbooklist.forEach((value1) {
994 - priceSum += double.parse(value1.price) *  
995 - value1.amount *  
996 - newdata.amountHasOrderList[0].amount;  
997 - memberPriceSum += double.parse(value1.member_price) *  
998 - value1.amount *  
999 - newdata.amountHasOrderList[0].amount; 1306 + if (value1.amountHasOrderList != null &&
  1307 + value1.amountHasOrderList.length > 0) {
  1308 + value1.amountHasOrderList.forEach((element1) {
  1309 + priceSum += double.parse(element1.specModel.price) *
  1310 + newdata.amountHasOrderList[0].amount *
  1311 + element1.amount;
  1312 + memberPriceSum += double.parse(
  1313 + element1.specModel.memberPrice == '0' ||
  1314 + element1.specModel.memberPrice == null
  1315 + ? element1.specModel.price
  1316 + : element1.specModel.memberPrice) *
  1317 + newdata.amountHasOrderList[0].amount *
  1318 + element1.amount;
  1319 + });
  1320 + }
1000 }); 1321 });
1001 }); 1322 });
1002 } 1323 }
@@ -1089,9 +1410,13 @@ class _OrderAdvanceEidtPageState extends State<OrderAdvanceEidtPage> { @@ -1089,9 +1410,13 @@ class _OrderAdvanceEidtPageState extends State<OrderAdvanceEidtPage> {
1089 // }); 1410 // });
1090 menuSunModel.cookList.forEach((element) { 1411 menuSunModel.cookList.forEach((element) {
1091 //遍历菜品 1412 //遍历菜品
1092 - element.cookbooklist.forEach((cook) {  
1093 - carSum -= cook.amount;  
1094 - }); 1413 + if (element.cookbooklist != null) {
  1414 + element.cookbooklist.forEach((cook) {
  1415 + cook.amountHasOrderList.forEach((cookson) {
  1416 + carSum -= cookson.amount;
  1417 + });
  1418 + });
  1419 + }
1095 }); 1420 });
1096 } else { 1421 } else {
1097 carSum--; 1422 carSum--;
@@ -1163,14 +1488,15 @@ class _OrderAdvanceEidtPageState extends State<OrderAdvanceEidtPage> { @@ -1163,14 +1488,15 @@ class _OrderAdvanceEidtPageState extends State<OrderAdvanceEidtPage> {
1163 ) 1488 )
1164 : SizedBox(), 1489 : SizedBox(),
1165 HEmptyView(20), 1490 HEmptyView(20),
1166 - if (amountHasOrder.specModel != null) 1491 + if (amountHasOrder.specModel != null && amountHasOrder.amount > 0)
1167 Text(amountHasOrder.specModel.specs, 1492 Text(amountHasOrder.specModel.specs,
1168 style: TextStyle( 1493 style: TextStyle(
1169 fontWeight: FontWeight.bold, 1494 fontWeight: FontWeight.bold,
1170 color: MyColours.color_515151, 1495 color: MyColours.color_515151,
1171 fontSize: font(14))), 1496 fontSize: font(14))),
1172 HEmptyView(20), 1497 HEmptyView(20),
1173 - if (amountHasOrder.practiceModel != null) 1498 + if (amountHasOrder.practiceModel != null &&
  1499 + amountHasOrder.amount > 0)
1174 Text(amountHasOrder.practiceModel.name, 1500 Text(amountHasOrder.practiceModel.name,
1175 style: TextStyle( 1501 style: TextStyle(
1176 fontWeight: FontWeight.bold, 1502 fontWeight: FontWeight.bold,
@@ -1212,7 +1538,12 @@ class _OrderAdvanceEidtPageState extends State<OrderAdvanceEidtPage> { @@ -1212,7 +1538,12 @@ class _OrderAdvanceEidtPageState extends State<OrderAdvanceEidtPage> {
1212 menuSunModel.cookList.forEach((element) { 1538 menuSunModel.cookList.forEach((element) {
1213 //遍历菜品 1539 //遍历菜品
1214 element.cookbooklist.forEach((cook) { 1540 element.cookbooklist.forEach((cook) {
1215 - carSum += cook.amount; 1541 + if (cook.amountHasOrderList != null &&
  1542 + cook.amountHasOrderList.length > 0) {
  1543 + cook.amountHasOrderList.forEach((son) {
  1544 + carSum += son.amount;
  1545 + });
  1546 + }
1216 }); 1547 });
1217 }); 1548 });
1218 } else { 1549 } else {
@@ -2353,12 +2684,13 @@ class _OrderAdvanceEidtPageState extends State<OrderAdvanceEidtPage> { @@ -2353,12 +2684,13 @@ class _OrderAdvanceEidtPageState extends State<OrderAdvanceEidtPage> {
2353 if (value.id == elementCook.id) { 2684 if (value.id == elementCook.id) {
2354 //同一个套餐 2685 //同一个套餐
2355 // elementCook.cookList = value.cookList; 2686 // elementCook.cookList = value.cookList;
2356 - elementCook.amount = value.moreSum; 2687 + elementCook.amountHasOrderList[0]
  2688 + .amount = value.moreSum;
2357 elementCook.cookList 2689 elementCook.cookList
2358 .forEach((oldValue) { 2690 .forEach((oldValue) {
2359 oldValue.cookbooklist 2691 oldValue.cookbooklist
2360 .forEach((oldCook) { 2692 .forEach((oldCook) {
2361 - oldCook.amount = 0; 2693 + oldCook.amountHasOrderList = [];
2362 }); 2694 });
2363 value.cookList.forEach((newValue) { 2695 value.cookList.forEach((newValue) {
2364 if (newValue.id == oldValue.id) { 2696 if (newValue.id == oldValue.id) {
@@ -2374,10 +2706,16 @@ class _OrderAdvanceEidtPageState extends State<OrderAdvanceEidtPage> { @@ -2374,10 +2706,16 @@ class _OrderAdvanceEidtPageState extends State<OrderAdvanceEidtPage> {
2374 if (oldCook.id == 2706 if (oldCook.id ==
2375 newCook.id) { 2707 newCook.id) {
2376 //同一个菜品 2708 //同一个菜品
2377 - oldCook.amount =  
2378 - newCook.amount;  
2379 - carSumTemp +=  
2380 - newCook.amount; 2709 +
  2710 + oldCook.amountHasOrderList
  2711 + .addAll(newCook
  2712 + .amountHasOrderList);
  2713 +
  2714 + carSumTemp += newCook
  2715 + .amountHasOrderList[
  2716 + 0]
  2717 + .amount *
  2718 + value.moreSum;
2381 } 2719 }
2382 }); 2720 });
2383 }); 2721 });
@@ -2394,13 +2732,76 @@ class _OrderAdvanceEidtPageState extends State<OrderAdvanceEidtPage> { @@ -2394,13 +2732,76 @@ class _OrderAdvanceEidtPageState extends State<OrderAdvanceEidtPage> {
2394 if (element.id == one.id) { 2732 if (element.id == one.id) {
2395 //同一分类 2733 //同一分类
2396 element.cookbooklist.forEach((old) { 2734 element.cookbooklist.forEach((old) {
  2735 + old.amountHasOrderList = [];
2397 one.cookbooklist.forEach((newvalue) { 2736 one.cookbooklist.forEach((newvalue) {
2398 if (old.id == newvalue.id) { 2737 if (old.id == newvalue.id) {
2399 if (element.className == '临时加菜' && 2738 if (element.className == '临时加菜' &&
2400 old.name == '临时菜') { 2739 old.name == '临时菜') {
2401 } else { 2740 } else {
2402 - old.amount = newvalue.amount;  
2403 - carSumTemp += newvalue.amount; 2741 + // old.amountHasOrderList =
  2742 + // newvalue.amountHasOrderList;
  2743 + old.amountHasOrderList.addAll(
  2744 + newvalue.amountHasOrderList);
  2745 + newvalue.amountHasOrderList
  2746 + .forEach((newelement) {
  2747 + //
  2748 + carSumTemp += newelement.amount;
  2749 + });
  2750 + // old.amountHasOrderList
  2751 + // .forEach((oldelement) {
  2752 + // if (oldelement.practiceModel !=
  2753 + // null &&
  2754 + // newvalue
  2755 + // .amountHasOrderList[
  2756 + // 0]
  2757 + // .practiceModel !=
  2758 + // null &&
  2759 + // oldelement.specModel !=
  2760 + // null &&
  2761 + // newvalue
  2762 + // .amountHasOrderList[
  2763 + // 0]
  2764 + // .specModel !=
  2765 + // null) {
  2766 + // if (oldelement.practiceModel
  2767 + // .practice ==
  2768 + // oldelement
  2769 + // .practiceModel
  2770 + // .practice &&
  2771 + // oldelement.specModel
  2772 + // .specid ==
  2773 + // newvalue
  2774 + // .amountHasOrderList[
  2775 + // 0]
  2776 + // .specModel
  2777 + // .specid) {
  2778 + // oldelement.amount = newvalue
  2779 + // .amountHasOrderList[0]
  2780 + // .amount;
  2781 + // carSumTemp += newvalue
  2782 + // .amountHasOrderList[0]
  2783 + // .amount;
  2784 + // }
  2785 + // } else if (oldelement
  2786 + // .practiceModel ==
  2787 + // null &&
  2788 + // oldelement.specModel !=
  2789 + // null) {
  2790 + // if (oldelement
  2791 + // .specModel.specid ==
  2792 + // newvalue
  2793 + // .amountHasOrderList[0]
  2794 + // .specModel
  2795 + // .specid) {
  2796 + // oldelement.amount = newvalue
  2797 + // .amountHasOrderList[0]
  2798 + // .amount;
  2799 + // carSumTemp += newvalue
  2800 + // .amountHasOrderList[0]
  2801 + // .amount;
  2802 + // }
  2803 + // }
  2804 + // });
2404 } 2805 }
2405 } 2806 }
2406 }); 2807 });
@@ -2444,8 +2845,8 @@ class _OrderAdvanceEidtPageState extends State<OrderAdvanceEidtPage> { @@ -2444,8 +2845,8 @@ class _OrderAdvanceEidtPageState extends State<OrderAdvanceEidtPage> {
2444 //调用提交排菜接口 2845 //调用提交排菜接口
2445 //调用排菜信息提交接口 2846 //调用排菜信息提交接口
2446 2847
2447 - FocusScope.of(context).requestFocus(  
2448 - FocusNode()); //点击空白处隐藏键盘‘i7 8uuUUUUUUum'x\c [] 2848 + FocusScope.of(context)
  2849 + .requestFocus(FocusNode()); //点击空白处隐藏键盘
2449 List<MenuModel> showList = []; 2850 List<MenuModel> showList = [];
2450 List<MenuSunModel> dataLocalShowMore = []; //二级菜单 2851 List<MenuSunModel> dataLocalShowMore = []; //二级菜单
2451 List<MenuModel> dataLocalShowOne = []; //一级菜单 2852 List<MenuModel> dataLocalShowOne = []; //一级菜单
@@ -2465,7 +2866,8 @@ class _OrderAdvanceEidtPageState extends State<OrderAdvanceEidtPage> { @@ -2465,7 +2866,8 @@ class _OrderAdvanceEidtPageState extends State<OrderAdvanceEidtPage> {
2465 // } 2866 // }
2466 2867
2467 element.cookbooklist.forEach((value) { 2868 element.cookbooklist.forEach((value) {
2468 - if (value.amount > 0) { 2869 + if (value.amountHasOrderList != null &&
  2870 + value.amountHasOrderList.length > 0) {
2469 // if (!isChange) { 2871 // if (!isChange) {
2470 // priceSum += double.parse(value.price) * value.amount; 2872 // priceSum += double.parse(value.price) * value.amount;
2471 // memberPriceSum += 2873 // memberPriceSum +=
@@ -2485,20 +2887,57 @@ class _OrderAdvanceEidtPageState extends State<OrderAdvanceEidtPage> { @@ -2485,20 +2887,57 @@ class _OrderAdvanceEidtPageState extends State<OrderAdvanceEidtPage> {
2485 cook.cookbooklist.forEach((cookSun) { 2887 cook.cookbooklist.forEach((cookSun) {
2486 // 具体菜品 2888 // 具体菜品
2487 2889
2488 - if (cookSun.amount > 0) {  
2489 - //当前菜品已选择  
2490 - // moreSum += cookSun.amount;  
2491 - cookSum += cookSun.amount; 2890 + if (cookSun.amountHasOrderList !=
  2891 + null &&
  2892 + cookSun.amountHasOrderList
  2893 + .length >
  2894 + 0) {
  2895 + // cookSun.amountHasOrderList
  2896 + // .forEach((hasOrder) {
  2897 + // //当前菜品已选择
  2898 + // // moreSum += cookSun.amount;
  2899 + // if (hasOrder.amount > 0) {
  2900 + // cookSum += hasOrder.amount;
  2901 +
  2902 + // // if (isChange) {
  2903 + // // priceSum += double.parse(cookSun.price) * cookSun.amount;
  2904 + // // memberPriceSum +=
  2905 + // // double.parse(cookSun.member_price) * cookSun.amount;
  2906 + // // }
  2907 +
  2908 + // // carSum += hasOrder.amount;
  2909 + // }
  2910 + // });
  2911 + // cooklistSun.add(cookSun);
  2912 + cookSun.amountHasOrderList
  2913 + .forEach((element) {
  2914 + MenuSunModel cooksunTemp =
  2915 + MenuSunModel.fromJson2(
  2916 + cookSun.toJson());
  2917 + cookSum += element.amount;
  2918 + // carSum += element.amount;
  2919 + cooksunTemp.amountHasOrderList =
  2920 + [];
  2921 + cooksunTemp.amountHasOrderList
  2922 + .add(element);
  2923 + cooklistSun.add(cooksunTemp);
  2924 + });
  2925 + }
2492 2926
2493 - // if (isChange) {  
2494 - // priceSum += double.parse(cookSun.price) * cookSun.amount;  
2495 - // memberPriceSum +=  
2496 - // double.parse(cookSun.member_price) * cookSun.amount;  
2497 - // } 2927 + // if (cookSun.amount > 0) {
  2928 + // //当前菜品已选择
  2929 + // // moreSum += cookSun.amount;
  2930 + // cookSum += cookSun.amount;
2498 2931
2499 - carSum += cookSun.amount;  
2500 - cooklistSun.add(cookSun);  
2501 - } 2932 + // // if (isChange) {
  2933 + // // priceSum += double.parse(cookSun.price) * cookSun.amount;
  2934 + // // memberPriceSum +=
  2935 + // // double.parse(cookSun.member_price) * cookSun.amount;
  2936 + // // }
  2937 +
  2938 + // carSum += cookSun.amount;
  2939 + // cooklistSun.add(cookSun);
  2940 + // }
2502 }); 2941 });
2503 if (cooklistSun.length > 0) { 2942 if (cooklistSun.length > 0) {
2504 cook.cookbooklist = cooklistSun; 2943 cook.cookbooklist = cooklistSun;
@@ -2507,7 +2946,8 @@ class _OrderAdvanceEidtPageState extends State<OrderAdvanceEidtPage> { @@ -2507,7 +2946,8 @@ class _OrderAdvanceEidtPageState extends State<OrderAdvanceEidtPage> {
2507 value.cookList = moreMenu; 2946 value.cookList = moreMenu;
2508 } 2947 }
2509 }); 2948 });
2510 - value.moreSum = value.amount; 2949 + value.moreSum =
  2950 + value.amountHasOrderList[0].amount;
2511 value.channel = element.className == '套餐' 2951 value.channel = element.className == '套餐'
2512 ? '1' 2952 ? '1'
2513 : element.className == '我的排菜' 2953 : element.className == '我的排菜'
@@ -2531,8 +2971,14 @@ class _OrderAdvanceEidtPageState extends State<OrderAdvanceEidtPage> { @@ -2531,8 +2971,14 @@ class _OrderAdvanceEidtPageState extends State<OrderAdvanceEidtPage> {
2531 // } 2971 // }
2532 else { 2972 else {
2533 //单菜 2973 //单菜
2534 - bool hasmMenu = element.cookbooklist  
2535 - .any(((value) => value.amount > 0)); 2974 + // bool hasmMenu = element.cookbooklist.any(
  2975 + // ((value) =>
  2976 + // value.amountHasOrderList[0].amount >
  2977 + // 0));
  2978 + bool hasmMenu = element.cookbooklist.any(
  2979 + ((value) =>
  2980 + value.amountHasOrderList != null &&
  2981 + value.amountHasOrderList.length > 0));
2536 if (hasmMenu) { 2982 if (hasmMenu) {
2537 //单品此类有选中菜品 2983 //单品此类有选中菜品
2538 MenuModel menuModel = MenuModel(); 2984 MenuModel menuModel = MenuModel();
@@ -2547,13 +2993,31 @@ class _OrderAdvanceEidtPageState extends State<OrderAdvanceEidtPage> { @@ -2547,13 +2993,31 @@ class _OrderAdvanceEidtPageState extends State<OrderAdvanceEidtPage> {
2547 List<MenuSunModel> cookbooklist = []; 2993 List<MenuSunModel> cookbooklist = [];
2548 int allSum = 0; 2994 int allSum = 0;
2549 element.cookbooklist.forEach((value) { 2995 element.cookbooklist.forEach((value) {
2550 - if (value.amount > 0) {  
2551 - allSum += value.amount;  
2552 - // priceSum += double.parse(value.price) * value.amount;  
2553 - // memberPriceSum +=  
2554 - // double.parse(value.member_price) * value.amount;  
2555 - carSum += value.amount;  
2556 - cookbooklist.add(value); 2996 + if (value.amountHasOrderList != null &&
  2997 + value.amountHasOrderList.length > 0) {
  2998 + // value.amountHasOrderList
  2999 + // .forEach((hasOrder) {
  3000 + // if (hasOrder.amount > 0) {
  3001 + // allSum += hasOrder.amount;
  3002 + // // priceSum += double.parse(value.price) * value.amount;
  3003 + // // memberPriceSum +=
  3004 + // // double.parse(value.member_price) * value.amount;
  3005 + // carSum += hasOrder.amount;
  3006 + // }
  3007 + // });
  3008 + // cookbooklist.add(value);
  3009 + value.amountHasOrderList
  3010 + .forEach((element) {
  3011 + allSum += element.amount;
  3012 + // carSum += element.amount;
  3013 + MenuSunModel cooksunTemp =
  3014 + MenuSunModel.fromJson2(
  3015 + value.toJson());
  3016 + cooksunTemp.amountHasOrderList = [];
  3017 + cooksunTemp.amountHasOrderList
  3018 + .add(element);
  3019 + cookbooklist.add(cooksunTemp);
  3020 + });
2557 } 3021 }
2558 }); 3022 });
2559 menuModel.allSum = allSum; 3023 menuModel.allSum = allSum;
@@ -2564,12 +3028,16 @@ class _OrderAdvanceEidtPageState extends State<OrderAdvanceEidtPage> { @@ -2564,12 +3028,16 @@ class _OrderAdvanceEidtPageState extends State<OrderAdvanceEidtPage> {
2564 // planDishC.text = priceSum.toString(); 3028 // planDishC.text = priceSum.toString();
2565 }); 3029 });
2566 } 3030 }
  3031 + print(dataLocalShowMore);
  3032 + print(dataLocalShowOne);
2567 3033
2568 dataLocalShowMore.forEach((value) { 3034 dataLocalShowMore.forEach((value) {
2569 value.cookList.forEach((newValue) { 3035 value.cookList.forEach((newValue) {
2570 if (showList.length == 0) { 3036 if (showList.length == 0) {
2571 - showList.add(  
2572 - MenuModel.fromJson2(newValue.toJson())); 3037 + Map<String, dynamic> map = newValue.toJson();
  3038 + map['out_all_num'] =
  3039 + value.amountHasOrderList[0].amount;
  3040 + showList.add(MenuModel.fromJson3(map));
2573 } else { 3041 } else {
2574 bool hasC = false; 3042 bool hasC = false;
2575 showList.forEach((show) { 3043 showList.forEach((show) {
@@ -2581,22 +3049,101 @@ class _OrderAdvanceEidtPageState extends State<OrderAdvanceEidtPage> { @@ -2581,22 +3049,101 @@ class _OrderAdvanceEidtPageState extends State<OrderAdvanceEidtPage> {
2581 bool has = false; 3049 bool has = false;
2582 show.cookbooklist.forEach((oldshow) { 3050 show.cookbooklist.forEach((oldshow) {
2583 if (oldshow.id == newcook.id) { 3051 if (oldshow.id == newcook.id) {
2584 - //同一个菜品  
2585 - has = true;  
2586 - oldshow.amount += newcook.amount;  
2587 - show.allSum += newcook.amount; 3052 + //同一个菜品条件: id相同,并且规格和做法也相同
  3053 + if (oldshow.amountHasOrderList[0]
  3054 + .practiceModel !=
  3055 + null &&
  3056 + newcook.amountHasOrderList[0]
  3057 + .practiceModel !=
  3058 + null &&
  3059 + oldshow.amountHasOrderList[0]
  3060 + .specModel !=
  3061 + null &&
  3062 + newcook.amountHasOrderList[0]
  3063 + .specModel !=
  3064 + null) {
  3065 + if (oldshow
  3066 + .amountHasOrderList[0]
  3067 + .practiceModel
  3068 + .practice ==
  3069 + newcook
  3070 + .amountHasOrderList[0]
  3071 + .practiceModel
  3072 + .practice &&
  3073 + oldshow.amountHasOrderList[0]
  3074 + .specModel.specid ==
  3075 + newcook
  3076 + .amountHasOrderList[0]
  3077 + .specModel
  3078 + .specid) {
  3079 + // if (oldshow.amount !=
  3080 + // newcook
  3081 + // .amountHasOrderList[0]
  3082 + // .amount) {
  3083 + has = true;
  3084 + oldshow.amount += newcook
  3085 + .amountHasOrderList[0]
  3086 + .amount *
  3087 + value.amountHasOrderList[0]
  3088 + .amount;
  3089 + oldshow.amountHasOrderList
  3090 + .addAll(newcook
  3091 + .amountHasOrderList);
  3092 + show.allSum += newcook
  3093 + .amountHasOrderList[0]
  3094 + .amount;
  3095 + // }
  3096 + }
  3097 + } else if (oldshow
  3098 + .amountHasOrderList[0]
  3099 + .practiceModel ==
  3100 + null &&
  3101 + oldshow.amountHasOrderList[0]
  3102 + .specModel !=
  3103 + null) {
  3104 + if (oldshow.amountHasOrderList[0]
  3105 + .specModel.specid ==
  3106 + newcook.amountHasOrderList[0]
  3107 + .specModel.specid) {
  3108 + // if (oldshow.amount !=
  3109 + // newcook
  3110 + // .amountHasOrderList[0]
  3111 + // .amount) {
  3112 + has = true;
  3113 + oldshow.amount += newcook
  3114 + .amountHasOrderList[0]
  3115 + .amount *
  3116 + value.amountHasOrderList[0]
  3117 + .amount;
  3118 + oldshow.amountHasOrderList
  3119 + .addAll(newcook
  3120 + .amountHasOrderList);
  3121 + show.allSum += newcook
  3122 + .amountHasOrderList[0]
  3123 + .amount;
  3124 + // }
  3125 + }
  3126 + }
2588 } 3127 }
2589 }); 3128 });
2590 if (!has) { 3129 if (!has) {
2591 //旧的里面没有该菜品 3130 //旧的里面没有该菜品
  3131 + newcook.amount = newcook
  3132 + .amountHasOrderList[0]
  3133 + .amount *
  3134 + value
  3135 + .amountHasOrderList[0].amount;
2592 show.cookbooklist.add(newcook); 3136 show.cookbooklist.add(newcook);
2593 } 3137 }
2594 }); 3138 });
2595 } 3139 }
2596 }); 3140 });
2597 if (!hasC) { 3141 if (!hasC) {
2598 - showList.add(  
2599 - MenuModel.fromJson2(newValue.toJson())); 3142 + Map<String, dynamic> map =
  3143 + newValue.toJson();
  3144 + map['out_all_num'] =
  3145 + value.amountHasOrderList[0].amount;
  3146 + showList.add(MenuModel.fromJson3(map));
2600 } 3147 }
2601 } 3148 }
2602 }); 3149 });
@@ -2607,7 +3154,7 @@ class _OrderAdvanceEidtPageState extends State<OrderAdvanceEidtPage> { @@ -2607,7 +3154,7 @@ class _OrderAdvanceEidtPageState extends State<OrderAdvanceEidtPage> {
2607 dataLocalShowOne.forEach((element) { 3154 dataLocalShowOne.forEach((element) {
2608 if (showList.length == 0) { 3155 if (showList.length == 0) {
2609 showList 3156 showList
2610 - .add(MenuModel.fromJson2(element.toJson())); 3157 + .add(MenuModel.fromJson3(element.toJson()));
2611 } else { 3158 } else {
2612 bool hasC = false; 3159 bool hasC = false;
2613 showList.forEach((show) { 3160 showList.forEach((show) {
@@ -2619,10 +3166,72 @@ class _OrderAdvanceEidtPageState extends State<OrderAdvanceEidtPage> { @@ -2619,10 +3166,72 @@ class _OrderAdvanceEidtPageState extends State<OrderAdvanceEidtPage> {
2619 bool has = false; 3166 bool has = false;
2620 show.cookbooklist.forEach((oldshow) { 3167 show.cookbooklist.forEach((oldshow) {
2621 if (oldshow.id == newcook.id) { 3168 if (oldshow.id == newcook.id) {
2622 - //同一个菜品  
2623 - has = true;  
2624 - oldshow.amount += newcook.amount;  
2625 - show.allSum += newcook.amount; 3169 + //同一个菜品条件: id相同,并且规格和做法也相同
  3170 + if (oldshow.amountHasOrderList[0]
  3171 + .practiceModel !=
  3172 + null &&
  3173 + newcook.amountHasOrderList[0]
  3174 + .practiceModel !=
  3175 + null &&
  3176 + oldshow.amountHasOrderList[0]
  3177 + .specModel !=
  3178 + null &&
  3179 + newcook.amountHasOrderList[0]
  3180 + .specModel !=
  3181 + null) {
  3182 + if (oldshow
  3183 + .amountHasOrderList[0]
  3184 + .practiceModel
  3185 + .practice ==
  3186 + newcook
  3187 + .amountHasOrderList[0]
  3188 + .practiceModel
  3189 + .practice &&
  3190 + oldshow.amountHasOrderList[0]
  3191 + .specModel.specid ==
  3192 + newcook
  3193 + .amountHasOrderList[0]
  3194 + .specModel
  3195 + .specid) {
  3196 + // if (oldshow
  3197 + // .amountHasOrderList[0].amount !=
  3198 + // newcook
  3199 + // .amountHasOrderList[0].amount) {
  3200 + has = true;
  3201 + oldshow.amount += newcook
  3202 + .amountHasOrderList[0].amount;
  3203 + oldshow.amountHasOrderList.addAll(
  3204 + newcook.amountHasOrderList);
  3205 + show.allSum += newcook
  3206 + .amountHasOrderList[0].amount;
  3207 +
  3208 + // }
  3209 + }
  3210 + } else if (oldshow
  3211 + .amountHasOrderList[0]
  3212 + .practiceModel ==
  3213 + null &&
  3214 + oldshow.amountHasOrderList[0]
  3215 + .specModel !=
  3216 + null) {
  3217 + if (oldshow.amountHasOrderList[0]
  3218 + .specModel.specid ==
  3219 + newcook.amountHasOrderList[0]
  3220 + .specModel.specid) {
  3221 + // if (oldshow
  3222 + // .amountHasOrderList[0].amount !=
  3223 + // newcook
  3224 + // .amountHasOrderList[0].amount) {
  3225 + has = true;
  3226 + oldshow.amount += newcook
  3227 + .amountHasOrderList[0].amount;
  3228 + oldshow.amountHasOrderList.addAll(
  3229 + newcook.amountHasOrderList);
  3230 + show.allSum += newcook
  3231 + .amountHasOrderList[0].amount;
  3232 + // }
  3233 + }
  3234 + }
2626 } 3235 }
2627 }); 3236 });
2628 if (!has) { 3237 if (!has) {
@@ -2634,7 +3243,7 @@ class _OrderAdvanceEidtPageState extends State<OrderAdvanceEidtPage> { @@ -2634,7 +3243,7 @@ class _OrderAdvanceEidtPageState extends State<OrderAdvanceEidtPage> {
2634 }); 3243 });
2635 if (!hasC) { 3244 if (!hasC) {
2636 showList.add( 3245 showList.add(
2637 - MenuModel.fromJson2(element.toJson())); 3246 + MenuModel.fromJson3(element.toJson()));
2638 } 3247 }
2639 } 3248 }
2640 }); 3249 });
@@ -2642,7 +3251,8 @@ class _OrderAdvanceEidtPageState extends State<OrderAdvanceEidtPage> { @@ -2642,7 +3251,8 @@ class _OrderAdvanceEidtPageState extends State<OrderAdvanceEidtPage> {
2642 // double memberPriceSum = 0; //会员价 3251 // double memberPriceSum = 0; //会员价
2643 // TextEditingController planDishC = 3252 // TextEditingController planDishC =
2644 // TextEditingController(); //排菜价 3253 // TextEditingController(); //排菜价
2645 - 3254 + _initMenuModelForManagerData();
  3255 + setState(() {});
2646 NavigatorUtil.goOrderPreviewPage(context, 3256 NavigatorUtil.goOrderPreviewPage(context,
2647 object: {'object': showList}, 3257 object: {'object': showList},
2648 name: planDishName ?? "", 3258 name: planDishName ?? "",
@@ -7,6 +7,7 @@ import 'package:one_key/route/navigator_util.dart'; @@ -7,6 +7,7 @@ import 'package:one_key/route/navigator_util.dart';
7 import 'package:one_key/utils/utils.dart'; 7 import 'package:one_key/utils/utils.dart';
8 import 'package:one_key/widgets/MyDivider.dart'; 8 import 'package:one_key/widgets/MyDivider.dart';
9 import 'package:one_key/widgets/h_empty_view.dart'; 9 import 'package:one_key/widgets/h_empty_view.dart';
  10 +import 'package:one_key/widgets/loading.dart';
10 import 'package:one_key/widgets/system_app_bar.dart'; 11 import 'package:one_key/widgets/system_app_bar.dart';
11 import 'package:one_key/widgets/v_empty_view.dart'; 12 import 'package:one_key/widgets/v_empty_view.dart';
12 import 'package:provider/provider.dart'; 13 import 'package:provider/provider.dart';
@@ -89,7 +90,8 @@ class _OrderAdvanceHomePageState extends State<OrderAdvanceHomePage> { @@ -89,7 +90,8 @@ class _OrderAdvanceHomePageState extends State<OrderAdvanceHomePage> {
89 } 90 }
90 91
91 _getPlanCookByRid() async { 92 _getPlanCookByRid() async {
92 - await _planDishProvider.getPlanCookByRid(context, {'rid': widget.rid}); 93 + await _planDishProvider.getPlanCookByRid(context, {'rid': widget.rid},
  94 + showLoading: true, selfDismiss: true);
93 if (_planDishProvider.planCookByRidSunModel != null) { 95 if (_planDishProvider.planCookByRidSunModel != null) {
94 pnumController.text = _planDishProvider.planCookByRidSunModel.pnum; 96 pnumController.text = _planDishProvider.planCookByRidSunModel.pnum;
95 if (_planDishProvider.planCookByRidSunModel.totalPrice != '0' && 97 if (_planDishProvider.planCookByRidSunModel.totalPrice != '0' &&
@@ -119,6 +121,7 @@ class _OrderAdvanceHomePageState extends State<OrderAdvanceHomePage> { @@ -119,6 +121,7 @@ class _OrderAdvanceHomePageState extends State<OrderAdvanceHomePage> {
119 [_getCookbookByClass(showLoading: true), _getPlanCookList()]) 121 [_getCookbookByClass(showLoading: true), _getPlanCookList()])
120 .then((results) { 122 .then((results) {
121 print(results[0]); 123 print(results[0]);
  124 +
122 if (results[0] && results[1]) { 125 if (results[0] && results[1]) {
123 _planDishProvider.menuModelForManager = 126 _planDishProvider.menuModelForManager =
124 List.from(_planDishProvider.menuModel); 127 List.from(_planDishProvider.menuModel);
@@ -135,7 +138,7 @@ class _OrderAdvanceHomePageState extends State<OrderAdvanceHomePage> { @@ -135,7 +138,7 @@ class _OrderAdvanceHomePageState extends State<OrderAdvanceHomePage> {
135 newvalue.cookbooklist.forEach((newcook) { 138 newvalue.cookbooklist.forEach((newcook) {
136 if (oldcook.id == newcook.id) { 139 if (oldcook.id == newcook.id) {
137 //同一个菜 140 //同一个菜
138 - oldcook.amount = newcook.amount; 141 + oldcook.amountHasOrderList = newcook.amountHasOrderList;
139 } 142 }
140 }); 143 });
141 }); 144 });
@@ -172,7 +175,7 @@ class _OrderAdvanceHomePageState extends State<OrderAdvanceHomePage> { @@ -172,7 +175,7 @@ class _OrderAdvanceHomePageState extends State<OrderAdvanceHomePage> {
172 .forEach((package) { 175 .forEach((package) {
173 if (package.id == menuSunModel.id) { 176 if (package.id == menuSunModel.id) {
174 //同一个套餐 177 //同一个套餐
175 - menuSunModel.amount = package.amount; 178 + menuSunModel.amountHasOrderList = package.amountHasOrderList;
176 menuSunModel.cookList.forEach((oldcooklist) { 179 menuSunModel.cookList.forEach((oldcooklist) {
177 package.cookList.forEach((newcooklist) { 180 package.cookList.forEach((newcooklist) {
178 if (oldcooklist.id == newcooklist.id) { 181 if (oldcooklist.id == newcooklist.id) {
@@ -180,7 +183,8 @@ class _OrderAdvanceHomePageState extends State<OrderAdvanceHomePage> { @@ -180,7 +183,8 @@ class _OrderAdvanceHomePageState extends State<OrderAdvanceHomePage> {
180 oldcooklist.cookbooklist.forEach((oldcook) { 183 oldcooklist.cookbooklist.forEach((oldcook) {
181 newcooklist.cookbooklist.forEach((newcook) { 184 newcooklist.cookbooklist.forEach((newcook) {
182 if (oldcook.id == newcook.id) { 185 if (oldcook.id == newcook.id) {
183 - oldcook.amount = newcook.amount; 186 + oldcook.amountHasOrderList =
  187 + newcook.amountHasOrderList;
184 } 188 }
185 }); 189 });
186 }); 190 });
@@ -223,7 +227,7 @@ class _OrderAdvanceHomePageState extends State<OrderAdvanceHomePage> { @@ -223,7 +227,7 @@ class _OrderAdvanceHomePageState extends State<OrderAdvanceHomePage> {
223 .forEach((package) { 227 .forEach((package) {
224 if (package.id == menuSunModel.id) { 228 if (package.id == menuSunModel.id) {
225 //同一个排菜 229 //同一个排菜
226 - menuSunModel.amount = package.amount; 230 + menuSunModel.amountHasOrderList = package.amountHasOrderList;
227 menuSunModel.cookList.forEach((oldcooklist) { 231 menuSunModel.cookList.forEach((oldcooklist) {
228 package.cookList.forEach((newcooklist) { 232 package.cookList.forEach((newcooklist) {
229 if (oldcooklist.id == newcooklist.id) { 233 if (oldcooklist.id == newcooklist.id) {
@@ -231,7 +235,9 @@ class _OrderAdvanceHomePageState extends State<OrderAdvanceHomePage> { @@ -231,7 +235,9 @@ class _OrderAdvanceHomePageState extends State<OrderAdvanceHomePage> {
231 oldcooklist.cookbooklist.forEach((oldcook) { 235 oldcooklist.cookbooklist.forEach((oldcook) {
232 newcooklist.cookbooklist.forEach((newcook) { 236 newcooklist.cookbooklist.forEach((newcook) {
233 if (oldcook.id == newcook.id) { 237 if (oldcook.id == newcook.id) {
234 - oldcook.amount = newcook.amount; 238 + // oldcook.amount = newcook.amount;
  239 + oldcook.amountHasOrderList =
  240 + newcook.amountHasOrderList;
235 } 241 }
236 }); 242 });
237 }); 243 });
@@ -283,7 +289,7 @@ class _OrderAdvanceHomePageState extends State<OrderAdvanceHomePage> { @@ -283,7 +289,7 @@ class _OrderAdvanceHomePageState extends State<OrderAdvanceHomePage> {
283 // _calculatePrice(); 289 // _calculatePrice();
284 // } 290 // }
285 _planDishProvider.pageStateMenu = PageState.Success; 291 _planDishProvider.pageStateMenu = PageState.Success;
286 - 292 + Loading.hideLoading(context);
287 setState(() {}); 293 setState(() {});
288 } else { 294 } else {
289 if (!results[0]) { 295 if (!results[0]) {
@@ -292,9 +298,12 @@ class _OrderAdvanceHomePageState extends State<OrderAdvanceHomePage> { @@ -292,9 +298,12 @@ class _OrderAdvanceHomePageState extends State<OrderAdvanceHomePage> {
292 // Utils.showToast(''); 298 // Utils.showToast('');
293 } 299 }
294 _planDishProvider.pageStateMenu = PageState.ConnectivityError; 300 _planDishProvider.pageStateMenu = PageState.ConnectivityError;
  301 + Loading.hideLoading(context);
  302 + setState(() {});
295 } 303 }
296 }).catchError((e) { 304 }).catchError((e) {
297 print(e); 305 print(e);
  306 + Loading.hideLoading(context);
298 }); 307 });
299 } 308 }
300 309
@@ -306,7 +315,7 @@ class _OrderAdvanceHomePageState extends State<OrderAdvanceHomePage> { @@ -306,7 +315,7 @@ class _OrderAdvanceHomePageState extends State<OrderAdvanceHomePage> {
306 }; 315 };
307 316
308 bool success = await _planDishProvider.getCookbookByClass(context, params, 317 bool success = await _planDishProvider.getCookbookByClass(context, params,
309 - showLoading: showLoading); 318 + showLoading: showLoading, selfDismiss: true);
310 if (success) { 319 if (success) {
311 return true; 320 return true;
312 } else { 321 } else {
@@ -353,7 +362,7 @@ class _OrderAdvanceHomePageState extends State<OrderAdvanceHomePage> { @@ -353,7 +362,7 @@ class _OrderAdvanceHomePageState extends State<OrderAdvanceHomePage> {
353 "sellerid": Provider.of<UserModel>(context, listen: false).user.sellerid, 362 "sellerid": Provider.of<UserModel>(context, listen: false).user.sellerid,
354 }; 363 };
355 bool success = await _planDishProvider.getPlanCookList(context, params, 364 bool success = await _planDishProvider.getPlanCookList(context, params,
356 - showLoading: isShowLoading); 365 + showLoading: isShowLoading, selfDismiss: true);
357 if (success) { 366 if (success) {
358 return true; 367 return true;
359 } else { 368 } else {
@@ -1064,7 +1073,8 @@ class _OrderAdvanceHomePageState extends State<OrderAdvanceHomePage> { @@ -1064,7 +1073,8 @@ class _OrderAdvanceHomePageState extends State<OrderAdvanceHomePage> {
1064 // } 1073 // }
1065 1074
1066 element.cookbooklist.forEach((value) { 1075 element.cookbooklist.forEach((value) {
1067 - if (value.amount > 0) { 1076 + if (value.amountHasOrderList != null &&
  1077 + value.amountHasOrderList.length > 0) {
1068 // if (!isChange) { 1078 // if (!isChange) {
1069 // priceSum += double.parse(value.price) * value.amount; 1079 // priceSum += double.parse(value.price) * value.amount;
1070 // memberPriceSum += 1080 // memberPriceSum +=
@@ -1083,10 +1093,24 @@ class _OrderAdvanceHomePageState extends State<OrderAdvanceHomePage> { @@ -1083,10 +1093,24 @@ class _OrderAdvanceHomePageState extends State<OrderAdvanceHomePage> {
1083 cook.cookbooklist.forEach((cookSun) { 1093 cook.cookbooklist.forEach((cookSun) {
1084 // 具体菜品 1094 // 具体菜品
1085 1095
1086 - if (cookSun.amount > 0) { 1096 + if (cookSun.amountHasOrderList !=
  1097 + null &&
  1098 + cookSun.amountHasOrderList.length >
  1099 + 0) {
1087 //当前菜品已选择 1100 //当前菜品已选择
1088 // moreSum += cookSun.amount; 1101 // moreSum += cookSun.amount;
1089 - cookSum += cookSun.amount; 1102 + cookSun.amountHasOrderList
  1103 + .forEach((element) {
  1104 + MenuSunModel cooksunTemp =
  1105 + MenuSunModel.fromJson2(
  1106 + cookSun.toJson());
  1107 + cookSum += element.amount;
  1108 + // carSum += element.amount;
  1109 + cooksunTemp.amountHasOrderList = [];
  1110 + cooksunTemp.amountHasOrderList
  1111 + .add(element);
  1112 + cooklistSun.add(cooksunTemp);
  1113 + });
1090 1114
1091 // if (isChange) { 1115 // if (isChange) {
1092 // priceSum += double.parse(cookSun.price) * cookSun.amount; 1116 // priceSum += double.parse(cookSun.price) * cookSun.amount;
@@ -1095,7 +1119,7 @@ class _OrderAdvanceHomePageState extends State<OrderAdvanceHomePage> { @@ -1095,7 +1119,7 @@ class _OrderAdvanceHomePageState extends State<OrderAdvanceHomePage> {
1095 // } 1119 // }
1096 1120
1097 // carSum += cookSun.amount; 1121 // carSum += cookSun.amount;
1098 - cooklistSun.add(cookSun); 1122 + // cooklistSun.add(cookSun);
1099 } 1123 }
1100 }); 1124 });
1101 if (cooklistSun.length > 0) { 1125 if (cooklistSun.length > 0) {
@@ -1105,7 +1129,8 @@ class _OrderAdvanceHomePageState extends State<OrderAdvanceHomePage> { @@ -1105,7 +1129,8 @@ class _OrderAdvanceHomePageState extends State<OrderAdvanceHomePage> {
1105 value.cookList = moreMenu; 1129 value.cookList = moreMenu;
1106 } 1130 }
1107 }); 1131 });
1108 - value.moreSum = value.amount; 1132 + value.moreSum =
  1133 + value.amountHasOrderList[0].amount;
1109 value.channel = element.className == '套餐' 1134 value.channel = element.className == '套餐'
1110 ? '1' 1135 ? '1'
1111 : '2'; // 1套餐----2排菜 1136 : '2'; // 1套餐----2排菜
@@ -1126,8 +1151,39 @@ class _OrderAdvanceHomePageState extends State<OrderAdvanceHomePage> { @@ -1126,8 +1151,39 @@ class _OrderAdvanceHomePageState extends State<OrderAdvanceHomePage> {
1126 // } 1151 // }
1127 else { 1152 else {
1128 //单菜 1153 //单菜
1129 - bool hasmMenu = element.cookbooklist  
1130 - .any(((value) => value.amount > 0)); 1154 + // bool hasmMenu = element.cookbooklist
  1155 + // .any(((value) => value.amount > 0));
  1156 + // if (hasmMenu) {
  1157 + // //单品此类有选中菜品
  1158 + // MenuModel menuModel = MenuModel();
  1159 + // menuModel.className = element.className;
  1160 + // menuModel.classLabel = element.classLabel;
  1161 + // menuModel.classType = element.classType;
  1162 + // menuModel.id = element.id;
  1163 + // menuModel.order = element.order;
  1164 + // menuModel.sellerid = element.sellerid;
  1165 + // menuModel.status = element.status;
  1166 + // menuModel.cookbooklist = [];
  1167 + // List<MenuSunModel> cookbooklist = [];
  1168 + // int allSum = 0;
  1169 + // element.cookbooklist.forEach((value) {
  1170 + // if (value.amount > 0) {
  1171 + // allSum += value.amount;
  1172 + // // priceSum += double.parse(value.price) * value.amount;
  1173 + // // memberPriceSum +=
  1174 + // // double.parse(value.member_price) * value.amount;
  1175 + // // carSum += value.amount;
  1176 + // cookbooklist.add(value);
  1177 + // }
  1178 + // });
  1179 + // menuModel.allSum = allSum;
  1180 + // menuModel.cookbooklist.addAll(cookbooklist);
  1181 + // dataLocalShowOne.add(menuModel);
  1182 + // }
  1183 + bool hasmMenu = element.cookbooklist.any(
  1184 + ((value) =>
  1185 + value.amountHasOrderList != null &&
  1186 + value.amountHasOrderList.length > 0));
1131 if (hasmMenu) { 1187 if (hasmMenu) {
1132 //单品此类有选中菜品 1188 //单品此类有选中菜品
1133 MenuModel menuModel = MenuModel(); 1189 MenuModel menuModel = MenuModel();
@@ -1142,13 +1198,31 @@ class _OrderAdvanceHomePageState extends State<OrderAdvanceHomePage> { @@ -1142,13 +1198,31 @@ class _OrderAdvanceHomePageState extends State<OrderAdvanceHomePage> {
1142 List<MenuSunModel> cookbooklist = []; 1198 List<MenuSunModel> cookbooklist = [];
1143 int allSum = 0; 1199 int allSum = 0;
1144 element.cookbooklist.forEach((value) { 1200 element.cookbooklist.forEach((value) {
1145 - if (value.amount > 0) {  
1146 - allSum += value.amount;  
1147 - // priceSum += double.parse(value.price) * value.amount;  
1148 - // memberPriceSum +=  
1149 - // double.parse(value.member_price) * value.amount;  
1150 - // carSum += value.amount;  
1151 - cookbooklist.add(value); 1201 + if (value.amountHasOrderList != null &&
  1202 + value.amountHasOrderList.length > 0) {
  1203 + // value.amountHasOrderList
  1204 + // .forEach((hasOrder) {
  1205 + // if (hasOrder.amount > 0) {
  1206 + // allSum += hasOrder.amount;
  1207 + // // priceSum += double.parse(value.price) * value.amount;
  1208 + // // memberPriceSum +=
  1209 + // // double.parse(value.member_price) * value.amount;
  1210 + // carSum += hasOrder.amount;
  1211 + // }
  1212 + // });
  1213 + // cookbooklist.add(value);
  1214 + value.amountHasOrderList
  1215 + .forEach((element) {
  1216 + allSum += element.amount;
  1217 + // carSum += element.amount;
  1218 + MenuSunModel cooksunTemp =
  1219 + MenuSunModel.fromJson2(
  1220 + value.toJson());
  1221 + cooksunTemp.amountHasOrderList = [];
  1222 + cooksunTemp.amountHasOrderList
  1223 + .add(element);
  1224 + cookbooklist.add(cooksunTemp);
  1225 + });
1152 } 1226 }
1153 }); 1227 });
1154 menuModel.allSum = allSum; 1228 menuModel.allSum = allSum;
@@ -1160,11 +1234,53 @@ class _OrderAdvanceHomePageState extends State<OrderAdvanceHomePage> { @@ -1160,11 +1234,53 @@ class _OrderAdvanceHomePageState extends State<OrderAdvanceHomePage> {
1160 }); 1234 });
1161 } 1235 }
1162 1236
  1237 + // dataLocalShowMore.forEach((value) {
  1238 + // value.cookList.forEach((newValue) {
  1239 + // if (showList.length == 0) {
  1240 + // // showList.add(
  1241 + // // MenuModel.fromJson2(newValue.toJson()));
  1242 + // Map<String, dynamic> map = newValue.toJson();
  1243 + // map['out_all_num'] =
  1244 + // value.amountHasOrderList[0].amount;
  1245 + // showList.add(MenuModel.fromJson3(map));
  1246 + // } else {
  1247 + // bool hasC = false;
  1248 + // showList.forEach((show) {
  1249 + // if (show.id == newValue.id) {
  1250 + // hasC = true;
  1251 + // //数据存在相同菜类
  1252 +
  1253 + // newValue.cookbooklist.forEach((newcook) {
  1254 + // bool has = false;
  1255 + // show.cookbooklist.forEach((oldshow) {
  1256 + // if (oldshow.id == newcook.id) {
  1257 + // //同一个菜品
  1258 + // has = true;
  1259 + // oldshow.amount += newcook.amount;
  1260 + // show.allSum += newcook.amount;
  1261 + // }
  1262 + // });
  1263 + // if (!has) {
  1264 + // //旧的里面没有该菜品
  1265 + // show.cookbooklist.add(newcook);
  1266 + // }
  1267 + // });
  1268 + // }
  1269 + // });
  1270 + // if (!hasC) {
  1271 + // showList.add(
  1272 + // MenuModel.fromJson2(newValue.toJson()));
  1273 + // }
  1274 + // }
  1275 + // });
  1276 + // });
1163 dataLocalShowMore.forEach((value) { 1277 dataLocalShowMore.forEach((value) {
1164 value.cookList.forEach((newValue) { 1278 value.cookList.forEach((newValue) {
1165 if (showList.length == 0) { 1279 if (showList.length == 0) {
1166 - showList.add(  
1167 - MenuModel.fromJson2(newValue.toJson())); 1280 + Map<String, dynamic> map = newValue.toJson();
  1281 + map['out_all_num'] =
  1282 + value.amountHasOrderList[0].amount;
  1283 + showList.add(MenuModel.fromJson3(map));
1168 } else { 1284 } else {
1169 bool hasC = false; 1285 bool hasC = false;
1170 showList.forEach((show) { 1286 showList.forEach((show) {
@@ -1176,22 +1292,94 @@ class _OrderAdvanceHomePageState extends State<OrderAdvanceHomePage> { @@ -1176,22 +1292,94 @@ class _OrderAdvanceHomePageState extends State<OrderAdvanceHomePage> {
1176 bool has = false; 1292 bool has = false;
1177 show.cookbooklist.forEach((oldshow) { 1293 show.cookbooklist.forEach((oldshow) {
1178 if (oldshow.id == newcook.id) { 1294 if (oldshow.id == newcook.id) {
1179 - //同一个菜品  
1180 - has = true;  
1181 - oldshow.amount += newcook.amount;  
1182 - show.allSum += newcook.amount; 1295 + //同一个菜品条件: id相同,并且规格和做法也相同
  1296 + if (oldshow.amountHasOrderList[0]
  1297 + .practiceModel !=
  1298 + null &&
  1299 + newcook.amountHasOrderList[0]
  1300 + .practiceModel !=
  1301 + null &&
  1302 + oldshow.amountHasOrderList[0]
  1303 + .specModel !=
  1304 + null &&
  1305 + newcook.amountHasOrderList[0]
  1306 + .specModel !=
  1307 + null) {
  1308 + if (oldshow
  1309 + .amountHasOrderList[0]
  1310 + .practiceModel
  1311 + .practice ==
  1312 + newcook
  1313 + .amountHasOrderList[0]
  1314 + .practiceModel
  1315 + .practice &&
  1316 + oldshow.amountHasOrderList[0]
  1317 + .specModel.specid ==
  1318 + newcook
  1319 + .amountHasOrderList[0]
  1320 + .specModel
  1321 + .specid) {
  1322 + // if (oldshow.amount !=
  1323 + // newcook
  1324 + // .amountHasOrderList[0]
  1325 + // .amount) {
  1326 + has = true;
  1327 + oldshow.amount += newcook
  1328 + .amountHasOrderList[0]
  1329 + .amount *
  1330 + value.amountHasOrderList[0]
  1331 + .amount;
  1332 + oldshow.amountHasOrderList.addAll(
  1333 + newcook.amountHasOrderList);
  1334 + show.allSum += newcook
  1335 + .amountHasOrderList[0].amount;
  1336 + // }
  1337 + }
  1338 + } else if (oldshow
  1339 + .amountHasOrderList[0]
  1340 + .practiceModel ==
  1341 + null &&
  1342 + oldshow.amountHasOrderList[0]
  1343 + .specModel !=
  1344 + null) {
  1345 + if (oldshow.amountHasOrderList[0]
  1346 + .specModel.specid ==
  1347 + newcook.amountHasOrderList[0]
  1348 + .specModel.specid) {
  1349 + // if (oldshow.amount !=
  1350 + // newcook
  1351 + // .amountHasOrderList[0]
  1352 + // .amount) {
  1353 + has = true;
  1354 + oldshow.amount += newcook
  1355 + .amountHasOrderList[0]
  1356 + .amount *
  1357 + value.amountHasOrderList[0]
  1358 + .amount;
  1359 + oldshow.amountHasOrderList.addAll(
  1360 + newcook.amountHasOrderList);
  1361 + show.allSum += newcook
  1362 + .amountHasOrderList[0].amount;
  1363 + // }
  1364 + }
  1365 + }
1183 } 1366 }
1184 }); 1367 });
1185 if (!has) { 1368 if (!has) {
1186 //旧的里面没有该菜品 1369 //旧的里面没有该菜品
  1370 + newcook.amount = newcook
  1371 + .amountHasOrderList[0].amount *
  1372 + value.amountHasOrderList[0].amount;
1187 show.cookbooklist.add(newcook); 1373 show.cookbooklist.add(newcook);
1188 } 1374 }
1189 }); 1375 });
1190 } 1376 }
1191 }); 1377 });
1192 if (!hasC) { 1378 if (!hasC) {
1193 - showList.add(  
1194 - MenuModel.fromJson2(newValue.toJson())); 1379 + Map<String, dynamic> map = newValue.toJson();
  1380 + map['out_all_num'] =
  1381 + value.amountHasOrderList[0].amount;
  1382 + showList.add(MenuModel.fromJson3(map));
1195 } 1383 }
1196 } 1384 }
1197 }); 1385 });
@@ -1199,10 +1387,47 @@ class _OrderAdvanceHomePageState extends State<OrderAdvanceHomePage> { @@ -1199,10 +1387,47 @@ class _OrderAdvanceHomePageState extends State<OrderAdvanceHomePage> {
1199 1387
1200 print(showList); 1388 print(showList);
1201 1389
  1390 + // dataLocalShowOne.forEach((element) {
  1391 + // if (showList.length == 0) {
  1392 + // showList
  1393 + // .add(MenuModel.fromJson2(element.toJson()));
  1394 + // } else {
  1395 + // bool hasC = false;
  1396 + // showList.forEach((show) {
  1397 + // if (show.id == element.id) {
  1398 + // hasC = true;
  1399 + // //数据存在相同菜类
  1400 +
  1401 + // element.cookbooklist.forEach((newcook) {
  1402 + // bool has = false;
  1403 + // show.cookbooklist.forEach((oldshow) {
  1404 + // if (oldshow.id == newcook.id) {
  1405 + // //同一个菜品
  1406 + // has = true;
  1407 + // oldshow.amountHasOrderList[0].amount +=
  1408 + // newcook
  1409 + // .amountHasOrderList[0].amount;
  1410 + // show.allSum += oldshow
  1411 + // .amountHasOrderList[0].amount;
  1412 + // }
  1413 + // });
  1414 + // if (!has) {
  1415 + // //旧的里面没有该菜品
  1416 + // show.cookbooklist.add(newcook);
  1417 + // }
  1418 + // });
  1419 + // }
  1420 + // });
  1421 + // if (!hasC) {
  1422 + // showList
  1423 + // .add(MenuModel.fromJson2(element.toJson()));
  1424 + // }
  1425 + // }
  1426 + // });
1202 dataLocalShowOne.forEach((element) { 1427 dataLocalShowOne.forEach((element) {
1203 if (showList.length == 0) { 1428 if (showList.length == 0) {
1204 showList 1429 showList
1205 - .add(MenuModel.fromJson2(element.toJson())); 1430 + .add(MenuModel.fromJson3(element.toJson()));
1206 } else { 1431 } else {
1207 bool hasC = false; 1432 bool hasC = false;
1208 showList.forEach((show) { 1433 showList.forEach((show) {
@@ -1214,10 +1439,65 @@ class _OrderAdvanceHomePageState extends State<OrderAdvanceHomePage> { @@ -1214,10 +1439,65 @@ class _OrderAdvanceHomePageState extends State<OrderAdvanceHomePage> {
1214 bool has = false; 1439 bool has = false;
1215 show.cookbooklist.forEach((oldshow) { 1440 show.cookbooklist.forEach((oldshow) {
1216 if (oldshow.id == newcook.id) { 1441 if (oldshow.id == newcook.id) {
1217 - //同一个菜品  
1218 - has = true;  
1219 - oldshow.amount += newcook.amount;  
1220 - show.allSum += newcook.amount; 1442 + //同一个菜品条件: id相同,并且规格和做法也相同
  1443 + if (oldshow.amountHasOrderList[0]
  1444 + .practiceModel !=
  1445 + null &&
  1446 + newcook.amountHasOrderList[0]
  1447 + .practiceModel !=
  1448 + null &&
  1449 + oldshow.amountHasOrderList[0]
  1450 + .specModel !=
  1451 + null &&
  1452 + newcook.amountHasOrderList[0]
  1453 + .specModel !=
  1454 + null) {
  1455 + if (oldshow.amountHasOrderList[0]
  1456 + .practiceModel.practice ==
  1457 + newcook.amountHasOrderList[0]
  1458 + .practiceModel.practice &&
  1459 + oldshow.amountHasOrderList[0]
  1460 + .specModel.specid ==
  1461 + newcook.amountHasOrderList[0]
  1462 + .specModel.specid) {
  1463 + // if (oldshow
  1464 + // .amountHasOrderList[0].amount !=
  1465 + // newcook
  1466 + // .amountHasOrderList[0].amount) {
  1467 + has = true;
  1468 + oldshow.amount += newcook
  1469 + .amountHasOrderList[0].amount;
  1470 + oldshow.amountHasOrderList.addAll(
  1471 + newcook.amountHasOrderList);
  1472 + show.allSum += newcook
  1473 + .amountHasOrderList[0].amount;
  1474 +
  1475 + // }
  1476 + }
  1477 + } else if (oldshow.amountHasOrderList[0]
  1478 + .practiceModel ==
  1479 + null &&
  1480 + oldshow.amountHasOrderList[0]
  1481 + .specModel !=
  1482 + null) {
  1483 + if (oldshow.amountHasOrderList[0]
  1484 + .specModel.specid ==
  1485 + newcook.amountHasOrderList[0]
  1486 + .specModel.specid) {
  1487 + // if (oldshow
  1488 + // .amountHasOrderList[0].amount !=
  1489 + // newcook
  1490 + // .amountHasOrderList[0].amount) {
  1491 + has = true;
  1492 + oldshow.amount += newcook
  1493 + .amountHasOrderList[0].amount;
  1494 + oldshow.amountHasOrderList.addAll(
  1495 + newcook.amountHasOrderList);
  1496 + show.allSum += newcook
  1497 + .amountHasOrderList[0].amount;
  1498 + // }
  1499 + }
  1500 + }
1221 } 1501 }
1222 }); 1502 });
1223 if (!has) { 1503 if (!has) {
@@ -1229,7 +1509,7 @@ class _OrderAdvanceHomePageState extends State<OrderAdvanceHomePage> { @@ -1229,7 +1509,7 @@ class _OrderAdvanceHomePageState extends State<OrderAdvanceHomePage> {
1229 }); 1509 });
1230 if (!hasC) { 1510 if (!hasC) {
1231 showList 1511 showList
1232 - .add(MenuModel.fromJson2(element.toJson())); 1512 + .add(MenuModel.fromJson3(element.toJson()));
1233 } 1513 }
1234 } 1514 }
1235 }); 1515 });
@@ -537,38 +537,33 @@ class _OrderCreateTemporaryPageState extends State<OrderCreateTemporaryPage> { @@ -537,38 +537,33 @@ class _OrderCreateTemporaryPageState extends State<OrderCreateTemporaryPage> {
537 textInputAction: TextInputAction.done, 537 textInputAction: TextInputAction.done,
538 538
539 onChanged: (value) { 539 onChanged: (value) {
540 - // if (value != null && value != '') {  
541 - // //用户输入的数据  
542 - // int input = int.parse(value);  
543 - // //减去当前数据  
544 -  
545 - // menuModel.allSum -= menuSunModel.amount;  
546 -  
547 - // carSum -= menuSunModel.amount;  
548 -  
549 - // if (input == 0) {  
550 - // //把当前菜品从列表中去除  
551 -  
552 - // dataLocalShowOne[indexOne]  
553 - // .cookbooklist  
554 - // .removeAt(indexReal); //移除当前行  
555 - // //判断当前类没有cookbooklist,则删除当前类  
556 - // if (dataLocalShowOne[indexOne]  
557 - // .cookbooklist  
558 - // .length ==  
559 - // 0) {  
560 - // dataLocalShowOne.removeAt(indexOne);  
561 - // }  
562 - // } else {  
563 - // menuModel.allSum += input;  
564 -  
565 - // carSum += input;  
566 - // }  
567 -  
568 - // menuSunModel.amount = int.parse(value);  
569 - // _calculatePrice();  
570 - // setState(() {});  
571 - // } 540 + if (value != null && value != '') {
  541 + //用户输入的数据
  542 + int input = int.parse(value);
  543 + //减去当前数据
  544 +
  545 + allSum -= menuSunModel.amount;
  546 +
  547 + // carSum -= menuSunModel.amount;
  548 +
  549 + if (input == 0) {
  550 + //把当前菜品从列表中去除
  551 +
  552 + menuSunShort.removeAt(index); //移除当前行
  553 + //判断当前类没有cookbooklist,则删除当前类
  554 +
  555 + } else {
  556 + allSum += input;
  557 + }
  558 +
  559 + menuSunModel.amount = int.parse(value);
  560 + menuSunModel.amountHasOrderList[0]
  561 + .amount = int.parse(value);
  562 + // _calculatePrice();
  563 +
  564 + setState(() {});
  565 + bus.emit('refresh_data', menuSunShort);
  566 + }
572 }, 567 },
573 onEditingComplete: () { 568 onEditingComplete: () {
574 FocusScope.of(context).requestFocus( 569 FocusScope.of(context).requestFocus(
@@ -138,7 +138,8 @@ class _OrderEditListShowPageState extends State<OrderEditListShowPage> { @@ -138,7 +138,8 @@ class _OrderEditListShowPageState extends State<OrderEditListShowPage> {
138 // 具体菜品 138 // 具体菜品
139 139
140 if (cookSun.amountHasOrderList != null && 140 if (cookSun.amountHasOrderList != null &&
141 - cookSun.amountHasOrderList.length > 0) { 141 + cookSun.amountHasOrderList.length > 0 &&
  142 + cookSun.amountHasOrderList[0].amount > 0) {
142 //当前菜品已选择 143 //当前菜品已选择
143 // moreSum += cookSun.amount; 144 // moreSum += cookSun.amount;
144 145
@@ -148,7 +149,8 @@ class _OrderEditListShowPageState extends State<OrderEditListShowPage> { @@ -148,7 +149,8 @@ class _OrderEditListShowPageState extends State<OrderEditListShowPage> {
148 MenuSunModel cooksunTemp = 149 MenuSunModel cooksunTemp =
149 MenuSunModel.fromJson2(cookSun.toJson()); 150 MenuSunModel.fromJson2(cookSun.toJson());
150 cookSum += element.amount; 151 cookSum += element.amount;
151 - carSum += element.amount; 152 + carSum +=
  153 + element.amount * value.amountHasOrderList[0].amount;
152 cooksunTemp.amountHasOrderList = []; 154 cooksunTemp.amountHasOrderList = [];
153 cooksunTemp.amountHasOrderList.add(element); 155 cooksunTemp.amountHasOrderList.add(element);
154 cooklistSun.add(cooksunTemp); 156 cooklistSun.add(cooksunTemp);
@@ -448,56 +450,46 @@ class _OrderEditListShowPageState extends State<OrderEditListShowPage> { @@ -448,56 +450,46 @@ class _OrderEditListShowPageState extends State<OrderEditListShowPage> {
448 bool isChange = false; //套餐数量是否发生变化 450 bool isChange = false; //套餐数量是否发生变化
449 //同一个套餐 451 //同一个套餐
450 452
451 - store.cookList.forEach((storeCook) {  
452 - if (store.cookList.length > element.cookList.length) {  
453 - //删除了整个菜品分类  
454 - isChange = true;  
455 - }  
456 - element.cookList.forEach((cooklist) { 453 + element.cookList.forEach((cooklist) {
  454 + store.cookList.forEach((storeCook) {
457 if (cooklist.id == storeCook.id) { 455 if (cooklist.id == storeCook.id) {
458 - // if (cooklist.cookbooklist.length !=  
459 - // storeCook.cookbooklist.length) {  
460 - // isChange = true;  
461 - // }  
462 //同一分类 456 //同一分类
  457 + if (cooklist.cookbooklist.length !=
  458 + storeCook.cookbooklist.length) {
  459 + isChange = true;
  460 + }
463 cooklist.cookbooklist.forEach((value1) { 461 cooklist.cookbooklist.forEach((value1) {
464 storeCook.cookbooklist.forEach((value2) { 462 storeCook.cookbooklist.forEach((value2) {
465 if (value1.id == value2.id) { 463 if (value1.id == value2.id) {
466 - // if (value1.amount != value2.amount) {  
467 - // isChange = true;  
468 - // }  
469 - if (value1.amountHasOrderList != null &&  
470 - value2.amountHasOrderList != null) {  
471 - if (value1.amountHasOrderList.length !=  
472 - value2.amountHasOrderList.length) {  
473 - isChange = true;  
474 - } else {  
475 - value1.amountHasOrderList.forEach((element1) {  
476 - value2.amountHasOrderList.forEach((element2) {  
477 - if (element1.practiceModel != null &&  
478 - element2.practiceModel != null &&  
479 - element1.specModel != null &&  
480 - element2.specModel != null) {  
481 - if (element1.practiceModel.practice ==  
482 - element2.practiceModel.practice &&  
483 - element1.specModel.specid ==  
484 - element2.specModel.specid) {  
485 - if (element1.amount != element2.amount) {  
486 - isChange = true;  
487 - } 464 + if (value1.amountHasOrderList.length !=
  465 + value2.amountHasOrderList.length) {
  466 + isChange = true;
  467 + } else {
  468 + value1.amountHasOrderList.forEach((element1) {
  469 + value2.amountHasOrderList.forEach((element2) {
  470 + if (element1.practiceModel != null &&
  471 + element2.practiceModel != null &&
  472 + element1.specModel != null &&
  473 + element2.specModel != null) {
  474 + if (element1.practiceModel.practice ==
  475 + element2.practiceModel.practice &&
  476 + element1.specModel.specid ==
  477 + element2.specModel.specid) {
  478 + if (element1.amount != element2.amount) {
  479 + isChange = true;
488 } 480 }
489 - } else if (element1.practiceModel == null &&  
490 - element1.specModel != null) {  
491 - if (element1.specModel.specid ==  
492 - element2.specModel.specid) {  
493 - if (element1.amount != element2.amount) {  
494 - isChange = true;  
495 - } 481 + }
  482 + } else if (element1.practiceModel == null &&
  483 + element1.specModel != null) {
  484 + if (element1.specModel.specid ==
  485 + element2.specModel.specid) {
  486 + if (element1.amount != element2.amount) {
  487 + isChange = true;
496 } 488 }
497 } 489 }
498 - }); 490 + }
499 }); 491 });
500 - } 492 + });
501 } 493 }
502 } 494 }
503 }); 495 });
@@ -505,6 +497,64 @@ class _OrderEditListShowPageState extends State<OrderEditListShowPage> { @@ -505,6 +497,64 @@ class _OrderEditListShowPageState extends State<OrderEditListShowPage> {
505 } 497 }
506 }); 498 });
507 }); 499 });
  500 +
  501 + // store.cookList.forEach((storeCook) {
  502 + // if (store.cookList.length > element.cookList.length) {
  503 + // //删除了整个菜品分类
  504 + // isChange = true;
  505 + // }
  506 + // element.cookList.forEach((cooklist) {
  507 + // if (cooklist.id == storeCook.id) {
  508 + // // if (cooklist.cookbooklist.length !=
  509 + // // storeCook.cookbooklist.length) {
  510 + // // isChange = true;
  511 + // // }
  512 + // //同一分类
  513 + // cooklist.cookbooklist.forEach((value1) {
  514 + // storeCook.cookbooklist.forEach((value2) {
  515 + // if (value1.id == value2.id) {
  516 + // // if (value1.amount != value2.amount) {
  517 + // // isChange = true;
  518 + // // }
  519 + // if (value1.amountHasOrderList != null &&
  520 + // value2.amountHasOrderList != null) {
  521 + // if (value1.amountHasOrderList.length !=
  522 + // value2.amountHasOrderList.length) {
  523 + // isChange = true;
  524 + // } else {
  525 + // value1.amountHasOrderList.forEach((element1) {
  526 + // value2.amountHasOrderList.forEach((element2) {
  527 + // if (element1.practiceModel != null &&
  528 + // element2.practiceModel != null &&
  529 + // element1.specModel != null &&
  530 + // element2.specModel != null) {
  531 + // if (element1.practiceModel.practice ==
  532 + // element2.practiceModel.practice &&
  533 + // element1.specModel.specid ==
  534 + // element2.specModel.specid) {
  535 + // if (element1.amount != element2.amount) {
  536 + // isChange = true;
  537 + // }
  538 + // }
  539 + // } else if (element1.practiceModel == null &&
  540 + // element1.specModel != null) {
  541 + // if (element1.specModel.specid ==
  542 + // element2.specModel.specid) {
  543 + // if (element1.amount != element2.amount) {
  544 + // isChange = true;
  545 + // }
  546 + // }
  547 + // }
  548 + // });
  549 + // });
  550 + // }
  551 + // }
  552 + // }
  553 + // });
  554 + // });
  555 + // }
  556 + // });
  557 + // });
508 //当前套餐/排菜数量已经发生变化 558 //当前套餐/排菜数量已经发生变化
509 if (!isChange) { 559 if (!isChange) {
510 // priceSum += double.parse(store.planPrice) * element.amount; 560 // priceSum += double.parse(store.planPrice) * element.amount;
@@ -516,30 +566,51 @@ class _OrderEditListShowPageState extends State<OrderEditListShowPage> { @@ -516,30 +566,51 @@ class _OrderEditListShowPageState extends State<OrderEditListShowPage> {
516 element.amountHasOrderList[0].amount; 566 element.amountHasOrderList[0].amount;
517 } else { 567 } else {
518 //单品 568 //单品
  569 + // element.cookList.forEach((cooklist) {
  570 + // //同一分类
  571 + // cooklist.cookbooklist.forEach((value1) {
  572 + // // priceSum += double.parse(value1.price) *
  573 + // // value1.amount *
  574 + // // element.amount;
  575 + // // memberPriceSum += double.parse(value1.member_price) *
  576 + // // value1.amount *
  577 + // // element.amount;
  578 + // priceSum += double.parse(
  579 + // value1.amountHasOrderList[0].specModel.price) *
  580 + // value1.amountHasOrderList[0].amount *
  581 + // element.amountHasOrderList[0].amount;
  582 + // memberPriceSum += double.parse(value1.amountHasOrderList[0]
  583 + // .specModel.memberPrice ==
  584 + // '0' ||
  585 + // value1.amountHasOrderList[0].specModel
  586 + // .memberPrice ==
  587 + // null
  588 + // ? value1.amountHasOrderList[0].specModel.price
  589 + // : value1
  590 + // .amountHasOrderList[0].specModel.memberPrice) *
  591 + // value1.amountHasOrderList[0].amount *
  592 + // element.amountHasOrderList[0].amount;
  593 + // });
  594 + // });
  595 +
519 element.cookList.forEach((cooklist) { 596 element.cookList.forEach((cooklist) {
520 //同一分类 597 //同一分类
521 cooklist.cookbooklist.forEach((value1) { 598 cooklist.cookbooklist.forEach((value1) {
522 - // priceSum += double.parse(value1.price) *  
523 - // value1.amount *  
524 - // element.amount;  
525 - // memberPriceSum += double.parse(value1.member_price) *  
526 - // value1.amount *  
527 - // element.amount;  
528 - priceSum += double.parse(  
529 - value1.amountHasOrderList[0].specModel.price) *  
530 - value1.amountHasOrderList[0].amount *  
531 - element.amountHasOrderList[0].amount;  
532 - memberPriceSum += double.parse(value1.amountHasOrderList[0]  
533 - .specModel.memberPrice ==  
534 - '0' ||  
535 - value1.amountHasOrderList[0].specModel  
536 - .memberPrice ==  
537 - null  
538 - ? value1.amountHasOrderList[0].specModel.price  
539 - : value1  
540 - .amountHasOrderList[0].specModel.memberPrice) *  
541 - value1.amountHasOrderList[0].amount *  
542 - element.amountHasOrderList[0].amount; 599 + if (value1.amountHasOrderList != null &&
  600 + value1.amountHasOrderList.length > 0) {
  601 + value1.amountHasOrderList.forEach((element1) {
  602 + priceSum += double.parse(element1.specModel.price) *
  603 + element.amountHasOrderList[0].amount *
  604 + element1.amount;
  605 + memberPriceSum += double.parse(
  606 + element1.specModel.memberPrice == '0' ||
  607 + element1.specModel.memberPrice == null
  608 + ? element1.specModel.price
  609 + : element1.specModel.memberPrice) *
  610 + element.amountHasOrderList[0].amount *
  611 + element1.amount;
  612 + });
  613 + }
543 }); 614 });
544 }); 615 });
545 } 616 }
@@ -568,6 +639,10 @@ class _OrderEditListShowPageState extends State<OrderEditListShowPage> { @@ -568,6 +639,10 @@ class _OrderEditListShowPageState extends State<OrderEditListShowPage> {
568 // isChange = true; 639 // isChange = true;
569 // } 640 // }
570 //同一分类 641 //同一分类
  642 + if (cooklist.cookbooklist.length !=
  643 + storeCook.cookbooklist.length) {
  644 + isChange = true;
  645 + }
571 cooklist.cookbooklist.forEach((value1) { 646 cooklist.cookbooklist.forEach((value1) {
572 storeCook.cookbooklist.forEach((value2) { 647 storeCook.cookbooklist.forEach((value2) {
573 if (value1.id == value2.id) { 648 if (value1.id == value2.id) {
@@ -624,30 +699,50 @@ class _OrderEditListShowPageState extends State<OrderEditListShowPage> { @@ -624,30 +699,50 @@ class _OrderEditListShowPageState extends State<OrderEditListShowPage> {
624 element.amountHasOrderList[0].amount; 699 element.amountHasOrderList[0].amount;
625 } else { 700 } else {
626 //单品 701 //单品
  702 + // element.cookList.forEach((cooklist) {
  703 + // //同一分类
  704 + // cooklist.cookbooklist.forEach((value1) {
  705 + // // priceSum += double.parse(value1.price) *
  706 + // // value1.amount *
  707 + // // element.amount;
  708 + // // memberPriceSum += double.parse(value1.member_price) *
  709 + // // value1.amount *
  710 + // // element.amount;
  711 + // priceSum += double.parse(
  712 + // value1.amountHasOrderList[0].specModel.price) *
  713 + // value1.amountHasOrderList[0].amount *
  714 + // element.amountHasOrderList[0].amount;
  715 + // memberPriceSum += double.parse(value1.amountHasOrderList[0]
  716 + // .specModel.memberPrice ==
  717 + // '0' ||
  718 + // value1.amountHasOrderList[0].specModel
  719 + // .memberPrice ==
  720 + // null
  721 + // ? value1.amountHasOrderList[0].specModel.price
  722 + // : value1
  723 + // .amountHasOrderList[0].specModel.memberPrice) *
  724 + // value1.amountHasOrderList[0].amount *
  725 + // element.amountHasOrderList[0].amount;
  726 + // });
  727 + // });
627 element.cookList.forEach((cooklist) { 728 element.cookList.forEach((cooklist) {
628 //同一分类 729 //同一分类
629 cooklist.cookbooklist.forEach((value1) { 730 cooklist.cookbooklist.forEach((value1) {
630 - // priceSum += double.parse(value1.price) *  
631 - // value1.amount *  
632 - // element.amount;  
633 - // memberPriceSum += double.parse(value1.member_price) *  
634 - // value1.amount *  
635 - // element.amount;  
636 - priceSum += double.parse(  
637 - value1.amountHasOrderList[0].specModel.price) *  
638 - value1.amountHasOrderList[0].amount *  
639 - element.amountHasOrderList[0].amount;  
640 - memberPriceSum += double.parse(value1.amountHasOrderList[0]  
641 - .specModel.memberPrice ==  
642 - '0' ||  
643 - value1.amountHasOrderList[0].specModel  
644 - .memberPrice ==  
645 - null  
646 - ? value1.amountHasOrderList[0].specModel.price  
647 - : value1  
648 - .amountHasOrderList[0].specModel.memberPrice) *  
649 - value1.amountHasOrderList[0].amount *  
650 - element.amountHasOrderList[0].amount; 731 + if (value1.amountHasOrderList != null &&
  732 + value1.amountHasOrderList.length > 0) {
  733 + value1.amountHasOrderList.forEach((element1) {
  734 + priceSum += double.parse(element1.specModel.price) *
  735 + element.amountHasOrderList[0].amount *
  736 + element1.amount;
  737 + memberPriceSum += double.parse(
  738 + element1.specModel.memberPrice == '0' ||
  739 + element1.specModel.memberPrice == null
  740 + ? element1.specModel.price
  741 + : element1.specModel.memberPrice) *
  742 + element.amountHasOrderList[0].amount *
  743 + element1.amount;
  744 + });
  745 + }
651 }); 746 });
652 }); 747 });
653 } 748 }
@@ -680,6 +775,22 @@ class _OrderEditListShowPageState extends State<OrderEditListShowPage> { @@ -680,6 +775,22 @@ class _OrderEditListShowPageState extends State<OrderEditListShowPage> {
680 if (hasmMenu) { 775 if (hasmMenu) {
681 //单品此类有选中菜品 776 //单品此类有选中菜品
682 777
  778 + // element.cookbooklist.forEach((value) {
  779 + // value.amountHasOrderList.forEach((element) {
  780 + // priceSum += double.parse(element.specModel.price) * element.amount;
  781 + // memberPriceSum += double.parse(
  782 + // element.specModel.memberPrice == null ||
  783 + // element.specModel.memberPrice == '0'
  784 + // ? element.specModel.price
  785 + // : element.specModel.memberPrice) *
  786 + // element.amount;
  787 + // });
  788 + // // if (value.amount > 0) {
  789 + // // priceSum += double.parse(value.price) * value.amount;
  790 + // // memberPriceSum += double.parse(value.member_price) * value.amount;
  791 + // // }
  792 + // });
  793 +
683 element.cookbooklist.forEach((value) { 794 element.cookbooklist.forEach((value) {
684 value.amountHasOrderList.forEach((element) { 795 value.amountHasOrderList.forEach((element) {
685 priceSum += double.parse(element.specModel.price) * element.amount; 796 priceSum += double.parse(element.specModel.price) * element.amount;
@@ -690,10 +801,6 @@ class _OrderEditListShowPageState extends State<OrderEditListShowPage> { @@ -690,10 +801,6 @@ class _OrderEditListShowPageState extends State<OrderEditListShowPage> {
690 : element.specModel.memberPrice) * 801 : element.specModel.memberPrice) *
691 element.amount; 802 element.amount;
692 }); 803 });
693 - // if (value.amount > 0) {  
694 - // priceSum += double.parse(value.price) * value.amount;  
695 - // memberPriceSum += double.parse(value.member_price) * value.amount;  
696 - // }  
697 }); 804 });
698 } 805 }
699 }); 806 });
@@ -783,7 +890,9 @@ class _OrderEditListShowPageState extends State<OrderEditListShowPage> { @@ -783,7 +890,9 @@ class _OrderEditListShowPageState extends State<OrderEditListShowPage> {
783 if (element.className == '套餐') { 890 if (element.className == '套餐') {
784 List<MenuSunModel> packagelist = []; 891 List<MenuSunModel> packagelist = [];
785 element.cookbooklist.forEach((cooklist) { 892 element.cookbooklist.forEach((cooklist) {
786 - if (cooklist.amount > 0) { 893 + if (cooklist.amountHasOrderList != null &&
  894 + cooklist.amountHasOrderList.length > 0 &&
  895 + cooklist.amountHasOrderList[0].amount > 0) {
787 packagelist.add(cooklist); 896 packagelist.add(cooklist);
788 } 897 }
789 }); 898 });
@@ -795,7 +904,9 @@ class _OrderEditListShowPageState extends State<OrderEditListShowPage> { @@ -795,7 +904,9 @@ class _OrderEditListShowPageState extends State<OrderEditListShowPage> {
795 } else if (element.className == '我的排菜') { 904 } else if (element.className == '我的排菜') {
796 List<MenuSunModel> planlist = []; 905 List<MenuSunModel> planlist = [];
797 element.cookbooklist.forEach((cooklist) { 906 element.cookbooklist.forEach((cooklist) {
798 - if (cooklist.amount > 0) { 907 + if (cooklist.amountHasOrderList != null &&
  908 + cooklist.amountHasOrderList.length > 0 &&
  909 + cooklist.amountHasOrderList[0].amount > 0) {
799 planlist.add(cooklist); 910 planlist.add(cooklist);
800 } 911 }
801 }); 912 });
@@ -804,12 +915,36 @@ class _OrderEditListShowPageState extends State<OrderEditListShowPage> { @@ -804,12 +915,36 @@ class _OrderEditListShowPageState extends State<OrderEditListShowPage> {
804 } else { 915 } else {
805 params['plan_list'] = null; 916 params['plan_list'] = null;
806 } 917 }
  918 + } else if (element.className == '店内常点') {
  919 + List<MenuSunModel> oftenlist = [];
  920 + element.cookbooklist.forEach((cooklist) {
  921 + if (cooklist.amountHasOrderList != null &&
  922 + cooklist.amountHasOrderList.length > 0 &&
  923 + cooklist.amountHasOrderList[0].amount > 0) {
  924 + oftenlist.add(cooklist);
  925 + }
  926 + });
  927 + if (oftenlist.length > 0) {
  928 + params['often_list'] = json.encode(oftenlist);
  929 + } else {
  930 + params['often_list'] = null;
  931 + }
807 } else if (element.className == '临时加菜') { 932 } else if (element.className == '临时加菜') {
808 //临时加菜 933 //临时加菜
809 934
810 temporarylist.addAll(element.cookbooklist); 935 temporarylist.addAll(element.cookbooklist);
  936 + // if (temporarylist.length > 0) {
  937 + // temporarylist.removeWhere((value) => value.amount == 0);
  938 + // if (temporarylist.length > 0) {
  939 + // params['temporary_list'] = json.encode(temporarylist);
  940 + // } else {
  941 + // params['temporary_list'] = null;
  942 + // }
  943 + // }
811 if (temporarylist.length > 0) { 944 if (temporarylist.length > 0) {
812 - temporarylist.removeWhere((value) => value.amount == 0); 945 + temporarylist.removeWhere((value) =>
  946 + value.amountHasOrderList == null ||
  947 + value.amountHasOrderList.length == 0);
813 if (temporarylist.length > 0) { 948 if (temporarylist.length > 0) {
814 params['temporary_list'] = json.encode(temporarylist); 949 params['temporary_list'] = json.encode(temporarylist);
815 } else { 950 } else {
@@ -818,10 +953,27 @@ class _OrderEditListShowPageState extends State<OrderEditListShowPage> { @@ -818,10 +953,27 @@ class _OrderEditListShowPageState extends State<OrderEditListShowPage> {
818 } 953 }
819 } else { 954 } else {
820 //单品 955 //单品
  956 + // cooklistdata.add(element);
  957 + // if (cooklistdata.length > 0) {
  958 + // cooklistdata.forEach((cooklist) {
  959 + // cooklist.cookbooklist.removeWhere((element) => element.amount == 0);
  960 + // });
  961 + // if (cooklistdata.length > 0) {
  962 + // params['cooklist'] = json.encode(cooklistdata);
  963 + // } else {
  964 + // params['cooklist'] = null;
  965 + // }
  966 + // }
821 cooklistdata.add(element); 967 cooklistdata.add(element);
822 if (cooklistdata.length > 0) { 968 if (cooklistdata.length > 0) {
823 cooklistdata.forEach((cooklist) { 969 cooklistdata.forEach((cooklist) {
824 - cooklist.cookbooklist.removeWhere((element) => element.amount == 0); 970 + cooklist.cookbooklist.forEach((element) {
  971 + element.amountHasOrderList
  972 + .removeWhere((element) => element.amount == 0);
  973 + });
  974 + cooklist.cookbooklist.removeWhere((element) =>
  975 + element.amountHasOrderList == null ||
  976 + element.amountHasOrderList.length == 0);
825 }); 977 });
826 if (cooklistdata.length > 0) { 978 if (cooklistdata.length > 0) {
827 params['cooklist'] = json.encode(cooklistdata); 979 params['cooklist'] = json.encode(cooklistdata);
@@ -1019,9 +1171,19 @@ class _OrderEditListShowPageState extends State<OrderEditListShowPage> { @@ -1019,9 +1171,19 @@ class _OrderEditListShowPageState extends State<OrderEditListShowPage> {
1019 () { 1171 () {
1020 //遍历将要被删除的列表,计算页面显示数值 1172 //遍历将要被删除的列表,计算页面显示数值
1021 1173
1022 - carSum -=  
1023 - menuSunModelF  
1024 - .moreSum; 1174 + // carSum -=
  1175 + // menuSunModelF
  1176 + // .moreSum;
  1177 + menuSunModelF
  1178 + .cookList
  1179 + .forEach(
  1180 + (element) {
  1181 + carSum -= element
  1182 + .allSum *
  1183 + menuSunModelF
  1184 + .moreSum;
  1185 + });
  1186 +
1025 dataLocalShowMore 1187 dataLocalShowMore
1026 .removeAt( 1188 .removeAt(
1027 indexMore); 1189 indexMore);
@@ -1135,13 +1297,13 @@ class _OrderEditListShowPageState extends State<OrderEditListShowPage> { @@ -1135,13 +1297,13 @@ class _OrderEditListShowPageState extends State<OrderEditListShowPage> {
1135 // double.parse(element.member_price) * element.amount; 1297 // double.parse(element.member_price) * element.amount;
1136 // carSum += element.amount; 1298 // carSum += element.amount;
1137 1299
1138 - menuModel.allSum -= element.amount; 1300 + menuModel.allSum -= element.amountHasOrderList[0].amount;
1139 // menuSunModelF.moreSum -= element.amount; 1301 // menuSunModelF.moreSum -= element.amount;
1140 // priceSum -= double.parse(element.price) * element.amount; 1302 // priceSum -= double.parse(element.price) * element.amount;
1141 // planDishC.text = priceSum.toString(); 1303 // planDishC.text = priceSum.toString();
1142 // memberPriceSum -= double.parse(element.member_price) * element.amount; 1304 // memberPriceSum -= double.parse(element.member_price) * element.amount;
1143 1305
1144 - carSum -= element.amount; 1306 + carSum -= element.amountHasOrderList[0].amount * menuSunModelF.moreSum;
1145 }); 1307 });
1146 dataLocalShowMore[indexMore].cookList.removeAt(indexF); 1308 dataLocalShowMore[indexMore].cookList.removeAt(indexF);
1147 //爷爷级 1309 //爷爷级
@@ -1308,7 +1470,9 @@ class _OrderEditListShowPageState extends State<OrderEditListShowPage> { @@ -1308,7 +1470,9 @@ class _OrderEditListShowPageState extends State<OrderEditListShowPage> {
1308 // menuSunModel 1470 // menuSunModel
1309 // .member_price); 1471 // .member_price);
1310 _calculatePrice(); 1472 _calculatePrice();
1311 - carSum--; 1473 + carSum -=
  1474 + menuSunModelF
  1475 + .moreSum;
1312 if (menuSunModel 1476 if (menuSunModel
1313 .amountHasOrderList[ 1477 .amountHasOrderList[
1314 0] 1478 0]
@@ -1470,9 +1634,11 @@ class _OrderEditListShowPageState extends State<OrderEditListShowPage> { @@ -1470,9 +1634,11 @@ class _OrderEditListShowPageState extends State<OrderEditListShowPage> {
1470 // .amount; 1634 // .amount;
1471 // _calculatePrice(); 1635 // _calculatePrice();
1472 carSum -= menuSunModel 1636 carSum -= menuSunModel
1473 - .amountHasOrderList[  
1474 - 0]  
1475 - .amount; 1637 + .amountHasOrderList[
  1638 + 0]
  1639 + .amount *
  1640 + menuSunModelF
  1641 + .moreSum;
1476 1642
1477 if (input == 1643 if (input ==
1478 0) { 1644 0) {
@@ -1529,8 +1695,9 @@ class _OrderEditListShowPageState extends State<OrderEditListShowPage> { @@ -1529,8 +1695,9 @@ class _OrderEditListShowPageState extends State<OrderEditListShowPage> {
1529 // memberPriceSum += 1695 // memberPriceSum +=
1530 // double.parse(menuSunModel.member_price) * 1696 // double.parse(menuSunModel.member_price) *
1531 // input; 1697 // input;
1532 - carSum +=  
1533 - input; 1698 + carSum += input *
  1699 + menuSunModelF
  1700 + .moreSum;
1534 } 1701 }
1535 1702
1536 menuSunModel 1703 menuSunModel
@@ -1585,7 +1752,9 @@ class _OrderEditListShowPageState extends State<OrderEditListShowPage> { @@ -1585,7 +1752,9 @@ class _OrderEditListShowPageState extends State<OrderEditListShowPage> {
1585 // menuSunModel 1752 // menuSunModel
1586 // .member_price); 1753 // .member_price);
1587 _calculatePrice(); 1754 _calculatePrice();
1588 - carSum++; 1755 + carSum +=
  1756 + menuSunModelF
  1757 + .moreSum;
1589 setState(() {}); 1758 setState(() {});
1590 }, 1759 },
1591 child: Container( 1760 child: Container(
@@ -1690,6 +1859,8 @@ class _OrderEditListShowPageState extends State<OrderEditListShowPage> { @@ -1690,6 +1859,8 @@ class _OrderEditListShowPageState extends State<OrderEditListShowPage> {
1690 menuModel 1859 menuModel
1691 .allSum -= 1860 .allSum -=
1692 element 1861 element
  1862 + .amountHasOrderList[
  1863 + 0]
1693 .amount; 1864 .amount;
1694 1865
1695 // element 1866 // element
@@ -1708,14 +1879,16 @@ class _OrderEditListShowPageState extends State<OrderEditListShowPage> { @@ -1708,14 +1879,16 @@ class _OrderEditListShowPageState extends State<OrderEditListShowPage> {
1708 // .member_price) * 1879 // .member_price) *
1709 // element 1880 // element
1710 // .amount; 1881 // .amount;
1711 - _calculatePrice();  
1712 - carSum -=  
1713 - element  
1714 - .amount; 1882 +
  1883 + carSum -= element
  1884 + .amountHasOrderList[
  1885 + 0]
  1886 + .amount;
1715 }); 1887 });
1716 dataLocalShowOne 1888 dataLocalShowOne
1717 .removeAt( 1889 .removeAt(
1718 indexOne); 1890 indexOne);
  1891 + _calculatePrice();
1719 1892
1720 setState(() {}); 1893 setState(() {});
1721 }); 1894 });
@@ -2294,10 +2467,13 @@ class _OrderEditListShowPageState extends State<OrderEditListShowPage> { @@ -2294,10 +2467,13 @@ class _OrderEditListShowPageState extends State<OrderEditListShowPage> {
2294 List<MenuModel> showList = []; 2467 List<MenuModel> showList = [];
2295 2468
2296 dataLocalShowMore.forEach((value) { 2469 dataLocalShowMore.forEach((value) {
  2470 + // unit = value.amountHasOrderList[0].amount;
2297 value.cookList.forEach((newValue) { 2471 value.cookList.forEach((newValue) {
2298 if (showList.length == 0) { 2472 if (showList.length == 0) {
2299 - showList  
2300 - .add(MenuModel.fromJson2(newValue.toJson())); 2473 + Map<String, dynamic> map = newValue.toJson();
  2474 + map['out_all_num'] =
  2475 + value.amountHasOrderList[0].amount;
  2476 + showList.add(MenuModel.fromJson3(map));
2301 } else { 2477 } else {
2302 bool hasC = false; 2478 bool hasC = false;
2303 showList.forEach((show) { 2479 showList.forEach((show) {
@@ -2330,16 +2506,20 @@ class _OrderEditListShowPageState extends State<OrderEditListShowPage> { @@ -2330,16 +2506,20 @@ class _OrderEditListShowPageState extends State<OrderEditListShowPage> {
2330 .specModel.specid == 2506 .specModel.specid ==
2331 newcook.amountHasOrderList[0] 2507 newcook.amountHasOrderList[0]
2332 .specModel.specid) { 2508 .specModel.specid) {
2333 - if (oldshow.amount !=  
2334 - newcook.amount) {  
2335 - has = true;  
2336 - oldshow.amountHasOrderList[0]  
2337 - .amount +=  
2338 - newcook.amountHasOrderList[0]  
2339 - .amount;  
2340 - show.allSum += newcook  
2341 - .amountHasOrderList[0].amount;  
2342 - } 2509 + // if (oldshow.amount !=
  2510 + // newcook.amountHasOrderList[0]
  2511 + // .amount) {
  2512 + has = true;
  2513 + oldshow.amount += newcook
  2514 + .amountHasOrderList[0]
  2515 + .amount *
  2516 + value
  2517 + .amountHasOrderList[0].amount;
  2518 + oldshow.amountHasOrderList.addAll(
  2519 + newcook.amountHasOrderList);
  2520 + show.allSum += newcook
  2521 + .amountHasOrderList[0].amount;
  2522 + // }
2343 } 2523 }
2344 } else if (oldshow.amountHasOrderList[0] 2524 } else if (oldshow.amountHasOrderList[0]
2345 .practiceModel == 2525 .practiceModel ==
@@ -2351,31 +2531,41 @@ class _OrderEditListShowPageState extends State<OrderEditListShowPage> { @@ -2351,31 +2531,41 @@ class _OrderEditListShowPageState extends State<OrderEditListShowPage> {
2351 .specModel.specid == 2531 .specModel.specid ==
2352 newcook.amountHasOrderList[0] 2532 newcook.amountHasOrderList[0]
2353 .specModel.specid) { 2533 .specModel.specid) {
2354 - if (oldshow.amount !=  
2355 - newcook.amountHasOrderList[0]  
2356 - .amount) {  
2357 - has = true;  
2358 - oldshow.amountHasOrderList[0]  
2359 - .amount +=  
2360 - newcook.amountHasOrderList[0]  
2361 - .amount;  
2362 - show.allSum += newcook  
2363 - .amountHasOrderList[0].amount;  
2364 - } 2534 + // if (oldshow.amount !=
  2535 + // newcook.amountHasOrderList[0]
  2536 + // .amount) {
  2537 + has = true;
  2538 + oldshow.amount += newcook
  2539 + .amountHasOrderList[0]
  2540 + .amount *
  2541 + value
  2542 + .amountHasOrderList[0].amount;
  2543 + oldshow.amountHasOrderList.addAll(
  2544 + newcook.amountHasOrderList);
  2545 + show.allSum += newcook
  2546 + .amountHasOrderList[0].amount;
  2547 + // }
  2548 + }else{
  2549 +
2365 } 2550 }
2366 } 2551 }
2367 } 2552 }
2368 }); 2553 });
2369 if (!has) { 2554 if (!has) {
2370 //旧的里面没有该菜品 2555 //旧的里面没有该菜品
  2556 + newcook.amount =
  2557 + newcook.amountHasOrderList[0].amount *
  2558 + value.amountHasOrderList[0].amount;
2371 show.cookbooklist.add(newcook); 2559 show.cookbooklist.add(newcook);
2372 } 2560 }
2373 }); 2561 });
2374 } 2562 }
2375 }); 2563 });
2376 if (!hasC) { 2564 if (!hasC) {
2377 - showList  
2378 - .add(MenuModel.fromJson2(newValue.toJson())); 2565 + Map<String, dynamic> map = newValue.toJson();
  2566 + map['out_all_num'] =
  2567 + value.amountHasOrderList[0].amount;
  2568 + showList.add(MenuModel.fromJson3(map));
2379 } 2569 }
2380 } 2570 }
2381 }); 2571 });
@@ -2385,7 +2575,7 @@ class _OrderEditListShowPageState extends State<OrderEditListShowPage> { @@ -2385,7 +2575,7 @@ class _OrderEditListShowPageState extends State<OrderEditListShowPage> {
2385 2575
2386 dataLocalShowOne.forEach((element) { 2576 dataLocalShowOne.forEach((element) {
2387 if (showList.length == 0) { 2577 if (showList.length == 0) {
2388 - showList.add(MenuModel.fromJson2(element.toJson())); 2578 + showList.add(MenuModel.fromJson3(element.toJson()));
2389 } else { 2579 } else {
2390 bool hasC = false; 2580 bool hasC = false;
2391 showList.forEach((show) { 2581 showList.forEach((show) {
@@ -2418,15 +2608,18 @@ class _OrderEditListShowPageState extends State<OrderEditListShowPage> { @@ -2418,15 +2608,18 @@ class _OrderEditListShowPageState extends State<OrderEditListShowPage> {
2418 .specModel.specid == 2608 .specModel.specid ==
2419 newcook.amountHasOrderList[0] 2609 newcook.amountHasOrderList[0]
2420 .specModel.specid) { 2610 .specModel.specid) {
2421 - if (oldshow.amount != newcook.amount) {  
2422 - has = true;  
2423 - oldshow.amountHasOrderList[0]  
2424 - .amount +=  
2425 - newcook  
2426 - .amountHasOrderList[0].amount;  
2427 - show.allSum += newcook  
2428 - .amountHasOrderList[0].amount;  
2429 - } 2611 + // if (oldshow
  2612 + // .amountHasOrderList[0].amount !=
  2613 + // newcook
  2614 + // .amountHasOrderList[0].amount) {
  2615 + has = true;
  2616 + oldshow.amount += newcook
  2617 + .amountHasOrderList[0].amount;
  2618 + oldshow.amountHasOrderList
  2619 + .addAll(newcook.amountHasOrderList);
  2620 + show.allSum += newcook
  2621 + .amountHasOrderList[0].amount;
  2622 + // }
2430 } 2623 }
2431 } else if (oldshow.amountHasOrderList[0] 2624 } else if (oldshow.amountHasOrderList[0]
2432 .practiceModel == 2625 .practiceModel ==
@@ -2438,17 +2631,18 @@ class _OrderEditListShowPageState extends State<OrderEditListShowPage> { @@ -2438,17 +2631,18 @@ class _OrderEditListShowPageState extends State<OrderEditListShowPage> {
2438 .specModel.specid == 2631 .specModel.specid ==
2439 newcook.amountHasOrderList[0] 2632 newcook.amountHasOrderList[0]
2440 .specModel.specid) { 2633 .specModel.specid) {
2441 - if (oldshow.amount !=  
2442 - newcook  
2443 - .amountHasOrderList[0].amount) {  
2444 - has = true;  
2445 - oldshow.amountHasOrderList[0]  
2446 - .amount +=  
2447 - newcook  
2448 - .amountHasOrderList[0].amount;  
2449 - show.allSum += newcook  
2450 - .amountHasOrderList[0].amount;  
2451 - } 2634 + // if (oldshow
  2635 + // .amountHasOrderList[0].amount !=
  2636 + // newcook
  2637 + // .amountHasOrderList[0].amount) {
  2638 + has = true;
  2639 + oldshow.amount += newcook
  2640 + .amountHasOrderList[0].amount;
  2641 + oldshow.amountHasOrderList
  2642 + .addAll(newcook.amountHasOrderList);
  2643 + show.allSum += newcook
  2644 + .amountHasOrderList[0].amount;
  2645 + // }
2452 } 2646 }
2453 } 2647 }
2454 } 2648 }
@@ -2461,7 +2655,7 @@ class _OrderEditListShowPageState extends State<OrderEditListShowPage> { @@ -2461,7 +2655,7 @@ class _OrderEditListShowPageState extends State<OrderEditListShowPage> {
2461 } 2655 }
2462 }); 2656 });
2463 if (!hasC) { 2657 if (!hasC) {
2464 - showList.add(MenuModel.fromJson2(element.toJson())); 2658 + showList.add(MenuModel.fromJson3(element.toJson()));
2465 } 2659 }
2466 } 2660 }
2467 }); 2661 });
@@ -2469,7 +2663,7 @@ class _OrderEditListShowPageState extends State<OrderEditListShowPage> { @@ -2469,7 +2663,7 @@ class _OrderEditListShowPageState extends State<OrderEditListShowPage> {
2469 // double memberPriceSum = 0; //会员价 2663 // double memberPriceSum = 0; //会员价
2470 // TextEditingController planDishC = 2664 // TextEditingController planDishC =
2471 // TextEditingController(); //排菜价 2665 // TextEditingController(); //排菜价
2472 - 2666 + print(showList);
2473 NavigatorUtil.goOrderPreviewPage(context, 2667 NavigatorUtil.goOrderPreviewPage(context,
2474 object: {'object': showList}, 2668 object: {'object': showList},
2475 name: planDishName.text, 2669 name: planDishName.text,
@@ -2517,16 +2711,34 @@ class _OrderEditListShowPageState extends State<OrderEditListShowPage> { @@ -2517,16 +2711,34 @@ class _OrderEditListShowPageState extends State<OrderEditListShowPage> {
2517 widget.datatemp.forEach((element) { 2711 widget.datatemp.forEach((element) {
2518 if (element.className == '套餐' || 2712 if (element.className == '套餐' ||
2519 element.className == '我的排菜') { 2713 element.className == '我的排菜') {
  2714 + element.cookbooklist.forEach((elementCook) {
  2715 + if (elementCook.amountHasOrderList.length > 0) {
  2716 + elementCook.amountHasOrderList[0].amount = 0;
  2717 + }
  2718 + });
2520 dataLocalShowMore.forEach((value) { 2719 dataLocalShowMore.forEach((value) {
2521 element.cookbooklist.forEach((elementCook) { 2720 element.cookbooklist.forEach((elementCook) {
  2721 + if (elementCook.amountHasOrderList.length >
  2722 + 0) {
  2723 + elementCook.amountHasOrderList[0].amount =
  2724 + 0;
  2725 + }
  2726 +
2522 if (value.id == elementCook.id) { 2727 if (value.id == elementCook.id) {
2523 //同一个套餐 2728 //同一个套餐
2524 // elementCook.cookList = value.cookList; 2729 // elementCook.cookList = value.cookList;
2525 - elementCook.amount = value.moreSum; 2730 + elementCook.amountHasOrderList[0].amount =
  2731 + value.moreSum;
2526 elementCook.cookList.forEach((oldValue) { 2732 elementCook.cookList.forEach((oldValue) {
2527 print(dataLocalShowMore); 2733 print(dataLocalShowMore);
2528 oldValue.cookbooklist.forEach((oldCook) { 2734 oldValue.cookbooklist.forEach((oldCook) {
2529 - oldCook.amount = 0; 2735 + // oldCook.amountHasOrderList[0].amount =
  2736 + // 0;
  2737 + // oldCook.amountHasOrderList
  2738 + // .forEach((elementoldCook) {
  2739 + // elementoldCook.amount = 0; //置空amount
  2740 + // });
  2741 + oldCook.amountHasOrderList = [];
2530 }); 2742 });
2531 print(dataLocalShowMore); 2743 print(dataLocalShowMore);
2532 value.cookList.forEach((newValue) { 2744 value.cookList.forEach((newValue) {
@@ -2542,8 +2754,143 @@ class _OrderEditListShowPageState extends State<OrderEditListShowPage> { @@ -2542,8 +2754,143 @@ class _OrderEditListShowPageState extends State<OrderEditListShowPage> {
2542 .forEach((newCook) { 2754 .forEach((newCook) {
2543 if (oldCook.id == newCook.id) { 2755 if (oldCook.id == newCook.id) {
2544 //同一个菜品 2756 //同一个菜品
2545 - oldCook.amount = newCook.amount; 2757 + oldCook.amountHasOrderList
  2758 + .addAll(newCook
  2759 + .amountHasOrderList);
  2760 + // oldCook.amountHasOrderList
  2761 + // .forEach((oldCookelement) {
  2762 + // if (oldCookelement
  2763 + // .practiceModel !=
  2764 + // null &&
  2765 + // newCook
  2766 + // .amountHasOrderList[
  2767 + // 0]
  2768 + // .practiceModel !=
  2769 + // null &&
  2770 + // oldCookelement
  2771 + // .specModel !=
  2772 + // null &&
  2773 + // newCook
  2774 + // .amountHasOrderList[
  2775 + // 0]
  2776 + // .specModel !=
  2777 + // null) {
  2778 + // if (oldCookelement
  2779 + // .practiceModel
  2780 + // .practice ==
  2781 + // newCook
  2782 + // .amountHasOrderList[
  2783 + // 0]
  2784 + // .practiceModel
  2785 + // .practice &&
  2786 + // oldCookelement.specModel
  2787 + // .specid ==
  2788 + // newCook
  2789 + // .amountHasOrderList[
  2790 + // 0]
  2791 + // .specModel
  2792 + // .specid) {
  2793 + // oldCookelement.amount =
  2794 + // newCook
  2795 + // .amountHasOrderList[
  2796 + // 0]
  2797 + // .amount;
  2798 + // }
  2799 + // } else if (oldCookelement
  2800 + // .practiceModel ==
  2801 + // null &&
  2802 + // oldCookelement
  2803 + // .specModel !=
  2804 + // null) {
  2805 + // if (oldCookelement
  2806 + // .specModel.specid ==
  2807 + // newCook
  2808 + // .amountHasOrderList[
  2809 + // 0]
  2810 + // .specModel
  2811 + // .specid) {
  2812 + // oldCookelement.amount =
  2813 + // newCook
  2814 + // .amountHasOrderList[
  2815 + // 0]
  2816 + // .amount;
  2817 + // }
  2818 + // }
  2819 + // });
  2820 + // }
  2821 +
2546 // carSumTemp += newCook.amount; 2822 // carSumTemp += newCook.amount;
  2823 + // if (oldCook.amountHasOrderList[0].practiceModel != null &&
  2824 + // newCook
  2825 + // .amountHasOrderList[
  2826 + // 0]
  2827 + // .practiceModel !=
  2828 + // null &&
  2829 + // oldCook
  2830 + // .amountHasOrderList[
  2831 + // 0]
  2832 + // .specModel !=
  2833 + // null &&
  2834 + // newCook
  2835 + // .amountHasOrderList[
  2836 + // 0]
  2837 + // .specModel !=
  2838 + // null) {
  2839 + // if (oldCook
  2840 + // .amountHasOrderList[
  2841 + // 0]
  2842 + // .practiceModel
  2843 + // .practice ==
  2844 + // newCook
  2845 + // .amountHasOrderList[
  2846 + // 0]
  2847 + // .practiceModel
  2848 + // .practice &&
  2849 + // oldCook
  2850 + // .amountHasOrderList[
  2851 + // 0]
  2852 + // .specModel
  2853 + // .specid ==
  2854 + // newCook
  2855 + // .amountHasOrderList[
  2856 + // 0]
  2857 + // .specModel
  2858 + // .specid) {
  2859 + // oldCook
  2860 + // .amountHasOrderList[0]
  2861 + // .amount =
  2862 + // newCook
  2863 + // .amountHasOrderList[
  2864 + // 0]
  2865 + // .amount;
  2866 + // }
  2867 + // } else if (oldCook
  2868 + // .amountHasOrderList[
  2869 + // 0]
  2870 + // .practiceModel ==
  2871 + // null &&
  2872 + // oldCook
  2873 + // .amountHasOrderList[
  2874 + // 0]
  2875 + // .specModel !=
  2876 + // null) {
  2877 + // if (oldCook
  2878 + // .amountHasOrderList[0]
  2879 + // .specModel
  2880 + // .specid ==
  2881 + // newCook
  2882 + // .amountHasOrderList[0]
  2883 + // .specModel
  2884 + // .specid) {
  2885 + // oldCook
  2886 + // .amountHasOrderList[0]
  2887 + // .amount =
  2888 + // newCook
  2889 + // .amountHasOrderList[
  2890 + // 0]
  2891 + // .amount;
  2892 + // }
  2893 + // }
2547 } 2894 }
2548 }); 2895 });
2549 }); 2896 });
@@ -2556,13 +2903,68 @@ class _OrderEditListShowPageState extends State<OrderEditListShowPage> { @@ -2556,13 +2903,68 @@ class _OrderEditListShowPageState extends State<OrderEditListShowPage> {
2556 } else { 2903 } else {
2557 //单品 2904 //单品
2558 print(dataLocalShowOne); 2905 print(dataLocalShowOne);
  2906 + element.cookbooklist.forEach((old) {
  2907 + // oldCook.amountHasOrderList[0].amount =
  2908 + // 0;
  2909 + old.amountHasOrderList = [];
  2910 + });
2559 dataLocalShowOne.forEach((one) { 2911 dataLocalShowOne.forEach((one) {
2560 if (element.id == one.id) { 2912 if (element.id == one.id) {
2561 //同一分类 2913 //同一分类
2562 element.cookbooklist.forEach((old) { 2914 element.cookbooklist.forEach((old) {
  2915 + // oldCook.amountHasOrderList[0].amount =
  2916 + // 0;
  2917 + old.amountHasOrderList = [];
  2918 +
2563 one.cookbooklist.forEach((newvalue) { 2919 one.cookbooklist.forEach((newvalue) {
2564 if (old.id == newvalue.id) { 2920 if (old.id == newvalue.id) {
2565 - old.amount = newvalue.amount; 2921 + //同一菜品
  2922 + old.amountHasOrderList.addAll(
  2923 + newvalue.amountHasOrderList);
  2924 + // newvalue.amountHasOrderList
  2925 + // .forEach((newelement) {
  2926 + // //
  2927 + // });
  2928 +
  2929 + // if (old.amountHasOrderList[0]
  2930 + // .practiceModel !=
  2931 + // null &&
  2932 + // newvalue.amountHasOrderList[0]
  2933 + // .practiceModel !=
  2934 + // null &&
  2935 + // old.amountHasOrderList[0]
  2936 + // .specModel !=
  2937 + // null &&
  2938 + // newvalue.amountHasOrderList[0]
  2939 + // .specModel !=
  2940 + // null) {
  2941 + // if (old.amountHasOrderList[0]
  2942 + // .practiceModel.practice ==
  2943 + // newvalue.amountHasOrderList[0]
  2944 + // .practiceModel.practice &&
  2945 + // old.amountHasOrderList[0]
  2946 + // .specModel.specid ==
  2947 + // newvalue.amountHasOrderList[0]
  2948 + // .specModel.specid) {
  2949 + // old.amountHasOrderList[0].amount =
  2950 + // newvalue.amountHasOrderList[0]
  2951 + // .amount;
  2952 + // }
  2953 + // } else if (old.amountHasOrderList[0]
  2954 + // .practiceModel ==
  2955 + // null &&
  2956 + // old.amountHasOrderList[0]
  2957 + // .specModel !=
  2958 + // null) {
  2959 + // if (old.amountHasOrderList[0]
  2960 + // .specModel.specid ==
  2961 + // newvalue.amountHasOrderList[0]
  2962 + // .specModel.specid) {
  2963 + // old.amountHasOrderList[0].amount =
  2964 + // newvalue.amountHasOrderList[0]
  2965 + // .amount;
  2966 + // }
  2967 + // }
2566 } 2968 }
2567 }); 2969 });
2568 }); 2970 });
@@ -2570,6 +2972,7 @@ class _OrderEditListShowPageState extends State<OrderEditListShowPage> { @@ -2570,6 +2972,7 @@ class _OrderEditListShowPageState extends State<OrderEditListShowPage> {
2570 }); 2972 });
2571 } 2973 }
2572 }); 2974 });
  2975 + print(widget.datatemp);
2573 bool success = 2976 bool success =
2574 await setPlanCookByReserve(widget.datatemp); 2977 await setPlanCookByReserve(widget.datatemp);
2575 if (success) { 2978 if (success) {
@@ -61,8 +61,16 @@ class _OrderPreviewPageState extends State<OrderPreviewPage> { @@ -61,8 +61,16 @@ class _OrderPreviewPageState extends State<OrderPreviewPage> {
61 void initState() { 61 void initState() {
62 super.initState(); 62 super.initState();
63 Utils.changeStatusColor(color: Colors.transparent); 63 Utils.changeStatusColor(color: Colors.transparent);
64 - recommendC.text =  
65 - '${widget.detailEntity.rnameStr ?? ''}:\n 根据您选择的菜品,我们推荐您参加以下活动,本次消费可用,预计可以享受大量优惠!'; 64 + String name = widget.detailEntity.rnameStr == null ||
  65 + widget.detailEntity.rnameStr == ''
  66 + ? ''
  67 + : '${widget.detailEntity.rnameStr ?? ''}:\n ';
  68 + recommendC.text = '${name}根据您选择的菜品,我们推荐您参加以下活动,本次消费可用,预计可以享受大量优惠!';
  69 + widget.showList.forEach((element) {
  70 + element.cookbooklist.forEach((cook) {
  71 + element.allsumPreviewShow += cook.amount;
  72 + });
  73 + });
66 WidgetsBinding.instance.addPostFrameCallback((_) { 74 WidgetsBinding.instance.addPostFrameCallback((_) {
67 _getNewRechargeList(); 75 _getNewRechargeList();
68 }); 76 });
@@ -89,7 +97,8 @@ class _OrderPreviewPageState extends State<OrderPreviewPage> { @@ -89,7 +97,8 @@ class _OrderPreviewPageState extends State<OrderPreviewPage> {
89 ? '预计可以节约${marketingCenterProvider.rechargeList[index].rechargeList.price}元!' 97 ? '预计可以节约${marketingCenterProvider.rechargeList[index].rechargeList.price}元!'
90 : '预计可以享受大量优惠!'; 98 : '预计可以享受大量优惠!';
91 99
92 - String name = widget.detailEntity.rnameStr != null 100 + String name = widget.detailEntity.rnameStr != null &&
  101 + widget.detailEntity.rnameStr != ''
93 ? '${widget.detailEntity.rnameStr}:\n' 102 ? '${widget.detailEntity.rnameStr}:\n'
94 : ''; 103 : '';
95 104
@@ -453,7 +462,7 @@ class _OrderPreviewPageState extends State<OrderPreviewPage> { @@ -453,7 +462,7 @@ class _OrderPreviewPageState extends State<OrderPreviewPage> {
453 .bold), 462 .bold),
454 ), 463 ),
455 Text( 464 Text(
456 - '${menuModel.allSum}道', 465 + '${menuModel.allsumPreviewShow}道',
457 style: TextStyle( 466 style: TextStyle(
458 fontSize: 467 fontSize:
459 font(14), 468 font(14),
@@ -536,7 +545,7 @@ class _OrderPreviewPageState extends State<OrderPreviewPage> { @@ -536,7 +545,7 @@ class _OrderPreviewPageState extends State<OrderPreviewPage> {
536 alignment: 545 alignment:
537 Alignment.centerRight, 546 Alignment.centerRight,
538 child: Text( 547 child: Text(
539 - '${menuSunModel.amountHasOrderList[0].amount}份', 548 + '${menuSunModel.amount}份',
540 style: TextStyle( 549 style: TextStyle(
541 fontSize: font(12), 550 fontSize: font(12),
542 color: MyColours 551 color: MyColours
@@ -66,6 +66,11 @@ class _OrderSharePageState extends State<OrderSharePage> { @@ -66,6 +66,11 @@ class _OrderSharePageState extends State<OrderSharePage> {
66 void initState() { 66 void initState() {
67 super.initState(); 67 super.initState();
68 Utils.changeStatusColor(color: Colors.transparent); 68 Utils.changeStatusColor(color: Colors.transparent);
  69 + widget.showList.forEach((element) {
  70 + element.cookbooklist.forEach((cook) {
  71 + element.allsumPreviewShow += cook.amount;
  72 + });
  73 + });
69 74
70 WidgetsBinding.instance.addPostFrameCallback((_) {}); 75 WidgetsBinding.instance.addPostFrameCallback((_) {});
71 } 76 }
@@ -400,7 +405,7 @@ class _OrderSharePageState extends State<OrderSharePage> { @@ -400,7 +405,7 @@ class _OrderSharePageState extends State<OrderSharePage> {
400 FontWeight.bold), 405 FontWeight.bold),
401 ), 406 ),
402 Text( 407 Text(
403 - '${menuModel.allSum}道', 408 + '${menuModel.allsumPreviewShow}道',
404 style: TextStyle( 409 style: TextStyle(
405 fontSize: font(14), 410 fontSize: font(14),
406 color: 411 color:
@@ -415,6 +420,12 @@ class _OrderSharePageState extends State<OrderSharePage> { @@ -415,6 +420,12 @@ class _OrderSharePageState extends State<OrderSharePage> {
415 int indexReal = index - 1; 420 int indexReal = index - 1;
416 MenuSunModel menuSunModel = 421 MenuSunModel menuSunModel =
417 menuModel.cookbooklist[indexReal]; 422 menuModel.cookbooklist[indexReal];
  423 + String practice = menuSunModel
  424 + .amountHasOrderList[0]
  425 + .practiceModel ==
  426 + null
  427 + ? ''
  428 + : '(${menuSunModel.amountHasOrderList[0].practiceModel.name})';
418 return Container( 429 return Container(
419 padding: EdgeInsets.symmetric( 430 padding: EdgeInsets.symmetric(
420 horizontal: w(20), vertical: w(13)), 431 horizontal: w(20), vertical: w(13)),
@@ -431,7 +442,7 @@ class _OrderSharePageState extends State<OrderSharePage> { @@ -431,7 +442,7 @@ class _OrderSharePageState extends State<OrderSharePage> {
431 // maxWidth: w(80)), 442 // maxWidth: w(80)),
432 Expanded( 443 Expanded(
433 child: Text( 444 child: Text(
434 - menuSunModel.name, 445 + '${menuSunModel.name}${practice}',
435 maxLines: 10, 446 maxLines: 10,
436 overflow: TextOverflow.ellipsis, 447 overflow: TextOverflow.ellipsis,
437 style: TextStyle( 448 style: TextStyle(
@@ -442,7 +453,11 @@ class _OrderSharePageState extends State<OrderSharePage> { @@ -442,7 +453,11 @@ class _OrderSharePageState extends State<OrderSharePage> {
442 // _laduWidget(), 453 // _laduWidget(),
443 Spacer(), 454 Spacer(),
444 Text( 455 Text(
445 - '${menuSunModel.price}元/${menuSunModel.unit}', 456 + menuSunModel.amountHasOrderList[0]
  457 + .specModel ==
  458 + null
  459 + ? '${menuSunModel.price}元/${menuSunModel.unit}'
  460 + : '${menuSunModel.amountHasOrderList[0].specModel.price}元/${menuSunModel.amountHasOrderList[0].specModel.specs}',
446 maxLines: 2, 461 maxLines: 2,
447 overflow: TextOverflow.ellipsis, 462 overflow: TextOverflow.ellipsis,
448 style: TextStyle( 463 style: TextStyle(
@@ -8,6 +8,7 @@ import 'package:one_key/models/plan_cook_list_model.dart'; @@ -8,6 +8,7 @@ import 'package:one_key/models/plan_cook_list_model.dart';
8 import 'package:one_key/net/base_resp.dart'; 8 import 'package:one_key/net/base_resp.dart';
9 import 'package:one_key/net/dio_util.dart'; 9 import 'package:one_key/net/dio_util.dart';
10 import 'package:one_key/utils/utils.dart'; 10 import 'package:one_key/utils/utils.dart';
  11 +import 'package:one_key/widgets/loading.dart';
11 12
12 import '../constant/constant.dart'; 13 import '../constant/constant.dart';
13 import '../constant/error.dart'; 14 import '../constant/error.dart';
@@ -28,6 +29,7 @@ class PlanDishProvider extends ChangeNotifier { @@ -28,6 +29,7 @@ class PlanDishProvider extends ChangeNotifier {
28 PageState pageStateMenu = PageState.Loading; 29 PageState pageStateMenu = PageState.Loading;
29 30
30 List<MenuModel> menuModel; //菜品数据 31 List<MenuModel> menuModel; //菜品数据
  32 + List<MenuModel> menuModelOld; //菜品数据
31 List<MenuModel> menuModelForManager = []; //经理点菜菜品数据 33 List<MenuModel> menuModelForManager = []; //经理点菜菜品数据
32 34
33 List<SunListPlan> allList = []; //排菜套餐列表--全部 35 List<SunListPlan> allList = []; //排菜套餐列表--全部
@@ -48,11 +50,11 @@ class PlanDishProvider extends ChangeNotifier { @@ -48,11 +50,11 @@ class PlanDishProvider extends ChangeNotifier {
48 ///分类下所有菜品列表(1.传orderid顾客端获取带订单信息的 否则不传 50 ///分类下所有菜品列表(1.传orderid顾客端获取带订单信息的 否则不传
49 51
50 getCookbookByClass(BuildContext context, Map<String, String> params, 52 getCookbookByClass(BuildContext context, Map<String, String> params,
51 - {showLoading = false}) async { 53 + {showLoading = false,selfDismiss= false}) async {
52 BaseResp<dynamic> baseResp = await DioUtil() 54 BaseResp<dynamic> baseResp = await DioUtil()
53 .request<dynamic>(context, Method.get, HttpUrl.get_cookbook_by_class, 55 .request<dynamic>(context, Method.get, HttpUrl.get_cookbook_by_class,
54 data: params, 56 data: params,
55 - showLoading: pageState == PageState.Loading ? false : showLoading) 57 + showLoading: pageState == PageState.Loading ? false : showLoading,selfDismiss: selfDismiss)
56 .catchError((error) { 58 .catchError((error) {
57 print(error.toString()); 59 print(error.toString());
58 if (error is MyError) { 60 if (error is MyError) {
@@ -72,6 +74,7 @@ class PlanDishProvider extends ChangeNotifier { @@ -72,6 +74,7 @@ class PlanDishProvider extends ChangeNotifier {
72 return false; 74 return false;
73 }); 75 });
74 menuModel = []; 76 menuModel = [];
  77 + menuModelOld = [];
75 78
76 if (baseResp != null && baseResp.code == Constant.status_success) { 79 if (baseResp != null && baseResp.code == Constant.status_success) {
77 if (baseResp.data[0]['list'] == '') { 80 if (baseResp.data[0]['list'] == '') {
@@ -80,6 +83,7 @@ class PlanDishProvider extends ChangeNotifier { @@ -80,6 +83,7 @@ class PlanDishProvider extends ChangeNotifier {
80 List menu = baseResp.data[0]['list']; 83 List menu = baseResp.data[0]['list'];
81 for (int i = 0; i < menu.length; i++) { 84 for (int i = 0; i < menu.length; i++) {
82 menuModel.add(MenuModel.fromJson(menu[i])); 85 menuModel.add(MenuModel.fromJson(menu[i]));
  86 + menuModelOld.add(MenuModel.fromJson(menu[i]));
83 } 87 }
84 print(menuModel); 88 print(menuModel);
85 pageState = PageState.Success; 89 pageState = PageState.Success;
@@ -136,10 +140,10 @@ class PlanDishProvider extends ChangeNotifier { @@ -136,10 +140,10 @@ class PlanDishProvider extends ChangeNotifier {
136 140
137 /// 根据预定ID获取排菜 141 /// 根据预定ID获取排菜
138 getPlanCookByRid(BuildContext context, Map<String, String> params, 142 getPlanCookByRid(BuildContext context, Map<String, String> params,
139 - {showLoading = false}) async { 143 + {showLoading = false, selfDismiss = false}) async {
140 BaseResp<dynamic> baseResp = await DioUtil() 144 BaseResp<dynamic> baseResp = await DioUtil()
141 .request<dynamic>(context, Method.get, HttpUrl.get_plan_cook_by_rid, 145 .request<dynamic>(context, Method.get, HttpUrl.get_plan_cook_by_rid,
142 - data: params, showLoading: showLoading) 146 + data: params, showLoading: showLoading, selfDismiss: selfDismiss)
143 .catchError((error) { 147 .catchError((error) {
144 print(error.toString()); 148 print(error.toString());
145 // if (error is MyError) { 149 // if (error is MyError) {
@@ -156,6 +160,7 @@ class PlanDishProvider extends ChangeNotifier { @@ -156,6 +160,7 @@ class PlanDishProvider extends ChangeNotifier {
156 // } 160 // }
157 // } 161 // }
158 // notifyListeners(); 162 // notifyListeners();
  163 +
159 return false; 164 return false;
160 }); 165 });
161 // menuModel = []; 166 // menuModel = [];
@@ -195,10 +200,12 @@ class PlanDishProvider extends ChangeNotifier { @@ -195,10 +200,12 @@ class PlanDishProvider extends ChangeNotifier {
195 200
196 Future<bool> setPlanCook(BuildContext context, Map<String, String> params, 201 Future<bool> setPlanCook(BuildContext context, Map<String, String> params,
197 {showLoading = false}) async { 202 {showLoading = false}) async {
  203 + Loading.showLoading(context);
198 FormData formData = FormData.fromMap(params); 204 FormData formData = FormData.fromMap(params);
199 Response response = await DioUtil.getInstance().getDio().post( 205 Response response = await DioUtil.getInstance().getDio().post(
200 - 'http://xt04.colorcun.com/?service=App.PlanCook.SetPlanCook', 206 + 'http://xt04.colorcun.com/${HttpUrl.set_plan_cook}',
201 data: formData); 207 data: formData);
  208 + Loading.hideLoading(context);
202 209
203 print(response); 210 print(response);
204 if (response.data != null && 211 if (response.data != null &&
@@ -229,28 +236,39 @@ class PlanDishProvider extends ChangeNotifier { @@ -229,28 +236,39 @@ class PlanDishProvider extends ChangeNotifier {
229 Future<bool> setPlanCookByReserve( 236 Future<bool> setPlanCookByReserve(
230 BuildContext context, Map<String, String> params, 237 BuildContext context, Map<String, String> params,
231 {showLoading = false}) async { 238 {showLoading = false}) async {
232 - BaseResp<dynamic> baseResp = await DioUtil()  
233 - .request<dynamic>(context, Method.get, HttpUrl.set_plan_cook_by_reserve,  
234 - data: params, showLoading: showLoading)  
235 - .catchError((error) {  
236 - print(error.toString());  
237 - if (error is MyError) {}  
238 - // return false;  
239 - }); 239 + Loading.showLoading(context);
  240 + FormData formData = FormData.fromMap(params);
  241 + Response response = await DioUtil.getInstance().getDio().post(
  242 + 'http://xt04.colorcun.com/${HttpUrl.set_plan_cook_by_reserve}',
  243 + data: formData);
  244 + Loading.hideLoading(context);
240 245
241 - if (baseResp != null && baseResp.code == Constant.status_success) {  
242 - if (baseResp.data == 1) { 246 + print(response);
  247 + if (response.data != null &&
  248 + response.data['ret'] == Constant.status_success) {
  249 + // BaseResp<dynamic> baseResp = await DioUtil()
  250 + // .request<dynamic>(context, Method.get, HttpUrl.set_plan_cook_by_reserve,
  251 + // data: params, showLoading: showLoading)
  252 + // .catchError((error) {
  253 + // print(error.toString());
  254 + // if (error is MyError) {}
  255 + // // return false;
  256 + // });
  257 +
  258 + // if (baseResp != null && baseResp.code == Constant.status_success) {
  259 + if (response.data['data'] == 1) {
243 return true; 260 return true;
244 } 261 }
245 - if (baseResp.data['id'] != null && baseResp.data['id'] != '') {  
246 - planId = baseResp.data['id']; 262 + if (response.data['data']['id'] != null &&
  263 + response.data['data']['id'] != '') {
  264 + planId = response.data['data']['id'];
247 return true; 265 return true;
248 } 266 }
249 } else { 267 } else {
250 - if (baseResp == null) { 268 + if (response.data == null) {
251 Utils.showToast("提交失败,请重试"); 269 Utils.showToast("提交失败,请重试");
252 } else { 270 } else {
253 - Utils.showToast(baseResp.msg ?? ""); 271 + Utils.showToast(response.data['msg'] ?? "");
254 } 272 }
255 273
256 return false; 274 return false;
@@ -281,7 +299,7 @@ class PlanDishProvider extends ChangeNotifier { @@ -281,7 +299,7 @@ class PlanDishProvider extends ChangeNotifier {
281 ///排菜/套餐列表 299 ///排菜/套餐列表
282 300
283 Future<bool> getPlanCookList(BuildContext context, Map<String, String> params, 301 Future<bool> getPlanCookList(BuildContext context, Map<String, String> params,
284 - {showLoading = false}) async { 302 + {showLoading = false,selfDismiss = false}) async {
285 BaseResp<dynamic> baseResp = await DioUtil() 303 BaseResp<dynamic> baseResp = await DioUtil()
286 .request<dynamic>(context, Method.get, HttpUrl.get_plan_cook_list, 304 .request<dynamic>(context, Method.get, HttpUrl.get_plan_cook_list,
287 data: params, 305 data: params,
@@ -289,7 +307,7 @@ class PlanDishProvider extends ChangeNotifier { @@ -289,7 +307,7 @@ class PlanDishProvider extends ChangeNotifier {
289 pageStateHome == PageState.Loading || 307 pageStateHome == PageState.Loading ||
290 pageStateMine == PageState.Loading 308 pageStateMine == PageState.Loading
291 ? false 309 ? false
292 - : showLoading) 310 + : showLoading,selfDismiss:selfDismiss)
293 .catchError((error) { 311 .catchError((error) {
294 print(error.toString()); 312 print(error.toString());
295 if (error is MyError) {} 313 if (error is MyError) {}
@@ -2092,7 +2092,7 @@ var orderPreviewPageHandle = new Handler( @@ -2092,7 +2092,7 @@ var orderPreviewPageHandle = new Handler(
2092 // MenuModel menuModel = MenuModel.fromJson2(item); 2092 // MenuModel menuModel = MenuModel.fromJson2(item);
2093 // res.add(menuModel); 2093 // res.add(menuModel);
2094 // print(res); 2094 // print(res);
2095 - res.add(MenuModel.fromJson2(item)); 2095 + res.add(MenuModel.fromJson5(item));
2096 } 2096 }
2097 } 2097 }
2098 String priceSum = params["priceSum"].first; 2098 String priceSum = params["priceSum"].first;
@@ -1224,7 +1224,8 @@ class Utils { @@ -1224,7 +1224,8 @@ class Utils {
1224 // String _thumbnail = sellerImage == null || sellerImage == '' 1224 // String _thumbnail = sellerImage == null || sellerImage == ''
1225 // ? 'http://nosqn.colorcun.com/reserve/images/3x/%E6%9A%82%E6%97%A0.png' 1225 // ? 'http://nosqn.colorcun.com/reserve/images/3x/%E6%9A%82%E6%97%A0.png'
1226 // : sellerImage; 1226 // : sellerImage;
1227 - String _thumbnail = 'https://nosqn.colorcun.com/share_advanced_order.png'; 1227 + String _thumbnail =
  1228 + 'https://nosqn.colorcun.com/share_advanced_order_new.png';
1228 String _title = title; 1229 String _title = title;
1229 String _userName = "gh_487873d353b3"; 1230 String _userName = "gh_487873d353b3";
1230 // String _path = "pack-cookbook/pages/index?rid=$rid&identity=2&sid=$sid"; 1231 // String _path = "pack-cookbook/pages/index?rid=$rid&identity=2&sid=$sid";
@@ -1234,8 +1235,8 @@ class Utils { @@ -1234,8 +1235,8 @@ class Utils {
1234 String _description = "OneKey"; 1235 String _description = "OneKey";
1235 // Uint8List source = await testComporessList(context, _thumbnail); 1236 // Uint8List source = await testComporessList(context, _thumbnail);
1236 var model = new WeChatShareMiniProgramModel( 1237 var model = new WeChatShareMiniProgramModel(
1237 - miniProgramType: WXMiniProgramType.PREVIEW, //体验版  
1238 - // miniProgramType: WXMiniProgramType.RELEASE, //正式版 1238 + // miniProgramType: WXMiniProgramType.PREVIEW, //体验版
  1239 + miniProgramType: WXMiniProgramType.RELEASE, //正式版
1239 // miniProgramType: WXMiniProgramType.TEST //开发版 1240 // miniProgramType: WXMiniProgramType.TEST //开发版
1240 webPageUrl: _webPageUrl, 1241 webPageUrl: _webPageUrl,
1241 userName: _userName, 1242 userName: _userName,
@@ -1263,7 +1264,8 @@ class Utils { @@ -1263,7 +1264,8 @@ class Utils {
1263 // String _thumbnail = sellerImage == null || sellerImage == '' 1264 // String _thumbnail = sellerImage == null || sellerImage == ''
1264 // ? 'http://nosqn.colorcun.com/reserve/images/3x/%E6%9A%82%E6%97%A0.png' 1265 // ? 'http://nosqn.colorcun.com/reserve/images/3x/%E6%9A%82%E6%97%A0.png'
1265 // : sellerImage; 1266 // : sellerImage;
1266 - String _thumbnail = 'https://nosqn.colorcun.com/share_advanced_order.png'; 1267 + String _thumbnail =
  1268 + 'https://nosqn.colorcun.com/share_advanced_order_new.png';
1267 1269
1268 String _title = title; 1270 String _title = title;
1269 String _userName = "gh_487873d353b3"; 1271 String _userName = "gh_487873d353b3";
@@ -1274,7 +1276,7 @@ class Utils { @@ -1274,7 +1276,7 @@ class Utils {
1274 String _description = "OneKey"; 1276 String _description = "OneKey";
1275 // Uint8List source = await testComporessList(context, _thumbnail); 1277 // Uint8List source = await testComporessList(context, _thumbnail);
1276 var model = new WeChatShareMiniProgramModel( 1278 var model = new WeChatShareMiniProgramModel(
1277 - miniProgramType: WXMiniProgramType.PREVIEW, //体验版 1279 + miniProgramType: WXMiniProgramType.RELEASE,
1278 webPageUrl: _webPageUrl, 1280 webPageUrl: _webPageUrl,
1279 userName: _userName, 1281 userName: _userName,
1280 title: _title, 1282 title: _title,
@@ -1603,8 +1605,8 @@ class Utils { @@ -1603,8 +1605,8 @@ class Utils {
1603 title: _title, 1605 title: _title,
1604 path: _path, 1606 path: _path,
1605 description: _description, 1607 description: _description,
1606 - miniProgramType: WXMiniProgramType.PREVIEW, //体验版  
1607 - // miniProgramType: WXMiniProgramType.RELEASE, //正式版 1608 + // miniProgramType: WXMiniProgramType.PREVIEW, //体验版
  1609 + miniProgramType: WXMiniProgramType.RELEASE, //正式版
1608 // miniProgramType: WXMiniProgramType.TEST //开发版 1610 // miniProgramType: WXMiniProgramType.TEST //开发版
1609 // thumbnail: WeChatImage.binary(source) 1611 // thumbnail: WeChatImage.binary(source)
1610 thumbnail: WeChatImage.network(_thumbnail) 1612 thumbnail: WeChatImage.network(_thumbnail)
@@ -1687,8 +1689,8 @@ class Utils { @@ -1687,8 +1689,8 @@ class Utils {
1687 title: 'ff', 1689 title: 'ff',
1688 path: _path, 1690 path: _path,
1689 description: 'hhh', 1691 description: 'hhh',
1690 - miniProgramType: WXMiniProgramType.PREVIEW, //体验版  
1691 - // miniProgramType: WXMiniProgramType.RELEASE //正式版 1692 + // miniProgramType: WXMiniProgramType.PREVIEW, //体验版
  1693 + miniProgramType: WXMiniProgramType.RELEASE, //正式版
1692 // miniProgramType: WXMiniProgramType.TEST //开发版 1694 // miniProgramType: WXMiniProgramType.TEST //开发版
1693 // thumbnail: WeChatImage.binary(source) 1695 // thumbnail: WeChatImage.binary(source)
1694 thumbnail: WeChatImage.network(_thumbnail), 1696 thumbnail: WeChatImage.network(_thumbnail),
@@ -1742,8 +1744,8 @@ class Utils { @@ -1742,8 +1744,8 @@ class Utils {
1742 title: _title, 1744 title: _title,
1743 path: _path, 1745 path: _path,
1744 description: _description, 1746 description: _description,
1745 - miniProgramType: WXMiniProgramType.PREVIEW, //体验版  
1746 - // miniProgramType: WXMiniProgramType.RELEASE //正式版 1747 + // miniProgramType: WXMiniProgramType.PREVIEW, //体验版
  1748 + miniProgramType: WXMiniProgramType.RELEASE, //正式版
1747 // miniProgramType: WXMiniProgramType.TEST //开发版 1749 // miniProgramType: WXMiniProgramType.TEST //开发版
1748 // thumbnail: WeChatImage.binary(source) 1750 // thumbnail: WeChatImage.binary(source)
1749 thumbnail: WeChatImage.network(_thumbnail) 1751 thumbnail: WeChatImage.network(_thumbnail)
@@ -1796,8 +1798,8 @@ class Utils { @@ -1796,8 +1798,8 @@ class Utils {
1796 title: _title, 1798 title: _title,
1797 path: _path, 1799 path: _path,
1798 description: _description, 1800 description: _description,
1799 - miniProgramType: WXMiniProgramType.PREVIEW, //体验版  
1800 - // miniProgramType: WXMiniProgramType.RELEASE //正式版 1801 + // miniProgramType: WXMiniProgramType.PREVIEW, //体验版
  1802 + miniProgramType: WXMiniProgramType.RELEASE, //正式版
1801 // miniProgramType: WXMiniProgramType.TEST //开发版 1803 // miniProgramType: WXMiniProgramType.TEST //开发版
1802 // thumbnail: WeChatImage.binary(source) 1804 // thumbnail: WeChatImage.binary(source)
1803 thumbnail: WeChatImage.network(_thumbnail) 1805 thumbnail: WeChatImage.network(_thumbnail)