Commit 8fc69a6de75ec1ec17a87fe64f0200c41d67e9d2

Authored by wdn127929
1 parent fb5a1aaf

菜单OK

  1 +import 'dart:convert' as convert;
  2 +
  3 +class GetDzSellerConfModel {
  4 + int ret;
  5 + GetDzSellerConfSunModel data;
  6 + String msg;
  7 +
  8 + GetDzSellerConfModel({this.ret, this.data, this.msg});
  9 +
  10 + GetDzSellerConfModel.fromJson(Map<String, dynamic> json) {
  11 + ret = json['ret'];
  12 + data = json['data'] != null
  13 + ? new GetDzSellerConfSunModel.fromJson(json['data'])
  14 + : null;
  15 + msg = json['msg'];
  16 + }
  17 +
  18 + Map<String, dynamic> toJson() {
  19 + final Map<String, dynamic> data = new Map<String, dynamic>();
  20 + data['ret'] = this.ret;
  21 + if (this.data != null) {
  22 + data['data'] = this.data.toJson();
  23 + }
  24 + data['msg'] = this.msg;
  25 + return data;
  26 + }
  27 +}
  28 +
  29 +class GetDzSellerConfSunModel {
  30 + String id;
  31 + String sid;
  32 + String isSms;
  33 + String templateId;
  34 + String isOpenOrder;
  35 + String isOpenWine;
  36 + String dzVersion;
  37 + String isCheckedCall;
  38 + String isCheckedApp;
  39 + String isCheckedLite;
  40 + String reserveMode;
  41 + String isDisplayDish;
  42 + String isNewTemplate;
  43 + AllCookStyle cookStyle;
  44 + String cdate;
  45 +
  46 + GetDzSellerConfSunModel(
  47 + {this.id,
  48 + this.sid,
  49 + this.isSms,
  50 + this.templateId,
  51 + this.isOpenOrder,
  52 + this.isOpenWine,
  53 + this.dzVersion,
  54 + this.isCheckedCall,
  55 + this.isCheckedApp,
  56 + this.isCheckedLite,
  57 + this.reserveMode,
  58 + this.isDisplayDish,
  59 + this.isNewTemplate,
  60 + this.cookStyle,
  61 + this.cdate});
  62 +
  63 + GetDzSellerConfSunModel.fromJson(Map<String, dynamic> json) {
  64 + id = json['id'];
  65 + sid = json['sid'];
  66 + isSms = json['is_sms'];
  67 + templateId = json['template_id'];
  68 + isOpenOrder = json['is_open_order'];
  69 + isOpenWine = json['is_open_wine'];
  70 + dzVersion = json['dz_version'];
  71 + isCheckedCall = json['is_checked_call'];
  72 + isCheckedApp = json['is_checked_app'];
  73 + isCheckedLite = json['is_checked_lite'];
  74 + reserveMode = json['reserve_mode'];
  75 + isDisplayDish = json['is_display_dish'];
  76 + isNewTemplate = json['is_new_template'];
  77 + cookStyle = AllCookStyle.fromJson(convert.json.decode(json['cook_style']));
  78 + cdate = json['cdate'];
  79 + }
  80 +
  81 + Map<String, dynamic> toJson() {
  82 + final Map<String, dynamic> data = new Map<String, dynamic>();
  83 + data['id'] = this.id;
  84 + data['sid'] = this.sid;
  85 + data['is_sms'] = this.isSms;
  86 + data['template_id'] = this.templateId;
  87 + data['is_open_order'] = this.isOpenOrder;
  88 + data['is_open_wine'] = this.isOpenWine;
  89 + data['dz_version'] = this.dzVersion;
  90 + data['is_checked_call'] = this.isCheckedCall;
  91 + data['is_checked_app'] = this.isCheckedApp;
  92 + data['is_checked_lite'] = this.isCheckedLite;
  93 + data['reserve_mode'] = this.reserveMode;
  94 + data['is_display_dish'] = this.isDisplayDish;
  95 + data['is_new_template'] = this.isNewTemplate;
  96 + data['cook_style'] = this.cookStyle;
  97 + data['cdate'] = this.cdate;
  98 + return data;
  99 + }
  100 +}
  101 +
  102 +class AllCookStyle {
  103 + String menuThemeColor;
  104 + String index;
  105 +
  106 + AllCookStyle({
  107 + this.menuThemeColor,
  108 + this.index,
  109 + });
  110 +
  111 + AllCookStyle.fromJson(Map<String, dynamic> json) {
  112 + menuThemeColor = json['menu_theme_color'];
  113 + index = json['index'] ?? "0";
  114 + }
  115 +
  116 + Map<String, dynamic> toJson() {
  117 + final Map<String, dynamic> data = new Map<String, dynamic>();
  118 + data['menu_theme_color'] = this.menuThemeColor;
  119 + data['index'] = this.index ?? '0';
  120 + return data;
  121 + }
  122 +}
@@ -2,6 +2,8 @@ import 'package:flutter/material.dart'; @@ -2,6 +2,8 @@ import 'package:flutter/material.dart';
2 import 'package:one_key/models/radio_model.dart'; 2 import 'package:one_key/models/radio_model.dart';
3 import 'package:one_key/utils/utils.dart'; 3 import 'package:one_key/utils/utils.dart';
4 4
  5 +import 'dart:convert' as convert;
  6 +
5 ///菜单 7 ///菜单
6 8
7 class MenuModel { 9 class MenuModel {
@@ -115,29 +117,29 @@ class MenuSunModel { @@ -115,29 +117,29 @@ class MenuSunModel {
115 TextEditingController amountC = TextEditingController(); 117 TextEditingController amountC = TextEditingController();
116 int moreSum = 0; //排菜编辑页展示选中总数 118 int moreSum = 0; //排菜编辑页展示选中总数
117 119
118 - String nameType = '3'; //1左侧,2右侧,3顶部分开  
119 - String imageType = '1'; //1大图,2小图 120 + // String nameType = '3'; //1左侧,2右侧,3顶部分开
  121 + // String imageType = '1'; //1大图,2小图
120 int sort; 122 int sort;
121 int indexNew; 123 int indexNew;
122 124
123 String taste; 125 String taste;
124 String cooks; 126 String cooks;
125 - String cookStyle; 127 + DishCookStyle cookStyle;
126 128
127 //名称样式选择数组 129 //名称样式选择数组
128 List<RadioModel> get nameTypeList { 130 List<RadioModel> get nameTypeList {
129 RadioModel radioModel1 = RadioModel(); 131 RadioModel radioModel1 = RadioModel();
130 radioModel1.title = '菜品名称(味型/烹调)及价格在顶部左侧'; 132 radioModel1.title = '菜品名称(味型/烹调)及价格在顶部左侧';
131 radioModel1.code = '1'; 133 radioModel1.code = '1';
132 - radioModel1.select = nameType == radioModel1.code ? true : false; 134 + radioModel1.select = cookStyle.nameType == radioModel1.code ? true : false;
133 RadioModel radioModel2 = RadioModel(); 135 RadioModel radioModel2 = RadioModel();
134 radioModel2.title = '菜品名称(味型/烹调)及价格在顶部右侧'; 136 radioModel2.title = '菜品名称(味型/烹调)及价格在顶部右侧';
135 radioModel2.code = '2'; 137 radioModel2.code = '2';
136 - radioModel2.select = nameType == radioModel2.code ? true : false; 138 + radioModel2.select = cookStyle.nameType == radioModel2.code ? true : false;
137 RadioModel radioModel3 = RadioModel(); 139 RadioModel radioModel3 = RadioModel();
138 radioModel3.title = '菜品名称(味型/烹调)及价格在顶部分开'; 140 radioModel3.title = '菜品名称(味型/烹调)及价格在顶部分开';
139 radioModel3.code = '3'; 141 radioModel3.code = '3';
140 - radioModel3.select = nameType == radioModel3.code ? true : false; 142 + radioModel3.select = cookStyle.nameType == radioModel3.code ? true : false;
141 return [radioModel1, radioModel2, radioModel3]; 143 return [radioModel1, radioModel2, radioModel3];
142 } 144 }
143 145
@@ -146,11 +148,11 @@ class MenuSunModel { @@ -146,11 +148,11 @@ class MenuSunModel {
146 RadioModel radioModel1 = RadioModel(); 148 RadioModel radioModel1 = RadioModel();
147 radioModel1.title = '大图展示菜品'; 149 radioModel1.title = '大图展示菜品';
148 radioModel1.code = '1'; 150 radioModel1.code = '1';
149 - radioModel1.select = imageType == radioModel1.code ? true : false; 151 + radioModel1.select = cookStyle.imageType == radioModel1.code ? true : false;
150 RadioModel radioModel2 = RadioModel(); 152 RadioModel radioModel2 = RadioModel();
151 radioModel2.title = '小图展示菜品'; 153 radioModel2.title = '小图展示菜品';
152 radioModel2.code = '2'; 154 radioModel2.code = '2';
153 - radioModel2.select = imageType == radioModel2.code ? true : false; 155 + radioModel2.select = cookStyle.imageType == radioModel2.code ? true : false;
154 156
155 return [radioModel1, radioModel2]; 157 return [radioModel1, radioModel2];
156 } 158 }
@@ -200,8 +202,6 @@ class MenuSunModel { @@ -200,8 +202,6 @@ class MenuSunModel {
200 this.amount = 0, 202 this.amount = 0,
201 this.cookList, 203 this.cookList,
202 this.amountC, 204 this.amountC,
203 - this.nameType,  
204 - this.imageType,  
205 this.sort, 205 this.sort,
206 this.taste, 206 this.taste,
207 this.cooks, 207 this.cooks,
@@ -263,14 +263,22 @@ class MenuSunModel { @@ -263,14 +263,22 @@ class MenuSunModel {
263 } 263 }
264 // imageType = Utils.randomGet(1, 3) ?? '1'; 264 // imageType = Utils.randomGet(1, 3) ?? '1';
265 // nameType = Utils.randomGet(1, 4) ?? '3'; 265 // nameType = Utils.randomGet(1, 4) ?? '3';
266 - imageType = name == '小炒肉' || name == '水煮肉片' || name == '西湖牛肉羹' ? '2' : '1';  
267 - nameType = '1'; 266 + // imageType = name == '小炒肉' || name == '水煮肉片' || name == '西湖牛肉羹' ? '2' : '1';
  267 + // nameType = '1';
268 268
269 sort = json['sort']; 269 sort = json['sort'];
270 270
271 taste = json['taste']; 271 taste = json['taste'];
272 cooks = json['cooks']; 272 cooks = json['cooks'];
273 - cookStyle = json['cook_style']; 273 + json['cook_style'] != null && json['cook_style'] != ''
  274 + ? cookStyle = DishCookStyle.fromJson(json['cook_style'] is Map
  275 + ? json['cook_style']
  276 + : convert.json.decode(json['cook_style']))
  277 + : cookStyle = DishCookStyle.fromJson({
  278 + // 'image_type': image != null && image != '' ? '1' : '2',
  279 + 'image_type': '1',
  280 + 'name_type': '3'
  281 + });
274 } 282 }
275 283
276 MenuSunModel.fromJson3(Map<String, dynamic> json) { 284 MenuSunModel.fromJson3(Map<String, dynamic> json) {
@@ -328,7 +336,15 @@ class MenuSunModel { @@ -328,7 +336,15 @@ class MenuSunModel {
328 } 336 }
329 taste = json['taste']; 337 taste = json['taste'];
330 cooks = json['cooks']; 338 cooks = json['cooks'];
331 - cookStyle = json['cook_style']; 339 + json['cook_style'] != null && json['cook_style'] != ''
  340 + ? cookStyle = DishCookStyle.fromJson(json['cook_style'] is Map
  341 + ? json['cook_style']
  342 + : convert.json.decode(json['cook_style']))
  343 + : cookStyle = DishCookStyle.fromJson({
  344 + // 'image_type': image != null && image != '' ? '1' : '2',
  345 + 'image_type': '1',
  346 + 'name_type': '3'
  347 + });
332 } 348 }
333 349
334 MenuSunModel.fromJson2(Map<String, dynamic> json) { 350 MenuSunModel.fromJson2(Map<String, dynamic> json) {
@@ -386,7 +402,15 @@ class MenuSunModel { @@ -386,7 +402,15 @@ class MenuSunModel {
386 } 402 }
387 taste = json['taste']; 403 taste = json['taste'];
388 cooks = json['cooks']; 404 cooks = json['cooks'];
389 - cookStyle = json['cook_style']; 405 + json['cook_style'] != null && json['cook_style'] != ''
  406 + ? cookStyle = DishCookStyle.fromJson(json['cook_style'] is Map
  407 + ? json['cook_style']
  408 + : convert.json.decode(json['cook_style']))
  409 + : cookStyle = DishCookStyle.fromJson({
  410 + // 'image_type': image != null && image != '' ? '1' : '2',
  411 + 'image_type': '1',
  412 + 'name_type': '3'
  413 + });
390 } 414 }
391 415
392 Map<String, dynamic> toJson() { 416 Map<String, dynamic> toJson() {
@@ -511,3 +535,22 @@ class PracticeModel { @@ -511,3 +535,22 @@ class PracticeModel {
511 return data; 535 return data;
512 } 536 }
513 } 537 }
  538 +
  539 +class DishCookStyle {
  540 + String imageType; //1大图,2小图
  541 + String nameType; //1左侧,2右侧,3顶部分开
  542 +
  543 + DishCookStyle({this.imageType, this.nameType});
  544 +
  545 + DishCookStyle.fromJson(Map<String, dynamic> json) {
  546 + imageType = json['image_type'];
  547 + nameType = json['name_type'];
  548 + }
  549 +
  550 + Map<String, dynamic> toJson() {
  551 + final Map<String, dynamic> data = new Map<String, dynamic>();
  552 + data['image_type'] = this.imageType;
  553 + data['name_type'] = this.nameType;
  554 + return data;
  555 + }
  556 +}
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 import 'package:one_key/models/cookbook_model.dart';
  3 +import 'dart:convert' as convert;
3 4
4 part 'cookbook_one_model.g.dart'; 5 part 'cookbook_one_model.g.dart';
5 6
@@ -107,36 +108,36 @@ class CookbookOneSunModel extends Object { @@ -107,36 +108,36 @@ class CookbookOneSunModel extends Object {
107 String cooks; 108 String cooks;
108 109
109 @JsonKey(name: 'cook_style') 110 @JsonKey(name: 'cook_style')
110 - String cookStyle; 111 + DishCookStyle cookStyle;
111 112
112 @JsonKey(name: 'desc') 113 @JsonKey(name: 'desc')
113 String desc; 114 String desc;
114 115
115 CookbookOneSunModel( 116 CookbookOneSunModel(
116 - this.id,  
117 - this.sellerid,  
118 - this.cid,  
119 - this.unit,  
120 - this.name,  
121 - this.price,  
122 - this.firstName,  
123 - this.channel,  
124 - this.status,  
125 - this.give,  
126 - this.image,  
127 - this.orderO,  
128 - this.cdate,  
129 - this.className,  
130 - this.classOrder,  
131 - this.attr,  
132 - this.spec,  
133 - this.practice,  
134 - this.taste,  
135 - this.cooks,  
136 - this.cookStyle,  
137 - this.desc  
138 - // this.template,  
139 - ); 117 + this.id,
  118 + this.sellerid,
  119 + this.cid,
  120 + this.unit,
  121 + this.name,
  122 + this.price,
  123 + this.firstName,
  124 + this.channel,
  125 + this.status,
  126 + this.give,
  127 + this.image,
  128 + this.orderO,
  129 + this.cdate,
  130 + this.className,
  131 + this.classOrder,
  132 + this.attr,
  133 + this.spec,
  134 + this.practice,
  135 + this.taste,
  136 + this.cooks,
  137 + this.cookStyle,
  138 + this.desc
  139 + // this.template,
  140 + );
140 141
141 factory CookbookOneSunModel.fromJson(Map<String, dynamic> srcJson) => 142 factory CookbookOneSunModel.fromJson(Map<String, dynamic> srcJson) =>
142 _$CookbookOneSunModelFromJson(srcJson); 143 _$CookbookOneSunModelFromJson(srcJson);
@@ -64,7 +64,7 @@ CookbookOneSunModel _$CookbookOneSunModelFromJson(Map<String, dynamic> json) { @@ -64,7 +64,7 @@ CookbookOneSunModel _$CookbookOneSunModelFromJson(Map<String, dynamic> json) {
64 ?.toList(), 64 ?.toList(),
65 json['taste'] as String, 65 json['taste'] as String,
66 json['cooks'] as String, 66 json['cooks'] as String,
67 - json['cook_style'] as String, 67 + DishCookStyle.fromJson(convert.json.decode(json['cook_style'])),
68 json['desc'] as String, 68 json['desc'] as String,
69 ); 69 );
70 } 70 }
@@ -424,18 +424,13 @@ class HttpUrl { @@ -424,18 +424,13 @@ class HttpUrl {
424 static const String add_practice = 424 static const String add_practice =
425 "?service=Android.Seller.AddPractice"; // 商家添加做法 425 "?service=Android.Seller.AddPractice"; // 商家添加做法
426 426
427 -  
428 static const String add_unit_value = 427 static const String add_unit_value =
429 "?service=App.Seller.AddUnitValue"; // 添加商家计价单位 428 "?service=App.Seller.AddUnitValue"; // 添加商家计价单位
430 429
431 -  
432 static const String del_unit_value = 430 static const String del_unit_value =
433 "?service=App.Seller.DelUnitValue"; // 删除商家计价单位 431 "?service=App.Seller.DelUnitValue"; // 删除商家计价单位
434 432
435 -  
436 -  
437 -  
438 -  
439 - 433 + static const String get_dz_seller_conf =
  434 + "?service=App.Seller.GetDzSellerConf"; // 获取商家订座配置
440 435
441 } 436 }
@@ -740,16 +740,16 @@ class _MarkingInteractionPageState extends State<MarkingInteractionPage> { @@ -740,16 +740,16 @@ class _MarkingInteractionPageState extends State<MarkingInteractionPage> {
740 // onPressed: () {}, 740 // onPressed: () {},
741 // )), 741 // )),
742 // VEmptyView(18), 742 // VEmptyView(18),
743 - Container(  
744 - height: w(28),  
745 - alignment: Alignment.center,  
746 - child: Text(  
747 - Provider.of<UserModel>(context, listen: false).user.sellername,  
748 - style:  
749 - TextStyle(fontSize: font(14), color: MyColours.color_515151),  
750 - ),  
751 - ),  
752 - VEmptyView(20) 743 + // Container(
  744 + // height: w(28),
  745 + // alignment: Alignment.center,
  746 + // child: Text(
  747 + // Provider.of<UserModel>(context, listen: false).user.sellername,
  748 + // style:
  749 + // TextStyle(fontSize: font(14), color: MyColours.color_515151),
  750 + // ),
  751 + // ),
  752 + // VEmptyView(20)
753 ])); 753 ]));
754 } 754 }
755 755
@@ -1425,15 +1425,15 @@ class _MarkingPreviewPageState extends State<MarkingPreviewPage> { @@ -1425,15 +1425,15 @@ class _MarkingPreviewPageState extends State<MarkingPreviewPage> {
1425 )) 1425 ))
1426 : SizedBox(), 1426 : SizedBox(),
1427 VEmptyView(18), 1427 VEmptyView(18),
1428 - Container(  
1429 - height: w(28),  
1430 - alignment: Alignment.center,  
1431 - child: Text(  
1432 - Provider.of<UserModel>(context, listen: false).user.sellername,  
1433 - style: TextStyle(fontSize: font(14), color: MyColours.color_515151),  
1434 - ),  
1435 - ),  
1436 - VEmptyView(20) 1428 + // Container(
  1429 + // height: w(28),
  1430 + // alignment: Alignment.center,
  1431 + // child: Text(
  1432 + // Provider.of<UserModel>(context, listen: false).user.sellername,
  1433 + // style: TextStyle(fontSize: font(14), color: MyColours.color_515151),
  1434 + // ),
  1435 + // ),
  1436 + // VEmptyView(20)
1437 ], 1437 ],
1438 ); 1438 );
1439 } 1439 }
@@ -47,11 +47,17 @@ class _MenuManagePageState extends State<MenuManagePage> { @@ -47,11 +47,17 @@ class _MenuManagePageState extends State<MenuManagePage> {
47 WidgetsBinding.instance.addPostFrameCallback((timeStamp) { 47 WidgetsBinding.instance.addPostFrameCallback((timeStamp) {
48 _getCookbookByClass(showLoading: false); 48 _getCookbookByClass(showLoading: false);
49 _getCookbookBySellerId(); 49 _getCookbookBySellerId();
  50 + _getDzSellerConf();
50 }); 51 });
51 EventBus().on('menu_manage_page', (arg) { 52 EventBus().on('menu_manage_page', (arg) {
52 _getCookbookByClass(showLoading: false); 53 _getCookbookByClass(showLoading: false);
53 _getCookbookBySellerId(); 54 _getCookbookBySellerId();
54 }); 55 });
  56 + EventBus().on('menu_theme_color', (arg) {
  57 + print(arg);
  58 + themeColerModel1 = themeColorData[arg];
  59 + setState(() {});
  60 + });
55 } 61 }
56 62
57 @override 63 @override
@@ -59,6 +65,7 @@ class _MenuManagePageState extends State<MenuManagePage> { @@ -59,6 +65,7 @@ class _MenuManagePageState extends State<MenuManagePage> {
59 // TODO: implement dispose 65 // TODO: implement dispose
60 super.dispose(); 66 super.dispose();
61 EventBus().off('menu_manage_page'); 67 EventBus().off('menu_manage_page');
  68 + EventBus().off('menu_theme_color');
62 } 69 }
63 70
64 ///初始化主题颜色 71 ///初始化主题颜色
@@ -99,7 +106,15 @@ class _MenuManagePageState extends State<MenuManagePage> { @@ -99,7 +106,15 @@ class _MenuManagePageState extends State<MenuManagePage> {
99 colorModel4.name = '国风绿'; 106 colorModel4.name = '国风绿';
100 colorModel4.color = MyColours.color_3E6F51; 107 colorModel4.color = MyColours.color_3E6F51;
101 themeColorData.add(colorModel4); 108 themeColorData.add(colorModel4);
102 - themeColerModel1 = themeColorData[4]; 109 + themeColerModel1 = themeColorData[0];
  110 + }
  111 +
  112 + _getDzSellerConf() async {
  113 + bool success = await menuManageProvider.getDzSellerConf(context);
  114 + if (success) {
  115 + themeColerModel1 = themeColorData[
  116 + int.parse(menuManageProvider.dzSellerConfModel.cookStyle.index)];
  117 + }
103 } 118 }
104 119
105 ///获取分类数据 120 ///获取分类数据
@@ -175,7 +190,7 @@ class _MenuManagePageState extends State<MenuManagePage> { @@ -175,7 +190,7 @@ class _MenuManagePageState extends State<MenuManagePage> {
175 j++) { 190 j++) {
176 MenuSunModel menuSunModel = 191 MenuSunModel menuSunModel =
177 menuManageProvider.menuModel[i].cookbooklist[j]; 192 menuManageProvider.menuModel[i].cookbooklist[j];
178 - if (menuSunModel.imageType == '1') { 193 + if (menuSunModel.cookStyle.imageType == '1') {
179 //大图 194 //大图
180 menuSunModel.indexNew = j; 195 menuSunModel.indexNew = j;
181 listSub.add(menuSunModel); 196 listSub.add(menuSunModel);
@@ -184,7 +199,7 @@ class _MenuManagePageState extends State<MenuManagePage> { @@ -184,7 +199,7 @@ class _MenuManagePageState extends State<MenuManagePage> {
184 //判断下一个是大图还是小图 199 //判断下一个是大图还是小图
185 if (menuManageProvider.menuModel[i].cookbooklist.length - 1 > j) { 200 if (menuManageProvider.menuModel[i].cookbooklist.length - 1 > j) {
186 if (menuManageProvider 201 if (menuManageProvider
187 - .menuModel[i].cookbooklist[j + 1].imageType == 202 + .menuModel[i].cookbooklist[j + 1].cookStyle.imageType ==
188 '1') { 203 '1') {
189 //下一个是大图 204 //下一个是大图
190 menuSunModel.indexNew = j; 205 menuSunModel.indexNew = j;
@@ -645,15 +660,15 @@ class _MenuManagePageState extends State<MenuManagePage> { @@ -645,15 +660,15 @@ class _MenuManagePageState extends State<MenuManagePage> {
645 if (object['name_type'] != null) { 660 if (object['name_type'] != null) {
646 //有一个选中 661 //有一个选中
647 662
648 - model.nameType = object['name_type']; 663 + model.cookStyle.nameType = object['name_type'];
649 } else { 664 } else {
650 //全部不选择 665 //全部不选择
651 - model.nameType = null; 666 + model.cookStyle.nameType = null;
652 } 667 }
653 if (object['image_type'] != null) { 668 if (object['image_type'] != null) {
654 - model.imageType = object['image_type']; 669 + model.cookStyle.imageType = object['image_type'];
655 } else { 670 } else {
656 - model.imageType = null; 671 + model.cookStyle.imageType = null;
657 } 672 }
658 if (object['move'] != null) { 673 if (object['move'] != null) {
659 if (object['move'] == '1' && model.indexNew != 0) { 674 if (object['move'] == '1' && model.indexNew != 0) {
@@ -685,8 +700,7 @@ class _MenuManagePageState extends State<MenuManagePage> { @@ -685,8 +700,7 @@ class _MenuManagePageState extends State<MenuManagePage> {
685 700
686 Map cookStyle = { 701 Map cookStyle = {
687 'name_type': object['name_type'], 702 'name_type': object['name_type'],
688 - 'image_type': '',  
689 - 'sort': '' 703 + 'image_type': object['image_type'],
690 }; 704 };
691 _setCookbookById(model.id, cookStyle); 705 _setCookbookById(model.id, cookStyle);
692 } 706 }
@@ -887,7 +901,7 @@ class _MenuManagePageState extends State<MenuManagePage> { @@ -887,7 +901,7 @@ class _MenuManagePageState extends State<MenuManagePage> {
887 .menuModel[indexOut] 901 .menuModel[indexOut]
888 .cookbooklistShow[index]; 902 .cookbooklistShow[index];
889 903
890 - if (model.imageType == '2') { 904 + if (model.cookStyle.imageType == '2') {
891 //小图 905 //小图
892 return GestureDetector( 906 return GestureDetector(
893 onTap: () async { 907 onTap: () async {
@@ -947,13 +961,18 @@ class _MenuManagePageState extends State<MenuManagePage> { @@ -947,13 +961,18 @@ class _MenuManagePageState extends State<MenuManagePage> {
947 bottom: (w(2))), 961 bottom: (w(2))),
948 child: Column( 962 child: Column(
949 crossAxisAlignment: model 963 crossAxisAlignment: model
  964 + .cookStyle
950 .imageType != 965 .imageType !=
951 '2' && 966 '2' &&
952 - model.nameType == '1' 967 + model.cookStyle
  968 + .nameType ==
  969 + '1'
953 ? CrossAxisAlignment.start 970 ? CrossAxisAlignment.start
954 - : model.imageType != 971 + : model.cookStyle
  972 + .imageType !=
955 '2' && 973 '2' &&
956 - model.nameType == 974 + model.cookStyle
  975 + .nameType ==
957 '2' 976 '2'
958 ? CrossAxisAlignment 977 ? CrossAxisAlignment
959 .end 978 .end
@@ -967,20 +986,23 @@ class _MenuManagePageState extends State<MenuManagePage> { @@ -967,20 +986,23 @@ class _MenuManagePageState extends State<MenuManagePage> {
967 left: w(20), 986 left: w(20),
968 right: w(20), 987 right: w(20),
969 bottom: w(15)), 988 bottom: w(15)),
970 - child: model.imageType != 989 + child: model.cookStyle
  990 + .imageType !=
971 '2' && 991 '2' &&
972 - model.nameType == 992 + model.cookStyle
  993 + .nameType ==
973 '3' 994 '3'
974 ? _topBetween(model) 995 ? _topBetween(model)
975 - : model.imageType != 996 + : model.cookStyle.imageType !=
976 '2' && 997 '2' &&
977 - model.nameType == 998 + model.cookStyle
  999 + .nameType ==
978 '2' 1000 '2'
979 ? _topRight( 1001 ? _topRight(
980 model) 1002 model)
981 - : model.imageType != 1003 + : model.cookStyle.imageType !=
982 '2' && 1004 '2' &&
983 - model.nameType == 1005 + model.cookStyle.nameType ==
984 '1' 1006 '1'
985 ? _topLeft( 1007 ? _topLeft(
986 model) 1008 model)
@@ -28,6 +28,7 @@ import '../../../../widgets/MyDivider.dart'; @@ -28,6 +28,7 @@ import '../../../../widgets/MyDivider.dart';
28 import '../../../../widgets/round_button.dart'; 28 import '../../../../widgets/round_button.dart';
29 import '../../../constant/state.dart'; 29 import '../../../constant/state.dart';
30 import '../../../models/cookbook_model.dart'; 30 import '../../../models/cookbook_model.dart';
  31 +import '../../../utils/event_bus.dart';
31 import '../../../widgets/h_empty_view.dart'; 32 import '../../../widgets/h_empty_view.dart';
32 import '../../../widgets/page_exception.dart'; 33 import '../../../widgets/page_exception.dart';
33 import '../../online_check/photo_view_wiget.dart'; 34 import '../../online_check/photo_view_wiget.dart';
@@ -60,6 +61,8 @@ class _MenuThemeColorSetPageState extends State<MenuThemeColorSetPage> { @@ -60,6 +61,8 @@ class _MenuThemeColorSetPageState extends State<MenuThemeColorSetPage> {
60 61
61 List<MenuModel> menuModelTemp = []; 62 List<MenuModel> menuModelTemp = [];
62 63
  64 + MenuManageProvider menuManageProvider;
  65 +
63 @override 66 @override
64 void initState() { 67 void initState() {
65 super.initState(); 68 super.initState();
@@ -243,7 +246,7 @@ class _MenuThemeColorSetPageState extends State<MenuThemeColorSetPage> { @@ -243,7 +246,7 @@ class _MenuThemeColorSetPageState extends State<MenuThemeColorSetPage> {
243 // } 246 // }
244 for (int j = 0; j < widget.menuModel[i].cookbooklist.length; j++) { 247 for (int j = 0; j < widget.menuModel[i].cookbooklist.length; j++) {
245 MenuSunModel menuSunModel = widget.menuModel[i].cookbooklist[j]; 248 MenuSunModel menuSunModel = widget.menuModel[i].cookbooklist[j];
246 - if (menuSunModel.imageType == '1') { 249 + if (menuSunModel.cookStyle.imageType == '1') {
247 //大图 250 //大图
248 menuSunModel.indexNew = j; 251 menuSunModel.indexNew = j;
249 listSub.add(menuSunModel); 252 listSub.add(menuSunModel);
@@ -251,7 +254,8 @@ class _MenuThemeColorSetPageState extends State<MenuThemeColorSetPage> { @@ -251,7 +254,8 @@ class _MenuThemeColorSetPageState extends State<MenuThemeColorSetPage> {
251 //小图 254 //小图
252 //判断下一个是大图还是小图 255 //判断下一个是大图还是小图
253 if (widget.menuModel[i].cookbooklist.length - 1 > j) { 256 if (widget.menuModel[i].cookbooklist.length - 1 > j) {
254 - if (widget.menuModel[i].cookbooklist[j + 1].imageType == '1') { 257 + if (widget.menuModel[i].cookbooklist[j + 1].cookStyle.imageType ==
  258 + '1') {
255 //下一个是大图 259 //下一个是大图
256 menuSunModel.indexNew = j; 260 menuSunModel.indexNew = j;
257 listSub.add(menuSunModel); 261 listSub.add(menuSunModel);
@@ -301,40 +305,111 @@ class _MenuThemeColorSetPageState extends State<MenuThemeColorSetPage> { @@ -301,40 +305,111 @@ class _MenuThemeColorSetPageState extends State<MenuThemeColorSetPage> {
301 spreadRadius: w(20)) 305 spreadRadius: w(20))
302 ]), 306 ]),
303 ), 307 ),
  308 + if ((model.taste != null &&
  309 + model.taste != '' &&
  310 + model.cooks != null &&
  311 + model.cooks != '') ||
  312 + (model.taste != null && model.taste != '') ||
  313 + (model.cooks != null && model.cooks != ''))
  314 + VEmptyView(20),
  315 + if ((model.taste != null &&
  316 + model.taste != '' &&
  317 + model.cooks != null &&
  318 + model.cooks != '') ||
  319 + (model.taste != null && model.taste != '') ||
  320 + (model.cooks != null && model.cooks != ''))
  321 + VEmptyView(20),
  322 + if ((model.taste != null &&
  323 + model.taste != '' &&
  324 + model.cooks != null &&
  325 + model.cooks != '') ||
  326 + (model.taste != null && model.taste != '') ||
  327 + (model.cooks != null && model.cooks != ''))
  328 + VEmptyView(20),
  329 + if ((model.taste != null &&
  330 + model.taste != '' &&
  331 + model.cooks != null &&
  332 + model.cooks != '') ||
  333 + (model.taste != null && model.taste != '') ||
  334 + (model.cooks != null && model.cooks != ''))
  335 + Text(
  336 + model.taste != null &&
  337 + model.taste != '' &&
  338 + model.cooks != null &&
  339 + model.cooks != ''
  340 + ? '味型:${model.taste} 烹调:${model.cooks}'
  341 + : model.taste != null && model.taste != ''
  342 + ? '味型:${model.taste}'
  343 + : model.cooks != null && model.cooks != ''
  344 + ? '味型:${model.taste} 烹调:${model.cooks}'
  345 + : '',
  346 + style: TextStyle(
  347 + fontWeight: FontWeight.bold,
  348 + fontSize: font(12),
  349 + color: MyColours.color_515151,
  350 + shadows: [
  351 + BoxShadow(
  352 + color: MyColours.color_FBF6F1,
  353 + offset: Offset(0, 1),
  354 + blurRadius: w(2),
  355 + spreadRadius: w(20))
  356 + ])),
304 VEmptyView(20), 357 VEmptyView(20),
305 - Text('味型:咸鲜 烹调:熬煮',  
306 - style: TextStyle(  
307 - fontWeight: FontWeight.bold,  
308 - fontSize: font(12),  
309 - color: MyColours.color_515151,  
310 - shadows: [  
311 - BoxShadow(  
312 - color: MyColours.color_FBF6F1,  
313 - offset: Offset(0, 1),  
314 - blurRadius: w(2),  
315 - spreadRadius: w(20))  
316 - ])),  
317 - VEmptyView(20),  
318 - Text(  
319 - '¥${model.price}/${model.unit} 会员 ¥${model.price}/${model.unit} ',  
320 - textAlign: TextAlign.right,  
321 - style: TextStyle(  
322 - fontWeight: FontWeight.bold,  
323 - fontSize: font(14),  
324 - color: MyColours.color_515151,  
325 - shadows: [  
326 - BoxShadow(  
327 - color: MyColours.color_FBF6F1,  
328 - offset: Offset(0, 1),  
329 - blurRadius: w(2),  
330 - spreadRadius: w(20))  
331 - ]),  
332 - ), 358 + model.price == null
  359 + ? Column(children: _priceWidget(model))
  360 + : Text(
  361 + '¥${model.price}/${model.unit} 会员 ¥${model.price}/${model.unit} ',
  362 + textAlign: TextAlign.right,
  363 + style: TextStyle(
  364 + fontWeight: FontWeight.bold,
  365 + fontSize: font(14),
  366 + color: MyColours.color_515151,
  367 + shadows: [
  368 + BoxShadow(
  369 + color: MyColours.color_FBF6F1,
  370 + offset: Offset(0, 1),
  371 + blurRadius: w(2),
  372 + spreadRadius: w(20))
  373 + ]),
  374 + ),
333 ], 375 ],
334 ), 376 ),
335 ); 377 );
336 } 378 }
337 379
  380 + List<Widget> _priceWidget(MenuSunModel model) {
  381 + List<SpecModel> tempPrice = [];
  382 + if (model.price == null) {
  383 + //新添加菜品
  384 + model.spec.forEach((element) {
  385 + if (element.status == '1') {
  386 + //规格启用状态
  387 + tempPrice.add(element);
  388 + }
  389 + });
  390 + }
  391 + List<Widget> textWidgetList = [];
  392 + tempPrice.forEach((element) {
  393 + textWidgetList.add(
  394 + Text(
  395 + '¥${element.price}/${element.specs} 会员 ¥${element.memberPrice ?? ''}/${element.specs} ',
  396 + textAlign: TextAlign.right,
  397 + style: TextStyle(
  398 + fontWeight: FontWeight.bold,
  399 + fontSize: font(14),
  400 + color: MyColours.color_515151,
  401 + shadows: [
  402 + BoxShadow(
  403 + color: MyColours.color_FBF6F1,
  404 + offset: Offset(0, 1),
  405 + blurRadius: w(2),
  406 + spreadRadius: w(20))
  407 + ]),
  408 + ),
  409 + );
  410 + });
  411 + return textWidgetList;
  412 + }
338 413
339 //右边 414 //右边
340 Widget _topRight(MenuSunModel model) { 415 Widget _topRight(MenuSunModel model) {
@@ -356,35 +431,59 @@ class _MenuThemeColorSetPageState extends State<MenuThemeColorSetPage> { @@ -356,35 +431,59 @@ class _MenuThemeColorSetPageState extends State<MenuThemeColorSetPage> {
356 spreadRadius: w(20)) 431 spreadRadius: w(20))
357 ]), 432 ]),
358 ), 433 ),
  434 + if ((model.taste != null &&
  435 + model.taste != '' &&
  436 + model.cooks != null &&
  437 + model.cooks != '') ||
  438 + (model.taste != null && model.taste != '') ||
  439 + (model.cooks != null && model.cooks != ''))
  440 + VEmptyView(20),
  441 + if ((model.taste != null &&
  442 + model.taste != '' &&
  443 + model.cooks != null &&
  444 + model.cooks != '') ||
  445 + (model.taste != null && model.taste != '') ||
  446 + (model.cooks != null && model.cooks != ''))
  447 + Text(
  448 + model.taste != null &&
  449 + model.taste != '' &&
  450 + model.cooks != null &&
  451 + model.cooks != ''
  452 + ? '味型:${model.taste} 烹调:${model.cooks}'
  453 + : model.taste != null && model.taste != ''
  454 + ? '味型:${model.taste}'
  455 + : model.cooks != null && model.cooks != ''
  456 + ? '味型:${model.taste} 烹调:${model.cooks}'
  457 + : '',
  458 + style: TextStyle(
  459 + fontWeight: FontWeight.bold,
  460 + fontSize: font(12),
  461 + color: MyColours.color_515151,
  462 + shadows: [
  463 + BoxShadow(
  464 + color: MyColours.color_FBF6F1,
  465 + offset: Offset(0, 1),
  466 + blurRadius: w(2),
  467 + spreadRadius: w(20))
  468 + ])),
359 VEmptyView(20), 469 VEmptyView(20),
360 - Text('味型:咸鲜 烹调:熬煮',  
361 - style: TextStyle(  
362 - fontWeight: FontWeight.bold,  
363 - fontSize: font(12),  
364 - color: MyColours.color_515151,  
365 - shadows: [  
366 - BoxShadow(  
367 - color: MyColours.color_FBF6F1,  
368 - offset: Offset(0, 1),  
369 - blurRadius: w(2),  
370 - spreadRadius: w(20))  
371 - ])),  
372 - VEmptyView(20),  
373 - Text(  
374 - '¥${model.price}/${model.unit} 会员 ¥${model.price}/${model.unit} ',  
375 - textAlign: TextAlign.right,  
376 - style: TextStyle(  
377 - fontWeight: FontWeight.bold,  
378 - fontSize: font(14),  
379 - color: MyColours.color_515151,  
380 - shadows: [  
381 - BoxShadow(  
382 - color: MyColours.color_FBF6F1,  
383 - offset: Offset(0, 1),  
384 - blurRadius: w(2),  
385 - spreadRadius: w(20))  
386 - ]),  
387 - ), 470 + model.price == null
  471 + ? Column(children: _priceWidget(model))
  472 + : Text(
  473 + '¥${model.price}/${model.unit} 会员 ¥${model.member_price ?? ''}/${model.unit} ',
  474 + textAlign: TextAlign.right,
  475 + style: TextStyle(
  476 + fontWeight: FontWeight.bold,
  477 + fontSize: font(14),
  478 + color: MyColours.color_515151,
  479 + shadows: [
  480 + BoxShadow(
  481 + color: MyColours.color_FBF6F1,
  482 + offset: Offset(0, 1),
  483 + blurRadius: w(2),
  484 + spreadRadius: w(20))
  485 + ]),
  486 + ),
388 ], 487 ],
389 ), 488 ),
390 ); 489 );
@@ -415,38 +514,76 @@ class _MenuThemeColorSetPageState extends State<MenuThemeColorSetPage> { @@ -415,38 +514,76 @@ class _MenuThemeColorSetPageState extends State<MenuThemeColorSetPage> {
415 spreadRadius: w(20)) 514 spreadRadius: w(20))
416 ]), 515 ]),
417 ), 516 ),
418 - VEmptyView(20),  
419 - Text('味型:咸鲜 烹调:熬煮',  
420 - style: TextStyle(  
421 - fontWeight: FontWeight.bold,  
422 - fontSize: font(12),  
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 - ])) 517 + if ((model.taste != null &&
  518 + model.taste != '' &&
  519 + model.cooks != null &&
  520 + model.cooks != '') ||
  521 + (model.taste != null && model.taste != '') ||
  522 + (model.cooks != null && model.cooks != ''))
  523 + VEmptyView(20),
  524 + if ((model.taste != null &&
  525 + model.taste != '' &&
  526 + model.cooks != null &&
  527 + model.cooks != '') ||
  528 + (model.taste != null && model.taste != '') ||
  529 + (model.cooks != null && model.cooks != ''))
  530 + VEmptyView(20),
  531 + if ((model.taste != null &&
  532 + model.taste != '' &&
  533 + model.cooks != null &&
  534 + model.cooks != '') ||
  535 + (model.taste != null && model.taste != '') ||
  536 + (model.cooks != null && model.cooks != ''))
  537 + VEmptyView(20),
  538 + if ((model.taste != null &&
  539 + model.taste != '' &&
  540 + model.cooks != null &&
  541 + model.cooks != '') ||
  542 + (model.taste != null && model.taste != '') ||
  543 + (model.cooks != null && model.cooks != ''))
  544 + Text(
  545 + model.taste != null &&
  546 + model.taste != '' &&
  547 + model.cooks != null &&
  548 + model.cooks != ''
  549 + ? '味型:${model.taste} 烹调:${model.cooks}'
  550 + : model.taste != null && model.taste != ''
  551 + ? '味型:${model.taste}'
  552 + : model.cooks != null && model.cooks != ''
  553 + ? '味型:${model.taste} 烹调:${model.cooks}'
  554 + : '',
  555 + style: TextStyle(
  556 + fontWeight: FontWeight.bold,
  557 + fontSize: font(12),
  558 + color: MyColours.color_515151,
  559 + shadows: [
  560 + BoxShadow(
  561 + color: MyColours.color_FBF6F1,
  562 + offset: Offset(0, 1),
  563 + blurRadius: w(2),
  564 + spreadRadius: w(20))
  565 + ]))
431 ], 566 ],
432 ), 567 ),
433 ), 568 ),
434 HEmptyView(10), 569 HEmptyView(10),
435 - Text(  
436 - '¥${model.price}/${model.unit} 会员 ¥${model.price}/${model.unit} ',  
437 - textAlign: TextAlign.right,  
438 - style: TextStyle(  
439 - fontWeight: FontWeight.bold,  
440 - fontSize: font(14),  
441 - color: MyColours.color_515151,  
442 - shadows: [  
443 - BoxShadow(  
444 - color: MyColours.color_FBF6F1,  
445 - offset: Offset(0, 1),  
446 - blurRadius: w(2),  
447 - spreadRadius: w(20))  
448 - ]),  
449 - ), 570 + model.price == null
  571 + ? Column(children: _priceWidget(model))
  572 + : Text(
  573 + '¥${model.price}/${model.unit} 会员 ¥${model.price}/${model.unit} ',
  574 + textAlign: TextAlign.right,
  575 + style: TextStyle(
  576 + fontWeight: FontWeight.bold,
  577 + fontSize: font(14),
  578 + color: MyColours.color_515151,
  579 + shadows: [
  580 + BoxShadow(
  581 + color: MyColours.color_FBF6F1,
  582 + offset: Offset(0, 1),
  583 + blurRadius: w(2),
  584 + spreadRadius: w(20))
  585 + ]),
  586 + ),
450 ], 587 ],
451 ); 588 );
452 } 589 }
@@ -475,41 +612,64 @@ class _MenuThemeColorSetPageState extends State<MenuThemeColorSetPage> { @@ -475,41 +612,64 @@ class _MenuThemeColorSetPageState extends State<MenuThemeColorSetPage> {
475 spreadRadius: w(20)) 612 spreadRadius: w(20))
476 ]), 613 ]),
477 )), 614 )),
  615 + if ((model.taste != null &&
  616 + model.taste != '' &&
  617 + model.cooks != null &&
  618 + model.cooks != '') ||
  619 + (model.taste != null && model.taste != '') ||
  620 + (model.cooks != null && model.cooks != ''))
  621 + VEmptyView(20),
  622 + if ((model.taste != null &&
  623 + model.taste != '' &&
  624 + model.cooks != null &&
  625 + model.cooks != '') ||
  626 + (model.taste != null && model.taste != '') ||
  627 + (model.cooks != null && model.cooks != ''))
  628 + Padding(
  629 + padding: EdgeInsets.symmetric(horizontal: w(10)),
  630 + child: Text(
  631 + model.taste != null &&
  632 + model.taste != '' &&
  633 + model.cooks != null &&
  634 + model.cooks != ''
  635 + ? '味型:${model.taste} 烹调:${model.cooks}'
  636 + : model.taste != null && model.taste != ''
  637 + ? '味型:${model.taste}'
  638 + : model.cooks != null && model.cooks != ''
  639 + ? '味型:${model.taste} 烹调:${model.cooks}'
  640 + : '',
  641 + style: TextStyle(
  642 + fontWeight: FontWeight.bold,
  643 + fontSize: font(12),
  644 + color: MyColours.color_515151,
  645 + shadows: [
  646 + BoxShadow(
  647 + color: MyColours.color_FBF6F1,
  648 + offset: Offset(0, 1),
  649 + blurRadius: w(2),
  650 + spreadRadius: w(20))
  651 + ]),
  652 + )),
478 VEmptyView(20), 653 VEmptyView(20),
479 Padding( 654 Padding(
480 padding: EdgeInsets.symmetric(horizontal: w(10)), 655 padding: EdgeInsets.symmetric(horizontal: w(10)),
481 - child: Text(  
482 - '味型:咸鲜 烹调:熬煮',  
483 - style: TextStyle(  
484 - fontWeight: FontWeight.bold,  
485 - fontSize: font(12),  
486 - color: MyColours.color_515151,  
487 - shadows: [  
488 - BoxShadow(  
489 - color: MyColours.color_FBF6F1,  
490 - offset: Offset(0, 1),  
491 - blurRadius: w(2),  
492 - spreadRadius: w(20))  
493 - ]),  
494 - )),  
495 - VEmptyView(20),  
496 - Padding(  
497 - padding: EdgeInsets.symmetric(horizontal: w(10)),  
498 - child: Text(  
499 - '¥${model.price}/${model.unit} 会员 ¥${model.price}/${model.unit} ',  
500 - textAlign: TextAlign.right,  
501 - style: TextStyle(  
502 - fontWeight: FontWeight.bold,  
503 - fontSize: font(14),  
504 - color: MyColours.color_515151,  
505 - shadows: [  
506 - BoxShadow(  
507 - color: MyColours.color_FBF6F1,  
508 - offset: Offset(0, 1),  
509 - blurRadius: w(2),  
510 - spreadRadius: w(20))  
511 - ]),  
512 - )), 656 + child: model.price == null
  657 + ? Column(children: _priceWidget(model))
  658 + : Text(
  659 + '¥${model.price}/${model.unit} 会员 ¥${model.member_price}/${model.unit} ',
  660 + textAlign: TextAlign.right,
  661 + style: TextStyle(
  662 + fontWeight: FontWeight.bold,
  663 + fontSize: font(14),
  664 + color: MyColours.color_515151,
  665 + shadows: [
  666 + BoxShadow(
  667 + color: MyColours.color_FBF6F1,
  668 + offset: Offset(0, 1),
  669 + blurRadius: w(2),
  670 + spreadRadius: w(20))
  671 + ]),
  672 + )),
513 VEmptyView(30), 673 VEmptyView(30),
514 if (model.image != null) 674 if (model.image != null)
515 CachedNetworkImage( 675 CachedNetworkImage(
@@ -518,11 +678,11 @@ class _MenuThemeColorSetPageState extends State<MenuThemeColorSetPage> { @@ -518,11 +678,11 @@ class _MenuThemeColorSetPageState extends State<MenuThemeColorSetPage> {
518 width: ScreenUtil().screenWidth / 2, 678 width: ScreenUtil().screenWidth / 2,
519 height: w(125), 679 height: w(125),
520 ), 680 ),
521 - if (true) 681 + if (model.desc != null && model.desc != '')
522 Padding( 682 Padding(
523 padding: EdgeInsets.symmetric(horizontal: w(10), vertical: w(10)), 683 padding: EdgeInsets.symmetric(horizontal: w(10), vertical: w(10)),
524 child: Text( 684 child: Text(
525 - '江南传统名菜,口味咸鲜,汤白汁浓,肉质酥肥,笋清香脆嫩,鲜味浓厚。', 685 + model.desc ?? "",
526 style: TextStyle( 686 style: TextStyle(
527 color: themeColerModel.name == '珍珠白' 687 color: themeColerModel.name == '珍珠白'
528 ? MyColours.color_515151 688 ? MyColours.color_515151
@@ -549,7 +709,7 @@ class _MenuThemeColorSetPageState extends State<MenuThemeColorSetPage> { @@ -549,7 +709,7 @@ class _MenuThemeColorSetPageState extends State<MenuThemeColorSetPage> {
549 Widget build(BuildContext context) { 709 Widget build(BuildContext context) {
550 ThemeColorModel themeColerModel = themeColorData[themeColorIndex]; 710 ThemeColorModel themeColerModel = themeColorData[themeColorIndex];
551 711
552 - // menuManageProvider = Provider.of<MenuManageProvider>(context, listen: true); 712 + menuManageProvider = Provider.of<MenuManageProvider>(context, listen: true);
553 713
554 return Scaffold( 714 return Scaffold(
555 backgroundColor: MyColours.color_ffffff, 715 backgroundColor: MyColours.color_ffffff,
@@ -674,7 +834,7 @@ class _MenuThemeColorSetPageState extends State<MenuThemeColorSetPage> { @@ -674,7 +834,7 @@ class _MenuThemeColorSetPageState extends State<MenuThemeColorSetPage> {
674 menuModelTemp[indexOut] 834 menuModelTemp[indexOut]
675 .cookbooklistShow[index]; 835 .cookbooklistShow[index];
676 836
677 - if (model.imageType == '2') { 837 + if (model.cookStyle.imageType == '2') {
678 //小图 838 //小图
679 return Padding( 839 return Padding(
680 padding: 840 padding:
@@ -707,13 +867,17 @@ class _MenuThemeColorSetPageState extends State<MenuThemeColorSetPage> { @@ -707,13 +867,17 @@ class _MenuThemeColorSetPageState extends State<MenuThemeColorSetPage> {
707 margin: 867 margin:
708 EdgeInsets.only(bottom: (w(2))), 868 EdgeInsets.only(bottom: (w(2))),
709 child: Column( 869 child: Column(
710 - crossAxisAlignment: model 870 + crossAxisAlignment: model.cookStyle
711 .imageType != 871 .imageType !=
712 '2' && 872 '2' &&
713 - model.nameType == '1' 873 + model.cookStyle.nameType ==
  874 + '1'
714 ? CrossAxisAlignment.start 875 ? CrossAxisAlignment.start
715 - : model.imageType != '2' &&  
716 - model.nameType == '2' 876 + : model.cookStyle.imageType !=
  877 + '2' &&
  878 + model.cookStyle
  879 + .nameType ==
  880 + '2'
717 ? CrossAxisAlignment.end 881 ? CrossAxisAlignment.end
718 : CrossAxisAlignment.center, 882 : CrossAxisAlignment.center,
719 children: [ 883 children: [
@@ -723,18 +887,25 @@ class _MenuThemeColorSetPageState extends State<MenuThemeColorSetPage> { @@ -723,18 +887,25 @@ class _MenuThemeColorSetPageState extends State<MenuThemeColorSetPage> {
723 left: w(20), 887 left: w(20),
724 right: w(20), 888 right: w(20),
725 bottom: w(15)), 889 bottom: w(15)),
726 - child: model.imageType != 890 + child: model.cookStyle
  891 + .imageType !=
727 '2' && 892 '2' &&
728 - model.nameType == '3' 893 + model.cookStyle
  894 + .nameType ==
  895 + '3'
729 ? _topBetween(model) 896 ? _topBetween(model)
730 - : model.imageType != 897 + : model.cookStyle
  898 + .imageType !=
731 '2' && 899 '2' &&
732 - model.nameType == 900 + model.cookStyle
  901 + .nameType ==
733 '2' 902 '2'
734 ? _topRight(model) 903 ? _topRight(model)
735 - : model.imageType != 904 + : model.cookStyle
  905 + .imageType !=
736 '2' && 906 '2' &&
737 - model.nameType == 907 + model.cookStyle
  908 + .nameType ==
738 '1' 909 '1'
739 ? _topLeft(model) 910 ? _topLeft(model)
740 : _topLeft( 911 : _topLeft(
@@ -746,13 +917,14 @@ class _MenuThemeColorSetPageState extends State<MenuThemeColorSetPage> { @@ -746,13 +917,14 @@ class _MenuThemeColorSetPageState extends State<MenuThemeColorSetPage> {
746 width: double.infinity, 917 width: double.infinity,
747 height: w(250), 918 height: w(250),
748 ), 919 ),
749 - if (true) 920 + if (model.desc != null &&
  921 + model.desc != '')
750 Padding( 922 Padding(
751 padding: EdgeInsets.symmetric( 923 padding: EdgeInsets.symmetric(
752 horizontal: w(16), 924 horizontal: w(16),
753 vertical: w(10)), 925 vertical: w(10)),
754 child: Text( 926 child: Text(
755 - '江南传统名菜,口味咸鲜,汤白汁浓,肉质酥肥,笋清香脆嫩,鲜味浓厚。', 927 + model.desc,
756 style: TextStyle( 928 style: TextStyle(
757 color: themeColerModel 929 color: themeColerModel
758 .name == 930 .name ==
@@ -883,27 +1055,31 @@ class _MenuThemeColorSetPageState extends State<MenuThemeColorSetPage> { @@ -883,27 +1055,31 @@ class _MenuThemeColorSetPageState extends State<MenuThemeColorSetPage> {
883 // App.sp.setInt( 1055 // App.sp.setInt(
884 // "themeColor", themeColorData[themeColorIndex].color.value); 1056 // "themeColor", themeColorData[themeColorIndex].color.value);
885 //接口 1057 //接口
886 - Map homeData = {  
887 - 'theme_color': 1058 + Map menuThemeData = {
  1059 + 'menu_theme_color':
888 themeColorData[themeColorIndex].color.value.toString(), 1060 themeColorData[themeColorIndex].color.value.toString(),
889 'red': themeColorData[themeColorIndex].color.red, 1061 'red': themeColorData[themeColorIndex].color.red,
890 'green': themeColorData[themeColorIndex].color.green, 1062 'green': themeColorData[themeColorIndex].color.green,
891 'blue': themeColorData[themeColorIndex].color.blue, 1063 'blue': themeColorData[themeColorIndex].color.blue,
892 'alpha': themeColorData[themeColorIndex].color.opacity, 1064 'alpha': themeColorData[themeColorIndex].color.opacity,
  1065 + 'index': themeColorIndex.toString()
893 }; 1066 };
  1067 +
  1068 + //调用接口
894 Map<String, String> params = { 1069 Map<String, String> params = {
895 'sid': Provider.of<UserModel>(context, listen: false) 1070 'sid': Provider.of<UserModel>(context, listen: false)
896 .user 1071 .user
897 .sellerid, 1072 .sellerid,
898 - 'home': json.encode(homeData) 1073 + 'key': 'cook_style',
  1074 + 'value': json.encode(menuThemeData)
899 }; 1075 };
900 1076
901 - // bool success = await menuManageProvider  
902 - // .setSellerTemplateConf(context, params, showLoading: true);  
903 - // if (success) {  
904 - // Utils.showToast('保存成功');  
905 - // Navigator.pop(context);  
906 - // } 1077 + bool success =
  1078 + await menuManageProvider.setConfing(context, params);
  1079 + if (success) {
  1080 + Utils.showToast('设置成功!');
  1081 + bus.emit('menu_theme_color', themeColorIndex);
  1082 + }
907 }, 1083 },
908 ), 1084 ),
909 ) 1085 )
@@ -9,8 +9,11 @@ import 'package:one_key/models/cookbook_spec_model.dart'; @@ -9,8 +9,11 @@ import 'package:one_key/models/cookbook_spec_model.dart';
9 import 'package:one_key/net/base_resp.dart'; 9 import 'package:one_key/net/base_resp.dart';
10 import 'package:one_key/net/dio_util.dart'; 10 import 'package:one_key/net/dio_util.dart';
11 import 'package:one_key/net/http_url.dart'; 11 import 'package:one_key/net/http_url.dart';
  12 +import 'package:one_key/provider/user_model.dart';
12 import 'package:one_key/utils/utils.dart'; 13 import 'package:one_key/utils/utils.dart';
  14 +import 'package:provider/provider.dart';
13 15
  16 +import '../models/GetDzSellerConfModel.dart';
14 import '../models/cookbook_practice_model.dart'; 17 import '../models/cookbook_practice_model.dart';
15 18
16 class MenuManageProvider extends ChangeNotifier { 19 class MenuManageProvider extends ChangeNotifier {
@@ -26,6 +29,8 @@ class MenuManageProvider extends ChangeNotifier { @@ -26,6 +29,8 @@ class MenuManageProvider extends ChangeNotifier {
26 PageState pageStatePractice = PageState.Loading; 29 PageState pageStatePractice = PageState.Loading;
27 List<CookbookPracticeSunModel> dataPractice; //做法数据 30 List<CookbookPracticeSunModel> dataPractice; //做法数据
28 31
  32 + GetDzSellerConfSunModel dzSellerConfModel; //商家配置
  33 +
29 /// 获取单个菜品信息 34 /// 获取单个菜品信息
30 getCookbookById(BuildContext context, Map<String, String> params, 35 getCookbookById(BuildContext context, Map<String, String> params,
31 {showLoading = false}) async { 36 {showLoading = false}) async {
@@ -164,6 +169,54 @@ class MenuManageProvider extends ChangeNotifier { @@ -164,6 +169,54 @@ class MenuManageProvider extends ChangeNotifier {
164 notifyListeners(); 169 notifyListeners();
165 } 170 }
166 171
  172 + // 设置订座商家配置信息
  173 + Future<bool> setConfing(BuildContext context, Map<String, String> params,
  174 + {bool showLoading = true}) async {
  175 + BaseResp<dynamic> baseResp = await DioUtil()
  176 + .request<dynamic>(context, Method.get, HttpUrl.set_confing,
  177 + data: params, showLoading: showLoading)
  178 + .catchError((error) {
  179 + print(error.toString());
  180 + Utils.showToast('设置失败,请重试');
  181 + return false;
  182 + });
  183 + if (baseResp.code == Constant.status_success) {
  184 + if (baseResp.data == 0 || baseResp.data == 1) {
  185 + Utils.showToast('设置成功');
  186 + return true;
  187 + } else {
  188 + Utils.showToast('设置失败,请重试');
  189 + }
  190 + } else {
  191 + Utils.showToast(baseResp.msg ?? '设置失败,请重试');
  192 + }
  193 + return false;
  194 + }
  195 +
  196 + // 获取商家订座配置
  197 + Future<bool> getDzSellerConf(BuildContext context,
  198 + {bool showLoading = true}) async {
  199 + Map<String, String> params = {
  200 + 'sid': Provider.of<UserModel>(context, listen: false).user.sellerid
  201 + };
  202 + BaseResp<dynamic> baseResp = await DioUtil()
  203 + .request<dynamic>(context, Method.get, HttpUrl.get_dz_seller_conf,
  204 + data: params, showLoading: showLoading)
  205 + .catchError((error) {
  206 + print(error.toString());
  207 + Utils.showToast('请求失败,请重试');
  208 + return false;
  209 + });
  210 + if (baseResp.code == Constant.status_success) {
  211 + dzSellerConfModel =
  212 + GetDzSellerConfModel.fromJson(baseResp.responseData).data;
  213 + return true;
  214 + } else {
  215 + Utils.showToast(baseResp.msg ?? '设置失败,请重试');
  216 + }
  217 + return false;
  218 + }
  219 +
167 ///分类下所有菜品列表(1.传orderid顾客端获取带订单信息的 否则不传 220 ///分类下所有菜品列表(1.传orderid顾客端获取带订单信息的 否则不传
168 221
169 getCookbookByClass(BuildContext context, Map<String, String> params, 222 getCookbookByClass(BuildContext context, Map<String, String> params,