Commit fb5a1aaf5c91d44c7e267ce421e764c08d576a81

Authored by wdn127929
1 parent 72089486

列表数据

@@ -105,9 +105,9 @@ class MenuSunModel { @@ -105,9 +105,9 @@ class MenuSunModel {
105 String desc; 105 String desc;
106 String order_o; 106 String order_o;
107 String cdate; 107 String cdate;
108 - List spec; 108 + List<SpecModel> spec;
109 int isSpec; 109 int isSpec;
110 - List practice; 110 + List<PracticeModel> practice;
111 List<MenuModel> cookList; 111 List<MenuModel> cookList;
112 112
113 int amount; //菜品数量 113 int amount; //菜品数量
@@ -120,6 +120,10 @@ class MenuSunModel { @@ -120,6 +120,10 @@ class MenuSunModel {
120 int sort; 120 int sort;
121 int indexNew; 121 int indexNew;
122 122
  123 + String taste;
  124 + String cooks;
  125 + String cookStyle;
  126 +
123 //名称样式选择数组 127 //名称样式选择数组
124 List<RadioModel> get nameTypeList { 128 List<RadioModel> get nameTypeList {
125 RadioModel radioModel1 = RadioModel(); 129 RadioModel radioModel1 = RadioModel();
@@ -198,7 +202,10 @@ class MenuSunModel { @@ -198,7 +202,10 @@ class MenuSunModel {
198 this.amountC, 202 this.amountC,
199 this.nameType, 203 this.nameType,
200 this.imageType, 204 this.imageType,
201 - this.sort}); 205 + this.sort,
  206 + this.taste,
  207 + this.cooks,
  208 + this.cookStyle});
202 209
203 MenuSunModel.fromJson(Map<String, dynamic> json) { 210 MenuSunModel.fromJson(Map<String, dynamic> json) {
204 id = json['id']; 211 id = json['id'];
@@ -224,9 +231,28 @@ class MenuSunModel { @@ -224,9 +231,28 @@ class MenuSunModel {
224 desc = json['desc']; 231 desc = json['desc'];
225 order_o = json['order_o']; 232 order_o = json['order_o'];
226 cdate = json['cdate']; 233 cdate = json['cdate'];
227 - spec = json['spec']; 234 + // spec = json['spec'];
  235 + if (json['spec'] != null) {
  236 + spec = [];
  237 + json['spec'].forEach((v) {
  238 + spec.add(new SpecModel.fromJson(v));
  239 + });
  240 + }
228 isSpec = json['isSpec']; 241 isSpec = json['isSpec'];
229 - practice = json['practice']; 242 + // practice = json['practice'];
  243 + if (json['practice'] != null) {
  244 + practice = [];
  245 + // if (json['practice'].length > 0 && json['practice'][0] is String) {
  246 + // } else {
  247 + json['practice'].forEach((v) {
  248 + if (v is Map) {
  249 + practice.add(new PracticeModel.fromJson(v));
  250 + } else if (v is PracticeModel) {
  251 + practice.add(v);
  252 + }
  253 + });
  254 + // }
  255 + }
230 amount = 0; 256 amount = 0;
231 amountC.text = '0'; 257 amountC.text = '0';
232 if (json['cookList'] != null) { 258 if (json['cookList'] != null) {
@@ -241,6 +267,10 @@ class MenuSunModel { @@ -241,6 +267,10 @@ class MenuSunModel {
241 nameType = '1'; 267 nameType = '1';
242 268
243 sort = json['sort']; 269 sort = json['sort'];
  270 +
  271 + taste = json['taste'];
  272 + cooks = json['cooks'];
  273 + cookStyle = json['cook_style'];
244 } 274 }
245 275
246 MenuSunModel.fromJson3(Map<String, dynamic> json) { 276 MenuSunModel.fromJson3(Map<String, dynamic> json) {
@@ -267,9 +297,27 @@ class MenuSunModel { @@ -267,9 +297,27 @@ class MenuSunModel {
267 desc = json['desc']; 297 desc = json['desc'];
268 order_o = json['order_o']; 298 order_o = json['order_o'];
269 cdate = json['cdate']; 299 cdate = json['cdate'];
270 - spec = json['spec']; 300 + if (json['spec'] != null) {
  301 + spec = [];
  302 + json['spec'].forEach((v) {
  303 + spec.add(new SpecModel.fromJson(v));
  304 + });
  305 + }
271 isSpec = json['isSpec']; 306 isSpec = json['isSpec'];
272 - practice = json['practice']; 307 + // practice = json['practice'];
  308 + if (json['practice'] != null) {
  309 + practice = [];
  310 + // if (json['practice'].length > 0 && json['practice'][0] is String) {
  311 + // } else {
  312 + json['practice'].forEach((v) {
  313 + if (v is Map) {
  314 + practice.add(new PracticeModel.fromJson(v));
  315 + } else if (v is PracticeModel) {
  316 + practice.add(v);
  317 + }
  318 + });
  319 + // }
  320 + }
273 amount = 0; 321 amount = 0;
274 amountC.text = '0'; 322 amountC.text = '0';
275 if (json['cookList'] != null) { 323 if (json['cookList'] != null) {
@@ -278,6 +326,9 @@ class MenuSunModel { @@ -278,6 +326,9 @@ class MenuSunModel {
278 cookList.add(v); 326 cookList.add(v);
279 }); 327 });
280 } 328 }
  329 + taste = json['taste'];
  330 + cooks = json['cooks'];
  331 + cookStyle = json['cook_style'];
281 } 332 }
282 333
283 MenuSunModel.fromJson2(Map<String, dynamic> json) { 334 MenuSunModel.fromJson2(Map<String, dynamic> json) {
@@ -304,9 +355,27 @@ class MenuSunModel { @@ -304,9 +355,27 @@ class MenuSunModel {
304 desc = json['desc']; 355 desc = json['desc'];
305 order_o = json['order_o']; 356 order_o = json['order_o'];
306 cdate = json['cdate']; 357 cdate = json['cdate'];
307 - spec = json['spec']; 358 + if (json['spec'] != null) {
  359 + spec = [];
  360 + json['spec'].forEach((v) {
  361 + spec.add(new SpecModel.fromJson(v));
  362 + });
  363 + }
308 isSpec = json['isSpec']; 364 isSpec = json['isSpec'];
309 - practice = json['practice']; 365 + // practice = json['practice'];
  366 + if (json['practice'] != null) {
  367 + practice = [];
  368 + // if (json['practice'].length > 0 && json['practice'][0] is String) {
  369 + // } else {
  370 + json['practice'].forEach((v) {
  371 + if (v is Map) {
  372 + practice.add(new PracticeModel.fromJson(v));
  373 + } else if (v is PracticeModel) {
  374 + practice.add(v);
  375 + }
  376 + });
  377 + // }
  378 + }
310 amount = json['amount'] ?? 0; 379 amount = json['amount'] ?? 0;
311 amountC.text = amount.toString(); 380 amountC.text = amount.toString();
312 if (json['cookList'] != null) { 381 if (json['cookList'] != null) {
@@ -315,6 +384,9 @@ class MenuSunModel { @@ -315,6 +384,9 @@ class MenuSunModel {
315 cookList.add(new MenuModel.fromJson2(v)); 384 cookList.add(new MenuModel.fromJson2(v));
316 }); 385 });
317 } 386 }
  387 + taste = json['taste'];
  388 + cooks = json['cooks'];
  389 + cookStyle = json['cook_style'];
318 } 390 }
319 391
320 Map<String, dynamic> toJson() { 392 Map<String, dynamic> toJson() {
@@ -349,6 +421,93 @@ class MenuSunModel { @@ -349,6 +421,93 @@ class MenuSunModel {
349 data['amount'] = this.amount; 421 data['amount'] = this.amount;
350 data['cookList'] = this.cookList; 422 data['cookList'] = this.cookList;
351 data['sort'] = this.sort; 423 data['sort'] = this.sort;
  424 +
  425 + data['taste'] = this.taste;
  426 + data['cooks'] = this.cooks;
  427 + data['cook_style'] = this.cookStyle;
  428 +
  429 + return data;
  430 + }
  431 +}
  432 +
  433 +class SpecModel {
  434 + String id;
  435 + String cid;
  436 + String specid;
  437 + String specs;
  438 + String price;
  439 + String memberPrice;
  440 + Null clearNum;
  441 + String status;
  442 +
  443 + SpecModel(
  444 + {this.id,
  445 + this.cid,
  446 + this.specid,
  447 + this.specs,
  448 + this.price,
  449 + this.memberPrice,
  450 + this.clearNum,
  451 + this.status});
  452 +
  453 + SpecModel.fromJson(Map<String, dynamic> json) {
  454 + id = json['id'];
  455 + cid = json['cid'];
  456 + specid = json['specid'];
  457 + specs = json['specs'];
  458 + price = json['price'];
  459 + memberPrice = json['member_price'];
  460 + clearNum = json['clear_num'];
  461 + status = json['status'];
  462 + }
  463 +
  464 + Map<String, dynamic> toJson() {
  465 + final Map<String, dynamic> data = new Map<String, dynamic>();
  466 + data['id'] = this.id;
  467 + data['cid'] = this.cid;
  468 + data['specid'] = this.specid;
  469 + data['specs'] = this.specs;
  470 + data['price'] = this.price;
  471 + data['member_price'] = this.memberPrice;
  472 + data['clear_num'] = this.clearNum;
  473 + data['status'] = this.status;
  474 + return data;
  475 + }
  476 +}
  477 +
  478 +class PracticeModel {
  479 + String id;
  480 + String cid;
  481 + String practice;
  482 + String name;
  483 + String price;
  484 + String memberPrice;
  485 +
  486 + PracticeModel(
  487 + {this.id,
  488 + this.cid,
  489 + this.practice,
  490 + this.name,
  491 + this.price,
  492 + this.memberPrice});
  493 +
  494 + PracticeModel.fromJson(Map<String, dynamic> json) {
  495 + id = json['id'];
  496 + cid = json['cid'];
  497 + practice = json['practice'];
  498 + name = json['name'];
  499 + price = json['price'];
  500 + memberPrice = json['member_price'];
  501 + }
  502 +
  503 + Map<String, dynamic> toJson() {
  504 + final Map<String, dynamic> data = new Map<String, dynamic>();
  505 + data['id'] = this.id;
  506 + data['cid'] = this.cid;
  507 + data['practice'] = this.practice;
  508 + data['name'] = this.name;
  509 + data['price'] = this.price;
  510 + data['member_price'] = this.memberPrice;
352 return data; 511 return data;
353 } 512 }
354 } 513 }
1 import 'package:json_annotation/json_annotation.dart'; 1 import 'package:json_annotation/json_annotation.dart';
  2 +import 'package:one_key/models/cookbook_model.dart';
2 3
3 part 'cookbook_one_model.g.dart'; 4 part 'cookbook_one_model.g.dart';
4 5
@@ -91,14 +92,26 @@ class CookbookOneSunModel extends Object { @@ -91,14 +92,26 @@ class CookbookOneSunModel extends Object {
91 List<dynamic> attr; 92 List<dynamic> attr;
92 93
93 @JsonKey(name: 'spec') 94 @JsonKey(name: 'spec')
94 - List<dynamic> spec; 95 + List<SpecModel> spec;
95 96
96 @JsonKey(name: 'practice') 97 @JsonKey(name: 'practice')
97 - List<dynamic> practice; 98 + List<PracticeModel> practice;
98 99
99 // @JsonKey(name: 'template') 100 // @JsonKey(name: 'template')
100 // Template template; 101 // Template template;
101 102
  103 + @JsonKey(name: 'taste')
  104 + String taste;
  105 +
  106 + @JsonKey(name: 'cooks')
  107 + String cooks;
  108 +
  109 + @JsonKey(name: 'cook_style')
  110 + String cookStyle;
  111 +
  112 + @JsonKey(name: 'desc')
  113 + String desc;
  114 +
102 CookbookOneSunModel( 115 CookbookOneSunModel(
103 this.id, 116 this.id,
104 this.sellerid, 117 this.sellerid,
@@ -118,6 +131,10 @@ class CookbookOneSunModel extends Object { @@ -118,6 +131,10 @@ class CookbookOneSunModel extends Object {
118 this.attr, 131 this.attr,
119 this.spec, 132 this.spec,
120 this.practice, 133 this.practice,
  134 + this.taste,
  135 + this.cooks,
  136 + this.cookStyle,
  137 + this.desc
121 // this.template, 138 // this.template,
122 ); 139 );
123 140
@@ -53,13 +53,19 @@ CookbookOneSunModel _$CookbookOneSunModelFromJson(Map<String, dynamic> json) { @@ -53,13 +53,19 @@ CookbookOneSunModel _$CookbookOneSunModelFromJson(Map<String, dynamic> json) {
53 json['class_name'] as String, 53 json['class_name'] as String,
54 json['class_order'] as String, 54 json['class_order'] as String,
55 json['attr'] as List, 55 json['attr'] as List,
56 - json['spec'] as List,  
57 - json['practice'] as List,  
58 - // json['template'] == null  
59 - // ? null  
60 - // : (json['template'] is Map)  
61 - // ? Template.fromJson(json['template'] as Map<String, dynamic>)  
62 - // : '', 56 + (json['spec'] as List)
  57 + ?.map((e) =>
  58 + e == null ? null : SpecModel.fromJson(e as Map<String, dynamic>))
  59 + ?.toList(),
  60 + (json['practice'] as List)
  61 + ?.map((e) => e == null
  62 + ? null
  63 + : PracticeModel.fromJson(e as Map<String, dynamic>))
  64 + ?.toList(),
  65 + json['taste'] as String,
  66 + json['cooks'] as String,
  67 + json['cook_style'] as String,
  68 + json['desc'] as String,
63 ); 69 );
64 } 70 }
65 71
@@ -84,6 +90,11 @@ Map<String, dynamic> _$CookbookOneSunModelToJson( @@ -84,6 +90,11 @@ Map<String, dynamic> _$CookbookOneSunModelToJson(
84 'attr': instance.attr, 90 'attr': instance.attr,
85 'spec': instance.spec, 91 'spec': instance.spec,
86 'practice': instance.practice, 92 'practice': instance.practice,
  93 + 'taste': instance.taste,
  94 + 'cooks': instance.cooks,
  95 + 'cook_style': instance.cookStyle,
  96 + 'desc': instance.desc
  97 +
87 // 'template': instance.template, 98 // 'template': instance.template,
88 }; 99 };
89 100
@@ -43,6 +43,11 @@ class CookbookPracticeSunModel { @@ -43,6 +43,11 @@ class CookbookPracticeSunModel {
43 cdate = json['cdate']; 43 cdate = json['cdate'];
44 } 44 }
45 45
  46 + CookbookPracticeSunModel.fromJson2(Map<String, dynamic> json) {
  47 + id = json['practice'];
  48 + name = json['name'];
  49 + }
  50 +
46 Map<String, dynamic> toJson() { 51 Map<String, dynamic> toJson() {
47 final Map<String, dynamic> data = new Map<String, dynamic>(); 52 final Map<String, dynamic> data = new Map<String, dynamic>();
48 data['id'] = this.id; 53 data['id'] = this.id;
@@ -52,7 +57,7 @@ class CookbookPracticeSunModel { @@ -52,7 +57,7 @@ class CookbookPracticeSunModel {
52 return data; 57 return data;
53 } 58 }
54 59
55 - Map<String, dynamic> toJson2() { 60 + Map<String, dynamic> toJson2() {
56 final Map<String, dynamic> data = new Map<String, dynamic>(); 61 final Map<String, dynamic> data = new Map<String, dynamic>();
57 data['id'] = this.id; 62 data['id'] = this.id;
58 data['name'] = this.name; 63 data['name'] = this.name;
@@ -30,4 +30,12 @@ class MenuUnitModel { @@ -30,4 +30,12 @@ class MenuUnitModel {
30 'member_price': memberPrice, 30 'member_price': memberPrice,
31 'status': select ? '1' : '0' 31 'status': select ? '1' : '0'
32 }; 32 };
  33 +
  34 + Map<String, dynamic> toJson1() => <String, dynamic>{
  35 + "specs": specs,
  36 + "id": specid,
  37 + 'price': price,
  38 + 'member_price': memberPrice,
  39 + 'status': select ? '1' : '0'
  40 + };
33 } 41 }
@@ -85,6 +85,25 @@ class _MenuAddDishesPageState extends State<MenuAddDishesPage> { @@ -85,6 +85,25 @@ class _MenuAddDishesPageState extends State<MenuAddDishesPage> {
85 }); 85 });
86 } 86 }
87 87
  88 + _getSelectPractice() {
  89 + selectPracticeShow = '';
  90 + selectPracticeIds = '';
  91 + selectPractice.forEach((element) {
  92 + // if (element.select) {
  93 + selectPracticeShow += '${element.name}、';
  94 + selectPracticeIds += '${element.id},';
  95 + // }
  96 + });
  97 + if (selectPracticeShow.endsWith('、')) {
  98 + selectPracticeShow =
  99 + selectPracticeShow.substring(0, selectPracticeShow.length - 1);
  100 + }
  101 + if (selectPracticeIds.endsWith(',')) {
  102 + selectPracticeIds =
  103 + selectPracticeIds.substring(0, selectPracticeIds.length - 1);
  104 + }
  105 + }
  106 +
88 ///获取单个菜品信息 107 ///获取单个菜品信息
89 _getCookbookById({bool showLoading = false}) async { 108 _getCookbookById({bool showLoading = false}) async {
90 Map<String, String> params = { 109 Map<String, String> params = {
@@ -96,9 +115,9 @@ class _MenuAddDishesPageState extends State<MenuAddDishesPage> { @@ -96,9 +115,9 @@ class _MenuAddDishesPageState extends State<MenuAddDishesPage> {
96 _nameController.text = menuManageProvider.cookbookOneSunModel.name; 115 _nameController.text = menuManageProvider.cookbookOneSunModel.name;
97 swichState = 116 swichState =
98 menuManageProvider.cookbookOneSunModel.status == '1' ? true : false; 117 menuManageProvider.cookbookOneSunModel.status == '1' ? true : false;
99 - _priceController.text = menuManageProvider.cookbookOneSunModel.price; 118 + // _priceController.text = menuManageProvider.cookbookOneSunModel.price;
100 categoryStr = menuManageProvider.cookbookOneSunModel.className; 119 categoryStr = menuManageProvider.cookbookOneSunModel.className;
101 - specStr = menuManageProvider.cookbookOneSunModel.unit; 120 + // specStr = menuManageProvider.cookbookOneSunModel.unit;
102 mid = menuManageProvider.cookbookOneSunModel.id; 121 mid = menuManageProvider.cookbookOneSunModel.id;
103 if (menuManageProvider.cookbookOneSunModel.image != null && 122 if (menuManageProvider.cookbookOneSunModel.image != null &&
104 menuManageProvider.cookbookOneSunModel.image != 'null' && 123 menuManageProvider.cookbookOneSunModel.image != 'null' &&
@@ -106,6 +125,37 @@ class _MenuAddDishesPageState extends State<MenuAddDishesPage> { @@ -106,6 +125,37 @@ class _MenuAddDishesPageState extends State<MenuAddDishesPage> {
106 uploadImageProvider.dish.qiniuUrl = 125 uploadImageProvider.dish.qiniuUrl =
107 menuManageProvider.cookbookOneSunModel.image; 126 menuManageProvider.cookbookOneSunModel.image;
108 } 127 }
  128 + if (menuManageProvider.cookbookOneSunModel.spec.length > 0) {
  129 + data = [];
  130 + }
  131 + menuManageProvider.cookbookOneSunModel.spec.forEach((element) {
  132 + data.add(MenuUnitModel.fromJson(element.toJson()));
  133 + });
  134 +
  135 + outerloop:
  136 + for (int i = 0; i < data.length; i++) {
  137 + MenuUnitModel menumodel = data[i];
  138 + if (menumodel.select) {
  139 + showPrice = menumodel.priceC.text;
  140 + break outerloop;
  141 + }
  142 + }
  143 +
  144 + // String selectPracticeShow;
  145 + // String selectPracticeIds;
  146 + // List<CookbookPracticeSunModel> selectPractice;
  147 +
  148 + //
  149 + selectPractice = [];
  150 + menuManageProvider.cookbookOneSunModel.practice.forEach((element) {
  151 + selectPractice
  152 + .add(CookbookPracticeSunModel.fromJson2(element.toJson()));
  153 + });
  154 + _getSelectPractice();
  155 +
  156 + introduceC.text = menuManageProvider.cookbookOneSunModel.desc;
  157 + tasteC.text = menuManageProvider.cookbookOneSunModel.taste; //味型
  158 + cooksC.text = menuManageProvider.cookbookOneSunModel.cooks; //烹调
109 159
110 setState(() {}); 160 setState(() {});
111 } 161 }
@@ -157,6 +207,10 @@ class _MenuAddDishesPageState extends State<MenuAddDishesPage> { @@ -157,6 +207,10 @@ class _MenuAddDishesPageState extends State<MenuAddDishesPage> {
157 // unit = element.id; 207 // unit = element.id;
158 // } 208 // }
159 // }); 209 // });
  210 + List temp = [];
  211 + data.forEach((element) {
  212 + temp.add(element.toJson1());
  213 + });
160 Map<String, String> params = { 214 Map<String, String> params = {
161 "sellerid": Provider.of<UserModel>(context, listen: false).user.sellerid, 215 "sellerid": Provider.of<UserModel>(context, listen: false).user.sellerid,
162 'cid': cid, 216 'cid': cid,
@@ -164,7 +218,7 @@ class _MenuAddDishesPageState extends State<MenuAddDishesPage> { @@ -164,7 +218,7 @@ class _MenuAddDishesPageState extends State<MenuAddDishesPage> {
164 'name': _nameController.text, 218 'name': _nameController.text,
165 'status': swichState ? '1' : '0', 219 'status': swichState ? '1' : '0',
166 // 'price': _priceController.text 220 // 'price': _priceController.text
167 - 'dishSkuList': json.encode(data) 221 + 'dishSkuList': json.encode(temp)
168 }; 222 };
169 223
170 if (mid != '') { 224 if (mid != '') {
@@ -733,25 +787,26 @@ class _MenuAddDishesPageState extends State<MenuAddDishesPage> { @@ -733,25 +787,26 @@ class _MenuAddDishesPageState extends State<MenuAddDishesPage> {
733 context, selectPracticeIds); 787 context, selectPracticeIds);
734 if (object != null) { 788 if (object != null) {
735 selectPractice = object['select_practice']; 789 selectPractice = object['select_practice'];
736 - selectPracticeShow = '';  
737 - selectPracticeIds = '';  
738 - selectPractice.forEach((element) {  
739 - if (element.select) {  
740 - selectPracticeShow +=  
741 - '${element.name}、';  
742 - selectPracticeIds += '${element.id},';  
743 - }  
744 - });  
745 - if (selectPracticeShow.endsWith('、')) {  
746 - selectPracticeShow =  
747 - selectPracticeShow.substring(  
748 - 0, selectPracticeShow.length - 1);  
749 - }  
750 - if (selectPracticeIds.endsWith(',')) {  
751 - selectPracticeIds =  
752 - selectPracticeIds.substring(  
753 - 0, selectPracticeIds.length - 1);  
754 - } 790 + _getSelectPractice();
  791 + // selectPracticeShow = '';
  792 + // selectPracticeIds = '';
  793 + // selectPractice.forEach((element) {
  794 + // if (element.select) {
  795 + // selectPracticeShow +=
  796 + // '${element.name}、';
  797 + // selectPracticeIds += '${element.id},';
  798 + // }
  799 + // });
  800 + // if (selectPracticeShow.endsWith('、')) {
  801 + // selectPracticeShow =
  802 + // selectPracticeShow.substring(
  803 + // 0, selectPracticeShow.length - 1);
  804 + // }
  805 + // if (selectPracticeIds.endsWith(',')) {
  806 + // selectPracticeIds =
  807 + // selectPracticeIds.substring(
  808 + // 0, selectPracticeIds.length - 1);
  809 + // }
755 setState(() {}); 810 setState(() {});
756 } 811 }
757 }, needStar: false)), 812 }, needStar: false)),
  1 +import 'dart:convert';
  2 +
1 import 'package:amap_map_fluttify/amap_map_fluttify.dart'; 3 import 'package:amap_map_fluttify/amap_map_fluttify.dart';
2 import 'package:cached_network_image/cached_network_image.dart'; 4 import 'package:cached_network_image/cached_network_image.dart';
3 import 'package:flutter/material.dart'; 5 import 'package:flutter/material.dart';
@@ -137,6 +139,21 @@ class _MenuManagePageState extends State<MenuManagePage> { @@ -137,6 +139,21 @@ class _MenuManagePageState extends State<MenuManagePage> {
137 _handleData(); 139 _handleData();
138 } 140 }
139 141
  142 + ///修改菜品样式
  143 + _setCookbookById(String mid, Map cookStyle) async {
  144 + Map<String, String> params = {
  145 + "sellerid": Provider.of<UserModel>(context, listen: false).user.sellerid,
  146 + "id": mid,
  147 + 'cook_style': json.encode(cookStyle)
  148 + };
  149 + print(params);
  150 + bool sucess = await menuManageProvider.setCookbookById(context, params,
  151 + showLoading: true);
  152 + if (sucess) {
  153 + Utils.showToast('修改成功!');
  154 + }
  155 + }
  156 +
140 ///处理数据 157 ///处理数据
141 _handleData({isMove = false}) { 158 _handleData({isMove = false}) {
142 if (menuManageProvider.menuModel != null) { 159 if (menuManageProvider.menuModel != null) {
@@ -220,40 +237,112 @@ class _MenuManagePageState extends State<MenuManagePage> { @@ -220,40 +237,112 @@ class _MenuManagePageState extends State<MenuManagePage> {
220 spreadRadius: w(20)) 237 spreadRadius: w(20))
221 ]), 238 ]),
222 ), 239 ),
  240 + if ((model.taste != null &&
  241 + model.taste != '' &&
  242 + model.cooks != null &&
  243 + model.cooks != '') ||
  244 + (model.taste != null && model.taste != '') ||
  245 + (model.cooks != null && model.cooks != ''))
  246 + VEmptyView(20),
  247 + if ((model.taste != null &&
  248 + model.taste != '' &&
  249 + model.cooks != null &&
  250 + model.cooks != '') ||
  251 + (model.taste != null && model.taste != '') ||
  252 + (model.cooks != null && model.cooks != ''))
  253 + VEmptyView(20),
  254 + if ((model.taste != null &&
  255 + model.taste != '' &&
  256 + model.cooks != null &&
  257 + model.cooks != '') ||
  258 + (model.taste != null && model.taste != '') ||
  259 + (model.cooks != null && model.cooks != ''))
  260 + VEmptyView(20),
  261 + if ((model.taste != null &&
  262 + model.taste != '' &&
  263 + model.cooks != null &&
  264 + model.cooks != '') ||
  265 + (model.taste != null && model.taste != '') ||
  266 + (model.cooks != null && model.cooks != ''))
  267 + Text(
  268 + model.taste != null &&
  269 + model.taste != '' &&
  270 + model.cooks != null &&
  271 + model.cooks != ''
  272 + ? '味型:${model.taste} 烹调:${model.cooks}'
  273 + : model.taste != null && model.taste != ''
  274 + ? '味型:${model.taste}'
  275 + : model.cooks != null && model.cooks != ''
  276 + ? '味型:${model.taste} 烹调:${model.cooks}'
  277 + : '',
  278 + style: TextStyle(
  279 + fontWeight: FontWeight.bold,
  280 + fontSize: font(12),
  281 + color: MyColours.color_515151,
  282 + shadows: [
  283 + BoxShadow(
  284 + color: MyColours.color_FBF6F1,
  285 + offset: Offset(0, 1),
  286 + blurRadius: w(2),
  287 + spreadRadius: w(20))
  288 + ])),
223 VEmptyView(20), 289 VEmptyView(20),
224 - Text('味型:咸鲜 烹调:熬煮',  
225 - style: TextStyle(  
226 - fontWeight: FontWeight.bold,  
227 - fontSize: font(12),  
228 - color: MyColours.color_515151,  
229 - shadows: [  
230 - BoxShadow(  
231 - color: MyColours.color_FBF6F1,  
232 - offset: Offset(0, 1),  
233 - blurRadius: w(2),  
234 - spreadRadius: w(20))  
235 - ])),  
236 - VEmptyView(20),  
237 - Text(  
238 - '¥${model.price}/${model.unit} 会员 ¥${model.price}/${model.unit} ',  
239 - textAlign: TextAlign.right,  
240 - style: TextStyle(  
241 - fontWeight: FontWeight.bold,  
242 - fontSize: font(14),  
243 - color: MyColours.color_515151,  
244 - shadows: [  
245 - BoxShadow(  
246 - color: MyColours.color_FBF6F1,  
247 - offset: Offset(0, 1),  
248 - blurRadius: w(2),  
249 - spreadRadius: w(20))  
250 - ]),  
251 - ), 290 + model.price == null
  291 + ? Column(children: _priceWidget(model))
  292 + : Text(
  293 + '¥${model.price}/${model.unit} 会员 ¥${model.price}/${model.unit} ',
  294 + textAlign: TextAlign.right,
  295 + style: TextStyle(
  296 + fontWeight: FontWeight.bold,
  297 + fontSize: font(14),
  298 + color: MyColours.color_515151,
  299 + shadows: [
  300 + BoxShadow(
  301 + color: MyColours.color_FBF6F1,
  302 + offset: Offset(0, 1),
  303 + blurRadius: w(2),
  304 + spreadRadius: w(20))
  305 + ]),
  306 + ),
252 ], 307 ],
253 ), 308 ),
254 ); 309 );
255 } 310 }
256 311
  312 + List<Widget> _priceWidget(MenuSunModel model) {
  313 + List<SpecModel> tempPrice = [];
  314 + if (model.price == null) {
  315 + //新添加菜品
  316 + model.spec.forEach((element) {
  317 + if (element.status == '1') {
  318 + //规格启用状态
  319 + tempPrice.add(element);
  320 + }
  321 + });
  322 + }
  323 + List<Widget> textWidgetList = [];
  324 + tempPrice.forEach((element) {
  325 + textWidgetList.add(
  326 + Text(
  327 + '¥${element.price}/${element.specs} 会员 ¥${element.memberPrice ?? ''}/${element.specs} ',
  328 + textAlign: TextAlign.right,
  329 + style: TextStyle(
  330 + fontWeight: FontWeight.bold,
  331 + fontSize: font(14),
  332 + color: MyColours.color_515151,
  333 + shadows: [
  334 + BoxShadow(
  335 + color: MyColours.color_FBF6F1,
  336 + offset: Offset(0, 1),
  337 + blurRadius: w(2),
  338 + spreadRadius: w(20))
  339 + ]),
  340 + ),
  341 + );
  342 + });
  343 + return textWidgetList;
  344 + }
  345 +
257 //右边 346 //右边
258 Widget _topRight(MenuSunModel model) { 347 Widget _topRight(MenuSunModel model) {
259 return Container( 348 return Container(
@@ -274,36 +363,59 @@ class _MenuManagePageState extends State<MenuManagePage> { @@ -274,36 +363,59 @@ class _MenuManagePageState extends State<MenuManagePage> {
274 spreadRadius: w(20)) 363 spreadRadius: w(20))
275 ]), 364 ]),
276 ), 365 ),
  366 + if ((model.taste != null &&
  367 + model.taste != '' &&
  368 + model.cooks != null &&
  369 + model.cooks != '') ||
  370 + (model.taste != null && model.taste != '') ||
  371 + (model.cooks != null && model.cooks != ''))
  372 + VEmptyView(20),
  373 + if ((model.taste != null &&
  374 + model.taste != '' &&
  375 + model.cooks != null &&
  376 + model.cooks != '') ||
  377 + (model.taste != null && model.taste != '') ||
  378 + (model.cooks != null && model.cooks != ''))
  379 + Text(
  380 + model.taste != null &&
  381 + model.taste != '' &&
  382 + model.cooks != null &&
  383 + model.cooks != ''
  384 + ? '味型:${model.taste} 烹调:${model.cooks}'
  385 + : model.taste != null && model.taste != ''
  386 + ? '味型:${model.taste}'
  387 + : model.cooks != null && model.cooks != ''
  388 + ? '味型:${model.taste} 烹调:${model.cooks}'
  389 + : '',
  390 + style: TextStyle(
  391 + fontWeight: FontWeight.bold,
  392 + fontSize: font(12),
  393 + color: MyColours.color_515151,
  394 + shadows: [
  395 + BoxShadow(
  396 + color: MyColours.color_FBF6F1,
  397 + offset: Offset(0, 1),
  398 + blurRadius: w(2),
  399 + spreadRadius: w(20))
  400 + ])),
277 VEmptyView(20), 401 VEmptyView(20),
278 - Text('味型:咸鲜 烹调:熬煮',  
279 - style:  
280 - TextStyle(  
281 - fontWeight: FontWeight.bold,  
282 - fontSize: font(12),  
283 - color: MyColours.color_515151,  
284 - shadows: [  
285 - BoxShadow(  
286 - color: MyColours.color_FBF6F1,  
287 - offset: Offset(0, 1),  
288 - blurRadius: w(2),  
289 - spreadRadius: w(20))  
290 - ])),  
291 - VEmptyView(20),  
292 - Text(  
293 - '¥${model.price}/${model.unit} 会员 ¥${model.price}/${model.unit} ',  
294 - textAlign: TextAlign.right,  
295 - style: TextStyle(  
296 - fontWeight: FontWeight.bold,  
297 - fontSize: font(14),  
298 - color: MyColours.color_515151,  
299 - shadows: [  
300 - BoxShadow(  
301 - color: MyColours.color_FBF6F1,  
302 - offset: Offset(0, 1),  
303 - blurRadius: w(2),  
304 - spreadRadius: w(20))  
305 - ]),  
306 - ), 402 + model.price == null
  403 + ? Column(children: _priceWidget(model))
  404 + : Text(
  405 + '¥${model.price}/${model.unit} 会员 ¥${model.member_price ?? ''}/${model.unit} ',
  406 + textAlign: TextAlign.right,
  407 + style: TextStyle(
  408 + fontWeight: FontWeight.bold,
  409 + fontSize: font(14),
  410 + color: MyColours.color_515151,
  411 + shadows: [
  412 + BoxShadow(
  413 + color: MyColours.color_FBF6F1,
  414 + offset: Offset(0, 1),
  415 + blurRadius: w(2),
  416 + spreadRadius: w(20))
  417 + ]),
  418 + ),
307 ], 419 ],
308 ), 420 ),
309 ); 421 );
@@ -334,38 +446,76 @@ class _MenuManagePageState extends State<MenuManagePage> { @@ -334,38 +446,76 @@ class _MenuManagePageState extends State<MenuManagePage> {
334 spreadRadius: w(20)) 446 spreadRadius: w(20))
335 ]), 447 ]),
336 ), 448 ),
337 - VEmptyView(20),  
338 - Text('味型:咸鲜 烹调:熬煮',  
339 - style: TextStyle(  
340 - fontWeight: FontWeight.bold,  
341 - fontSize: font(12),  
342 - color: MyColours.color_515151,  
343 - shadows: [  
344 - BoxShadow(  
345 - color: MyColours.color_FBF6F1,  
346 - offset: Offset(0, 1),  
347 - blurRadius: w(2),  
348 - spreadRadius: w(20))  
349 - ])) 449 + if ((model.taste != null &&
  450 + model.taste != '' &&
  451 + model.cooks != null &&
  452 + model.cooks != '') ||
  453 + (model.taste != null && model.taste != '') ||
  454 + (model.cooks != null && model.cooks != ''))
  455 + VEmptyView(20),
  456 + if ((model.taste != null &&
  457 + model.taste != '' &&
  458 + model.cooks != null &&
  459 + model.cooks != '') ||
  460 + (model.taste != null && model.taste != '') ||
  461 + (model.cooks != null && model.cooks != ''))
  462 + VEmptyView(20),
  463 + if ((model.taste != null &&
  464 + model.taste != '' &&
  465 + model.cooks != null &&
  466 + model.cooks != '') ||
  467 + (model.taste != null && model.taste != '') ||
  468 + (model.cooks != null && model.cooks != ''))
  469 + VEmptyView(20),
  470 + if ((model.taste != null &&
  471 + model.taste != '' &&
  472 + model.cooks != null &&
  473 + model.cooks != '') ||
  474 + (model.taste != null && model.taste != '') ||
  475 + (model.cooks != null && model.cooks != ''))
  476 + Text(
  477 + model.taste != null &&
  478 + model.taste != '' &&
  479 + model.cooks != null &&
  480 + model.cooks != ''
  481 + ? '味型:${model.taste} 烹调:${model.cooks}'
  482 + : model.taste != null && model.taste != ''
  483 + ? '味型:${model.taste}'
  484 + : model.cooks != null && model.cooks != ''
  485 + ? '味型:${model.taste} 烹调:${model.cooks}'
  486 + : '',
  487 + style: TextStyle(
  488 + fontWeight: FontWeight.bold,
  489 + fontSize: font(12),
  490 + color: MyColours.color_515151,
  491 + shadows: [
  492 + BoxShadow(
  493 + color: MyColours.color_FBF6F1,
  494 + offset: Offset(0, 1),
  495 + blurRadius: w(2),
  496 + spreadRadius: w(20))
  497 + ]))
350 ], 498 ],
351 ), 499 ),
352 ), 500 ),
353 HEmptyView(10), 501 HEmptyView(10),
354 - Text(  
355 - '¥${model.price}/${model.unit} 会员 ¥${model.price}/${model.unit} ',  
356 - textAlign: TextAlign.right,  
357 - style: TextStyle(  
358 - fontWeight: FontWeight.bold,  
359 - fontSize: font(14),  
360 - color: MyColours.color_515151,  
361 - shadows: [  
362 - BoxShadow(  
363 - color: MyColours.color_FBF6F1,  
364 - offset: Offset(0, 1),  
365 - blurRadius: w(2),  
366 - spreadRadius: w(20))  
367 - ]),  
368 - ), 502 + model.price == null
  503 + ? Column(children: _priceWidget(model))
  504 + : Text(
  505 + '¥${model.price}/${model.unit} 会员 ¥${model.price}/${model.unit} ',
  506 + textAlign: TextAlign.right,
  507 + style: TextStyle(
  508 + fontWeight: FontWeight.bold,
  509 + fontSize: font(14),
  510 + color: MyColours.color_515151,
  511 + shadows: [
  512 + BoxShadow(
  513 + color: MyColours.color_FBF6F1,
  514 + offset: Offset(0, 1),
  515 + blurRadius: w(2),
  516 + spreadRadius: w(20))
  517 + ]),
  518 + ),
369 ], 519 ],
370 ); 520 );
371 } 521 }
@@ -394,41 +544,64 @@ class _MenuManagePageState extends State<MenuManagePage> { @@ -394,41 +544,64 @@ class _MenuManagePageState extends State<MenuManagePage> {
394 spreadRadius: w(20)) 544 spreadRadius: w(20))
395 ]), 545 ]),
396 )), 546 )),
  547 + if ((model.taste != null &&
  548 + model.taste != '' &&
  549 + model.cooks != null &&
  550 + model.cooks != '') ||
  551 + (model.taste != null && model.taste != '') ||
  552 + (model.cooks != null && model.cooks != ''))
  553 + VEmptyView(20),
  554 + if ((model.taste != null &&
  555 + model.taste != '' &&
  556 + model.cooks != null &&
  557 + model.cooks != '') ||
  558 + (model.taste != null && model.taste != '') ||
  559 + (model.cooks != null && model.cooks != ''))
  560 + Padding(
  561 + padding: EdgeInsets.symmetric(horizontal: w(10)),
  562 + child: Text(
  563 + model.taste != null &&
  564 + model.taste != '' &&
  565 + model.cooks != null &&
  566 + model.cooks != ''
  567 + ? '味型:${model.taste} 烹调:${model.cooks}'
  568 + : model.taste != null && model.taste != ''
  569 + ? '味型:${model.taste}'
  570 + : model.cooks != null && model.cooks != ''
  571 + ? '味型:${model.taste} 烹调:${model.cooks}'
  572 + : '',
  573 + style: TextStyle(
  574 + fontWeight: FontWeight.bold,
  575 + fontSize: font(12),
  576 + color: MyColours.color_515151,
  577 + shadows: [
  578 + BoxShadow(
  579 + color: MyColours.color_FBF6F1,
  580 + offset: Offset(0, 1),
  581 + blurRadius: w(2),
  582 + spreadRadius: w(20))
  583 + ]),
  584 + )),
397 VEmptyView(20), 585 VEmptyView(20),
398 Padding( 586 Padding(
399 padding: EdgeInsets.symmetric(horizontal: w(10)), 587 padding: EdgeInsets.symmetric(horizontal: w(10)),
400 - child: Text(  
401 - '味型:咸鲜 烹调:熬煮',  
402 - style: TextStyle(  
403 - fontWeight: FontWeight.bold,  
404 - fontSize: font(12),  
405 - color: MyColours.color_515151,  
406 - shadows: [  
407 - BoxShadow(  
408 - color: MyColours.color_FBF6F1,  
409 - offset: Offset(0, 1),  
410 - blurRadius: w(2),  
411 - spreadRadius: w(20))  
412 - ]),  
413 - )),  
414 - VEmptyView(20),  
415 - Padding(  
416 - padding: EdgeInsets.symmetric(horizontal: w(10)),  
417 - child: Text(  
418 - '¥${model.price}/${model.unit} 会员 ¥${model.price}/${model.unit} ',  
419 - textAlign: TextAlign.right,  
420 - style: TextStyle(  
421 - fontWeight: FontWeight.bold,  
422 - fontSize: font(14),  
423 - color: MyColours.color_515151,  
424 - shadows: [  
425 - BoxShadow(  
426 - color: MyColours.color_FBF6F1,  
427 - offset: Offset(0, 1),  
428 - blurRadius: w(2),  
429 - spreadRadius: w(20))  
430 - ]),  
431 - )), 588 + child: model.price == null
  589 + ? Column(children: _priceWidget(model))
  590 + : Text(
  591 + '¥${model.price}/${model.unit} 会员 ¥${model.member_price}/${model.unit} ',
  592 + textAlign: TextAlign.right,
  593 + style: TextStyle(
  594 + fontWeight: FontWeight.bold,
  595 + fontSize: font(14),
  596 + color: MyColours.color_515151,
  597 + shadows: [
  598 + BoxShadow(
  599 + color: MyColours.color_FBF6F1,
  600 + offset: Offset(0, 1),
  601 + blurRadius: w(2),
  602 + spreadRadius: w(20))
  603 + ]),
  604 + )),
432 VEmptyView(30), 605 VEmptyView(30),
433 if (model.image != null) 606 if (model.image != null)
434 CachedNetworkImage( 607 CachedNetworkImage(
@@ -437,11 +610,11 @@ class _MenuManagePageState extends State<MenuManagePage> { @@ -437,11 +610,11 @@ class _MenuManagePageState extends State<MenuManagePage> {
437 width: ScreenUtil().screenWidth / 2, 610 width: ScreenUtil().screenWidth / 2,
438 height: w(125), 611 height: w(125),
439 ), 612 ),
440 - if (true) 613 + if (model.desc != null && model.desc != '')
441 Padding( 614 Padding(
442 padding: EdgeInsets.symmetric(horizontal: w(10), vertical: w(10)), 615 padding: EdgeInsets.symmetric(horizontal: w(10), vertical: w(10)),
443 child: Text( 616 child: Text(
444 - '江南传统名菜,口味咸鲜,汤白汁浓,肉质酥肥,笋清香脆嫩,鲜味浓厚。', 617 + model.desc ?? "",
445 style: TextStyle( 618 style: TextStyle(
446 color: themeColerModel.name == '珍珠白' 619 color: themeColerModel.name == '珍珠白'
447 ? MyColours.color_515151 620 ? MyColours.color_515151
@@ -509,6 +682,13 @@ class _MenuManagePageState extends State<MenuManagePage> { @@ -509,6 +682,13 @@ class _MenuManagePageState extends State<MenuManagePage> {
509 } else { 682 } else {
510 _handleData(); 683 _handleData();
511 } 684 }
  685 +
  686 + Map cookStyle = {
  687 + 'name_type': object['name_type'],
  688 + 'image_type': '',
  689 + 'sort': ''
  690 + };
  691 + _setCookbookById(model.id, cookStyle);
512 } 692 }
513 } 693 }
514 694
@@ -580,57 +760,59 @@ class _MenuManagePageState extends State<MenuManagePage> { @@ -580,57 +760,59 @@ class _MenuManagePageState extends State<MenuManagePage> {
580 ], 760 ],
581 ), 761 ),
582 )), 762 )),
583 - Container(  
584 - padding: EdgeInsets.symmetric(horizontal: w(23)),  
585 - // height: w(80),  
586 - child: Row(  
587 - mainAxisAlignment: MainAxisAlignment.spaceBetween,  
588 - children: [  
589 - Padding(  
590 - padding:  
591 - EdgeInsets.only(top: w(12), bottom: w(25)),  
592 - child: RoundButton(  
593 - onPressed: () async {  
594 - bool needRefresh =  
595 - await NavigatorUtil.goMenuCategoryPage(  
596 - context);  
597 - print(needRefresh);  
598 - if (needRefresh != null && needRefresh) {  
599 - //刷新页面数据  
600 - // _controller.callRefresh();  
601 - // _couponNetworkData();  
602 - }  
603 - },  
604 - text: '分类管理',  
605 - fontSize: 32,  
606 - gradientStart: MyColours.color_ffffff,  
607 - gradientEnd: MyColours.color_ffffff,  
608 - borderColor: MyColours.color_438E93,  
609 - textColor: MyColours.color_438E93,  
610 - isBold: true,  
611 - height: w(43),  
612 - width: w(100),  
613 - radius: r(5),  
614 - )),  
615 - !isShow  
616 - ? SizedBox()  
617 - : Padding(  
618 - padding: EdgeInsets.only(  
619 - top: w(12), bottom: w(25)),  
620 - child: RoundButton(  
621 - onPressed: () async {  
622 - await NavigatorUtil.goMenuAddDishesPage(  
623 - context);  
624 - },  
625 - text: '添加菜品',  
626 - fontSize: 32,  
627 - isBold: true,  
628 - width: w(218),  
629 - height: w(43),  
630 - radius: r(5),  
631 - ))  
632 - ],  
633 - )) 763 + if (model.pageState == PageState.Empty ||
  764 + model.pageState == PageState.Success)
  765 + Container(
  766 + padding: EdgeInsets.symmetric(horizontal: w(23)),
  767 + // height: w(80),
  768 + child: Row(
  769 + mainAxisAlignment: MainAxisAlignment.spaceBetween,
  770 + children: [
  771 + Padding(
  772 + padding:
  773 + EdgeInsets.only(top: w(12), bottom: w(25)),
  774 + child: RoundButton(
  775 + onPressed: () async {
  776 + bool needRefresh =
  777 + await NavigatorUtil.goMenuCategoryPage(
  778 + context);
  779 + print(needRefresh);
  780 + if (needRefresh != null && needRefresh) {
  781 + //刷新页面数据
  782 + // _controller.callRefresh();
  783 + // _couponNetworkData();
  784 + }
  785 + },
  786 + text: '分类管理',
  787 + fontSize: 32,
  788 + gradientStart: MyColours.color_ffffff,
  789 + gradientEnd: MyColours.color_ffffff,
  790 + borderColor: MyColours.color_438E93,
  791 + textColor: MyColours.color_438E93,
  792 + isBold: true,
  793 + height: w(43),
  794 + width: w(100),
  795 + radius: r(5),
  796 + )),
  797 + !isShow
  798 + ? SizedBox()
  799 + : Padding(
  800 + padding: EdgeInsets.only(
  801 + top: w(12), bottom: w(25)),
  802 + child: RoundButton(
  803 + onPressed: () async {
  804 + await NavigatorUtil.goMenuAddDishesPage(
  805 + context);
  806 + },
  807 + text: '添加菜品',
  808 + fontSize: 32,
  809 + isBold: true,
  810 + width: w(218),
  811 + height: w(43),
  812 + radius: r(5),
  813 + ))
  814 + ],
  815 + ))
634 ]); 816 ]);
635 } else { 817 } else {
636 // double cellWidth = (MediaQuery.of(context).size.width - 818 // double cellWidth = (MediaQuery.of(context).size.width -
@@ -811,7 +993,8 @@ class _MenuManagePageState extends State<MenuManagePage> { @@ -811,7 +993,8 @@ class _MenuManagePageState extends State<MenuManagePage> {
811 width: double.infinity, 993 width: double.infinity,
812 height: w(250), 994 height: w(250),
813 ), 995 ),
814 - if (true) 996 + if (model.desc != null &&
  997 + model.desc != '')
815 Padding( 998 Padding(
816 padding: EdgeInsets 999 padding: EdgeInsets
817 .symmetric( 1000 .symmetric(
@@ -820,7 +1003,7 @@ class _MenuManagePageState extends State<MenuManagePage> { @@ -820,7 +1003,7 @@ class _MenuManagePageState extends State<MenuManagePage> {
820 vertical: 1003 vertical:
821 w(10)), 1004 w(10)),
822 child: Text( 1005 child: Text(
823 - '江南传统名菜,口味咸鲜,汤白汁浓,肉质酥肥,笋清香脆嫩,鲜味浓厚。', 1006 + model.desc,
824 style: TextStyle( 1007 style: TextStyle(
825 color: themeColerModel1 1008 color: themeColerModel1
826 .name == 1009 .name ==
@@ -973,58 +1156,60 @@ class _MenuManagePageState extends State<MenuManagePage> { @@ -973,58 +1156,60 @@ class _MenuManagePageState extends State<MenuManagePage> {
973 ], 1156 ],
974 ); 1157 );
975 })), 1158 })),
976 - Container(  
977 - padding: EdgeInsets.symmetric(horizontal: w(23)),  
978 - // height: w(80),  
979 - color: MyColours.color_FAFAFA,  
980 - child: Row(  
981 - mainAxisAlignment: MainAxisAlignment.spaceBetween,  
982 - children: [  
983 - Padding(  
984 - padding:  
985 - EdgeInsets.only(top: w(12), bottom: w(25)),  
986 - child: RoundButton(  
987 - onPressed: () async {  
988 - bool needRefresh =  
989 - await NavigatorUtil.goMenuCategoryPage(  
990 - context);  
991 - print(needRefresh);  
992 - if (needRefresh != null && needRefresh) {  
993 - //刷新页面数据  
994 - // _controller.callRefresh();  
995 - // _couponNetworkData();  
996 - }  
997 - },  
998 - text: '分类管理',  
999 - fontSize: 32,  
1000 - gradientStart: MyColours.color_ffffff,  
1001 - gradientEnd: MyColours.color_ffffff,  
1002 - borderColor: MyColours.color_438E93,  
1003 - textColor: MyColours.color_438E93,  
1004 - isBold: true,  
1005 - height: w(43),  
1006 - width: w(100),  
1007 - radius: r(5),  
1008 - )),  
1009 - !isShow  
1010 - ? SizedBox()  
1011 - : Padding(  
1012 - padding: EdgeInsets.only(  
1013 - top: w(12), bottom: w(25)),  
1014 - child: RoundButton(  
1015 - onPressed: () async {  
1016 - await NavigatorUtil.goMenuAddDishesPage(  
1017 - context);  
1018 - },  
1019 - text: '添加菜品',  
1020 - fontSize: 32,  
1021 - isBold: true,  
1022 - width: w(218),  
1023 - height: w(43),  
1024 - radius: r(5),  
1025 - ))  
1026 - ],  
1027 - )) 1159 + if (model.pageState == PageState.Success ||
  1160 + model.pageState == PageState.Empty)
  1161 + Container(
  1162 + padding: EdgeInsets.symmetric(horizontal: w(23)),
  1163 + // height: w(80),
  1164 + color: MyColours.color_FAFAFA,
  1165 + child: Row(
  1166 + mainAxisAlignment: MainAxisAlignment.spaceBetween,
  1167 + children: [
  1168 + Padding(
  1169 + padding:
  1170 + EdgeInsets.only(top: w(12), bottom: w(25)),
  1171 + child: RoundButton(
  1172 + onPressed: () async {
  1173 + bool needRefresh =
  1174 + await NavigatorUtil.goMenuCategoryPage(
  1175 + context);
  1176 + print(needRefresh);
  1177 + if (needRefresh != null && needRefresh) {
  1178 + //刷新页面数据
  1179 + // _controller.callRefresh();
  1180 + // _couponNetworkData();
  1181 + }
  1182 + },
  1183 + text: '分类管理',
  1184 + fontSize: 32,
  1185 + gradientStart: MyColours.color_ffffff,
  1186 + gradientEnd: MyColours.color_ffffff,
  1187 + borderColor: MyColours.color_438E93,
  1188 + textColor: MyColours.color_438E93,
  1189 + isBold: true,
  1190 + height: w(43),
  1191 + width: w(100),
  1192 + radius: r(5),
  1193 + )),
  1194 + !isShow
  1195 + ? SizedBox()
  1196 + : Padding(
  1197 + padding: EdgeInsets.only(
  1198 + top: w(12), bottom: w(25)),
  1199 + child: RoundButton(
  1200 + onPressed: () async {
  1201 + await NavigatorUtil.goMenuAddDishesPage(
  1202 + context);
  1203 + },
  1204 + text: '添加菜品',
  1205 + fontSize: 32,
  1206 + isBold: true,
  1207 + width: w(218),
  1208 + height: w(43),
  1209 + radius: r(5),
  1210 + ))
  1211 + ],
  1212 + ))
1028 ]); 1213 ]);
1029 } 1214 }
1030 }, 1215 },
@@ -36,6 +36,12 @@ class _MenuSetPricePageState extends State<MenuSetPricePage> { @@ -36,6 +36,12 @@ class _MenuSetPricePageState extends State<MenuSetPricePage> {
36 MenuUnitModel menuUnitModel = MenuUnitModel(); 36 MenuUnitModel menuUnitModel = MenuUnitModel();
37 // menuUnitModel.status = '1'; 37 // menuUnitModel.status = '1';
38 menuUnitModel.select = true; 38 menuUnitModel.select = true;
  39 + String specid = App.sp.getString('specid');
  40 + String specs = App.sp.getString('specs');
  41 + if (specid != null) {
  42 + menuUnitModel.specs = specs;
  43 + menuUnitModel.specid = specid;
  44 + }
39 data.add(menuUnitModel); 45 data.add(menuUnitModel);
40 } else { 46 } else {
41 data = widget.data; 47 data = widget.data;
@@ -120,9 +120,12 @@ class _OrderCreateTemporaryPageState extends State<OrderCreateTemporaryPage> { @@ -120,9 +120,12 @@ class _OrderCreateTemporaryPageState extends State<OrderCreateTemporaryPage> {
120 @override 120 @override
121 Widget build(BuildContext context) { 121 Widget build(BuildContext context) {
122 return Scaffold( 122 return Scaffold(
123 - appBar: SystemAppBar('临时菜', onTap: () { 123 + appBar: SystemAppBar(
  124 + '临时菜',
  125 + onTap: () {
124 Navigator.pop(context); 126 Navigator.pop(context);
125 - },), 127 + },
  128 + ),
126 body: Container( 129 body: Container(
127 color: MyColours.color_ffffff, 130 color: MyColours.color_ffffff,
128 child: Column( 131 child: Column(
@@ -301,7 +304,9 @@ class _OrderCreateTemporaryPageState extends State<OrderCreateTemporaryPage> { @@ -301,7 +304,9 @@ class _OrderCreateTemporaryPageState extends State<OrderCreateTemporaryPage> {
301 menuSunModel.amount.toString(); 304 menuSunModel.amount.toString();
302 allSum += menuSunModel.amount; 305 allSum += menuSunModel.amount;
303 menuSunModel.unit = unit.text; 306 menuSunModel.unit = unit.text;
304 - menuSunModel.practice = [practice.text]; 307 + PracticeModel practiceModel = PracticeModel();
  308 + practiceModel.name = practice.text;
  309 + menuSunModel.practice = [practiceModel];
305 310
306 menuSunShort.add(menuSunModel); 311 menuSunShort.add(menuSunModel);
307 312