Commit ebbbaf677ff85f290598d8a8b4e2e9bff05292f7

Authored by wdn127929
1 parent 0e1804ed

差定金、是否可退接口

  1 +class GetSetmealClassByIdModel {
  2 + int ret;
  3 + GetSetmealClassByIdSunModel data;
  4 + String msg;
  5 +
  6 + GetSetmealClassByIdModel({this.ret, this.data, this.msg});
  7 +
  8 + GetSetmealClassByIdModel.fromJson(Map<String, dynamic> json) {
  9 + ret = json['ret'];
  10 + data = json['data'] != null
  11 + ? new GetSetmealClassByIdSunModel.fromJson(json['data'])
  12 + : null;
  13 + msg = json['msg'];
  14 + }
  15 +
  16 + Map<String, dynamic> toJson() {
  17 + final Map<String, dynamic> data = new Map<String, dynamic>();
  18 + data['ret'] = this.ret;
  19 + if (this.data != null) {
  20 + data['data'] = this.data.toJson();
  21 + }
  22 + data['msg'] = this.msg;
  23 + return data;
  24 + }
  25 +}
  26 +
  27 +class GetSetmealClassByIdSunModel {
  28 + String id;
  29 + String sid;
  30 + String mid;
  31 + String className;
  32 + String status;
  33 + Null cdate;
  34 + List<CookById> cook;
  35 +
  36 + GetSetmealClassByIdSunModel(
  37 + {this.id,
  38 + this.sid,
  39 + this.mid,
  40 + this.className,
  41 + this.status,
  42 + this.cdate,
  43 + this.cook});
  44 +
  45 + GetSetmealClassByIdSunModel.fromJson(Map<String, dynamic> json) {
  46 + id = json['id'];
  47 + sid = json['sid'];
  48 + mid = json['mid'];
  49 + className = json['class_name'];
  50 + status = json['status'];
  51 + cdate = json['cdate'];
  52 + if (json['cook'] != null) {
  53 + cook = <CookById>[];
  54 + json['cook'].forEach((v) {
  55 + cook.add(new CookById.fromJson(v));
  56 + });
  57 + }
  58 + }
  59 +
  60 + Map<String, dynamic> toJson() {
  61 + final Map<String, dynamic> data = new Map<String, dynamic>();
  62 + data['id'] = this.id;
  63 + data['sid'] = this.sid;
  64 + data['mid'] = this.mid;
  65 + data['class_name'] = this.className;
  66 + data['status'] = this.status;
  67 + data['cdate'] = this.cdate;
  68 + if (this.cook != null) {
  69 + data['cook'] = this.cook.map((v) => v.toJson()).toList();
  70 + }
  71 + return data;
  72 + }
  73 +}
  74 +
  75 +class CookById {
  76 + String id;
  77 + String sid;
  78 + String cid;
  79 + String mid;
  80 + String cname;
  81 + String spec;
  82 + String isTrim;
  83 + String status;
  84 +
  85 + CookById(
  86 + {this.id,
  87 + this.sid,
  88 + this.cid,
  89 + this.mid,
  90 + this.cname,
  91 + this.spec,
  92 + this.isTrim,
  93 + this.status});
  94 +
  95 + CookById.fromJson(Map<String, dynamic> json) {
  96 + id = json['id'];
  97 + sid = json['sid'];
  98 + cid = json['cid'];
  99 + mid = json['mid'];
  100 + cname = json['cname'];
  101 + spec = json['spec'];
  102 + isTrim = json['is_trim'];
  103 + status = json['status'];
  104 + }
  105 +
  106 + Map<String, dynamic> toJson() {
  107 + final Map<String, dynamic> data = new Map<String, dynamic>();
  108 + data['id'] = this.id;
  109 + data['sid'] = this.sid;
  110 + data['cid'] = this.cid;
  111 + data['mid'] = this.mid;
  112 + data['cname'] = this.cname;
  113 + data['spec'] = this.spec;
  114 + data['is_trim'] = this.isTrim;
  115 + data['status'] = this.status;
  116 + return data;
  117 + }
  118 +}
  1 +class GetSetmealClassModel {
  2 + int ret;
  3 + List<GetSetmealClassSunModel> data;
  4 + String msg;
  5 +
  6 + GetSetmealClassModel({this.ret, this.data, this.msg});
  7 +
  8 + GetSetmealClassModel.fromJson(Map<String, dynamic> json) {
  9 + ret = json['ret'];
  10 + if (json['data'] != null) {
  11 + data = <GetSetmealClassSunModel>[];
  12 + json['data'].forEach((v) {
  13 + data.add(new GetSetmealClassSunModel.fromJson(v));
  14 + });
  15 + }
  16 + msg = json['msg'];
  17 + }
  18 +
  19 + Map<String, dynamic> toJson() {
  20 + final Map<String, dynamic> data = new Map<String, dynamic>();
  21 + data['ret'] = this.ret;
  22 + if (this.data != null) {
  23 + data['data'] = this.data.map((v) => v.toJson()).toList();
  24 + }
  25 + data['msg'] = this.msg;
  26 + return data;
  27 + }
  28 +}
  29 +
  30 +class GetSetmealClassSunModel {
  31 + String id;
  32 + String sid;
  33 + String mid;
  34 + String className;
  35 + String status;
  36 + Null cdate;
  37 + List<Cook> cook;
  38 +
  39 + GetSetmealClassSunModel(
  40 + {this.id,
  41 + this.sid,
  42 + this.mid,
  43 + this.className,
  44 + this.status,
  45 + this.cdate,
  46 + this.cook});
  47 +
  48 + GetSetmealClassSunModel.fromJson(Map<String, dynamic> json) {
  49 + id = json['id'];
  50 + sid = json['sid'];
  51 + mid = json['mid'];
  52 + className = json['class_name'];
  53 + status = json['status'];
  54 + cdate = json['cdate'];
  55 + if (json['cook'] != null) {
  56 + cook = <Cook>[];
  57 + json['cook'].forEach((v) {
  58 + cook.add(new Cook.fromJson(v));
  59 + });
  60 + }
  61 + }
  62 +
  63 + Map<String, dynamic> toJson() {
  64 + final Map<String, dynamic> data = new Map<String, dynamic>();
  65 + data['id'] = this.id;
  66 + data['sid'] = this.sid;
  67 + data['mid'] = this.mid;
  68 + data['class_name'] = this.className;
  69 + data['status'] = this.status;
  70 + data['cdate'] = this.cdate;
  71 + if (this.cook != null) {
  72 + data['cook'] = this.cook.map((v) => v.toJson()).toList();
  73 + }
  74 + return data;
  75 + }
  76 +}
  77 +
  78 +class Cook {
  79 + String id;
  80 + String sid;
  81 + String cid;
  82 + String mid;
  83 + String cname;
  84 + String spec;
  85 + String isTrim;
  86 + String status;
  87 +
  88 + Cook(
  89 + {this.id,
  90 + this.sid,
  91 + this.cid,
  92 + this.mid,
  93 + this.cname,
  94 + this.spec,
  95 + this.isTrim,
  96 + this.status});
  97 +
  98 + Cook.fromJson(Map<String, dynamic> json) {
  99 + id = json['id'];
  100 + sid = json['sid'];
  101 + cid = json['cid'];
  102 + mid = json['mid'];
  103 + cname = json['cname'];
  104 + spec = json['spec'];
  105 + isTrim = json['is_trim'];
  106 + status = json['status'];
  107 + }
  108 +
  109 + Map<String, dynamic> toJson() {
  110 + final Map<String, dynamic> data = new Map<String, dynamic>();
  111 + data['id'] = this.id;
  112 + data['sid'] = this.sid;
  113 + data['cid'] = this.cid;
  114 + data['mid'] = this.mid;
  115 + data['cname'] = this.cname;
  116 + data['spec'] = this.spec;
  117 + data['is_trim'] = this.isTrim;
  118 + data['status'] = this.status;
  119 + return data;
  120 + }
  121 +}
  1 +class OthersetModel {
  2 + int ret;
  3 + List<OthersetSunModel> data;
  4 + String msg;
  5 +
  6 + OthersetModel({this.ret, this.data, this.msg});
  7 +
  8 + OthersetModel.fromJson(Map<String, dynamic> json) {
  9 + ret = json['ret'];
  10 + if (json['data'] != null) {
  11 + data = <OthersetSunModel>[];
  12 + json['data'].forEach((v) {
  13 + data.add(new OthersetSunModel.fromJson(v));
  14 + });
  15 + }
  16 + msg = json['msg'];
  17 + }
  18 +
  19 + Map<String, dynamic> toJson() {
  20 + final Map<String, dynamic> data = new Map<String, dynamic>();
  21 + data['ret'] = this.ret;
  22 + if (this.data != null) {
  23 + data['data'] = this.data.map((v) => v.toJson()).toList();
  24 + }
  25 + data['msg'] = this.msg;
  26 + return data;
  27 + }
  28 +}
  29 +
  30 +class OthersetSunModel {
  31 + String id;
  32 + String sid;
  33 + String otherName;
  34 + String price;
  35 + String spec;
  36 + String bargaining;
  37 +
  38 + OthersetSunModel(
  39 + {this.id,
  40 + this.sid,
  41 + this.otherName,
  42 + this.price,
  43 + this.spec,
  44 + this.bargaining});
  45 +
  46 + OthersetSunModel.fromJson(Map<String, dynamic> json) {
  47 + id = json['id'];
  48 + sid = json['sid'];
  49 + otherName = json['other_name'];
  50 + price = json['price'];
  51 + spec = json['spec'];
  52 + bargaining = json['bargaining'];
  53 + }
  54 +
  55 + Map<String, dynamic> toJson() {
  56 + final Map<String, dynamic> data = new Map<String, dynamic>();
  57 + data['id'] = this.id;
  58 + data['sid'] = this.sid;
  59 + data['other_name'] = this.otherName;
  60 + data['price'] = this.price;
  61 + data['spec'] = this.spec;
  62 + data['bargaining'] = this.bargaining;
  63 + return data;
  64 + }
  65 +}
  1 +class SetMeaByIdModel {
  2 + int ret;
  3 + SetMeaByIdSunModel data;
  4 + String msg;
  5 +
  6 + SetMeaByIdModel({this.ret, this.data, this.msg});
  7 +
  8 + SetMeaByIdModel.fromJson(Map<String, dynamic> json) {
  9 + ret = json['ret'];
  10 + data = json['data'] != null
  11 + ? new SetMeaByIdSunModel.fromJson(json['data'])
  12 + : null;
  13 + msg = json['msg'];
  14 + }
  15 +
  16 + Map<String, dynamic> toJson() {
  17 + final Map<String, dynamic> data = new Map<String, dynamic>();
  18 + data['ret'] = this.ret;
  19 + if (this.data != null) {
  20 + data['data'] = this.data.toJson();
  21 + }
  22 + data['msg'] = this.msg;
  23 + return data;
  24 + }
  25 +}
  26 +
  27 +class SetMeaByIdSunModel {
  28 + String id;
  29 + String sid;
  30 + String mealName;
  31 + String price;
  32 + String bargaining;
  33 + String status;
  34 + Null cdate;
  35 + List<Classify> classify;
  36 + List<Cook> cook;
  37 +
  38 + SetMeaByIdSunModel(
  39 + {this.id,
  40 + this.sid,
  41 + this.mealName,
  42 + this.price,
  43 + this.bargaining,
  44 + this.status,
  45 + this.cdate,
  46 + this.classify,
  47 + this.cook});
  48 +
  49 + SetMeaByIdSunModel.fromJson(Map<String, dynamic> json) {
  50 + id = json['id'];
  51 + sid = json['sid'];
  52 + mealName = json['meal_name'];
  53 + price = json['price'];
  54 + bargaining = json['bargaining'];
  55 + status = json['status'];
  56 + cdate = json['cdate'];
  57 + if (json['class'] != null) {
  58 + classify = <Classify>[];
  59 + json['class'].forEach((v) {
  60 + classify.add(new Classify.fromJson(v));
  61 + });
  62 + }
  63 + if (json['cook'] != null) {
  64 + cook = <Cook>[];
  65 + json['cook'].forEach((v) {
  66 + cook.add(new Cook.fromJson(v));
  67 + });
  68 + }
  69 + }
  70 +
  71 + Map<String, dynamic> toJson() {
  72 + final Map<String, dynamic> data = new Map<String, dynamic>();
  73 + data['id'] = this.id;
  74 + data['sid'] = this.sid;
  75 + data['meal_name'] = this.mealName;
  76 + data['price'] = this.price;
  77 + data['bargaining'] = this.bargaining;
  78 + data['status'] = this.status;
  79 + data['cdate'] = this.cdate;
  80 + if (this.classify != null) {
  81 + data['class'] = this.classify.map((v) => v.toJson()).toList();
  82 + }
  83 + if (this.cook != null) {
  84 + data['cook'] = this.classify.map((v) => v.toJson()).toList();
  85 + }
  86 + return data;
  87 + }
  88 +}
  89 +
  90 +class Classify {
  91 + String id;
  92 + String sid;
  93 + String mid;
  94 + String className;
  95 + String status;
  96 + dynamic cdate;
  97 +
  98 + Classify(
  99 + {this.id, this.sid, this.mid, this.className, this.status, this.cdate});
  100 +
  101 + Classify.fromJson(Map<String, dynamic> json) {
  102 + id = json['id'];
  103 + sid = json['sid'];
  104 + mid = json['mid'];
  105 + className = json['class_name'];
  106 + status = json['status'];
  107 + cdate = json['cdate'];
  108 + }
  109 +
  110 + Map<String, dynamic> toJson() {
  111 + final Map<String, dynamic> data = new Map<String, dynamic>();
  112 + data['id'] = this.id;
  113 + data['sid'] = this.sid;
  114 + data['mid'] = this.mid;
  115 + data['class_name'] = this.className;
  116 + data['status'] = this.status;
  117 + data['cdate'] = this.cdate;
  118 + return data;
  119 + }
  120 +}
  121 +
  122 +class Cook {
  123 + String id;
  124 + String sid;
  125 + String cid;
  126 + String mid;
  127 + String cname;
  128 + String spec;
  129 + String isTrim;
  130 + String status;
  131 +
  132 + Cook(
  133 + {this.id,
  134 + this.sid,
  135 + this.cid,
  136 + this.mid,
  137 + this.cname,
  138 + this.spec,
  139 + this.isTrim,
  140 + this.status});
  141 +
  142 + Cook.fromJson(Map<String, dynamic> json) {
  143 + id = json['id'];
  144 + sid = json['sid'];
  145 + cid = json['cid'];
  146 + mid = json['mid'];
  147 + cname = json['cname'];
  148 + spec = json['spec'];
  149 + isTrim = json['is_trim'];
  150 + status = json['status'];
  151 + }
  152 +
  153 + Map<String, dynamic> toJson() {
  154 + final Map<String, dynamic> data = new Map<String, dynamic>();
  155 + data['id'] = this.id;
  156 + data['sid'] = this.sid;
  157 + data['cid'] = this.cid;
  158 + data['mid'] = this.mid;
  159 + data['cname'] = this.cname;
  160 + data['spec'] = this.spec;
  161 + data['is_trim'] = this.isTrim;
  162 + data['status'] = this.status;
  163 + return data;
  164 + }
  165 +}
  1 +class SetMealModel {
  2 + int ret;
  3 + List<SetMealSunModel> data;
  4 + String msg;
  5 +
  6 + SetMealModel({this.ret, this.data, this.msg});
  7 +
  8 + SetMealModel.fromJson(Map<String, dynamic> json) {
  9 + ret = json['ret'];
  10 + if (json['data'] != null) {
  11 + data = <SetMealSunModel>[];
  12 + json['data'].forEach((v) {
  13 + data.add(new SetMealSunModel.fromJson(v));
  14 + });
  15 + }
  16 + msg = json['msg'];
  17 + }
  18 +
  19 + Map<String, dynamic> toJson() {
  20 + final Map<String, dynamic> data = new Map<String, dynamic>();
  21 + data['ret'] = this.ret;
  22 + if (this.data != null) {
  23 + data['data'] = this.data.map((v) => v.toJson()).toList();
  24 + }
  25 + data['msg'] = this.msg;
  26 + return data;
  27 + }
  28 +}
  29 +
  30 +class SetMealSunModel {
  31 + String id;
  32 + String sid;
  33 + String mealName;
  34 + String price;
  35 + String bargaining;
  36 + String status;
  37 + Null cdate;
  38 + List<Classify> classify;
  39 + List<Cook> cook;
  40 +
  41 + SetMealSunModel(
  42 + {this.id,
  43 + this.sid,
  44 + this.mealName,
  45 + this.price,
  46 + this.bargaining,
  47 + this.status,
  48 + this.cdate,
  49 + this.classify,
  50 + this.cook});
  51 +
  52 + SetMealSunModel.fromJson(Map<String, dynamic> json) {
  53 + id = json['id'];
  54 + sid = json['sid'];
  55 + mealName = json['meal_name'];
  56 + price = json['price'];
  57 + bargaining = json['bargaining'];
  58 + status = json['status'];
  59 + cdate = json['cdate'];
  60 + if (json['class'] != null) {
  61 + classify = <Classify>[];
  62 + json['class'].forEach((v) {
  63 + classify.add(new Classify.fromJson(v));
  64 + });
  65 + }
  66 + if (json['cook'] != null) {
  67 + cook = <Cook>[];
  68 + json['cook'].forEach((v) {
  69 + cook.add(new Cook.fromJson(v));
  70 + });
  71 + }
  72 + }
  73 +
  74 + Map<String, dynamic> toJson() {
  75 + final Map<String, dynamic> data = new Map<String, dynamic>();
  76 + data['id'] = this.id;
  77 + data['sid'] = this.sid;
  78 + data['meal_name'] = this.mealName;
  79 + data['price'] = this.price;
  80 + data['bargaining'] = this.bargaining;
  81 + data['status'] = this.status;
  82 + data['cdate'] = this.cdate;
  83 + if (this.classify = null) {
  84 + data['class'] = this.classify.map((v) => v.toJson()).toList();
  85 + }
  86 + if (this.cook != null) {
  87 + data['cook'] = this.cook.map((v) => v.toJson()).toList();
  88 + }
  89 + return data;
  90 + }
  91 +}
  92 +
  93 +class Classify {
  94 + String id;
  95 + String sid;
  96 + String mid;
  97 + String className;
  98 + String status;
  99 + Null cdate;
  100 +
  101 + Classify(
  102 + {this.id, this.sid, this.mid, this.className, this.status, this.cdate});
  103 +
  104 + Classify.fromJson(Map<String, dynamic> json) {
  105 + id = json['id'];
  106 + sid = json['sid'];
  107 + mid = json['mid'];
  108 + className = json['class_name'];
  109 + status = json['status'];
  110 + cdate = json['cdate'];
  111 + }
  112 +
  113 + Map<String, dynamic> toJson() {
  114 + final Map<String, dynamic> data = new Map<String, dynamic>();
  115 + data['id'] = this.id;
  116 + data['sid'] = this.sid;
  117 + data['mid'] = this.mid;
  118 + data['class_name'] = this.className;
  119 + data['status'] = this.status;
  120 + data['cdate'] = this.cdate;
  121 + return data;
  122 + }
  123 +}
  124 +
  125 +class Cook {
  126 + String id;
  127 + String sid;
  128 + String cid;
  129 + String mid;
  130 + String cname;
  131 + String spec;
  132 + String isTrim;
  133 + String status;
  134 +
  135 + Cook(
  136 + {this.id,
  137 + this.sid,
  138 + this.cid,
  139 + this.mid,
  140 + this.cname,
  141 + this.spec,
  142 + this.isTrim,
  143 + this.status});
  144 +
  145 + Cook.fromJson(Map<String, dynamic> json) {
  146 + id = json['id'];
  147 + sid = json['sid'];
  148 + cid = json['cid'];
  149 + mid = json['mid'];
  150 + cname = json['cname'];
  151 + spec = json['spec'];
  152 + isTrim = json['is_trim'];
  153 + status = json['status'];
  154 + }
  155 +
  156 + Map<String, dynamic> toJson() {
  157 + final Map<String, dynamic> data = new Map<String, dynamic>();
  158 + data['id'] = this.id;
  159 + data['sid'] = this.sid;
  160 + data['cid'] = this.cid;
  161 + data['mid'] = this.mid;
  162 + data['cname'] = this.cname;
  163 + data['spec'] = this.spec;
  164 + data['is_trim'] = this.isTrim;
  165 + data['status'] = this.status;
  166 + return data;
  167 + }
  168 +}
@@ -255,4 +255,31 @@ class HttpUrl { @@ -255,4 +255,31 @@ class HttpUrl {
255 static const String set_wine = "?service=App.Banquet.SetWine"; // 添加酒水 255 static const String set_wine = "?service=App.Banquet.SetWine"; // 添加酒水
256 static const String del_wine = "?service=App.Banquet.DelWine"; // 删除酒水 256 static const String del_wine = "?service=App.Banquet.DelWine"; // 删除酒水
257 257
  258 + static const String get_other = "?service=App.Banquet.GetOther"; // 获取其他配置
  259 + static const String set_other = "?service=App.Banquet.SetOther"; // 添加其他配置
  260 + static const String del_other = "?service=App.Banquet.DelOther"; // 删除其他配置
  261 +
  262 + static const String get_setmeal =
  263 + "?service=App.Banquet.GetSetmeal"; // 获取宴会套餐
  264 + static const String set_setmeal = "?service=App.Banquet.SetSetmeal"; // 添加宴会套餐
  265 + static const String del_setmeal = "?service=App.Banquet.DelSetmeal"; // 删除宴会套餐
  266 +
  267 + static const String get_setmeal_by_id =
  268 + "?service=App.Banquet.GetSetmealById"; // 根据ID获取宴会套餐
  269 + static const String get_setmeal_class =
  270 + "?service=App.Banquet.GetSetmealClass"; // 获取宴会套餐菜品分类
  271 + static const String set_setmeal_class =
  272 + "?service=App.Banquet.SetSetmealClass"; // 添加宴会套餐菜品分类
  273 + static const String del_setmeal_class =
  274 + "?service=App.Banquet.DelSetmealClass"; // 删除宴会套餐菜品分类
  275 + static const String get_setmeal_class_by_id =
  276 + "?service=App.Banquet.GetSetmealClassById"; // 根据ID获取宴会套餐菜品分类
  277 + static const String set_setmeal_cook =
  278 + "?service=App.Banquet.SetSetmealCook"; // 添加/修改宴会套餐菜品
  279 + static const String del_setmeal_cook =
  280 + "?service=App.Banquet.DelSetmealCook"; // 删除宴会套餐菜品
  281 +
  282 + static const String set_banquet_conf =
  283 + "?service=App.Banquet.SetBanquetConf"; // 商家宴会配置
  284 +
258 } 285 }
1 import 'package:flutter/material.dart'; 1 import 'package:flutter/material.dart';
2 import 'package:flutter_screenutil/flutter_screenutil.dart'; 2 import 'package:flutter_screenutil/flutter_screenutil.dart';
  3 +import 'package:provider/provider.dart';
3 4
  5 +import '../../../provider/feast_model.dart';
  6 +import '../../../provider/user_model.dart';
4 import '../../../res/colors.dart'; 7 import '../../../res/colors.dart';
5 import '../../../route/navigator_util.dart'; 8 import '../../../route/navigator_util.dart';
6 import '../../../utils/screen_util.dart'; 9 import '../../../utils/screen_util.dart';
@@ -22,6 +25,8 @@ class FeastDepositManagePage extends StatefulWidget { @@ -22,6 +25,8 @@ class FeastDepositManagePage extends StatefulWidget {
22 25
23 class _FeastDepositManagePageState extends State<FeastDepositManagePage> { 26 class _FeastDepositManagePageState extends State<FeastDepositManagePage> {
24 bool canrReturn = true; //是否可退 27 bool canrReturn = true; //是否可退
  28 + FeastModel feastModel;
  29 +
25 @override 30 @override
26 void initState() { 31 void initState() {
27 super.initState(); 32 super.initState();
@@ -65,6 +70,7 @@ class _FeastDepositManagePageState extends State<FeastDepositManagePage> { @@ -65,6 +70,7 @@ class _FeastDepositManagePageState extends State<FeastDepositManagePage> {
65 70
66 @override 71 @override
67 Widget build(BuildContext context) { 72 Widget build(BuildContext context) {
  73 + feastModel = Provider.of<FeastModel>(context);
68 return Scaffold( 74 return Scaffold(
69 backgroundColor: MyColours.color_ffffff, 75 backgroundColor: MyColours.color_ffffff,
70 appBar: SystemAppBar( 76 appBar: SystemAppBar(
@@ -98,7 +104,7 @@ class _FeastDepositManagePageState extends State<FeastDepositManagePage> { @@ -98,7 +104,7 @@ class _FeastDepositManagePageState extends State<FeastDepositManagePage> {
98 height: w(48), 104 height: w(48),
99 alignment: Alignment.centerLeft, 105 alignment: Alignment.centerLeft,
100 child: Text( 106 child: Text(
101 - '是否议价', 107 + '是否可退',
102 style: TextStyle( 108 style: TextStyle(
103 fontSize: ScreenUtil().setSp(32), 109 fontSize: ScreenUtil().setSp(32),
104 color: MyColours.color_E5000000), 110 color: MyColours.color_E5000000),
@@ -106,10 +112,19 @@ class _FeastDepositManagePageState extends State<FeastDepositManagePage> { @@ -106,10 +112,19 @@ class _FeastDepositManagePageState extends State<FeastDepositManagePage> {
106 ), 112 ),
107 Spacer(), 113 Spacer(),
108 InkWell( 114 InkWell(
109 - onTap: () { 115 + onTap: () async {
110 setState(() { 116 setState(() {
111 canrReturn = !canrReturn; 117 canrReturn = !canrReturn;
112 }); 118 });
  119 +
  120 + Map<String, String> pramas = {
  121 + 'sid':
  122 + Provider.of<UserModel>(context, listen: false)
  123 + .user
  124 + .sellerid,
  125 + 'is_deposit_back': canrReturn ? '1' : '0'
  126 + };
  127 + await feastModel.setBanquetConf(context, pramas);
113 }, 128 },
114 child: Container( 129 child: Container(
115 padding: 130 padding:
1 import 'package:flutter/material.dart'; 1 import 'package:flutter/material.dart';
2 import 'package:flutter_screenutil/flutter_screenutil.dart'; 2 import 'package:flutter_screenutil/flutter_screenutil.dart';
  3 +import 'package:one_key/models/get_setmeal_class_by_id_model.dart';
  4 +import 'package:one_key/models/setmeal_model.dart';
3 import 'package:one_key/route/navigator_util.dart'; 5 import 'package:one_key/route/navigator_util.dart';
4 import 'package:one_key/widgets/v_empty_view.dart'; 6 import 'package:one_key/widgets/v_empty_view.dart';
  7 +import 'package:provider/provider.dart';
5 8
  9 +import '../../../provider/feast_model.dart';
  10 +import '../../../provider/user_model.dart';
6 import '../../../res/colors.dart'; 11 import '../../../res/colors.dart';
7 import '../../../utils/dialog_util.dart'; 12 import '../../../utils/dialog_util.dart';
  13 +import '../../../utils/event_bus.dart';
8 import '../../../utils/screen_util.dart'; 14 import '../../../utils/screen_util.dart';
9 import '../../../utils/utils.dart'; 15 import '../../../utils/utils.dart';
10 import '../../../widgets/h_empty_view.dart'; 16 import '../../../widgets/h_empty_view.dart';
@@ -16,7 +22,9 @@ import '../../../widgets/system_app_bar.dart'; @@ -16,7 +22,9 @@ import '../../../widgets/system_app_bar.dart';
16 */ 22 */
17 23
18 class FeastDishPage extends StatefulWidget { 24 class FeastDishPage extends StatefulWidget {
19 - FeastDishPage({Key key}) : super(key: key); 25 + final String setmealId;
  26 + final String classId;
  27 + FeastDishPage({Key key, this.setmealId, this.classId}) : super(key: key);
20 28
21 @override 29 @override
22 _FeastDishPageState createState() => _FeastDishPageState(); 30 _FeastDishPageState createState() => _FeastDishPageState();
@@ -26,16 +34,76 @@ class _FeastDishPageState extends State<FeastDishPage> { @@ -26,16 +34,76 @@ class _FeastDishPageState extends State<FeastDishPage> {
26 ScrollController controller = ScrollController(); 34 ScrollController controller = ScrollController();
27 TextEditingController typeNameC = TextEditingController(); //分类名称 35 TextEditingController typeNameC = TextEditingController(); //分类名称
28 FocusNode typeF = FocusNode(); 36 FocusNode typeF = FocusNode();
  37 + FeastModel feastModel;
29 @override 38 @override
30 void initState() { 39 void initState() {
31 super.initState(); 40 super.initState();
32 Utils.changeStatusColor(color: MyColours.color_438E93); 41 Utils.changeStatusColor(color: MyColours.color_438E93);
  42 + WidgetsBinding.instance.addPostFrameCallback((_) {
  43 + _getSetmealClassById();
  44 + });
  45 + }
  46 +
  47 + ///添加宴会套餐菜品分类
  48 + _setSetmealCook(String name, String per, String trim, {String cookid}) async {
  49 + Map<String, String> params = {
  50 + "sid": Provider.of<UserModel>(context, listen: false).user.sellerid,
  51 + 'cname': name,
  52 + 'mid': widget.setmealId,
  53 + 'cid': widget.classId,
  54 + 'spec': per,
  55 + 'is_trim': trim
  56 + };
  57 + if (cookid != null) {
  58 + params['id'] = cookid;
  59 + }
  60 +
  61 + bool success = await feastModel.setSetmealCook(context, params);
  62 + if (success) {
  63 + Utils.showToast(cookid == null ? '添加成功' : '修改成功');
  64 + _getSetmealClassById();
  65 + }
  66 + }
  67 +
  68 + ///添加宴会套餐菜品分类
  69 + _setSetmealClass() async {
  70 + Map<String, String> params = {
  71 + "sid": Provider.of<UserModel>(context, listen: false).user.sellerid,
  72 + 'meal_name': typeNameC.text,
  73 + 'mid': widget.setmealId
  74 + };
  75 +
  76 + params['id'] = widget.classId;
  77 +
  78 + bool success = await feastModel.setSetmealClass(context, params);
  79 + if (success) {
  80 + Utils.showToast('修改成功');
  81 + bus.emit('feast_setmeal_class_list');
  82 + }
  83 + }
  84 +
  85 + /// 根据ID获取宴会套餐菜品分类
  86 + Future<bool> _getSetmealClassById({bool isShowLoading = true}) async {
  87 + Map<String, String> params = {"id": widget.classId};
  88 + bool success = await feastModel.getSetmealClassById(context, params,
  89 + isShowLoading: isShowLoading);
  90 + if (success) {
  91 + typeNameC.text = feastModel.setmealClassDetail.className;
  92 + setState(() {});
  93 + }
33 } 94 }
34 95
35 Widget buildFeastTypeHeader() { 96 Widget buildFeastTypeHeader() {
36 return RoundButton( 97 return RoundButton(
37 onPressed: () async { 98 onPressed: () async {
38 - NavigatorUtil.goFeastSetmealManageEditPage(context); 99 + FocusScope.of(context).requestFocus(FocusNode());
  100 + DialogUtil.feastDishEditDialog(context, onTap: (Map map) {
  101 + String per = map['per'];
  102 + String name = map['name'];
  103 + String can = map['can'];
  104 + print(can);
  105 + _setSetmealCook(name, per, can);
  106 + });
39 }, 107 },
40 text: '添加一项', 108 text: '添加一项',
41 fontSize: 32, 109 fontSize: 32,
@@ -51,7 +119,7 @@ class _FeastDishPageState extends State<FeastDishPage> { @@ -51,7 +119,7 @@ class _FeastDishPageState extends State<FeastDishPage> {
51 ); 119 );
52 } 120 }
53 121
54 - Widget buildFeastTypeItem() { 122 + Widget buildFeastTypeItem(CookById cook, int index) {
55 return Container( 123 return Container(
56 margin: EdgeInsets.only(bottom: w(12)), 124 margin: EdgeInsets.only(bottom: w(12)),
57 child: Row( 125 child: Row(
@@ -59,7 +127,7 @@ class _FeastDishPageState extends State<FeastDishPage> { @@ -59,7 +127,7 @@ class _FeastDishPageState extends State<FeastDishPage> {
59 Container( 127 Container(
60 width: w(120), 128 width: w(120),
61 child: Text( 129 child: Text(
62 - '鱼香肉丝', 130 + cook.cname,
63 style: TextStyle( 131 style: TextStyle(
64 fontSize: font(16), color: MyColours.color_E6000000), 132 fontSize: font(16), color: MyColours.color_E6000000),
65 )), 133 )),
@@ -67,7 +135,7 @@ class _FeastDishPageState extends State<FeastDishPage> { @@ -67,7 +135,7 @@ class _FeastDishPageState extends State<FeastDishPage> {
67 Container( 135 Container(
68 width: w(36), 136 width: w(36),
69 child: Text( 137 child: Text(
70 - '份', 138 + cook.spec,
71 style: TextStyle( 139 style: TextStyle(
72 fontSize: font(16), color: MyColours.color_515151), 140 fontSize: font(16), color: MyColours.color_515151),
73 )), 141 )),
@@ -75,21 +143,26 @@ class _FeastDishPageState extends State<FeastDishPage> { @@ -75,21 +143,26 @@ class _FeastDishPageState extends State<FeastDishPage> {
75 Container( 143 Container(
76 width: w(80), 144 width: w(80),
77 child: Text( 145 child: Text(
78 - '可调菜/不可调菜', 146 + cook.isTrim == '1' ? '可调菜' : '不可调菜',
79 style: TextStyle( 147 style: TextStyle(
80 fontSize: font(16), 148 fontSize: font(16),
81 - color:  
82 - true ? MyColours.color_00A870 : MyColours.color_E34D59), 149 + color: cook.isTrim == '1'
  150 + ? MyColours.color_00A870
  151 + : MyColours.color_E34D59),
83 )), 152 )),
84 Spacer(), 153 Spacer(),
85 InkWell( 154 InkWell(
86 onTap: () { 155 onTap: () {
87 FocusScope.of(context).requestFocus(FocusNode()); 156 FocusScope.of(context).requestFocus(FocusNode());
88 - DialogUtil.feastDishEditDialog(context, onTap: (Map map) { 157 + DialogUtil.feastDishEditDialog(context,
  158 + content: cook.cname,
  159 + per: cook.spec,
  160 + can: cook.isTrim == '1' ? true : false, onTap: (Map map) {
89 String per = map['per']; 161 String per = map['per'];
90 String name = map['name']; 162 String name = map['name'];
91 String can = map['can']; 163 String can = map['can'];
92 print(can); 164 print(can);
  165 + _setSetmealCook(name, per, can, cookid: cook.id);
93 }); 166 });
94 }, 167 },
95 child: Text( 168 child: Text(
@@ -107,15 +180,21 @@ class _FeastDishPageState extends State<FeastDishPage> { @@ -107,15 +180,21 @@ class _FeastDishPageState extends State<FeastDishPage> {
107 DialogUtil.cupertinoAlertDialogFeast(context, 180 DialogUtil.cupertinoAlertDialogFeast(context,
108 rTitle: '删除', 181 rTitle: '删除',
109 title: "是否确认删除", 182 title: "是否确认删除",
110 - content: "鱼香肉丝", lCallback: () { 183 + content: cook.cname, lCallback: () {
111 print("取消"); 184 print("取消");
112 - }, rCallback: () { 185 + }, rCallback: () async {
113 print("确定"); 186 print("确定");
114 - // widget.deleteCallback(index); 187 + Map<String, String> pramas = {'id': cook.id};
  188 + bool success =
  189 + await feastModel.delSetmealCook(context, pramas);
  190 + if (success) {
  191 + Utils.showToast('删除成功');
  192 + _getSetmealClassById(isShowLoading: true);
  193 + }
115 }); 194 });
116 }, 195 },
117 child: Image.asset( 196 child: Image.asset(
118 - Utils.getImgPath(true ? 'f_delete_red_un' : 'f_delete_red'), 197 + Utils.getImgPath('f_delete_red'),
119 width: w(24), 198 width: w(24),
120 height: w(24), 199 height: w(24),
121 )), 200 )),
@@ -187,6 +266,12 @@ class _FeastDishPageState extends State<FeastDishPage> { @@ -187,6 +266,12 @@ class _FeastDishPageState extends State<FeastDishPage> {
187 ), 266 ),
188 onChanged: (value) { 267 onChanged: (value) {
189 typeNameC.text = value; 268 typeNameC.text = value;
  269 + typeNameC.value = TextEditingValue(
  270 + text: typeNameC.text,
  271 + selection: TextSelection.fromPosition(TextPosition(
  272 + affinity: TextAffinity.downstream,
  273 + offset: typeNameC.text.length,
  274 + )));
190 setState(() {}); 275 setState(() {});
191 }, 276 },
192 onEditingComplete: () { 277 onEditingComplete: () {
@@ -254,6 +339,7 @@ class _FeastDishPageState extends State<FeastDishPage> { @@ -254,6 +339,7 @@ class _FeastDishPageState extends State<FeastDishPage> {
254 339
255 @override 340 @override
256 Widget build(BuildContext context) { 341 Widget build(BuildContext context) {
  342 + feastModel = Provider.of<FeastModel>(context, listen: true);
257 return Scaffold( 343 return Scaffold(
258 backgroundColor: MyColours.color_ffffff, 344 backgroundColor: MyColours.color_ffffff,
259 appBar: SystemAppBar( 345 appBar: SystemAppBar(
@@ -275,16 +361,21 @@ class _FeastDishPageState extends State<FeastDishPage> { @@ -275,16 +361,21 @@ class _FeastDishPageState extends State<FeastDishPage> {
275 child: Column( 361 child: Column(
276 crossAxisAlignment: CrossAxisAlignment.start, 362 crossAxisAlignment: CrossAxisAlignment.start,
277 children: [ 363 children: [
278 - _textfield('分类名称', '热菜', typeNameC, typeF, ''), 364 + _textfield('分类名称', '请输入', typeNameC, typeF, ''),
279 buildFeastTypeHeader(), 365 buildFeastTypeHeader(),
280 VEmptyView(54), 366 VEmptyView(54),
281 - ListView.builder(  
282 - itemCount: 100,  
283 - shrinkWrap: true,  
284 - controller: controller,  
285 - itemBuilder: (BuildContext context, int index) {  
286 - return buildFeastTypeItem();  
287 - }), 367 + feastModel.setmealClassDetail != null
  368 + ? ListView.builder(
  369 + itemCount:
  370 + feastModel.setmealClassDetail.cook.length,
  371 + shrinkWrap: true,
  372 + controller: controller,
  373 + itemBuilder: (BuildContext context, int index) {
  374 + CookById cook =
  375 + feastModel.setmealClassDetail.cook[index];
  376 + return buildFeastTypeItem(cook, index);
  377 + })
  378 + : SizedBox(),
288 ], 379 ],
289 )), 380 )),
290 )), 381 )),
@@ -300,7 +391,16 @@ class _FeastDishPageState extends State<FeastDishPage> { @@ -300,7 +391,16 @@ class _FeastDishPageState extends State<FeastDishPage> {
300 isSelect: false)), 391 isSelect: false)),
301 Expanded( 392 Expanded(
302 child: _callButton( 393 child: _callButton(
303 - onPress: () {}, 394 + onPress: () {
  395 + if (typeNameC.text.trim().length == 0) {
  396 + Utils.showToast('请输入分类名称');
  397 + return;
  398 + }
  399 +
  400 + FocusScope.of(context)
  401 + .requestFocus(FocusNode()); //点击空白处隐藏键盘
  402 + _setSetmealClass();
  403 + },
304 content: '保存', 404 content: '保存',
305 hasLeftBorder: true, 405 hasLeftBorder: true,
306 isSelect: true)) 406 isSelect: true))
1 import 'package:flutter/material.dart'; 1 import 'package:flutter/material.dart';
2 import 'package:flutter_screenutil/flutter_screenutil.dart'; 2 import 'package:flutter_screenutil/flutter_screenutil.dart';
3 import 'package:one_key/widgets/v_empty_view.dart'; 3 import 'package:one_key/widgets/v_empty_view.dart';
  4 +import 'package:provider/provider.dart';
4 5
  6 +import '../../../models/otherset_model.dart';
  7 +import '../../../provider/feast_model.dart';
  8 +import '../../../provider/user_model.dart';
5 import '../../../res/colors.dart'; 9 import '../../../res/colors.dart';
6 import '../../../route/navigator_util.dart'; 10 import '../../../route/navigator_util.dart';
7 import '../../../utils/dialog_util.dart'; 11 import '../../../utils/dialog_util.dart';
  12 +import '../../../utils/event_bus.dart';
8 import '../../../utils/screen_util.dart'; 13 import '../../../utils/screen_util.dart';
9 import '../../../utils/utils.dart'; 14 import '../../../utils/utils.dart';
10 import '../../../widgets/h_empty_view.dart'; 15 import '../../../widgets/h_empty_view.dart';
@@ -15,10 +20,10 @@ import '../../../widgets/system_app_bar.dart'; @@ -15,10 +20,10 @@ import '../../../widgets/system_app_bar.dart';
15 * 其他配置添加 20 * 其他配置添加
16 */ 21 */
17 class FeastOthersetManageEditPage extends StatefulWidget { 22 class FeastOthersetManageEditPage extends StatefulWidget {
18 - final isCreate; 23 + final OthersetSunModel othersetSunModel;
19 FeastOthersetManageEditPage({ 24 FeastOthersetManageEditPage({
20 Key key, 25 Key key,
21 - this.isCreate = true, 26 + this.othersetSunModel,
22 }) : super(key: key); 27 }) : super(key: key);
23 28
24 @override 29 @override
@@ -26,7 +31,8 @@ class FeastOthersetManageEditPage extends StatefulWidget { @@ -26,7 +31,8 @@ class FeastOthersetManageEditPage extends StatefulWidget {
26 _FeastOthersetManageEditPageState(); 31 _FeastOthersetManageEditPageState();
27 } 32 }
28 33
29 -class _FeastOthersetManageEditPageState extends State<FeastOthersetManageEditPage> { 34 +class _FeastOthersetManageEditPageState
  35 + extends State<FeastOthersetManageEditPage> {
30 TextEditingController othersetNameC = TextEditingController(); //其他配置名称 36 TextEditingController othersetNameC = TextEditingController(); //其他配置名称
31 FocusNode othersetF = FocusNode(); 37 FocusNode othersetF = FocusNode();
32 TextEditingController othersetPriceC = TextEditingController(); //其他配置价格 38 TextEditingController othersetPriceC = TextEditingController(); //其他配置价格
@@ -36,10 +42,38 @@ class _FeastOthersetManageEditPageState extends State<FeastOthersetManageEditPag @@ -36,10 +42,38 @@ class _FeastOthersetManageEditPageState extends State<FeastOthersetManageEditPag
36 bool canBargaining = true; //是否议价 42 bool canBargaining = true; //是否议价
37 ScrollController controller = ScrollController(); 43 ScrollController controller = ScrollController();
38 44
  45 + FeastModel feastModel;
  46 +
39 @override 47 @override
40 void initState() { 48 void initState() {
41 super.initState(); 49 super.initState();
42 Utils.changeStatusColor(color: MyColours.color_438E93); 50 Utils.changeStatusColor(color: MyColours.color_438E93);
  51 + if (widget.othersetSunModel != null) {
  52 + othersetNameC.text = widget.othersetSunModel.otherName;
  53 + othersetPriceC.text = widget.othersetSunModel.price;
  54 + othersetPerC.text = widget.othersetSunModel.spec;
  55 + canBargaining = widget.othersetSunModel.bargaining == '1' ? true : false;
  56 + }
  57 + }
  58 +
  59 + _setOthersetList() async {
  60 + Map<String, String> params = {
  61 + "sid": Provider.of<UserModel>(context, listen: false).user.sellerid,
  62 + 'class_name': othersetNameC.text,
  63 + 'price': othersetPriceC.text,
  64 + 'spec': othersetPerC.text,
  65 + 'bargaining': canBargaining ? '1' : '0'
  66 + };
  67 + if (widget.othersetSunModel != null) {
  68 + params['id'] = widget.othersetSunModel.id;
  69 + }
  70 + bool success = await feastModel.setOthersetList(context, params);
  71 + if (success) {
  72 + Utils.showToast('添加成功');
  73 + bus.emit('feast_otherset_list');
  74 + Navigator.pop(context);
  75 + // _getWine(isShowLoading: true);
  76 + }
43 } 77 }
44 78
45 ///请输入 79 ///请输入
@@ -104,7 +138,18 @@ class _FeastOthersetManageEditPageState extends State<FeastOthersetManageEditPag @@ -104,7 +138,18 @@ class _FeastOthersetManageEditPageState extends State<FeastOthersetManageEditPag
104 ), 138 ),
105 contentPadding: EdgeInsets.zero, 139 contentPadding: EdgeInsets.zero,
106 ), 140 ),
107 - onChanged: (value) {}, 141 + onChanged: (value) {
  142 + if (widget.othersetSunModel != null && title == '配置名称') {
  143 + othersetNameC.text = value;
  144 + othersetNameC.value = TextEditingValue(
  145 + text: othersetNameC.text,
  146 + selection: TextSelection.fromPosition(TextPosition(
  147 + affinity: TextAffinity.downstream,
  148 + offset: othersetNameC.text.length,
  149 + )));
  150 + setState(() {});
  151 + }
  152 + },
108 onEditingComplete: () { 153 onEditingComplete: () {
109 FocusScope.of(context) 154 FocusScope.of(context)
110 .requestFocus(FocusNode()); //点击空白处隐藏键盘 155 .requestFocus(FocusNode()); //点击空白处隐藏键盘
@@ -168,10 +213,11 @@ class _FeastOthersetManageEditPageState extends State<FeastOthersetManageEditPag @@ -168,10 +213,11 @@ class _FeastOthersetManageEditPageState extends State<FeastOthersetManageEditPag
168 213
169 @override 214 @override
170 Widget build(BuildContext context) { 215 Widget build(BuildContext context) {
  216 + feastModel = Provider.of<FeastModel>(context, listen: true);
171 return Scaffold( 217 return Scaffold(
172 backgroundColor: MyColours.color_ffffff, 218 backgroundColor: MyColours.color_ffffff,
173 appBar: SystemAppBar( 219 appBar: SystemAppBar(
174 - widget.isCreate ? '添加其他配置' : othersetNameC.text, 220 + widget.othersetSunModel == null ? '添加配置' : othersetNameC.text,
175 needWhite: true, 221 needWhite: true,
176 bgColor: MyColours.color_438E93, 222 bgColor: MyColours.color_438E93,
177 titleColor: MyColours.color_F6F6F6, 223 titleColor: MyColours.color_F6F6F6,
@@ -192,10 +238,11 @@ class _FeastOthersetManageEditPageState extends State<FeastOthersetManageEditPag @@ -192,10 +238,11 @@ class _FeastOthersetManageEditPageState extends State<FeastOthersetManageEditPag
192 crossAxisAlignment: CrossAxisAlignment.start, 238 crossAxisAlignment: CrossAxisAlignment.start,
193 children: [ 239 children: [
194 _textfield( 240 _textfield(
195 - '配置名称', '剑南春52度500ml', othersetNameC, othersetF, ''), 241 + '配置名称', '请输入', othersetNameC, othersetF, ''),
  242 + _textfield('配置单价', '请输入', othersetPriceC,
  243 + othersetPriceF, '元'),
196 _textfield( 244 _textfield(
197 - '配置单价', '1299', othersetPriceC, othersetPriceF, '元'),  
198 - _textfield('配置规格', '份', othersetPerC, othersetPerF, ''), 245 + '配置规格', '请输入', othersetPerC, othersetPerF, ''),
199 Container( 246 Container(
200 height: w(48), 247 height: w(48),
201 margin: EdgeInsets.only(top: w(12)), 248 margin: EdgeInsets.only(top: w(12)),
@@ -252,7 +299,21 @@ class _FeastOthersetManageEditPageState extends State<FeastOthersetManageEditPag @@ -252,7 +299,21 @@ class _FeastOthersetManageEditPageState extends State<FeastOthersetManageEditPag
252 isSelect: false)), 299 isSelect: false)),
253 Expanded( 300 Expanded(
254 child: _callButton( 301 child: _callButton(
255 - onPress: () {}, 302 + onPress: () {
  303 + if (othersetNameC.text.trim().length == 0) {
  304 + Utils.showToast('请输入配置名称');
  305 + return;
  306 + }
  307 + if (othersetPriceC.text.trim().length == 0) {
  308 + Utils.showToast('请输入配置单价');
  309 + return;
  310 + }
  311 + if (othersetPerC.text.trim().length == 0) {
  312 + Utils.showToast('请输入配置规格');
  313 + return;
  314 + }
  315 + _setOthersetList();
  316 + },
256 content: '保存', 317 content: '保存',
257 hasLeftBorder: true, 318 hasLeftBorder: true,
258 isSelect: true)) 319 isSelect: true))
1 import 'package:flutter/material.dart'; 1 import 'package:flutter/material.dart';
2 import 'package:flutter_screenutil/flutter_screenutil.dart'; 2 import 'package:flutter_screenutil/flutter_screenutil.dart';
  3 +import 'package:one_key/models/otherset_model.dart';
3 import 'package:one_key/route/navigator_util.dart'; 4 import 'package:one_key/route/navigator_util.dart';
4 import 'package:one_key/widgets/v_empty_view.dart'; 5 import 'package:one_key/widgets/v_empty_view.dart';
  6 +import 'package:provider/provider.dart';
5 7
  8 +import '../../../constant/state.dart';
  9 +import '../../../provider/feast_model.dart';
6 import '../../../res/colors.dart'; 10 import '../../../res/colors.dart';
7 import '../../../utils/dialog_util.dart'; 11 import '../../../utils/dialog_util.dart';
  12 +import '../../../utils/event_bus.dart';
8 import '../../../utils/screen_util.dart'; 13 import '../../../utils/screen_util.dart';
9 import '../../../utils/utils.dart'; 14 import '../../../utils/utils.dart';
10 import '../../../widgets/h_empty_view.dart'; 15 import '../../../widgets/h_empty_view.dart';
  16 +import '../../../widgets/page_exception.dart';
11 import '../../../widgets/round_button.dart'; 17 import '../../../widgets/round_button.dart';
12 import '../../../widgets/system_app_bar.dart'; 18 import '../../../widgets/system_app_bar.dart';
13 19
@@ -24,10 +30,29 @@ class FeastOthersetManagePage extends StatefulWidget { @@ -24,10 +30,29 @@ class FeastOthersetManagePage extends StatefulWidget {
24 } 30 }
25 31
26 class _FeastOthersetManagePageState extends State<FeastOthersetManagePage> { 32 class _FeastOthersetManagePageState extends State<FeastOthersetManagePage> {
  33 + FeastModel feastModel;
27 @override 34 @override
28 void initState() { 35 void initState() {
29 super.initState(); 36 super.initState();
30 Utils.changeStatusColor(color: MyColours.color_438E93); 37 Utils.changeStatusColor(color: MyColours.color_438E93);
  38 + WidgetsBinding.instance.addPostFrameCallback((_) {
  39 + _getOthersetList();
  40 + // scrollController.jumpTo(scrollController.position.minScrollExtent);
  41 + });
  42 + bus.on("feast_otherset_list", (arg) {
  43 + _getOthersetList();
  44 + });
  45 + }
  46 +
  47 + @override
  48 + void dispose() {
  49 + bus.off('feast_otherset_list');
  50 + super.dispose();
  51 + }
  52 +
  53 + ///获取宴会分类
  54 + Future<bool> _getOthersetList({bool isShowLoading = true}) async {
  55 + await feastModel.getOthersetList(context, isShowLoading: isShowLoading);
31 } 56 }
32 57
33 Widget buildFeastTypeHeader() { 58 Widget buildFeastTypeHeader() {
@@ -49,26 +74,27 @@ class _FeastOthersetManagePageState extends State<FeastOthersetManagePage> { @@ -49,26 +74,27 @@ class _FeastOthersetManagePageState extends State<FeastOthersetManagePage> {
49 ); 74 );
50 } 75 }
51 76
52 - Widget buildFeastTypeItem(String title, String subTitle) { 77 + Widget buildFeastTypeItem(OthersetSunModel model, int index) {
53 return Container( 78 return Container(
54 height: h(48), 79 height: h(48),
55 margin: EdgeInsets.only(top: w(12)), 80 margin: EdgeInsets.only(top: w(12)),
56 decoration: BoxDecoration( 81 decoration: BoxDecoration(
57 border: Border( 82 border: Border(
58 - bottom: BorderSide(width: w(0.5), color: MyColours.color_E7E7E7))), 83 + bottom:
  84 + BorderSide(width: w(0.5), color: MyColours.color_E7E7E7))),
59 child: Row( 85 child: Row(
60 children: [ 86 children: [
61 Column( 87 Column(
62 crossAxisAlignment: CrossAxisAlignment.start, 88 crossAxisAlignment: CrossAxisAlignment.start,
63 children: [ 89 children: [
64 Text( 90 Text(
65 - title, 91 + model.otherName,
66 style: TextStyle( 92 style: TextStyle(
67 fontSize: font(16), color: MyColours.color_E6000000), 93 fontSize: font(16), color: MyColours.color_E6000000),
68 ), 94 ),
69 VEmptyView(12), 95 VEmptyView(12),
70 Text( 96 Text(
71 - subTitle, 97 + '${model.price}元/${model.spec} ${model.bargaining == '1' ? '可议价' : '不可议价'}',
72 style: TextStyle( 98 style: TextStyle(
73 fontSize: font(12), color: MyColours.color_999999), 99 fontSize: font(12), color: MyColours.color_999999),
74 ) 100 )
@@ -77,7 +103,8 @@ class _FeastOthersetManagePageState extends State<FeastOthersetManagePage> { @@ -77,7 +103,8 @@ class _FeastOthersetManagePageState extends State<FeastOthersetManagePage> {
77 Spacer(), 103 Spacer(),
78 InkWell( 104 InkWell(
79 onTap: () { 105 onTap: () {
80 - NavigatorUtil.goFeastOthersetManageEditPage(context); 106 + NavigatorUtil.goFeastOthersetManageEditPage(context,
  107 + isNew: false, othersetSunModel: model);
81 }, 108 },
82 child: Text( 109 child: Text(
83 '修改', 110 '修改',
@@ -94,15 +121,21 @@ class _FeastOthersetManagePageState extends State<FeastOthersetManagePage> { @@ -94,15 +121,21 @@ class _FeastOthersetManagePageState extends State<FeastOthersetManagePage> {
94 DialogUtil.cupertinoAlertDialogFeast(context, 121 DialogUtil.cupertinoAlertDialogFeast(context,
95 rTitle: '删除', 122 rTitle: '删除',
96 title: "是否确认删除", 123 title: "是否确认删除",
97 - content: "LED大屏", lCallback: () { 124 + content: model.otherName, lCallback: () {
98 print("取消"); 125 print("取消");
99 - }, rCallback: () { 126 + }, rCallback: () async {
100 print("确定"); 127 print("确定");
101 - // widget.deleteCallback(index); 128 + Map<String, String> pramas = {'id': model.id};
  129 + bool success =
  130 + await feastModel.delOthersetList(context, pramas);
  131 + if (success) {
  132 + Utils.showToast('删除成功');
  133 + _getOthersetList(isShowLoading: true);
  134 + }
102 }); 135 });
103 }, 136 },
104 child: Image.asset( 137 child: Image.asset(
105 - Utils.getImgPath(true ? 'f_delete_red_un' : 'f_delete_red'), 138 + Utils.getImgPath('f_delete_red'),
106 width: w(32), 139 width: w(32),
107 height: w(32), 140 height: w(32),
108 )), 141 )),
@@ -154,6 +187,7 @@ class _FeastOthersetManagePageState extends State<FeastOthersetManagePage> { @@ -154,6 +187,7 @@ class _FeastOthersetManagePageState extends State<FeastOthersetManagePage> {
154 187
155 @override 188 @override
156 Widget build(BuildContext context) { 189 Widget build(BuildContext context) {
  190 + feastModel = Provider.of<FeastModel>(context, listen: true);
157 return Scaffold( 191 return Scaffold(
158 backgroundColor: MyColours.color_ffffff, 192 backgroundColor: MyColours.color_ffffff,
159 appBar: SystemAppBar( 193 appBar: SystemAppBar(
@@ -165,55 +199,45 @@ class _FeastOthersetManagePageState extends State<FeastOthersetManagePage> { @@ -165,55 +199,45 @@ class _FeastOthersetManagePageState extends State<FeastOthersetManagePage> {
165 Navigator.pop(context); 199 Navigator.pop(context);
166 }, 200 },
167 ), 201 ),
168 - body: Column(  
169 - children: [  
170 - Expanded(  
171 - child: NestedScrollView(  
172 - // controller: _scrollViewController,  
173 - headerSliverBuilder:  
174 - (BuildContext context, bool innerBoxIsScrolled) {  
175 - return <Widget>[  
176 - SliverAppBar(  
177 - pinned: true,  
178 - floating: false,  
179 - leading: null,  
180 - backgroundColor: MyColours.color_ffffff,  
181 - expandedHeight: ScreenUtil().setWidth(56 * 2),  
182 - automaticallyImplyLeading: false,  
183 - title: buildFeastTypeHeader(),  
184 - // flexibleSpace: FlexibleSpaceBar(  
185 - // collapseMode: CollapseMode.pin,  
186 - // title: buildFeastTypeHeader())  
187 - )  
188 - ];  
189 - },  
190 - body: ListView.builder(  
191 - itemCount: 100,  
192 - padding: EdgeInsets.only(left: w(16)),  
193 - itemBuilder: (BuildContext context, int index) {  
194 - return buildFeastTypeItem('LED大屏', '1100元/次 不可议价');  
195 - }),  
196 - )),  
197 - Row(  
198 - children: [  
199 - Expanded(  
200 - child: _callButton(  
201 - onPress: () {  
202 - Navigator.pop(context);  
203 - },  
204 - content: '返回',  
205 - hasLeftBorder: true,  
206 - isSelect: false)),  
207 - Expanded(  
208 - child: _callButton(  
209 - onPress: () {},  
210 - content: '保存',  
211 - hasLeftBorder: true,  
212 - isSelect: true))  
213 - ], 202 + body: NestedScrollView(
  203 + // controller: _scrollViewController,
  204 + headerSliverBuilder: (BuildContext context, bool innerBoxIsScrolled) {
  205 + return <Widget>[
  206 + SliverAppBar(
  207 + pinned: true,
  208 + floating: false,
  209 + leading: null,
  210 + backgroundColor: MyColours.color_ffffff,
  211 + expandedHeight: ScreenUtil().setWidth(56 * 2),
  212 + automaticallyImplyLeading: false,
  213 + title: buildFeastTypeHeader(),
  214 + // flexibleSpace: FlexibleSpaceBar(
  215 + // collapseMode: CollapseMode.pin,
  216 + // title: buildFeastTypeHeader())
214 ) 217 )
215 - ],  
216 - ), 218 + ];
  219 + }, body: Consumer<FeastModel>(builder: (context, model, _) {
  220 + if (model.pageStateOther != PageState.Success) {
  221 + return ExceptionPage(
  222 + pageState: model.pageStateOther,
  223 + callback: () {
  224 + _getOthersetList();
  225 + },
  226 + emptyMsg: "暂时没有配置哦",
  227 + emptyImg: "empty_search",
  228 + showMsg: "加载中,请稍后...",
  229 + );
  230 + } else {
  231 + return ListView.builder(
  232 + itemCount: feastModel.otherData.length,
  233 + padding: EdgeInsets.only(left: w(16)),
  234 + itemBuilder: (BuildContext context, int index) {
  235 + OthersetSunModel sunModel = feastModel.otherData[index];
  236 + return buildFeastTypeItem(sunModel, index);
  237 + // 'LED大屏', '1100元/次 不可议价'
  238 + });
  239 + }
  240 + })),
217 ); 241 );
218 } 242 }
219 } 243 }
1 import 'package:flutter/material.dart'; 1 import 'package:flutter/material.dart';
2 import 'package:flutter_screenutil/flutter_screenutil.dart'; 2 import 'package:flutter_screenutil/flutter_screenutil.dart';
  3 +import 'package:one_key/models/get_setmeal_class_model.dart';
3 import 'package:one_key/widgets/v_empty_view.dart'; 4 import 'package:one_key/widgets/v_empty_view.dart';
  5 +import 'package:provider/provider.dart';
4 6
  7 +import '../../../provider/feast_model.dart';
  8 +import '../../../provider/user_model.dart';
5 import '../../../res/colors.dart'; 9 import '../../../res/colors.dart';
6 import '../../../route/navigator_util.dart'; 10 import '../../../route/navigator_util.dart';
7 import '../../../utils/dialog_util.dart'; 11 import '../../../utils/dialog_util.dart';
  12 +import '../../../utils/event_bus.dart';
8 import '../../../utils/screen_util.dart'; 13 import '../../../utils/screen_util.dart';
9 import '../../../utils/utils.dart'; 14 import '../../../utils/utils.dart';
10 import '../../../widgets/h_empty_view.dart'; 15 import '../../../widgets/h_empty_view.dart';
@@ -15,10 +20,10 @@ import '../../../widgets/system_app_bar.dart'; @@ -15,10 +20,10 @@ import '../../../widgets/system_app_bar.dart';
15 * 套餐添加 20 * 套餐添加
16 */ 21 */
17 class FeastSetmealManageEditPage extends StatefulWidget { 22 class FeastSetmealManageEditPage extends StatefulWidget {
18 - final isCreate; 23 + final String setmealId;
19 FeastSetmealManageEditPage({ 24 FeastSetmealManageEditPage({
20 Key key, 25 Key key,
21 - this.isCreate = true, 26 + this.setmealId,
22 }) : super(key: key); 27 }) : super(key: key);
23 28
24 @override 29 @override
@@ -35,10 +40,82 @@ class _FeastSetmealManageEditPageState @@ -35,10 +40,82 @@ class _FeastSetmealManageEditPageState
35 bool canBargaining = true; //是否议价 40 bool canBargaining = true; //是否议价
36 ScrollController controller = ScrollController(); 41 ScrollController controller = ScrollController();
37 42
  43 + FeastModel feastModel;
  44 +
38 @override 45 @override
39 void initState() { 46 void initState() {
40 super.initState(); 47 super.initState();
41 Utils.changeStatusColor(color: MyColours.color_438E93); 48 Utils.changeStatusColor(color: MyColours.color_438E93);
  49 + WidgetsBinding.instance.addPostFrameCallback((_) {
  50 + _getSetmealById();
  51 + _getSetmealClass();
  52 + });
  53 + bus.on("feast_setmeal_class_list", (arg) {
  54 + _getSetmealClass();
  55 + });
  56 + }
  57 +
  58 + @override
  59 + void dispose() {
  60 + bus.off('feast_setmeal_class_list');
  61 + super.dispose();
  62 + }
  63 +
  64 + /// 根据ID获取宴会套餐
  65 + _getSetmealById({bool isShowLoading = true}) async {
  66 + Map<String, String> params = {"id": widget.setmealId};
  67 + bool success = await feastModel.getSetmealById(context, params,
  68 + isShowLoading: isShowLoading);
  69 + if (success) {
  70 + mealNameC.text = feastModel.setmealDetail.mealName;
  71 + mealPriceC.text = feastModel.setmealDetail.price;
  72 + canBargaining = feastModel.setmealDetail.bargaining == '1' ? true : false;
  73 + setState(() {});
  74 + }
  75 + }
  76 +
  77 + /// 根据ID获取宴会套餐
  78 + _getSetmealClass({bool isShowLoading = true}) async {
  79 + Map<String, String> params = {"mid": widget.setmealId};
  80 + await feastModel.getSetmealClass(context, params,
  81 + isShowLoading: isShowLoading);
  82 + }
  83 +
  84 + ///修改套餐基本信息
  85 + _setSetmeal() async {
  86 + Map<String, String> params = {
  87 + "sid": Provider.of<UserModel>(context, listen: false).user.sellerid,
  88 + 'meal_name': mealNameC.text,
  89 + 'price': mealPriceC.text,
  90 + 'bargaining': canBargaining ? '1' : '0'
  91 + };
  92 +
  93 + params['id'] = widget.setmealId;
  94 +
  95 + bool success = await feastModel.setSetmeal(context, params);
  96 + if (success) {
  97 + Utils.showToast('保存成功');
  98 + bus.emit('feast_setmeal_list');
  99 +
  100 + // _getWine(isShowLoading: true);
  101 + }
  102 + }
  103 +
  104 + ///添加宴会套餐菜品分类
  105 + _setSetmealClass(String name) async {
  106 + Map<String, String> params = {
  107 + "sid": Provider.of<UserModel>(context, listen: false).user.sellerid,
  108 + 'meal_name': name,
  109 + 'mid': widget.setmealId
  110 + };
  111 +
  112 + // params['id'] = widget.setmealId;
  113 +
  114 + bool success = await feastModel.setSetmealClass(context, params);
  115 + if (success) {
  116 + Utils.showToast('添加成功');
  117 + bus.emit('feast_setmeal_class_list');
  118 + }
42 } 119 }
43 120
44 ///请输入 121 ///请输入
@@ -103,7 +180,18 @@ class _FeastSetmealManageEditPageState @@ -103,7 +180,18 @@ class _FeastSetmealManageEditPageState
103 ), 180 ),
104 contentPadding: EdgeInsets.zero, 181 contentPadding: EdgeInsets.zero,
105 ), 182 ),
106 - onChanged: (value) {}, 183 + onChanged: (value) {
  184 + if (title == '套餐名称') {
  185 + mealNameC.text = value;
  186 + mealNameC.value = TextEditingValue(
  187 + text: mealNameC.text,
  188 + selection: TextSelection.fromPosition(TextPosition(
  189 + affinity: TextAffinity.downstream,
  190 + offset: mealNameC.text.length,
  191 + )));
  192 + setState(() {});
  193 + }
  194 + },
107 onEditingComplete: () { 195 onEditingComplete: () {
108 FocusScope.of(context) 196 FocusScope.of(context)
109 .requestFocus(FocusNode()); //点击空白处隐藏键盘 197 .requestFocus(FocusNode()); //点击空白处隐藏键盘
@@ -126,24 +214,26 @@ class _FeastSetmealManageEditPageState @@ -126,24 +214,26 @@ class _FeastSetmealManageEditPageState
126 ); 214 );
127 } 215 }
128 216
129 - Widget buildFeastTypeItem(String title) { 217 + Widget buildFeastTypeItem(GetSetmealClassSunModel data, int index) {
130 return Container( 218 return Container(
131 height: h(48), 219 height: h(48),
132 margin: EdgeInsets.only(bottom: w(12)), 220 margin: EdgeInsets.only(bottom: w(12)),
133 decoration: BoxDecoration( 221 decoration: BoxDecoration(
134 border: Border( 222 border: Border(
135 - bottom: BorderSide(width: w(0.5), color: MyColours.color_E7E7E7))), 223 + bottom:
  224 + BorderSide(width: w(0.5), color: MyColours.color_E7E7E7))),
136 child: Row( 225 child: Row(
137 children: [ 226 children: [
138 Text( 227 Text(
139 - title, 228 + data.className,
140 style: 229 style:
141 TextStyle(fontSize: font(16), color: MyColours.color_E5000000), 230 TextStyle(fontSize: font(16), color: MyColours.color_E5000000),
142 ), 231 ),
143 Spacer(), 232 Spacer(),
144 InkWell( 233 InkWell(
145 onTap: () { 234 onTap: () {
146 - NavigatorUtil.goFeastDishPage(context); 235 + NavigatorUtil.goFeastDishPage(
  236 + context, widget.setmealId, data.id);
147 }, 237 },
148 child: Text( 238 child: Text(
149 '修改', 239 '修改',
@@ -160,15 +250,21 @@ class _FeastSetmealManageEditPageState @@ -160,15 +250,21 @@ class _FeastSetmealManageEditPageState
160 DialogUtil.cupertinoAlertDialogFeast(context, 250 DialogUtil.cupertinoAlertDialogFeast(context,
161 rTitle: '删除', 251 rTitle: '删除',
162 title: "是否确认删除", 252 title: "是否确认删除",
163 - content: "热菜(18道)", lCallback: () { 253 + content: data.className, lCallback: () {
164 print("取消"); 254 print("取消");
165 - }, rCallback: () { 255 + }, rCallback: () async {
166 print("确定"); 256 print("确定");
167 - // widget.deleteCallback(index); 257 + Map<String, String> pramas = {'id': data.id};
  258 + bool success =
  259 + await feastModel.delSetmealClass(context, pramas);
  260 + if (success) {
  261 + Utils.showToast('删除成功');
  262 + _getSetmealClass(isShowLoading: true);
  263 + }
168 }); 264 });
169 }, 265 },
170 child: Image.asset( 266 child: Image.asset(
171 - Utils.getImgPath(true ? 'f_delete_red_un' : 'f_delete_red'), 267 + Utils.getImgPath('f_delete_red'),
172 width: w(32), 268 width: w(32),
173 height: w(32), 269 height: w(32),
174 )), 270 )),
@@ -220,10 +316,11 @@ class _FeastSetmealManageEditPageState @@ -220,10 +316,11 @@ class _FeastSetmealManageEditPageState
220 316
221 @override 317 @override
222 Widget build(BuildContext context) { 318 Widget build(BuildContext context) {
  319 + feastModel = Provider.of<FeastModel>(context, listen: true);
223 return Scaffold( 320 return Scaffold(
224 backgroundColor: MyColours.color_ffffff, 321 backgroundColor: MyColours.color_ffffff,
225 appBar: SystemAppBar( 322 appBar: SystemAppBar(
226 - widget.isCreate ? '添加套餐' : mealNameC.text, 323 + mealNameC.text,
227 needWhite: true, 324 needWhite: true,
228 bgColor: MyColours.color_438E93, 325 bgColor: MyColours.color_438E93,
229 titleColor: MyColours.color_F6F6F6, 326 titleColor: MyColours.color_F6F6F6,
@@ -243,9 +340,9 @@ class _FeastSetmealManageEditPageState @@ -243,9 +340,9 @@ class _FeastSetmealManageEditPageState
243 child: Column( 340 child: Column(
244 crossAxisAlignment: CrossAxisAlignment.start, 341 crossAxisAlignment: CrossAxisAlignment.start,
245 children: [ 342 children: [
246 - _textfield('套餐名称', '1299套餐', mealNameC, mealF, ''), 343 + _textfield('套餐名称', '请输入', mealNameC, mealF, ''),
247 _textfield( 344 _textfield(
248 - '套餐价格', '1299', mealPriceC, mealPriceF, '元'), 345 + '套餐价格', '请输入', mealPriceC, mealPriceF, '元'),
249 Container( 346 Container(
250 height: w(48), 347 height: w(48),
251 margin: EdgeInsets.only(top: w(12)), 348 margin: EdgeInsets.only(top: w(12)),
@@ -305,6 +402,8 @@ class _FeastSetmealManageEditPageState @@ -305,6 +402,8 @@ class _FeastSetmealManageEditPageState
305 lenghtLimit: false, 402 lenghtLimit: false,
306 toast: '请输入分类名称', rCallback: (name) { 403 toast: '请输入分类名称', rCallback: (name) {
307 // _addCookbookClass(name, showLoading: true); 404 // _addCookbookClass(name, showLoading: true);
  405 +
  406 + _setSetmealClass(name);
308 }); 407 });
309 }, 408 },
310 text: '添加菜品分类', 409 text: '添加菜品分类',
@@ -320,11 +419,13 @@ class _FeastSetmealManageEditPageState @@ -320,11 +419,13 @@ class _FeastSetmealManageEditPageState
320 ), 419 ),
321 VEmptyView(14), 420 VEmptyView(14),
322 ListView.builder( 421 ListView.builder(
323 - itemCount: 100, 422 + itemCount: feastModel.setmealClassData.length,
324 shrinkWrap: true, 423 shrinkWrap: true,
325 controller: controller, 424 controller: controller,
326 itemBuilder: (BuildContext context, int index) { 425 itemBuilder: (BuildContext context, int index) {
327 - return buildFeastTypeItem('热菜(18道)'); 426 + GetSetmealClassSunModel data =
  427 + feastModel.setmealClassData[index];
  428 + return buildFeastTypeItem(data, index);
328 }) 429 })
329 ], 430 ],
330 )))), 431 )))),
@@ -340,7 +441,20 @@ class _FeastSetmealManageEditPageState @@ -340,7 +441,20 @@ class _FeastSetmealManageEditPageState
340 isSelect: false)), 441 isSelect: false)),
341 Expanded( 442 Expanded(
342 child: _callButton( 443 child: _callButton(
343 - onPress: () {}, 444 + onPress: () {
  445 + if (mealNameC.text.trim().length == 0) {
  446 + Utils.showToast('请输入套餐名称');
  447 + return;
  448 + }
  449 + if (mealPriceC.text.trim().length == 0) {
  450 + Utils.showToast('请输入套餐价格');
  451 + return;
  452 + }
  453 +
  454 + FocusScope.of(context)
  455 + .requestFocus(FocusNode()); //点击空白处隐藏键盘
  456 + _setSetmeal();
  457 + },
344 content: '保存', 458 content: '保存',
345 hasLeftBorder: true, 459 hasLeftBorder: true,
346 isSelect: true)) 460 isSelect: true))
1 import 'package:flutter/material.dart'; 1 import 'package:flutter/material.dart';
2 import 'package:flutter_screenutil/flutter_screenutil.dart'; 2 import 'package:flutter_screenutil/flutter_screenutil.dart';
  3 +import 'package:one_key/models/setmeal_model.dart';
3 import 'package:one_key/route/navigator_util.dart'; 4 import 'package:one_key/route/navigator_util.dart';
4 import 'package:one_key/widgets/v_empty_view.dart'; 5 import 'package:one_key/widgets/v_empty_view.dart';
  6 +import 'package:provider/provider.dart';
5 7
  8 +import '../../../constant/state.dart';
  9 +import '../../../provider/feast_model.dart';
  10 +import '../../../provider/user_model.dart';
6 import '../../../res/colors.dart'; 11 import '../../../res/colors.dart';
7 import '../../../utils/dialog_util.dart'; 12 import '../../../utils/dialog_util.dart';
  13 +import '../../../utils/event_bus.dart';
8 import '../../../utils/screen_util.dart'; 14 import '../../../utils/screen_util.dart';
9 import '../../../utils/utils.dart'; 15 import '../../../utils/utils.dart';
10 import '../../../widgets/h_empty_view.dart'; 16 import '../../../widgets/h_empty_view.dart';
  17 +import '../../../widgets/page_exception.dart';
11 import '../../../widgets/round_button.dart'; 18 import '../../../widgets/round_button.dart';
12 import '../../../widgets/system_app_bar.dart'; 19 import '../../../widgets/system_app_bar.dart';
13 20
@@ -23,16 +30,64 @@ class FeastSetmealManagePage extends StatefulWidget { @@ -23,16 +30,64 @@ class FeastSetmealManagePage extends StatefulWidget {
23 } 30 }
24 31
25 class _FeastSetmealManagePageState extends State<FeastSetmealManagePage> { 32 class _FeastSetmealManagePageState extends State<FeastSetmealManagePage> {
  33 + FeastModel feastModel;
26 @override 34 @override
27 void initState() { 35 void initState() {
28 super.initState(); 36 super.initState();
29 Utils.changeStatusColor(color: MyColours.color_438E93); 37 Utils.changeStatusColor(color: MyColours.color_438E93);
  38 + WidgetsBinding.instance.addPostFrameCallback((_) {
  39 + _getSetmeal();
  40 + // scrollController.jumpTo(scrollController.position.minScrollExtent);
  41 + });
  42 + bus.on("feast_setmeal_list", (arg) {
  43 + _getSetmeal();
  44 + });
  45 + }
  46 +
  47 + @override
  48 + void dispose() {
  49 + bus.off('feast_setmeal_list');
  50 + super.dispose();
  51 + }
  52 +
  53 + ///获取宴会分类
  54 + Future<bool> _getSetmeal({bool isShowLoading = true}) async {
  55 + await feastModel.getSetmeal(context, isShowLoading: isShowLoading);
  56 + }
  57 +
  58 + _setSetmeal(String mealName, String price, String bargaining) async {
  59 + Map<String, String> params = {
  60 + "sid": Provider.of<UserModel>(context, listen: false).user.sellerid,
  61 + 'meal_name': mealName,
  62 + 'price': price,
  63 + 'bargaining': bargaining
  64 + };
  65 + // if (widget.othersetSunModel != null) {
  66 + // params['id'] = widget.othersetSunModel.id;
  67 + // }
  68 + bool success = await feastModel.setSetmeal(context, params);
  69 + if (success) {
  70 + Utils.showToast('添加成功');
  71 + bus.emit('feast_setmeal_list');
  72 +
  73 + // _getWine(isShowLoading: true);
  74 + }
30 } 75 }
31 76
32 Widget buildFeastTypeHeader() { 77 Widget buildFeastTypeHeader() {
33 return RoundButton( 78 return RoundButton(
34 onPressed: () async { 79 onPressed: () async {
35 - NavigatorUtil.goFeastSetmealManageEditPage(context); 80 + DialogUtil.feastDishEditDialog(context,
  81 + title: '新建套餐',
  82 + nametitle: '套餐名称',
  83 + pricetitle: '套餐价格',
  84 + swichtitle: '是否议价', onTap: (Map map) {
  85 + String per = map['per'];
  86 + String name = map['name'];
  87 + String can = map['can'];
  88 + print(can);
  89 + _setSetmeal(name, per, can);
  90 + });
36 }, 91 },
37 text: '添加一项', 92 text: '添加一项',
38 fontSize: 32, 93 fontSize: 32,
@@ -48,26 +103,27 @@ class _FeastSetmealManagePageState extends State<FeastSetmealManagePage> { @@ -48,26 +103,27 @@ class _FeastSetmealManagePageState extends State<FeastSetmealManagePage> {
48 ); 103 );
49 } 104 }
50 105
51 - Widget buildFeastTypeItem(String title, String subTitle) { 106 + Widget buildFeastTypeItem(SetMealSunModel data, int index) {
52 return Container( 107 return Container(
53 height: h(48), 108 height: h(48),
54 margin: EdgeInsets.only(top: w(12)), 109 margin: EdgeInsets.only(top: w(12)),
55 decoration: BoxDecoration( 110 decoration: BoxDecoration(
56 border: Border( 111 border: Border(
57 - bottom: BorderSide(width:w(0.5), color: MyColours.color_E7E7E7))), 112 + bottom:
  113 + BorderSide(width: w(0.5), color: MyColours.color_E7E7E7))),
58 child: Row( 114 child: Row(
59 children: [ 115 children: [
60 Column( 116 Column(
61 crossAxisAlignment: CrossAxisAlignment.start, 117 crossAxisAlignment: CrossAxisAlignment.start,
62 children: [ 118 children: [
63 Text( 119 Text(
64 - title, 120 + data.mealName,
65 style: TextStyle( 121 style: TextStyle(
66 fontSize: font(16), color: MyColours.color_E6000000), 122 fontSize: font(16), color: MyColours.color_E6000000),
67 ), 123 ),
68 VEmptyView(12), 124 VEmptyView(12),
69 Text( 125 Text(
70 - subTitle, 126 + '${data.price}元 ${data.bargaining == '1' ? '可议价' : '不可议价'}',
71 style: TextStyle( 127 style: TextStyle(
72 fontSize: font(12), color: MyColours.color_999999), 128 fontSize: font(12), color: MyColours.color_999999),
73 ) 129 )
@@ -76,7 +132,7 @@ class _FeastSetmealManagePageState extends State<FeastSetmealManagePage> { @@ -76,7 +132,7 @@ class _FeastSetmealManagePageState extends State<FeastSetmealManagePage> {
76 Spacer(), 132 Spacer(),
77 InkWell( 133 InkWell(
78 onTap: () { 134 onTap: () {
79 - NavigatorUtil.goFeastSetmealManageEditPage(context); 135 + NavigatorUtil.goFeastSetmealManageEditPage(context, data.id);
80 }, 136 },
81 child: Text( 137 child: Text(
82 '修改', 138 '修改',
@@ -93,15 +149,20 @@ class _FeastSetmealManagePageState extends State<FeastSetmealManagePage> { @@ -93,15 +149,20 @@ class _FeastSetmealManagePageState extends State<FeastSetmealManagePage> {
93 DialogUtil.cupertinoAlertDialogFeast(context, 149 DialogUtil.cupertinoAlertDialogFeast(context,
94 rTitle: '删除', 150 rTitle: '删除',
95 title: "是否确认删除", 151 title: "是否确认删除",
96 - content: "1299套餐", lCallback: () { 152 + content: data.mealName, lCallback: () {
97 print("取消"); 153 print("取消");
98 - }, rCallback: () { 154 + }, rCallback: () async {
99 print("确定"); 155 print("确定");
100 - // widget.deleteCallback(index); 156 + Map<String, String> pramas = {'id': data.id};
  157 + bool success = await feastModel.delSetmeal(context, pramas);
  158 + if (success) {
  159 + Utils.showToast('删除成功');
  160 + _getSetmeal(isShowLoading: true);
  161 + }
101 }); 162 });
102 }, 163 },
103 child: Image.asset( 164 child: Image.asset(
104 - Utils.getImgPath(true ? 'f_delete_red_un' : 'f_delete_red'), 165 + Utils.getImgPath('f_delete_red'),
105 width: w(32), 166 width: w(32),
106 height: w(32), 167 height: w(32),
107 )), 168 )),
@@ -113,6 +174,7 @@ class _FeastSetmealManagePageState extends State<FeastSetmealManagePage> { @@ -113,6 +174,7 @@ class _FeastSetmealManagePageState extends State<FeastSetmealManagePage> {
113 174
114 @override 175 @override
115 Widget build(BuildContext context) { 176 Widget build(BuildContext context) {
  177 + feastModel = Provider.of<FeastModel>(context, listen: true);
116 return Scaffold( 178 return Scaffold(
117 backgroundColor: MyColours.color_ffffff, 179 backgroundColor: MyColours.color_ffffff,
118 appBar: SystemAppBar( 180 appBar: SystemAppBar(
@@ -125,30 +187,44 @@ class _FeastSetmealManagePageState extends State<FeastSetmealManagePage> { @@ -125,30 +187,44 @@ class _FeastSetmealManagePageState extends State<FeastSetmealManagePage> {
125 }, 187 },
126 ), 188 ),
127 body: NestedScrollView( 189 body: NestedScrollView(
128 - // controller: _scrollViewController,  
129 - headerSliverBuilder: (BuildContext context, bool innerBoxIsScrolled) {  
130 - return <Widget>[  
131 - SliverAppBar(  
132 - pinned: true,  
133 - floating: false,  
134 - leading: null,  
135 - backgroundColor: MyColours.color_ffffff,  
136 - expandedHeight: ScreenUtil().setWidth(56 * 2),  
137 - automaticallyImplyLeading: false,  
138 - title: buildFeastTypeHeader(),  
139 - // flexibleSpace: FlexibleSpaceBar(  
140 - // collapseMode: CollapseMode.pin,  
141 - // title: buildFeastTypeHeader())  
142 - )  
143 - ];  
144 - },  
145 - body: ListView.builder(  
146 - itemCount: 100,  
147 - padding: EdgeInsets.only(left: w(16)),  
148 - itemBuilder: (BuildContext context, int index) {  
149 - return buildFeastTypeItem('1299套餐', '1499元 不可议价');  
150 - }),  
151 - ), 190 + // controller: _scrollViewController,
  191 + headerSliverBuilder: (BuildContext context, bool innerBoxIsScrolled) {
  192 + return <Widget>[
  193 + SliverAppBar(
  194 + pinned: true,
  195 + floating: false,
  196 + leading: null,
  197 + backgroundColor: MyColours.color_ffffff,
  198 + expandedHeight: ScreenUtil().setWidth(56 * 2),
  199 + automaticallyImplyLeading: false,
  200 + title: buildFeastTypeHeader(),
  201 + // flexibleSpace: FlexibleSpaceBar(
  202 + // collapseMode: CollapseMode.pin,
  203 + // title: buildFeastTypeHeader())
  204 + )
  205 + ];
  206 + }, body: Consumer<FeastModel>(builder: (context, model, _) {
  207 + if (model.pageStateSetmeal != PageState.Success) {
  208 + return ExceptionPage(
  209 + pageState: model.pageStateSetmeal,
  210 + callback: () {
  211 + _getSetmeal();
  212 + },
  213 + emptyMsg: "暂时没有套餐哦",
  214 + emptyImg: "empty_search",
  215 + showMsg: "加载中,请稍后...",
  216 + );
  217 + } else {
  218 + return ListView.builder(
  219 + itemCount: model.setmealData.length,
  220 + padding: EdgeInsets.only(left: w(16)),
  221 + itemBuilder: (BuildContext context, int index) {
  222 + SetMealSunModel data = model.setmealData[index];
  223 + return buildFeastTypeItem(data, index);
  224 + // '1299套餐', '1499元 不可议价'
  225 + });
  226 + }
  227 + })),
152 ); 228 );
153 } 229 }
154 } 230 }
@@ -136,7 +136,18 @@ class _FeastWineManageEditPageState extends State<FeastWineManageEditPage> { @@ -136,7 +136,18 @@ class _FeastWineManageEditPageState extends State<FeastWineManageEditPage> {
136 ), 136 ),
137 contentPadding: EdgeInsets.zero, 137 contentPadding: EdgeInsets.zero,
138 ), 138 ),
139 - onChanged: (value) {}, 139 + onChanged: (value) {
  140 + if (widget.wineSunModel != null && title == '酒水名称') {
  141 + wineNameC.text = value;
  142 + wineNameC.value = TextEditingValue(
  143 + text: wineNameC.text,
  144 + selection: TextSelection.fromPosition(TextPosition(
  145 + affinity: TextAffinity.downstream,
  146 + offset: wineNameC.text.length,
  147 + )));
  148 + setState(() {});
  149 + }
  150 + },
140 onEditingComplete: () { 151 onEditingComplete: () {
141 FocusScope.of(context) 152 FocusScope.of(context)
142 .requestFocus(FocusNode()); //点击空白处隐藏键盘 153 .requestFocus(FocusNode()); //点击空白处隐藏键盘
@@ -204,7 +215,7 @@ class _FeastWineManageEditPageState extends State<FeastWineManageEditPage> { @@ -204,7 +215,7 @@ class _FeastWineManageEditPageState extends State<FeastWineManageEditPage> {
204 return Scaffold( 215 return Scaffold(
205 backgroundColor: MyColours.color_ffffff, 216 backgroundColor: MyColours.color_ffffff,
206 appBar: SystemAppBar( 217 appBar: SystemAppBar(
207 - wineNameC.text, 218 + widget.wineSunModel == null ? '添加酒水' : wineNameC.text,
208 needWhite: true, 219 needWhite: true,
209 bgColor: MyColours.color_438E93, 220 bgColor: MyColours.color_438E93,
210 titleColor: MyColours.color_F6F6F6, 221 titleColor: MyColours.color_F6F6F6,
@@ -126,9 +126,14 @@ class _FeastWineManagePageState extends State<FeastWineManagePage> { @@ -126,9 +126,14 @@ class _FeastWineManagePageState extends State<FeastWineManagePage> {
126 title: "是否确认删除", 126 title: "是否确认删除",
127 content: data.wineName, lCallback: () { 127 content: data.wineName, lCallback: () {
128 print("取消"); 128 print("取消");
129 - }, rCallback: () { 129 + }, rCallback: () async {
130 print("确定"); 130 print("确定");
131 - // widget.deleteCallback(index); 131 + Map<String, String> pramas = {'id': data.id};
  132 + bool success = await feastModel.delWine(context, pramas);
  133 + if (success) {
  134 + Utils.showToast('删除成功');
  135 + _getWine(isShowLoading: true);
  136 + }
132 }); 137 });
133 }, 138 },
134 child: Image.asset( 139 child: Image.asset(
1 import 'package:flutter/material.dart'; 1 import 'package:flutter/material.dart';
2 import 'package:one_key/constant/state.dart'; 2 import 'package:one_key/constant/state.dart';
  3 +import 'package:one_key/models/get_setmeal_class_model.dart';
3 import 'package:one_key/provider/user_model.dart'; 4 import 'package:one_key/provider/user_model.dart';
4 import 'package:provider/provider.dart'; 5 import 'package:provider/provider.dart';
5 6
@@ -8,8 +9,12 @@ import '../constant/error.dart'; @@ -8,8 +9,12 @@ import '../constant/error.dart';
8 import '../models/classify_model.dart'; 9 import '../models/classify_model.dart';
9 import '../models/filter_btn_model.dart'; 10 import '../models/filter_btn_model.dart';
10 import '../models/get_seller_user_by_sellerid_model.dart'; 11 import '../models/get_seller_user_by_sellerid_model.dart';
  12 +import '../models/get_setmeal_class_by_id_model.dart';
11 import '../models/get_staff_model.dart'; 13 import '../models/get_staff_model.dart';
  14 +import '../models/otherset_model.dart';
12 import '../models/personnel_manage_model.dart'; 15 import '../models/personnel_manage_model.dart';
  16 +import '../models/setmeal_by_id_model.dart';
  17 +import '../models/setmeal_model.dart';
13 import '../models/wine_model.dart'; 18 import '../models/wine_model.dart';
14 import '../net/base_resp.dart'; 19 import '../net/base_resp.dart';
15 import '../net/dio_util.dart'; 20 import '../net/dio_util.dart';
@@ -32,6 +37,18 @@ class FeastModel extends ChangeNotifier { @@ -32,6 +37,18 @@ class FeastModel extends ChangeNotifier {
32 PageState pageStateWine = PageState.Loading; //酒水 37 PageState pageStateWine = PageState.Loading; //酒水
33 List<WineSunModel> wineData = []; 38 List<WineSunModel> wineData = [];
34 39
  40 + PageState pageStateOther = PageState.Loading; //其他配置
  41 + List<OthersetSunModel> otherData = [];
  42 +
  43 + PageState pageStateSetmeal = PageState.Loading; //宴会套餐
  44 + List<SetMealSunModel> setmealData = [];
  45 +
  46 + SetMeaByIdSunModel setmealDetail; //套餐详情
  47 +
  48 + List<GetSetmealClassSunModel> setmealClassData = []; //菜品分类
  49 +
  50 + GetSetmealClassByIdSunModel setmealClassDetail; //菜品分类详情
  51 +
35 /*** 52 /***
36 * 53 *
37 * 宴会员工 54 * 宴会员工
@@ -427,4 +444,420 @@ class FeastModel extends ChangeNotifier { @@ -427,4 +444,420 @@ class FeastModel extends ChangeNotifier {
427 return false; 444 return false;
428 } 445 }
429 } 446 }
  447 +
  448 + /**
  449 + * 其他配置
  450 + */
  451 +
  452 + ///添加其他配置
  453 + Future<dynamic> setOthersetList(
  454 + BuildContext context, Map<String, String> params,
  455 + {isShowLoading = true}) async {
  456 + BaseResp<dynamic> baseResp = await DioUtil()
  457 + .request<dynamic>(context, Method.get, HttpUrl.set_other,
  458 + data: params, showLoading: isShowLoading)
  459 + .catchError((error) {
  460 + print(error.toString());
  461 + if (error is MyError) {}
  462 + return false;
  463 + });
  464 + if (baseResp.code == Constant.status_success) {
  465 + // if (baseResp.data == 1) {
  466 + return true;
  467 + // } else {
  468 + // return false;
  469 + // }
  470 + } else {
  471 + if (baseResp != null) {
  472 + Utils.showToast(baseResp.msg ?? "");
  473 + }
  474 + return false;
  475 + }
  476 + }
  477 +
  478 + ///获取其他配置
  479 + Future<bool> getOthersetList(BuildContext context,
  480 + {isShowLoading = true}) async {
  481 + Map<String, String> params = {
  482 + "sid": Provider.of<UserModel>(context, listen: false).user.sellerid,
  483 + };
  484 + BaseResp<dynamic> baseResp = await DioUtil()
  485 + .request<dynamic>(context, Method.get, HttpUrl.get_other,
  486 + data: params, showLoading: isShowLoading)
  487 + .catchError((error) {
  488 + print(error.toString());
  489 + if (error is MyError) {
  490 + switch (error.type) {
  491 + case 1:
  492 + pageStateOther = PageState.ConnectivityError;
  493 + break;
  494 + case 2:
  495 + pageStateOther = PageState.ConnectivityTimeOut;
  496 + break;
  497 + default:
  498 + pageStateOther = PageState.ConnectivityError;
  499 + break;
  500 + }
  501 + }
  502 + notifyListeners();
  503 + return false;
  504 + });
  505 +
  506 + OthersetModel otherModel = OthersetModel.fromJson(baseResp.responseData);
  507 + if (otherModel.ret == Constant.status_success) {
  508 + otherData = otherModel.data;
  509 + if (otherData.length == 0) {
  510 + pageStateOther = PageState.Empty;
  511 + } else {
  512 + pageStateOther = PageState.Success;
  513 + }
  514 +
  515 + notifyListeners();
  516 + return true;
  517 + } else {
  518 + Utils.showToast(baseResp.msg ?? "");
  519 + pageStateOther = PageState.ConnectivityError;
  520 + notifyListeners();
  521 + return false;
  522 + }
  523 + }
  524 +
  525 + ///删除其他配置
  526 + Future<dynamic> delOthersetList(
  527 + BuildContext context, Map<String, String> params,
  528 + {isShowLoading = true}) async {
  529 + BaseResp<dynamic> baseResp = await DioUtil()
  530 + .request<dynamic>(context, Method.get, HttpUrl.del_other,
  531 + data: params, showLoading: isShowLoading)
  532 + .catchError((error) {
  533 + print(error.toString());
  534 + if (error is MyError) {}
  535 + return false;
  536 + });
  537 + if (baseResp.code == Constant.status_success) {
  538 + // if (baseResp.data == 1) {
  539 + return true;
  540 + // } else {
  541 + // return false;
  542 + // }
  543 + } else {
  544 + if (baseResp != null) {
  545 + Utils.showToast(baseResp.msg ?? "");
  546 + }
  547 + return false;
  548 + }
  549 + }
  550 +
  551 + /**
  552 + * 宴会套餐
  553 + */
  554 +
  555 + ///添加宴会套餐
  556 + Future<dynamic> setSetmeal(BuildContext context, Map<String, String> params,
  557 + {isShowLoading = true}) async {
  558 + BaseResp<dynamic> baseResp = await DioUtil()
  559 + .request<dynamic>(context, Method.get, HttpUrl.set_setmeal,
  560 + data: params, showLoading: isShowLoading)
  561 + .catchError((error) {
  562 + print(error.toString());
  563 + if (error is MyError) {}
  564 + return false;
  565 + });
  566 + if (baseResp.code == Constant.status_success) {
  567 + // if (baseResp.data == 1) {
  568 + return true;
  569 + // } else {
  570 + // return false;
  571 + // }
  572 + } else {
  573 + if (baseResp != null) {
  574 + Utils.showToast(baseResp.msg ?? "");
  575 + }
  576 + return false;
  577 + }
  578 + }
  579 +
  580 + ///获取宴会套餐
  581 + Future<bool> getSetmeal(BuildContext context, {isShowLoading = true}) async {
  582 + Map<String, String> params = {
  583 + "sid": Provider.of<UserModel>(context, listen: false).user.sellerid,
  584 + };
  585 + BaseResp<dynamic> baseResp = await DioUtil()
  586 + .request<dynamic>(context, Method.get, HttpUrl.get_setmeal,
  587 + data: params, showLoading: isShowLoading)
  588 + .catchError((error) {
  589 + print(error.toString());
  590 + if (error is MyError) {
  591 + switch (error.type) {
  592 + case 1:
  593 + pageStateSetmeal = PageState.ConnectivityError;
  594 + break;
  595 + case 2:
  596 + pageStateSetmeal = PageState.ConnectivityTimeOut;
  597 + break;
  598 + default:
  599 + pageStateSetmeal = PageState.ConnectivityError;
  600 + break;
  601 + }
  602 + }
  603 + notifyListeners();
  604 + return false;
  605 + });
  606 +
  607 + SetMealModel setmealModel = SetMealModel.fromJson(baseResp.responseData);
  608 + if (setmealModel.ret == Constant.status_success) {
  609 + setmealData = setmealModel.data;
  610 + if (setmealData.length == 0) {
  611 + pageStateSetmeal = PageState.Empty;
  612 + } else {
  613 + pageStateSetmeal = PageState.Success;
  614 + }
  615 +
  616 + notifyListeners();
  617 + return true;
  618 + } else {
  619 + Utils.showToast(baseResp.msg ?? "");
  620 + pageStateSetmeal = PageState.ConnectivityError;
  621 + notifyListeners();
  622 + return false;
  623 + }
  624 + }
  625 +
  626 + ///删除宴会套餐
  627 + Future<dynamic> delSetmeal(BuildContext context, Map<String, String> params,
  628 + {isShowLoading = true}) async {
  629 + BaseResp<dynamic> baseResp = await DioUtil()
  630 + .request<dynamic>(context, Method.get, HttpUrl.del_setmeal,
  631 + data: params, showLoading: isShowLoading)
  632 + .catchError((error) {
  633 + print(error.toString());
  634 + if (error is MyError) {}
  635 + return false;
  636 + });
  637 + if (baseResp.code == Constant.status_success) {
  638 + // if (baseResp.data == 1) {
  639 + return true;
  640 + // } else {
  641 + // return false;
  642 + // }
  643 + } else {
  644 + if (baseResp != null) {
  645 + Utils.showToast(baseResp.msg ?? "");
  646 + }
  647 + return false;
  648 + }
  649 + }
  650 +
  651 + /// 根据ID获取宴会套餐
  652 + Future<bool> getSetmealById(BuildContext context, Map<String, String> params,
  653 + {isShowLoading = true}) async {
  654 + BaseResp<dynamic> baseResp = await DioUtil()
  655 + .request<dynamic>(context, Method.get, HttpUrl.get_setmeal_by_id,
  656 + data: params, showLoading: isShowLoading)
  657 + .catchError((error) {
  658 + print(error.toString());
  659 + if (error is MyError) {}
  660 + notifyListeners();
  661 + return false;
  662 + });
  663 +
  664 + SetMeaByIdModel setMeaByIdModel =
  665 + SetMeaByIdModel.fromJson(baseResp.responseData);
  666 + if (setMeaByIdModel.ret == Constant.status_success) {
  667 + setmealDetail = setMeaByIdModel.data;
  668 +
  669 + notifyListeners();
  670 + return true;
  671 + } else {
  672 + Utils.showToast(baseResp.msg ?? "");
  673 + notifyListeners();
  674 + return false;
  675 + }
  676 + }
  677 +
  678 + /// 获取宴会套餐菜品分类列表
  679 + getSetmealClass(BuildContext context, Map<String, String> params,
  680 + {isShowLoading = true}) async {
  681 + BaseResp<dynamic> baseResp = await DioUtil()
  682 + .request<dynamic>(context, Method.get, HttpUrl.get_setmeal_class,
  683 + data: params, showLoading: isShowLoading)
  684 + .catchError((error) {
  685 + print(error.toString());
  686 + if (error is MyError) {}
  687 + notifyListeners();
  688 + });
  689 +
  690 + GetSetmealClassModel getSetmealClassModel =
  691 + GetSetmealClassModel.fromJson(baseResp.responseData);
  692 + if (getSetmealClassModel.ret == Constant.status_success) {
  693 + setmealClassData = getSetmealClassModel.data;
  694 +
  695 + notifyListeners();
  696 + } else {
  697 + Utils.showToast(baseResp.msg ?? "");
  698 + notifyListeners();
  699 + }
  700 + }
  701 +
  702 + ///添加宴会套餐---菜品分类
  703 + Future<dynamic> setSetmealClass(
  704 + BuildContext context, Map<String, String> params,
  705 + {isShowLoading = true}) async {
  706 + BaseResp<dynamic> baseResp = await DioUtil()
  707 + .request<dynamic>(context, Method.get, HttpUrl.set_setmeal_class,
  708 + data: params, showLoading: isShowLoading)
  709 + .catchError((error) {
  710 + print(error.toString());
  711 + if (error is MyError) {}
  712 + return false;
  713 + });
  714 + if (baseResp.code == Constant.status_success) {
  715 + // if (baseResp.data == 1) {
  716 + return true;
  717 + // } else {
  718 + // return false;
  719 + // }
  720 + } else {
  721 + if (baseResp != null) {
  722 + Utils.showToast(baseResp.msg ?? "");
  723 + }
  724 + return false;
  725 + }
  726 + }
  727 +
  728 + ///删除宴会套餐菜品分类
  729 + Future<dynamic> delSetmealClass(
  730 + BuildContext context, Map<String, String> params,
  731 + {isShowLoading = true}) async {
  732 + BaseResp<dynamic> baseResp = await DioUtil()
  733 + .request<dynamic>(context, Method.get, HttpUrl.del_setmeal_class,
  734 + data: params, showLoading: isShowLoading)
  735 + .catchError((error) {
  736 + print(error.toString());
  737 + if (error is MyError) {}
  738 + return false;
  739 + });
  740 + if (baseResp.code == Constant.status_success) {
  741 + // if (baseResp.data == 1) {
  742 + return true;
  743 + // } else {
  744 + // return false;
  745 + // }
  746 + } else {
  747 + if (baseResp != null) {
  748 + Utils.showToast(baseResp.msg ?? "");
  749 + }
  750 + return false;
  751 + }
  752 + }
  753 +
  754 + /// 根据ID获取宴会套餐菜品分类
  755 + Future<bool> getSetmealClassById(
  756 + BuildContext context, Map<String, String> params,
  757 + {isShowLoading = true}) async {
  758 + BaseResp<dynamic> baseResp = await DioUtil()
  759 + .request<dynamic>(context, Method.get, HttpUrl.get_setmeal_class_by_id,
  760 + data: params, showLoading: isShowLoading)
  761 + .catchError((error) {
  762 + print(error.toString());
  763 + if (error is MyError) {}
  764 + notifyListeners();
  765 + return false;
  766 + });
  767 +
  768 + GetSetmealClassByIdModel getSetmealClassByIdModel =
  769 + GetSetmealClassByIdModel.fromJson(baseResp.responseData);
  770 + if (getSetmealClassByIdModel.ret == Constant.status_success) {
  771 + setmealClassDetail = getSetmealClassByIdModel.data;
  772 +
  773 + notifyListeners();
  774 + return true;
  775 + } else {
  776 + Utils.showToast(baseResp.msg ?? "");
  777 + notifyListeners();
  778 + return false;
  779 + }
  780 + }
  781 +
  782 + ///添加宴会套餐---菜品
  783 + Future<dynamic> setSetmealCook(
  784 + BuildContext context, Map<String, String> params,
  785 + {isShowLoading = true}) async {
  786 + BaseResp<dynamic> baseResp = await DioUtil()
  787 + .request<dynamic>(context, Method.get, HttpUrl.set_setmeal_cook,
  788 + data: params, showLoading: isShowLoading)
  789 + .catchError((error) {
  790 + print(error.toString());
  791 + if (error is MyError) {}
  792 + return false;
  793 + });
  794 + if (baseResp.code == Constant.status_success) {
  795 + // if (baseResp.data == 1) {
  796 + return true;
  797 + // } else {
  798 + // return false;
  799 + // }
  800 + } else {
  801 + if (baseResp != null) {
  802 + Utils.showToast(baseResp.msg ?? "");
  803 + }
  804 + return false;
  805 + }
  806 + }
  807 +
  808 + /// 删除宴会套餐菜品
  809 + Future<dynamic> delSetmealCook(
  810 + BuildContext context, Map<String, String> params,
  811 + {isShowLoading = true}) async {
  812 + BaseResp<dynamic> baseResp = await DioUtil()
  813 + .request<dynamic>(context, Method.get, HttpUrl.del_setmeal_cook,
  814 + data: params, showLoading: isShowLoading)
  815 + .catchError((error) {
  816 + print(error.toString());
  817 + if (error is MyError) {}
  818 + return false;
  819 + });
  820 + if (baseResp.code == Constant.status_success) {
  821 + // if (baseResp.data == 1) {
  822 + return true;
  823 + // } else {
  824 + // return false;
  825 + // }
  826 + } else {
  827 + if (baseResp != null) {
  828 + Utils.showToast(baseResp.msg ?? "");
  829 + }
  830 + return false;
  831 + }
  832 + }
  833 +
  834 + /**
  835 + * 定金
  836 + */
  837 +
  838 + ///添加宴会套餐
  839 + Future<dynamic> setBanquetConf(
  840 + BuildContext context, Map<String, String> params,
  841 + {isShowLoading = true}) async {
  842 + BaseResp<dynamic> baseResp = await DioUtil()
  843 + .request<dynamic>(context, Method.get, HttpUrl.set_banquet_conf,
  844 + data: params, showLoading: isShowLoading)
  845 + .catchError((error) {
  846 + print(error.toString());
  847 + if (error is MyError) {}
  848 + return false;
  849 + });
  850 + if (baseResp.code == Constant.status_success) {
  851 + // if (baseResp.data == 1) {
  852 + return true;
  853 + // } else {
  854 + // return false;
  855 + // }
  856 + } else {
  857 + if (baseResp != null) {
  858 + Utils.showToast(baseResp.msg ?? "");
  859 + }
  860 + return false;
  861 + }
  862 + }
430 } 863 }
@@ -26,6 +26,7 @@ import 'package:one_key/utils/utils.dart'; @@ -26,6 +26,7 @@ import 'package:one_key/utils/utils.dart';
26 import 'package:sqflite/sqlite_api.dart'; 26 import 'package:sqflite/sqlite_api.dart';
27 27
28 import '../app.dart'; 28 import '../app.dart';
  29 +import '../models/otherset_model.dart';
29 import '../models/wine_model.dart'; 30 import '../models/wine_model.dart';
30 31
31 class NavigatorUtil { 32 class NavigatorUtil {
@@ -923,16 +924,21 @@ class NavigatorUtil { @@ -923,16 +924,21 @@ class NavigatorUtil {
923 } 924 }
924 925
925 ///宴会----宴会管理 --- 套餐添加 926 ///宴会----宴会管理 --- 套餐添加
926 - static Future<dynamic> goFeastSetmealManageEditPage(BuildContext context, 927 + static Future<dynamic> goFeastSetmealManageEditPage(
  928 + BuildContext context, String setmealId,
927 {replace = false, bool onlyShow = false}) { 929 {replace = false, bool onlyShow = false}) {
928 - return _navigateTo(context, "${Routes.feast_setmeal_manage_edit_page}", 930 + return _navigateTo(context,
  931 + "${Routes.feast_setmeal_manage_edit_page}?setmealId=$setmealId",
929 replace: replace); 932 replace: replace);
930 } 933 }
931 934
932 ///宴会----宴会管理 --- 套餐---菜品 935 ///宴会----宴会管理 --- 套餐---菜品
933 - static Future<dynamic> goFeastDishPage(BuildContext context, 936 + static Future<dynamic> goFeastDishPage(
  937 + BuildContext context, String setmealId, String classId,
934 {replace = false, bool onlyShow = false}) { 938 {replace = false, bool onlyShow = false}) {
935 - return _navigateTo(context, "${Routes.feast_dish_page}", replace: replace); 939 + return _navigateTo(context,
  940 + "${Routes.feast_dish_page}?setmealId=$setmealId&classId=$classId",
  941 + replace: replace);
936 } 942 }
937 943
938 ///宴会----宴会管理 --- 酒水管理 944 ///宴会----宴会管理 --- 酒水管理
@@ -959,8 +965,9 @@ class NavigatorUtil { @@ -959,8 +965,9 @@ class NavigatorUtil {
959 965
960 ///宴会----宴会管理 --- 其他配置添加 966 ///宴会----宴会管理 --- 其他配置添加
961 static Future<dynamic> goFeastOthersetManageEditPage(BuildContext context, 967 static Future<dynamic> goFeastOthersetManageEditPage(BuildContext context,
962 - {replace = false, bool onlyShow = false}) {  
963 - return _navigateTo(context, "${Routes.feast_otherset_manage_edit_page}", 968 + {replace = false, bool isNew = true, OthersetSunModel othersetSunModel}) {
  969 + return _navigateTo(context,
  970 + "${Routes.feast_otherset_manage_edit_page}?othersetSunModel=${FluroConvertUtils.object2string(othersetSunModel)}&isNew=$isNew",
964 replace: replace); 971 replace: replace);
965 } 972 }
966 973
@@ -13,6 +13,7 @@ import 'package:one_key/models/integral_model.dart'; @@ -13,6 +13,7 @@ import 'package:one_key/models/integral_model.dart';
13 import 'package:one_key/models/marketing_by_id_model.dart'; 13 import 'package:one_key/models/marketing_by_id_model.dart';
14 import 'package:one_key/models/marketing_by_uid_model.dart'; 14 import 'package:one_key/models/marketing_by_uid_model.dart';
15 import 'package:one_key/models/notebook_detail.dart'; 15 import 'package:one_key/models/notebook_detail.dart';
  16 +import 'package:one_key/models/otherset_model.dart';
16 import 'package:one_key/models/personnel_manage_model.dart'; 17 import 'package:one_key/models/personnel_manage_model.dart';
17 import 'package:one_key/models/sms_info.dart'; 18 import 'package:one_key/models/sms_info.dart';
18 import 'package:one_key/models/statics_model.dart'; 19 import 'package:one_key/models/statics_model.dart';
@@ -1463,21 +1464,24 @@ var feastSetmealManagePageHandle = new Handler( @@ -1463,21 +1464,24 @@ var feastSetmealManagePageHandle = new Handler(
1463 ///宴会---套餐管理 1464 ///宴会---套餐管理
1464 var feastSetmealManageEditPageHandle = new Handler( 1465 var feastSetmealManageEditPageHandle = new Handler(
1465 handlerFunc: (BuildContext context, Map<dynamic, List<Object>> params) { 1466 handlerFunc: (BuildContext context, Map<dynamic, List<Object>> params) {
1466 - // String uids = params["uids"].first; 1467 + String setmealId = params["setmealId"].first;
1467 1468
1468 // bool onlyShow = FluroConvertUtils.string2bool(params["onlyShow"].first); 1469 // bool onlyShow = FluroConvertUtils.string2bool(params["onlyShow"].first);
1469 return ChangeNotifierProvider<FeastModel>( 1470 return ChangeNotifierProvider<FeastModel>(
1470 - create: (_) => FeastModel(), child: FeastSetmealManageEditPage()); 1471 + create: (_) => FeastModel(),
  1472 + child: FeastSetmealManageEditPage(setmealId: setmealId));
1471 }); 1473 });
1472 1474
1473 ///宴会---菜品 1475 ///宴会---菜品
1474 var feastDishPageHandle = new Handler( 1476 var feastDishPageHandle = new Handler(
1475 handlerFunc: (BuildContext context, Map<dynamic, List<Object>> params) { 1477 handlerFunc: (BuildContext context, Map<dynamic, List<Object>> params) {
1476 - // String uids = params["uids"].first; 1478 + String setmealId = params["setmealId"].first;
  1479 + String classId = params["classId"].first;
1477 1480
1478 // bool onlyShow = FluroConvertUtils.string2bool(params["onlyShow"].first); 1481 // bool onlyShow = FluroConvertUtils.string2bool(params["onlyShow"].first);
1479 return ChangeNotifierProvider<FeastModel>( 1482 return ChangeNotifierProvider<FeastModel>(
1480 - create: (_) => FeastModel(), child: FeastDishPage()); 1483 + create: (_) => FeastModel(),
  1484 + child: FeastDishPage(setmealId: setmealId, classId: classId));
1481 }); 1485 });
1482 1486
1483 ///宴会---酒水管理 1487 ///宴会---酒水管理
@@ -1527,6 +1531,18 @@ var feastOthersetManageEditPageHandle = new Handler( @@ -1527,6 +1531,18 @@ var feastOthersetManageEditPageHandle = new Handler(
1527 // String uids = params["uids"].first; 1531 // String uids = params["uids"].first;
1528 1532
1529 // bool onlyShow = FluroConvertUtils.string2bool(params["onlyShow"].first); 1533 // bool onlyShow = FluroConvertUtils.string2bool(params["onlyShow"].first);
  1534 +
  1535 + bool isNew = FluroConvertUtils.string2bool(params["isNew"].first);
  1536 + if (!isNew) {
  1537 + OthersetSunModel othersetSunModel = OthersetSunModel.fromJson(json.decode(
  1538 + FluroConvertUtils.fluroCnParamsDecode(
  1539 + params["othersetSunModel"].first)));
  1540 +//
  1541 + // bool onlyShow = FluroConvertUtils.string2bool(params["onlyShow"].first);
  1542 + return ChangeNotifierProvider<FeastModel>(
  1543 + create: (_) => FeastModel(),
  1544 + child: FeastOthersetManageEditPage(othersetSunModel: othersetSunModel));
  1545 + }
1530 return ChangeNotifierProvider<FeastModel>( 1546 return ChangeNotifierProvider<FeastModel>(
1531 create: (_) => FeastModel(), child: FeastOthersetManageEditPage()); 1547 create: (_) => FeastModel(), child: FeastOthersetManageEditPage());
1532 }); 1548 });
@@ -692,6 +692,9 @@ class DialogUtil { @@ -692,6 +692,9 @@ class DialogUtil {
692 BuildContext context, { 692 BuildContext context, {
693 CustomCallBackMap onTap, 693 CustomCallBackMap onTap,
694 String title = '菜品信息', 694 String title = '菜品信息',
  695 + String nametitle = '菜品名称',
  696 + String pricetitle = '菜品规格',
  697 + String swichtitle = '是否可调菜',
695 String content = '', 698 String content = '',
696 String per = '', 699 String per = '',
697 bool can = true, 700 bool can = true,
@@ -738,7 +741,7 @@ class DialogUtil { @@ -738,7 +741,7 @@ class DialogUtil {
738 padding: EdgeInsets.symmetric(horizontal: w(16)), 741 padding: EdgeInsets.symmetric(horizontal: w(16)),
739 child: Row(children: [ 742 child: Row(children: [
740 Text( 743 Text(
741 - '菜品名称', 744 + nametitle,
742 style: TextStyle( 745 style: TextStyle(
743 fontSize: ScreenUtil().setSp(32), 746 fontSize: ScreenUtil().setSp(32),
744 color: MyColours.color_000000), 747 color: MyColours.color_000000),
@@ -786,7 +789,7 @@ class DialogUtil { @@ -786,7 +789,7 @@ class DialogUtil {
786 padding: EdgeInsets.symmetric(horizontal: w(16)), 789 padding: EdgeInsets.symmetric(horizontal: w(16)),
787 child: Row(children: [ 790 child: Row(children: [
788 Text( 791 Text(
789 - '菜品规格', 792 + pricetitle,
790 style: TextStyle( 793 style: TextStyle(
791 fontSize: ScreenUtil().setSp(32), 794 fontSize: ScreenUtil().setSp(32),
792 color: MyColours.color_000000), 795 color: MyColours.color_000000),
@@ -825,9 +828,19 @@ class DialogUtil { @@ -825,9 +828,19 @@ class DialogUtil {
825 FocusScope.of(context).requestFocus( 828 FocusScope.of(context).requestFocus(
826 FocusNode()); //点击空白处隐藏键盘 829 FocusNode()); //点击空白处隐藏键盘
827 }, 830 },
828 - keyboardType: TextInputType.text, 831 + keyboardType: title == '新建套餐'
  832 + ? TextInputType.numberWithOptions()
  833 + : TextInputType.text,
829 ), 834 ),
830 - )) 835 + )),
  836 + title == '新建套餐'
  837 + ? Padding(
  838 + padding: EdgeInsets.only(left: w(12)),
  839 + child: Text('元',
  840 + style: TextStyle(
  841 + fontSize: font(16),
  842 + color: MyColours.color_000000)))
  843 + : SizedBox()
831 ])), 844 ])),
832 VEmptyView(32), 845 VEmptyView(32),
833 Container( 846 Container(
@@ -844,9 +857,9 @@ class DialogUtil { @@ -844,9 +857,9 @@ class DialogUtil {
844 Container( 857 Container(
845 width: w(81), 858 width: w(81),
846 height: w(48), 859 height: w(48),
847 - alignment: Alignment.center, 860 + alignment: Alignment.centerLeft,
848 child: Text( 861 child: Text(
849 - '是否可调菜', 862 + swichtitle,
850 style: TextStyle( 863 style: TextStyle(
851 fontSize: ScreenUtil().setSp(32), 864 fontSize: ScreenUtil().setSp(32),
852 color: MyColours.color_E6000000), 865 color: MyColours.color_E6000000),
@@ -907,12 +920,12 @@ class DialogUtil { @@ -907,12 +920,12 @@ class DialogUtil {
907 fontSize: 32, 920 fontSize: 32,
908 onPressed: () { 921 onPressed: () {
909 if (nameC.text.trim() == '') { 922 if (nameC.text.trim() == '') {
910 - Utils.showToast('请输入菜品名称!'); 923 + Utils.showToast('请输入${nametitle}!');
911 924
912 return; 925 return;
913 } 926 }
914 if (perC.text.trim() == '') { 927 if (perC.text.trim() == '') {
915 - Utils.showToast('请输入菜品规格!'); 928 + Utils.showToast('请输入${pricetitle}!');
916 return; 929 return;
917 } 930 }
918 onTap({ 931 onTap({