Commit bf016e005766570d8c2f17d0750e44b820b323b3

Authored by wdn127929
1 parent a9bf214a

店内常点

@@ -41,7 +41,7 @@ class PlanCookByRidSunModel { @@ -41,7 +41,7 @@ class PlanCookByRidSunModel {
41 String serve; 41 String serve;
42 List<MenuModel> cooklist; 42 List<MenuModel> cooklist;
43 List<MenuSunModel> packageList; 43 List<MenuSunModel> packageList;
44 - // Null? oftenList; 44 + List<MenuSunModel> oftenList;
45 45
46 List<MenuSunModel> temporaryList; 46 List<MenuSunModel> temporaryList;
47 List<MenuSunModel> planList; 47 List<MenuSunModel> planList;
@@ -67,7 +67,7 @@ class PlanCookByRidSunModel { @@ -67,7 +67,7 @@ class PlanCookByRidSunModel {
67 this.serve, 67 this.serve,
68 this.cooklist, 68 this.cooklist,
69 this.packageList, 69 this.packageList,
70 - // this.oftenList, 70 + this.oftenList,
71 this.temporaryList, 71 this.temporaryList,
72 this.planList, 72 this.planList,
73 this.menuPrice, 73 this.menuPrice,
@@ -114,6 +114,18 @@ class PlanCookByRidSunModel { @@ -114,6 +114,18 @@ class PlanCookByRidSunModel {
114 } 114 }
115 } 115 }
116 // oftenList = json['often_list']; 116 // oftenList = json['often_list'];
  117 + if (json1['often_list'] != null && json1['often_list'] != '') {
  118 + oftenList = <MenuSunModel>[];
  119 + if (json1['often_list'] is List) {
  120 + json1['often_list'].forEach((v) {
  121 + oftenList.add(new MenuSunModel.fromJson2(v));
  122 + });
  123 + } else {
  124 + json.decode(json1['often_list']).forEach((v) {
  125 + oftenList.add(new MenuSunModel.fromJson2(v));
  126 + });
  127 + }
  128 + }
117 129
118 if (json1['temporary_list'] != null && json1['temporary_list'] != '') { 130 if (json1['temporary_list'] != null && json1['temporary_list'] != '') {
119 temporaryList = <MenuSunModel>[]; 131 temporaryList = <MenuSunModel>[];
@@ -163,7 +175,7 @@ class PlanCookByRidSunModel { @@ -163,7 +175,7 @@ class PlanCookByRidSunModel {
163 data['serve'] = this.serve; 175 data['serve'] = this.serve;
164 data['cooklist'] = this.cooklist; 176 data['cooklist'] = this.cooklist;
165 data['package_list'] = this.packageList; 177 data['package_list'] = this.packageList;
166 - // data['often_list'] = this.oftenList; 178 + data['often_list'] = this.oftenList;
167 data['temporary_list'] = this.temporaryList; 179 data['temporary_list'] = this.temporaryList;
168 data['plan_list'] = this.planList; 180 data['plan_list'] = this.planList;
169 data['menu_price'] = this.menuPrice; 181 data['menu_price'] = this.menuPrice;
@@ -132,7 +132,7 @@ class SellerOftenSunCooklist { @@ -132,7 +132,7 @@ class SellerOftenSunCooklist {
132 132
133 SellerOftenSunCooklist.fromJson(Map<String, dynamic> json) { 133 SellerOftenSunCooklist.fromJson(Map<String, dynamic> json) {
134 amount = json['amount'] == null || json['amount'] == '' 134 amount = json['amount'] == null || json['amount'] == ''
135 - ? 0 135 + ? 1
136 : int.parse(json['amount']); 136 : int.parse(json['amount']);
137 sid = json['sid']; 137 sid = json['sid'];
138 cookbookid = json['cookbookid']; 138 cookbookid = json['cookbookid'];
@@ -221,32 +221,32 @@ class _OrderAdvanceEidtPageState extends State<OrderAdvanceEidtPage> { @@ -221,32 +221,32 @@ class _OrderAdvanceEidtPageState extends State<OrderAdvanceEidtPage> {
221 // menuSunModel.amount = element.amount; 221 // menuSunModel.amount = element.amount;
222 // menuSunModel.cookList = element.cookList; 222 // menuSunModel.cookList = element.cookList;
223 223
224 - // if (widget.planCookByRidSunModel != null &&  
225 - // widget.planCookByRidSunModel.packageList != null &&  
226 - // widget.planCookByRidSunModel.packageList.length > 0) {  
227 - // //套餐数据对应  
228 - // widget.planCookByRidSunModel.packageList.forEach((package) {  
229 - // if (package.id == menuSunModel.id) {  
230 - // //同一个套餐  
231 - // menuSunModel.amount = package.amount;  
232 - // menuSunModel.cookList.forEach((oldcooklist) {  
233 - // package.cookList.forEach((newcooklist) {  
234 - // if (oldcooklist.id == newcooklist.id) {  
235 - // //同一菜品分类  
236 - // oldcooklist.cookbooklist.forEach((oldcook) {  
237 - // newcooklist.cookbooklist.forEach((newcook) {  
238 - // if (oldcook.id == newcook.id) {  
239 - // oldcook.amount = newcook.amount;  
240 - // carSum += newcook.amount;  
241 - // }  
242 - // });  
243 - // });  
244 - // }  
245 - // });  
246 - // });  
247 - // }  
248 - // });  
249 - // } 224 + if (widget.planCookByRidSunModel != null &&
  225 + widget.planCookByRidSunModel.oftenList != null &&
  226 + widget.planCookByRidSunModel.oftenList.length > 0) {
  227 + // //店内常点数据对应
  228 + widget.planCookByRidSunModel.oftenList.forEach((package) {
  229 + if (package.id == element.id) {
  230 + //同一个套餐
  231 + element.amount = package.amount;
  232 + element.cookList.forEach((oldcooklist) {
  233 + package.cookList.forEach((newcooklist) {
  234 + if (oldcooklist.id == newcooklist.id) {
  235 + //同一菜品分类
  236 + oldcooklist.cookbooklist.forEach((oldcook) {
  237 + newcooklist.cookbooklist.forEach((newcook) {
  238 + if (oldcook.id == newcook.id) {
  239 + oldcook.amount = newcook.amount;
  240 + carSum += newcook.amount;
  241 + }
  242 + });
  243 + });
  244 + }
  245 + });
  246 + });
  247 + }
  248 + });
  249 + }
250 250
251 // cookListStoreOften.add(menuSunModel); 251 // cookListStoreOften.add(menuSunModel);
252 // } 252 // }