Showing
17 changed files
with
977 additions
and
223 deletions
| @@ -4,7 +4,7 @@ class MenuModel { | @@ -4,7 +4,7 @@ class MenuModel { | ||
| 4 | String id; | 4 | String id; |
| 5 | String sellerid; | 5 | String sellerid; |
| 6 | String className; | 6 | String className; |
| 7 | - Null classLabel; | 7 | + dynamic classLabel; |
| 8 | String order; | 8 | String order; |
| 9 | String status; | 9 | String status; |
| 10 | String classType; | 10 | String classType; |
| @@ -30,7 +30,7 @@ class GetSetmealClassByIdSunModel { | @@ -30,7 +30,7 @@ class GetSetmealClassByIdSunModel { | ||
| 30 | String mid; | 30 | String mid; |
| 31 | String className; | 31 | String className; |
| 32 | String status; | 32 | String status; |
| 33 | - Null cdate; | 33 | + dynamic cdate; |
| 34 | List<CookById> cook; | 34 | List<CookById> cook; |
| 35 | 35 | ||
| 36 | GetSetmealClassByIdSunModel( | 36 | GetSetmealClassByIdSunModel( |
| @@ -33,7 +33,7 @@ class GetSetmealClassSunModel { | @@ -33,7 +33,7 @@ class GetSetmealClassSunModel { | ||
| 33 | String mid; | 33 | String mid; |
| 34 | String className; | 34 | String className; |
| 35 | String status; | 35 | String status; |
| 36 | - Null cdate; | 36 | + dynamic cdate; |
| 37 | List<Cook> cook; | 37 | List<Cook> cook; |
| 38 | 38 | ||
| 39 | GetSetmealClassSunModel( | 39 | GetSetmealClassSunModel( |
| 1 | +import 'package:flutter/material.dart'; | ||
| 1 | import 'package:one_key/models/dsolt_xt.dart'; | 2 | import 'package:one_key/models/dsolt_xt.dart'; |
| 2 | import 'package:one_key/models/table_list.dart' as t; | 3 | import 'package:one_key/models/table_list.dart' as t; |
| 3 | 4 | ||
| @@ -21,6 +22,7 @@ class SetXuanTaiModel { | @@ -21,6 +22,7 @@ class SetXuanTaiModel { | ||
| 21 | String startDate = ''; | 22 | String startDate = ''; |
| 22 | String endDate = ''; | 23 | String endDate = ''; |
| 23 | List<t.TableList> tableList; | 24 | List<t.TableList> tableList; |
| 25 | + int tableSum = 0; //桌位总数 | ||
| 24 | 26 | ||
| 25 | SetXuanTaiModel( | 27 | SetXuanTaiModel( |
| 26 | {this.rid, | 28 | {this.rid, |
| @@ -102,6 +104,7 @@ class Tids { | @@ -102,6 +104,7 @@ class Tids { | ||
| 102 | String tid; | 104 | String tid; |
| 103 | String numStr; | 105 | String numStr; |
| 104 | String name; | 106 | String name; |
| 107 | + TextEditingController tableNumC = TextEditingController(); //桌位个数 | ||
| 105 | 108 | ||
| 106 | Tids({this.tid, this.numStr, this.name}); | 109 | Tids({this.tid, this.numStr, this.name}); |
| 107 | 110 | ||
| @@ -125,14 +128,29 @@ class Setmeal { | @@ -125,14 +128,29 @@ class Setmeal { | ||
| 125 | String pnum; | 128 | String pnum; |
| 126 | String min; | 129 | String min; |
| 127 | String spare; | 130 | String spare; |
| 128 | - | ||
| 129 | - Setmeal( | ||
| 130 | - {this.setmealId, | ||
| 131 | - this.price, | ||
| 132 | - this.finalPrice, | ||
| 133 | - this.pnum, | ||
| 134 | - this.min, | ||
| 135 | - this.spare}); | 131 | + String name; |
| 132 | + bool select = false; | ||
| 133 | + String bargaining; | ||
| 134 | + TextEditingController finalPriceC; | ||
| 135 | + TextEditingController pnumC; | ||
| 136 | + TextEditingController minC; | ||
| 137 | + TextEditingController spareC; | ||
| 138 | + | ||
| 139 | + Setmeal({ | ||
| 140 | + this.setmealId, | ||
| 141 | + this.price, | ||
| 142 | + this.finalPrice, | ||
| 143 | + this.pnum, | ||
| 144 | + this.min, | ||
| 145 | + this.spare, | ||
| 146 | + this.name, | ||
| 147 | + this.select, | ||
| 148 | + this.bargaining, | ||
| 149 | + // this.finalPriceC, | ||
| 150 | + // this.pnumC, | ||
| 151 | + // this.minC, | ||
| 152 | + // this.spareC, | ||
| 153 | + }); | ||
| 136 | 154 | ||
| 137 | Setmeal.fromJson(Map<String, dynamic> json) { | 155 | Setmeal.fromJson(Map<String, dynamic> json) { |
| 138 | setmealId = json['setmeal_id']; | 156 | setmealId = json['setmeal_id']; |
| @@ -141,6 +159,13 @@ class Setmeal { | @@ -141,6 +159,13 @@ class Setmeal { | ||
| 141 | pnum = json['pnum']; | 159 | pnum = json['pnum']; |
| 142 | min = json['min']; | 160 | min = json['min']; |
| 143 | spare = json['spare']; | 161 | spare = json['spare']; |
| 162 | + name = json['name']; | ||
| 163 | + select = json['select']; | ||
| 164 | + bargaining = json['bargaining']; | ||
| 165 | + // finalPriceC = json['finalPriceC']; | ||
| 166 | + // pnumC = json['pnumC']; | ||
| 167 | + // minC = json['minC']; | ||
| 168 | + // spareC = json['spareC']; | ||
| 144 | } | 169 | } |
| 145 | 170 | ||
| 146 | Map<String, dynamic> toJson() { | 171 | Map<String, dynamic> toJson() { |
| @@ -151,6 +176,14 @@ class Setmeal { | @@ -151,6 +176,14 @@ class Setmeal { | ||
| 151 | data['pnum'] = this.pnum; | 176 | data['pnum'] = this.pnum; |
| 152 | data['min'] = this.min; | 177 | data['min'] = this.min; |
| 153 | data['spare'] = this.spare; | 178 | data['spare'] = this.spare; |
| 179 | + data['name'] = this.name; | ||
| 180 | + data['select'] = this.select; | ||
| 181 | + data['bargaining'] = this.bargaining; | ||
| 182 | + // data['finalPriceC'] = this.finalPriceC; | ||
| 183 | + // data['pnumC'] = this.pnumC; | ||
| 184 | + // data['minC'] = this.minC; | ||
| 185 | + // data['spareC'] = this.spareC; | ||
| 186 | + | ||
| 154 | return data; | 187 | return data; |
| 155 | } | 188 | } |
| 156 | } | 189 | } |
| @@ -31,9 +31,9 @@ class SetMeaByIdSunModel { | @@ -31,9 +31,9 @@ class SetMeaByIdSunModel { | ||
| 31 | String price; | 31 | String price; |
| 32 | String bargaining; | 32 | String bargaining; |
| 33 | String status; | 33 | String status; |
| 34 | - Null cdate; | ||
| 35 | - List<Classify> classify; | ||
| 36 | - List<Cook> cook; | 34 | + dynamic cdate; |
| 35 | + List<ClassifyById> classify; | ||
| 36 | + List<CookByIdSetmeal> cook; | ||
| 37 | 37 | ||
| 38 | SetMeaByIdSunModel( | 38 | SetMeaByIdSunModel( |
| 39 | {this.id, | 39 | {this.id, |
| @@ -55,15 +55,15 @@ class SetMeaByIdSunModel { | @@ -55,15 +55,15 @@ class SetMeaByIdSunModel { | ||
| 55 | status = json['status']; | 55 | status = json['status']; |
| 56 | cdate = json['cdate']; | 56 | cdate = json['cdate']; |
| 57 | if (json['class'] != null) { | 57 | if (json['class'] != null) { |
| 58 | - classify = <Classify>[]; | 58 | + classify = <ClassifyById>[]; |
| 59 | json['class'].forEach((v) { | 59 | json['class'].forEach((v) { |
| 60 | - classify.add(new Classify.fromJson(v)); | 60 | + classify.add(new ClassifyById.fromJson(v)); |
| 61 | }); | 61 | }); |
| 62 | } | 62 | } |
| 63 | if (json['cook'] != null) { | 63 | if (json['cook'] != null) { |
| 64 | - cook = <Cook>[]; | 64 | + cook = <CookByIdSetmeal>[]; |
| 65 | json['cook'].forEach((v) { | 65 | json['cook'].forEach((v) { |
| 66 | - cook.add(new Cook.fromJson(v)); | 66 | + cook.add(new CookByIdSetmeal.fromJson(v)); |
| 67 | }); | 67 | }); |
| 68 | } | 68 | } |
| 69 | } | 69 | } |
| @@ -87,7 +87,7 @@ class SetMeaByIdSunModel { | @@ -87,7 +87,7 @@ class SetMeaByIdSunModel { | ||
| 87 | } | 87 | } |
| 88 | } | 88 | } |
| 89 | 89 | ||
| 90 | -class Classify { | 90 | +class ClassifyById { |
| 91 | String id; | 91 | String id; |
| 92 | String sid; | 92 | String sid; |
| 93 | String mid; | 93 | String mid; |
| @@ -95,10 +95,10 @@ class Classify { | @@ -95,10 +95,10 @@ class Classify { | ||
| 95 | String status; | 95 | String status; |
| 96 | dynamic cdate; | 96 | dynamic cdate; |
| 97 | 97 | ||
| 98 | - Classify( | 98 | + ClassifyById( |
| 99 | {this.id, this.sid, this.mid, this.className, this.status, this.cdate}); | 99 | {this.id, this.sid, this.mid, this.className, this.status, this.cdate}); |
| 100 | 100 | ||
| 101 | - Classify.fromJson(Map<String, dynamic> json) { | 101 | + ClassifyById.fromJson(Map<String, dynamic> json) { |
| 102 | id = json['id']; | 102 | id = json['id']; |
| 103 | sid = json['sid']; | 103 | sid = json['sid']; |
| 104 | mid = json['mid']; | 104 | mid = json['mid']; |
| @@ -119,7 +119,7 @@ class Classify { | @@ -119,7 +119,7 @@ class Classify { | ||
| 119 | } | 119 | } |
| 120 | } | 120 | } |
| 121 | 121 | ||
| 122 | -class Cook { | 122 | +class CookByIdSetmeal { |
| 123 | String id; | 123 | String id; |
| 124 | String sid; | 124 | String sid; |
| 125 | String cid; | 125 | String cid; |
| @@ -129,7 +129,7 @@ class Cook { | @@ -129,7 +129,7 @@ class Cook { | ||
| 129 | String isTrim; | 129 | String isTrim; |
| 130 | String status; | 130 | String status; |
| 131 | 131 | ||
| 132 | - Cook( | 132 | + CookByIdSetmeal( |
| 133 | {this.id, | 133 | {this.id, |
| 134 | this.sid, | 134 | this.sid, |
| 135 | this.cid, | 135 | this.cid, |
| @@ -139,7 +139,7 @@ class Cook { | @@ -139,7 +139,7 @@ class Cook { | ||
| 139 | this.isTrim, | 139 | this.isTrim, |
| 140 | this.status}); | 140 | this.status}); |
| 141 | 141 | ||
| 142 | - Cook.fromJson(Map<String, dynamic> json) { | 142 | + CookByIdSetmeal.fromJson(Map<String, dynamic> json) { |
| 143 | id = json['id']; | 143 | id = json['id']; |
| 144 | sid = json['sid']; | 144 | sid = json['sid']; |
| 145 | cid = json['cid']; | 145 | cid = json['cid']; |
| @@ -96,7 +96,7 @@ class Classify { | @@ -96,7 +96,7 @@ class Classify { | ||
| 96 | String mid; | 96 | String mid; |
| 97 | String className; | 97 | String className; |
| 98 | String status; | 98 | String status; |
| 99 | - Null cdate; | 99 | + dynamic cdate; |
| 100 | 100 | ||
| 101 | Classify( | 101 | Classify( |
| 102 | {this.id, this.sid, this.mid, this.className, this.status, this.cdate}); | 102 | {this.id, this.sid, this.mid, this.className, this.status, this.cdate}); |
| @@ -917,6 +917,9 @@ class _FeastCreatePageState extends State<FeastCreatePage> { | @@ -917,6 +917,9 @@ class _FeastCreatePageState extends State<FeastCreatePage> { | ||
| 917 | return item.title; | 917 | return item.title; |
| 918 | }).toList(), (value) { | 918 | }).toList(), (value) { |
| 919 | if (value != null) { | 919 | if (value != null) { |
| 920 | + xuantaiData[xuantaiSelIndex].tids = []; | ||
| 921 | + xuantaiData[xuantaiSelIndex].tableList = []; | ||
| 922 | + xuantaiData[xuantaiSelIndex].tableSum = 0; | ||
| 920 | setState(() { | 923 | setState(() { |
| 921 | xuantaiData[xuantaiSelIndex].cdSelIndex = | 924 | xuantaiData[xuantaiSelIndex].cdSelIndex = |
| 922 | value.first; | 925 | value.first; |
| @@ -1005,7 +1008,8 @@ class _FeastCreatePageState extends State<FeastCreatePage> { | @@ -1005,7 +1008,8 @@ class _FeastCreatePageState extends State<FeastCreatePage> { | ||
| 1005 | recognizer: TapGestureRecognizer() | 1008 | recognizer: TapGestureRecognizer() |
| 1006 | ..onTap = () {}), | 1009 | ..onTap = () {}), |
| 1007 | TextSpan( | 1010 | TextSpan( |
| 1008 | - text: '(共0桌)', | 1011 | + text: |
| 1012 | + '(共${xuantaiData[xuantaiSelIndex].tableSum}桌)', | ||
| 1009 | style: TextStyle( | 1013 | style: TextStyle( |
| 1010 | color: MyColours.color_000000, | 1014 | color: MyColours.color_000000, |
| 1011 | fontSize: ScreenUtil().setSp(28)), | 1015 | fontSize: ScreenUtil().setSp(28)), |
| @@ -1043,14 +1047,71 @@ class _FeastCreatePageState extends State<FeastCreatePage> { | @@ -1043,14 +1047,71 @@ class _FeastCreatePageState extends State<FeastCreatePage> { | ||
| 1043 | fontSize: font(16)), | 1047 | fontSize: font(16)), |
| 1044 | )), | 1048 | )), |
| 1045 | Container( | 1049 | Container( |
| 1046 | - width: w(22), | ||
| 1047 | - child: Text( | ||
| 1048 | - '30', | ||
| 1049 | - style: TextStyle( | ||
| 1050 | - color: MyColours.color_438E93, | ||
| 1051 | - fontSize: font(14)), | ||
| 1052 | - ), | ||
| 1053 | - ), | 1050 | + width: w(80), |
| 1051 | + height: h(20), | ||
| 1052 | + decoration: BoxDecoration( | ||
| 1053 | + border: Border.all( | ||
| 1054 | + width: w(1), | ||
| 1055 | + color: MyColours | ||
| 1056 | + .color_438E93)), | ||
| 1057 | + child: TextField( | ||
| 1058 | + maxLines: 1, | ||
| 1059 | + | ||
| 1060 | + //输入文本的样式 | ||
| 1061 | + style: TextStyle( | ||
| 1062 | + fontSize: ScreenUtil() | ||
| 1063 | + .setSp(28), | ||
| 1064 | + color: MyColours | ||
| 1065 | + .color_438E93), | ||
| 1066 | + controller: xuantaiData[ | ||
| 1067 | + xuantaiSelIndex] | ||
| 1068 | + .tids[index] | ||
| 1069 | + .tableNumC, | ||
| 1070 | + // focusNode: node, | ||
| 1071 | + // textAlignVertical: TextAlignVertical.top, | ||
| 1072 | + textAlign: TextAlign.center, | ||
| 1073 | + decoration: InputDecoration( | ||
| 1074 | + hintText: '请输入', | ||
| 1075 | + hintStyle: TextStyle( | ||
| 1076 | + color: MyColours | ||
| 1077 | + .color_999999, | ||
| 1078 | + fontSize: ScreenUtil() | ||
| 1079 | + .setSp(28), | ||
| 1080 | + ), | ||
| 1081 | + // contentPadding: | ||
| 1082 | + // EdgeInsets.only(bottom: ScreenUtil().setWidth(17)), | ||
| 1083 | + // border: InputBorder.none, | ||
| 1084 | + contentPadding: | ||
| 1085 | + EdgeInsets.zero, | ||
| 1086 | + border: OutlineInputBorder( | ||
| 1087 | + borderSide: | ||
| 1088 | + BorderSide.none), | ||
| 1089 | + ), | ||
| 1090 | + onChanged: (value) { | ||
| 1091 | + print('ggg'); | ||
| 1092 | + xuantaiData[xuantaiSelIndex] | ||
| 1093 | + .tableSum = 0; | ||
| 1094 | + for (Tids item | ||
| 1095 | + in xuantaiData[ | ||
| 1096 | + xuantaiSelIndex] | ||
| 1097 | + .tids) { | ||
| 1098 | + xuantaiData[xuantaiSelIndex] | ||
| 1099 | + .tableSum += | ||
| 1100 | + int.parse(item | ||
| 1101 | + .tableNumC.text); | ||
| 1102 | + } | ||
| 1103 | + setState(() {}); | ||
| 1104 | + }, | ||
| 1105 | + onEditingComplete: () { | ||
| 1106 | + // print('fff'); | ||
| 1107 | + // node.unfocus(); | ||
| 1108 | + // _homeEnterModel.nameController.text = | ||
| 1109 | + // nameStr + _nameSuffix(); | ||
| 1110 | + // _addNameSuffix(nameStr, sexStr); | ||
| 1111 | + }, | ||
| 1112 | + keyboardType: | ||
| 1113 | + TextInputType.number)), | ||
| 1114 | + HEmptyView(8), | ||
| 1054 | Text( | 1115 | Text( |
| 1055 | '桌', | 1116 | '桌', |
| 1056 | style: TextStyle( | 1117 | style: TextStyle( |
| @@ -1059,10 +1120,38 @@ class _FeastCreatePageState extends State<FeastCreatePage> { | @@ -1059,10 +1120,38 @@ class _FeastCreatePageState extends State<FeastCreatePage> { | ||
| 1059 | ), | 1120 | ), |
| 1060 | HEmptyView(32), | 1121 | HEmptyView(32), |
| 1061 | InkWell( | 1122 | InkWell( |
| 1123 | + onTap: () { | ||
| 1124 | + FocusScope.of(context) | ||
| 1125 | + .requestFocus( | ||
| 1126 | + FocusNode()); //点击空白处隐藏键盘 | ||
| 1127 | + //弹框确认是否删除 | ||
| 1128 | + DialogUtil.cupertinoAlertDialog( | ||
| 1129 | + context, | ||
| 1130 | + title: "", | ||
| 1131 | + content: "是否确定删除?", | ||
| 1132 | + isBoldContent: true, | ||
| 1133 | + contentColor: MyColours | ||
| 1134 | + .color_E6000000, | ||
| 1135 | + rTitle: "删除", | ||
| 1136 | + rCallback: () { | ||
| 1137 | + xuantaiData[xuantaiSelIndex] | ||
| 1138 | + .tableSum -= | ||
| 1139 | + int.parse(xuantaiData[ | ||
| 1140 | + xuantaiSelIndex] | ||
| 1141 | + .tids[index] | ||
| 1142 | + .tableNumC | ||
| 1143 | + .text); | ||
| 1144 | + xuantaiData[xuantaiSelIndex] | ||
| 1145 | + .tids | ||
| 1146 | + .removeAt(index); | ||
| 1147 | + // _delGuestInfocDay(model.cday[index].id); | ||
| 1148 | + }); | ||
| 1149 | + }, | ||
| 1062 | child: Image.asset( | 1150 | child: Image.asset( |
| 1063 | - Utils.getImgPath('f_delete_red'), | ||
| 1064 | - width: w(20), | ||
| 1065 | - )) | 1151 | + Utils.getImgPath( |
| 1152 | + 'f_delete_red'), | ||
| 1153 | + width: w(20), | ||
| 1154 | + )) | ||
| 1066 | ], | 1155 | ], |
| 1067 | ), | 1156 | ), |
| 1068 | ); | 1157 | ); |
| @@ -1081,6 +1170,11 @@ class _FeastCreatePageState extends State<FeastCreatePage> { | @@ -1081,6 +1170,11 @@ class _FeastCreatePageState extends State<FeastCreatePage> { | ||
| 1081 | onPressed: () async { | 1170 | onPressed: () async { |
| 1082 | FocusScope.of(context) | 1171 | FocusScope.of(context) |
| 1083 | .requestFocus(FocusNode()); //点击空白处隐藏键盘 | 1172 | .requestFocus(FocusNode()); //点击空白处隐藏键盘 |
| 1173 | + if (xuantaiData[xuantaiSelIndex].cdShow == | ||
| 1174 | + '请选择') { | ||
| 1175 | + Utils.showToast('请选择餐段'); | ||
| 1176 | + return; | ||
| 1177 | + } | ||
| 1084 | 1178 | ||
| 1085 | if (xuantaiData[xuantaiSelIndex].cdShow == | 1179 | if (xuantaiData[xuantaiSelIndex].cdShow == |
| 1086 | '不带餐') { | 1180 | '不带餐') { |
| @@ -1127,52 +1221,70 @@ class _FeastCreatePageState extends State<FeastCreatePage> { | @@ -1127,52 +1221,70 @@ class _FeastCreatePageState extends State<FeastCreatePage> { | ||
| 1127 | setState(() {}); | 1221 | setState(() {}); |
| 1128 | } | 1222 | } |
| 1129 | } else { | 1223 | } else { |
| 1224 | + if (xuantaiData[xuantaiSelIndex] | ||
| 1225 | + .dateTimeShowxt == | ||
| 1226 | + '请选择') { | ||
| 1227 | + Utils.showToast('请选择宴会日期'); | ||
| 1228 | + return; | ||
| 1229 | + } | ||
| 1130 | //带餐 | 1230 | //带餐 |
| 1231 | + int ddate = xuantaiData[xuantaiSelIndex] | ||
| 1232 | + .dateTimext | ||
| 1233 | + .millisecondsSinceEpoch; | ||
| 1234 | + String ddateSolt = dsoltList[ | ||
| 1235 | + xuantaiData[xuantaiSelIndex] | ||
| 1236 | + .cdSelIndex] | ||
| 1237 | + .id; | ||
| 1238 | + | ||
| 1239 | + Map temp = {}; | ||
| 1240 | + if (xuantaiData[xuantaiSelIndex] | ||
| 1241 | + .tableList != | ||
| 1242 | + null && | ||
| 1243 | + xuantaiData[xuantaiSelIndex] | ||
| 1244 | + .tableList | ||
| 1245 | + .length > | ||
| 1246 | + 0) { | ||
| 1247 | + temp = await NavigatorUtil | ||
| 1248 | + .goSelectTableFPage( | ||
| 1249 | + context, '', ddate, ddateSolt, | ||
| 1250 | + canChoose: true, | ||
| 1251 | + object: { | ||
| 1252 | + 'object': | ||
| 1253 | + xuantaiData[xuantaiSelIndex] | ||
| 1254 | + .tableList | ||
| 1255 | + }); | ||
| 1256 | + } else { | ||
| 1257 | + temp = await NavigatorUtil | ||
| 1258 | + .goSelectTableFPage( | ||
| 1259 | + context, | ||
| 1260 | + '', | ||
| 1261 | + ddate, | ||
| 1262 | + ddateSolt, | ||
| 1263 | + canChoose: true, | ||
| 1264 | + ); | ||
| 1265 | + } | ||
| 1266 | + | ||
| 1267 | + if (temp == null) { | ||
| 1268 | + } else if (temp['object'].length == 0) { | ||
| 1269 | + } else { | ||
| 1270 | + xuantaiData[xuantaiSelIndex].tids = []; | ||
| 1271 | + xuantaiData[xuantaiSelIndex].tableList = | ||
| 1272 | + temp['object']; | ||
| 1273 | + | ||
| 1274 | + for (t.TableList item | ||
| 1275 | + in xuantaiData[xuantaiSelIndex] | ||
| 1276 | + .tableList) { | ||
| 1277 | + item.selected = true; | ||
| 1278 | + Tids tids = Tids(); | ||
| 1279 | + tids.tid = item.tid; | ||
| 1280 | + tids.name = item.name; | ||
| 1281 | + xuantaiData[xuantaiSelIndex] | ||
| 1282 | + .tids | ||
| 1283 | + .add(tids); | ||
| 1284 | + } | ||
| 1285 | + setState(() {}); | ||
| 1286 | + } | ||
| 1131 | } | 1287 | } |
| 1132 | - // int ddate = xuantaiData[xuantaiSelIndex] | ||
| 1133 | - // .dateTimext | ||
| 1134 | - // .millisecondsSinceEpoch; | ||
| 1135 | - // String ddateSolt = _notebookDetailChangeModel | ||
| 1136 | - // .currTimeIndex | ||
| 1137 | - // .toString(); | ||
| 1138 | - // Map temp = | ||
| 1139 | - // await NavigatorUtil.goSelectTableFPage( | ||
| 1140 | - // context, '', ddate, ddateSolt, | ||
| 1141 | - // canChoose: true, | ||
| 1142 | - // object: { | ||
| 1143 | - // 'object': | ||
| 1144 | - // _notebookDetailChangeModel.tableList | ||
| 1145 | - // }); | ||
| 1146 | - | ||
| 1147 | - // if (temp == null) { | ||
| 1148 | - // } else if (temp['object'].length == 0) { | ||
| 1149 | - // } else { | ||
| 1150 | - // _notebookDetailChangeModel.tableList = | ||
| 1151 | - // temp['object']; | ||
| 1152 | - | ||
| 1153 | - // for (t.TableList item | ||
| 1154 | - // in _notebookDetailChangeModel | ||
| 1155 | - // .tableList) { | ||
| 1156 | - // item.selected = true; | ||
| 1157 | - // } | ||
| 1158 | - // // setState(() {}); | ||
| 1159 | - // int dateTimeMill = | ||
| 1160 | - // _notebookDetailChangeModel | ||
| 1161 | - // .dateTime.millisecondsSinceEpoch; | ||
| 1162 | - | ||
| 1163 | - // await _notebookDetailChangeModel | ||
| 1164 | - // .getNewTableList( | ||
| 1165 | - // context, | ||
| 1166 | - // '${dateTimeMill}', | ||
| 1167 | - // _notebookDetailChangeModel | ||
| 1168 | - // .currTimeIndex | ||
| 1169 | - // .toString(), | ||
| 1170 | - // widget.detailEntity.pnum, | ||
| 1171 | - // _notebookDetailChangeModel | ||
| 1172 | - // .tableList); | ||
| 1173 | - // _notebookDetailChangeModel | ||
| 1174 | - // .notifyListeners(); | ||
| 1175 | - // } | ||
| 1176 | }, | 1288 | }, |
| 1177 | ), | 1289 | ), |
| 1178 | VEmptyView(52), | 1290 | VEmptyView(52), |
| @@ -1183,13 +1295,20 @@ class _FeastCreatePageState extends State<FeastCreatePage> { | @@ -1183,13 +1295,20 @@ class _FeastCreatePageState extends State<FeastCreatePage> { | ||
| 1183 | fontSize: ScreenUtil().setSp(28)), | 1295 | fontSize: ScreenUtil().setSp(28)), |
| 1184 | ), | 1296 | ), |
| 1185 | ListView.builder( | 1297 | ListView.builder( |
| 1186 | - itemCount: 2, | 1298 | + itemCount: xuantaiData[xuantaiSelIndex] |
| 1299 | + .setmeal | ||
| 1300 | + .length, | ||
| 1187 | shrinkWrap: true, | 1301 | shrinkWrap: true, |
| 1188 | controller: controller, | 1302 | controller: controller, |
| 1189 | itemBuilder: | 1303 | itemBuilder: |
| 1190 | (BuildContext context, int index) { | 1304 | (BuildContext context, int index) { |
| 1305 | + Setmeal setmeal = | ||
| 1306 | + xuantaiData[xuantaiSelIndex] | ||
| 1307 | + .setmeal[index]; | ||
| 1191 | return Container( | 1308 | return Container( |
| 1192 | - height: h(80), | 1309 | + // height: h(80), |
| 1310 | + padding: | ||
| 1311 | + EdgeInsets.symmetric(vertical: w(10)), | ||
| 1193 | decoration: BoxDecoration( | 1312 | decoration: BoxDecoration( |
| 1194 | border: Border( | 1313 | border: Border( |
| 1195 | bottom: BorderSide( | 1314 | bottom: BorderSide( |
| @@ -1206,7 +1325,7 @@ class _FeastCreatePageState extends State<FeastCreatePage> { | @@ -1206,7 +1325,7 @@ class _FeastCreatePageState extends State<FeastCreatePage> { | ||
| 1206 | children: [ | 1325 | children: [ |
| 1207 | Expanded( | 1326 | Expanded( |
| 1208 | child: Text( | 1327 | child: Text( |
| 1209 | - '1299套餐', | 1328 | + setmeal.name, |
| 1210 | overflow: TextOverflow.ellipsis, | 1329 | overflow: TextOverflow.ellipsis, |
| 1211 | style: TextStyle( | 1330 | style: TextStyle( |
| 1212 | color: | 1331 | color: |
| @@ -1217,7 +1336,8 @@ class _FeastCreatePageState extends State<FeastCreatePage> { | @@ -1217,7 +1336,8 @@ class _FeastCreatePageState extends State<FeastCreatePage> { | ||
| 1217 | onTap: () { | 1336 | onTap: () { |
| 1218 | NavigatorUtil | 1337 | NavigatorUtil |
| 1219 | .goFeastMenuPage( | 1338 | .goFeastMenuPage( |
| 1220 | - context); | 1339 | + context, |
| 1340 | + setmeal.setmealId); | ||
| 1221 | }, | 1341 | }, |
| 1222 | child: Row( | 1342 | child: Row( |
| 1223 | children: [ | 1343 | children: [ |
| @@ -1245,15 +1365,44 @@ class _FeastCreatePageState extends State<FeastCreatePage> { | @@ -1245,15 +1365,44 @@ class _FeastCreatePageState extends State<FeastCreatePage> { | ||
| 1245 | )) | 1365 | )) |
| 1246 | ], | 1366 | ], |
| 1247 | ), | 1367 | ), |
| 1368 | + setmeal.finalPrice.isEmpty && | ||
| 1369 | + setmeal.min.isEmpty && | ||
| 1370 | + setmeal.spare.isEmpty && | ||
| 1371 | + setmeal.pnum.isEmpty | ||
| 1372 | + ? SizedBox() | ||
| 1373 | + : VEmptyView(32), | ||
| 1248 | Row( | 1374 | Row( |
| 1249 | mainAxisAlignment: | 1375 | mainAxisAlignment: |
| 1250 | - MainAxisAlignment.spaceBetween, | 1376 | + MainAxisAlignment.start, |
| 1251 | children: [ | 1377 | children: [ |
| 1252 | - taocanText('1299', ' 元/桌'), | ||
| 1253 | - taocanText('10', ' 人/桌'), | ||
| 1254 | - taocanTextType( | ||
| 1255 | - '保证 ', '1299', ' 桌'), | ||
| 1256 | - taocanTextType('备用 ', '2', ' 桌'), | 1378 | + setmeal.finalPrice.isNotEmpty |
| 1379 | + ? Padding( | ||
| 1380 | + padding: EdgeInsets.only( | ||
| 1381 | + right: w(16)), | ||
| 1382 | + child: taocanText( | ||
| 1383 | + setmeal.finalPrice, | ||
| 1384 | + ' 元/桌')) | ||
| 1385 | + : SizedBox(), | ||
| 1386 | + setmeal.pnum.isNotEmpty | ||
| 1387 | + ? Padding( | ||
| 1388 | + padding: EdgeInsets.only( | ||
| 1389 | + right: w(16)), | ||
| 1390 | + child: taocanText( | ||
| 1391 | + setmeal.pnum, ' 人/桌')) | ||
| 1392 | + : SizedBox(), | ||
| 1393 | + setmeal.min.isNotEmpty | ||
| 1394 | + ? Padding( | ||
| 1395 | + padding: EdgeInsets.only( | ||
| 1396 | + right: w(16)), | ||
| 1397 | + child: taocanTextType( | ||
| 1398 | + '保证 ', | ||
| 1399 | + setmeal.min, | ||
| 1400 | + ' 桌')) | ||
| 1401 | + : SizedBox(), | ||
| 1402 | + setmeal.spare.isNotEmpty | ||
| 1403 | + ? taocanTextType('备用 ', | ||
| 1404 | + setmeal.spare, ' 桌') | ||
| 1405 | + : SizedBox(), | ||
| 1257 | ], | 1406 | ], |
| 1258 | ) | 1407 | ) |
| 1259 | ], | 1408 | ], |
| @@ -1271,8 +1420,36 @@ class _FeastCreatePageState extends State<FeastCreatePage> { | @@ -1271,8 +1420,36 @@ class _FeastCreatePageState extends State<FeastCreatePage> { | ||
| 1271 | isBold: false, | 1420 | isBold: false, |
| 1272 | gradientStart: MyColours.color_438E93, | 1421 | gradientStart: MyColours.color_438E93, |
| 1273 | gradientEnd: MyColours.color_438E93, | 1422 | gradientEnd: MyColours.color_438E93, |
| 1274 | - onPressed: () { | ||
| 1275 | - NavigatorUtil.goFeastSetmealPage(context); | 1423 | + onPressed: () async { |
| 1424 | + Map temp = {}; | ||
| 1425 | + if (xuantaiData[xuantaiSelIndex] | ||
| 1426 | + .setmeal | ||
| 1427 | + .length > | ||
| 1428 | + 0) { | ||
| 1429 | + temp = | ||
| 1430 | + await NavigatorUtil.goFeastSetmealPage( | ||
| 1431 | + context, | ||
| 1432 | + justSelData: { | ||
| 1433 | + 'object': xuantaiData[xuantaiSelIndex] | ||
| 1434 | + .setmeal | ||
| 1435 | + }); | ||
| 1436 | + } else { | ||
| 1437 | + temp = | ||
| 1438 | + await NavigatorUtil.goFeastSetmealPage( | ||
| 1439 | + context, | ||
| 1440 | + ); | ||
| 1441 | + } | ||
| 1442 | + | ||
| 1443 | + if (temp == null) { | ||
| 1444 | + } else if (temp['object'].length == 0) { | ||
| 1445 | + } else { | ||
| 1446 | + xuantaiData[xuantaiSelIndex].setmeal = | ||
| 1447 | + temp['object']; | ||
| 1448 | + print(xuantaiData[xuantaiSelIndex] | ||
| 1449 | + .setmeal | ||
| 1450 | + .toString()); | ||
| 1451 | + } | ||
| 1452 | + setState(() {}); | ||
| 1276 | }, | 1453 | }, |
| 1277 | ), | 1454 | ), |
| 1278 | VEmptyView(52), | 1455 | VEmptyView(52), |
| 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_by_id_model.dart'; | ||
| 5 | +import 'package:one_key/models/setmeal_model.dart'; | ||
| 3 | import 'package:one_key/widgets/MyDivider.dart'; | 6 | import 'package:one_key/widgets/MyDivider.dart'; |
| 4 | import 'package:one_key/widgets/h_empty_view.dart'; | 7 | import 'package:one_key/widgets/h_empty_view.dart'; |
| 8 | +import 'package:provider/provider.dart'; | ||
| 5 | 9 | ||
| 10 | +import '../../constant/state.dart'; | ||
| 11 | +import '../../provider/feast_model.dart'; | ||
| 6 | import '../../res/colors.dart'; | 12 | import '../../res/colors.dart'; |
| 7 | import '../../utils/screen_util.dart'; | 13 | import '../../utils/screen_util.dart'; |
| 8 | import '../../utils/utils.dart'; | 14 | import '../../utils/utils.dart'; |
| 15 | +import '../../widgets/page_exception.dart'; | ||
| 9 | import '../../widgets/system_app_bar.dart'; | 16 | import '../../widgets/system_app_bar.dart'; |
| 10 | import '../../widgets/v_empty_view.dart'; | 17 | import '../../widgets/v_empty_view.dart'; |
| 11 | 18 | ||
| @@ -14,7 +21,8 @@ import '../../widgets/v_empty_view.dart'; | @@ -14,7 +21,8 @@ import '../../widgets/v_empty_view.dart'; | ||
| 14 | * 调菜 | 21 | * 调菜 |
| 15 | */ | 22 | */ |
| 16 | class FeastMenuPage extends StatefulWidget { | 23 | class FeastMenuPage extends StatefulWidget { |
| 17 | - FeastMenuPage({Key key}) : super(key: key); | 24 | + final String setmealId; |
| 25 | + FeastMenuPage({Key key, this.setmealId}) : super(key: key); | ||
| 18 | 26 | ||
| 19 | @override | 27 | @override |
| 20 | _FeastMenuPageState createState() => _FeastMenuPageState(); | 28 | _FeastMenuPageState createState() => _FeastMenuPageState(); |
| @@ -22,12 +30,43 @@ class FeastMenuPage extends StatefulWidget { | @@ -22,12 +30,43 @@ class FeastMenuPage extends StatefulWidget { | ||
| 22 | 30 | ||
| 23 | class _FeastMenuPageState extends State<FeastMenuPage> { | 31 | class _FeastMenuPageState extends State<FeastMenuPage> { |
| 24 | ScrollController controller = ScrollController(); | 32 | ScrollController controller = ScrollController(); |
| 33 | + FeastModel feastModel; | ||
| 34 | + Map<String, List<CookByIdSetmeal>> data = {}; | ||
| 35 | + List<String> classNames = []; | ||
| 25 | @override | 36 | @override |
| 26 | void initState() { | 37 | void initState() { |
| 27 | // TODO: implement initState | 38 | // TODO: implement initState |
| 28 | super.initState(); | 39 | super.initState(); |
| 29 | 40 | ||
| 30 | Utils.changeStatusColor(color: MyColours.color_438E93); | 41 | Utils.changeStatusColor(color: MyColours.color_438E93); |
| 42 | + WidgetsBinding.instance.addPostFrameCallback((_) { | ||
| 43 | + _getSetmealById(); | ||
| 44 | + }); | ||
| 45 | + } | ||
| 46 | + | ||
| 47 | + /// 根据ID获取宴会套餐 | ||
| 48 | + _getSetmealById({bool isShowLoading = true}) async { | ||
| 49 | + Map<String, String> params = {"id": widget.setmealId}; | ||
| 50 | + bool success = await feastModel.getSetmealById(context, params, | ||
| 51 | + isShowLoading: isShowLoading); | ||
| 52 | + if (success) { | ||
| 53 | + for (ClassifyById item in feastModel.setmealDetail.classify) { | ||
| 54 | + // Map<String, List<CookByIdSetmeal>> map = {}; | ||
| 55 | + String cid = item.id; | ||
| 56 | + String className = item.className; | ||
| 57 | + | ||
| 58 | + List<CookByIdSetmeal> temp = []; | ||
| 59 | + for (CookByIdSetmeal itemCook in feastModel.setmealDetail.cook) { | ||
| 60 | + if (cid == itemCook.cid) { | ||
| 61 | + temp.add(itemCook); | ||
| 62 | + } | ||
| 63 | + } | ||
| 64 | + classNames.add(className); | ||
| 65 | + data[className] = temp; | ||
| 66 | + } | ||
| 67 | + feastModel.pageStateMenu = PageState.Success; | ||
| 68 | + setState(() {}); | ||
| 69 | + } | ||
| 31 | } | 70 | } |
| 32 | 71 | ||
| 33 | Widget _callButton( | 72 | Widget _callButton( |
| @@ -122,17 +161,19 @@ class _FeastMenuPageState extends State<FeastMenuPage> { | @@ -122,17 +161,19 @@ class _FeastMenuPageState extends State<FeastMenuPage> { | ||
| 122 | ); | 161 | ); |
| 123 | } | 162 | } |
| 124 | 163 | ||
| 125 | - Widget _itemBuildWidget(BuildContext context, int index) { | 164 | + Widget _itemBuildWidget(BuildContext context, int index1) { |
| 165 | + List<CookByIdSetmeal> cookList = data[classNames[index1]]; | ||
| 126 | return ListView.builder( | 166 | return ListView.builder( |
| 127 | shrinkWrap: true, | 167 | shrinkWrap: true, |
| 128 | controller: controller, | 168 | controller: controller, |
| 129 | padding: EdgeInsets.only(right: w(12)), | 169 | padding: EdgeInsets.only(right: w(12)), |
| 130 | - itemCount: _getItemListCount(), | 170 | + itemCount: cookList.length + 1, |
| 131 | itemBuilder: (BuildContext context, int index) { | 171 | itemBuilder: (BuildContext context, int index) { |
| 132 | if (index < 1) { | 172 | if (index < 1) { |
| 133 | - return _buildHeaderWidget(context, index); | 173 | + return _buildHeaderWidget(context, classNames[index1]); |
| 134 | } else { | 174 | } else { |
| 135 | int itemIndex = index - 1; | 175 | int itemIndex = index - 1; |
| 176 | + CookByIdSetmeal setmeal = cookList[itemIndex]; | ||
| 136 | 177 | ||
| 137 | return Container( | 178 | return Container( |
| 138 | margin: new EdgeInsets.only(bottom: h(12)), | 179 | margin: new EdgeInsets.only(bottom: h(12)), |
| @@ -148,7 +189,7 @@ class _FeastMenuPageState extends State<FeastMenuPage> { | @@ -148,7 +189,7 @@ class _FeastMenuPageState extends State<FeastMenuPage> { | ||
| 148 | Container( | 189 | Container( |
| 149 | width: h(90), | 190 | width: h(90), |
| 150 | child: Text( | 191 | child: Text( |
| 151 | - '鱼香肉丝', | 192 | + setmeal.cname, |
| 152 | overflow: TextOverflow.ellipsis, | 193 | overflow: TextOverflow.ellipsis, |
| 153 | maxLines: 10, | 194 | maxLines: 10, |
| 154 | style: TextStyle( | 195 | style: TextStyle( |
| @@ -159,7 +200,7 @@ class _FeastMenuPageState extends State<FeastMenuPage> { | @@ -159,7 +200,7 @@ class _FeastMenuPageState extends State<FeastMenuPage> { | ||
| 159 | Container( | 200 | Container( |
| 160 | width: h(36), | 201 | width: h(36), |
| 161 | child: Text( | 202 | child: Text( |
| 162 | - '10份', | 203 | + '10${setmeal.spec}', |
| 163 | overflow: TextOverflow.ellipsis, | 204 | overflow: TextOverflow.ellipsis, |
| 164 | maxLines: 1, | 205 | maxLines: 1, |
| 165 | style: TextStyle( | 206 | style: TextStyle( |
| @@ -167,7 +208,7 @@ class _FeastMenuPageState extends State<FeastMenuPage> { | @@ -167,7 +208,7 @@ class _FeastMenuPageState extends State<FeastMenuPage> { | ||
| 167 | fontSize: ScreenUtil().setSp(32)), | 208 | fontSize: ScreenUtil().setSp(32)), |
| 168 | )), | 209 | )), |
| 169 | HEmptyView(16), | 210 | HEmptyView(16), |
| 170 | - index == 1 | 211 | + setmeal.isTrim == '0' |
| 171 | ? Text( | 212 | ? Text( |
| 172 | '不可调菜', | 213 | '不可调菜', |
| 173 | overflow: TextOverflow.ellipsis, | 214 | overflow: TextOverflow.ellipsis, |
| @@ -202,17 +243,17 @@ class _FeastMenuPageState extends State<FeastMenuPage> { | @@ -202,17 +243,17 @@ class _FeastMenuPageState extends State<FeastMenuPage> { | ||
| 202 | ); | 243 | ); |
| 203 | } | 244 | } |
| 204 | 245 | ||
| 205 | - // 总count数 | ||
| 206 | - int _getItemListCount() { | ||
| 207 | - return 3 + 1; | ||
| 208 | - } | 246 | + // // 总count数 |
| 247 | + // int _getItemListCount() { | ||
| 248 | + // return data.length + 1; | ||
| 249 | + // } | ||
| 209 | 250 | ||
| 210 | // header内容 | 251 | // header内容 |
| 211 | - Widget _buildHeaderWidget(BuildContext context, int index) { | 252 | + Widget _buildHeaderWidget(BuildContext context, String title) { |
| 212 | return Padding( | 253 | return Padding( |
| 213 | padding: EdgeInsets.only(bottom: h(12)), | 254 | padding: EdgeInsets.only(bottom: h(12)), |
| 214 | child: Text( | 255 | child: Text( |
| 215 | - '热菜', | 256 | + title, |
| 216 | style: TextStyle( | 257 | style: TextStyle( |
| 217 | color: MyColours.color_515151, | 258 | color: MyColours.color_515151, |
| 218 | fontSize: font(16), | 259 | fontSize: font(16), |
| @@ -222,6 +263,7 @@ class _FeastMenuPageState extends State<FeastMenuPage> { | @@ -222,6 +263,7 @@ class _FeastMenuPageState extends State<FeastMenuPage> { | ||
| 222 | 263 | ||
| 223 | @override | 264 | @override |
| 224 | Widget build(BuildContext context) { | 265 | Widget build(BuildContext context) { |
| 266 | + feastModel = Provider.of(context); | ||
| 225 | return Scaffold( | 267 | return Scaffold( |
| 226 | backgroundColor: MyColours.color_ffffff, | 268 | backgroundColor: MyColours.color_ffffff, |
| 227 | appBar: SystemAppBar( | 269 | appBar: SystemAppBar( |
| @@ -233,62 +275,76 @@ class _FeastMenuPageState extends State<FeastMenuPage> { | @@ -233,62 +275,76 @@ class _FeastMenuPageState extends State<FeastMenuPage> { | ||
| 233 | Navigator.pop(context); | 275 | Navigator.pop(context); |
| 234 | }, | 276 | }, |
| 235 | ), | 277 | ), |
| 236 | - body: Column( | ||
| 237 | - crossAxisAlignment: CrossAxisAlignment.start, | ||
| 238 | - children: [ | ||
| 239 | - Expanded( | ||
| 240 | - child: SingleChildScrollView( | ||
| 241 | - controller: controller, | ||
| 242 | - child: Padding( | ||
| 243 | - padding: EdgeInsets.only(left: w(16)), | ||
| 244 | - child: Column( | ||
| 245 | - crossAxisAlignment: CrossAxisAlignment.start, | ||
| 246 | - children: [ | ||
| 247 | - VEmptyView(64), | ||
| 248 | - Text( | ||
| 249 | - '1299套餐', | ||
| 250 | - style: TextStyle( | ||
| 251 | - color: MyColours.color_E6000000, | ||
| 252 | - fontSize: font(16)), | ||
| 253 | - ), | ||
| 254 | - VEmptyView(24), | ||
| 255 | - MyDivider( | ||
| 256 | - double.infinity, | ||
| 257 | - h(1), | ||
| 258 | - color: MyColours.color_E7E7E7, | ||
| 259 | - ), | ||
| 260 | - VEmptyView(64), | ||
| 261 | - ListView.builder( | ||
| 262 | - shrinkWrap: true, | ||
| 263 | - controller: controller, | ||
| 264 | - padding: EdgeInsets.only(right: w(12)), | ||
| 265 | - itemCount: 10, | ||
| 266 | - itemBuilder: (BuildContext context, int index) { | ||
| 267 | - return buildItemWidget(context, index); | ||
| 268 | - }, | ||
| 269 | - ) | ||
| 270 | - ], | ||
| 271 | - )), | ||
| 272 | - )), | ||
| 273 | - Row( | 278 | + body: Consumer<FeastModel>(builder: (context, model, _) { |
| 279 | + if (model.pageStateMenu != PageState.Success) { | ||
| 280 | + return ExceptionPage( | ||
| 281 | + pageState: model.pageStateMenu, | ||
| 282 | + callback: () { | ||
| 283 | + // _getSellerUserBySellerid(); | ||
| 284 | + }, | ||
| 285 | + emptyMsg: "暂时没有菜品哦", | ||
| 286 | + emptyImg: "empty_search", | ||
| 287 | + showMsg: "加载中,请稍后...", | ||
| 288 | + ); | ||
| 289 | + } else { | ||
| 290 | + return Column( | ||
| 291 | + crossAxisAlignment: CrossAxisAlignment.start, | ||
| 274 | children: [ | 292 | children: [ |
| 275 | Expanded( | 293 | Expanded( |
| 276 | - child: _callButton( | ||
| 277 | - onPress: () { | ||
| 278 | - Navigator.pop(context); | ||
| 279 | - }, | ||
| 280 | - content: '返回', | ||
| 281 | - hasLeftBorder: true, | ||
| 282 | - isSelect: false)), | ||
| 283 | - Expanded( | ||
| 284 | - child: _callButton( | ||
| 285 | - onPress: () {}, | ||
| 286 | - content: '保存并返回', | ||
| 287 | - hasLeftBorder: true, | ||
| 288 | - isSelect: true)) | 294 | + child: SingleChildScrollView( |
| 295 | + controller: controller, | ||
| 296 | + child: Padding( | ||
| 297 | + padding: EdgeInsets.only(left: w(16)), | ||
| 298 | + child: Column( | ||
| 299 | + crossAxisAlignment: CrossAxisAlignment.start, | ||
| 300 | + children: [ | ||
| 301 | + VEmptyView(64), | ||
| 302 | + Text( | ||
| 303 | + feastModel.setmealDetail.mealName, | ||
| 304 | + style: TextStyle( | ||
| 305 | + color: MyColours.color_E6000000, | ||
| 306 | + fontSize: font(16)), | ||
| 307 | + ), | ||
| 308 | + VEmptyView(24), | ||
| 309 | + MyDivider( | ||
| 310 | + double.infinity, | ||
| 311 | + h(1), | ||
| 312 | + color: MyColours.color_E7E7E7, | ||
| 313 | + ), | ||
| 314 | + VEmptyView(64), | ||
| 315 | + ListView.builder( | ||
| 316 | + shrinkWrap: true, | ||
| 317 | + controller: controller, | ||
| 318 | + padding: EdgeInsets.only(right: w(12)), | ||
| 319 | + itemCount: data.length, | ||
| 320 | + itemBuilder: (BuildContext context, int index) { | ||
| 321 | + return buildItemWidget(context, index); | ||
| 322 | + }, | ||
| 323 | + ) | ||
| 324 | + ], | ||
| 325 | + )), | ||
| 326 | + )), | ||
| 327 | + Row( | ||
| 328 | + children: [ | ||
| 329 | + Expanded( | ||
| 330 | + child: _callButton( | ||
| 331 | + onPress: () { | ||
| 332 | + Navigator.pop(context); | ||
| 333 | + }, | ||
| 334 | + content: '返回', | ||
| 335 | + hasLeftBorder: true, | ||
| 336 | + isSelect: false)), | ||
| 337 | + Expanded( | ||
| 338 | + child: _callButton( | ||
| 339 | + onPress: () {}, | ||
| 340 | + content: '保存并返回', | ||
| 341 | + hasLeftBorder: true, | ||
| 342 | + isSelect: true)) | ||
| 343 | + ], | ||
| 344 | + ) | ||
| 289 | ], | 345 | ], |
| 290 | - ) | ||
| 291 | - ], | ||
| 292 | - )); | 346 | + ); |
| 347 | + } | ||
| 348 | + })); | ||
| 293 | } | 349 | } |
| 294 | } | 350 | } |
| 1 | +import 'package:contacts_service/contacts_service.dart'; | ||
| 1 | import 'package:flutter/material.dart'; | 2 | import 'package:flutter/material.dart'; |
| 2 | import 'package:flutter_screenutil/flutter_screenutil.dart'; | 3 | import 'package:flutter_screenutil/flutter_screenutil.dart'; |
| 3 | import 'package:one_key/widgets/h_empty_view.dart'; | 4 | import 'package:one_key/widgets/h_empty_view.dart'; |
| 5 | +import 'package:provider/provider.dart'; | ||
| 4 | 6 | ||
| 7 | +import '../../constant/state.dart'; | ||
| 8 | +import '../../models/set_xuan_tai_model.dart'; | ||
| 9 | +import '../../models/setmeal_model.dart'; | ||
| 10 | +import '../../provider/feast_model.dart'; | ||
| 5 | import '../../res/colors.dart'; | 11 | import '../../res/colors.dart'; |
| 6 | import '../../utils/screen_util.dart'; | 12 | import '../../utils/screen_util.dart'; |
| 7 | import '../../utils/utils.dart'; | 13 | import '../../utils/utils.dart'; |
| 14 | +import '../../widgets/page_exception.dart'; | ||
| 8 | import '../../widgets/round_button.dart'; | 15 | import '../../widgets/round_button.dart'; |
| 9 | import '../../widgets/system_app_bar.dart'; | 16 | import '../../widgets/system_app_bar.dart'; |
| 10 | import '../../widgets/v_empty_view.dart'; | 17 | import '../../widgets/v_empty_view.dart'; |
| @@ -13,17 +20,64 @@ import '../../widgets/v_empty_view.dart'; | @@ -13,17 +20,64 @@ import '../../widgets/v_empty_view.dart'; | ||
| 13 | * 添加套餐 | 20 | * 添加套餐 |
| 14 | */ | 21 | */ |
| 15 | class FeastSetmealPage extends StatefulWidget { | 22 | class FeastSetmealPage extends StatefulWidget { |
| 16 | - FeastSetmealPage({Key key}) : super(key: key); | 23 | + final List<Setmeal> justSelData; |
| 24 | + FeastSetmealPage({Key key, this.justSelData}) : super(key: key); | ||
| 17 | 25 | ||
| 18 | @override | 26 | @override |
| 19 | _FeastSetmealPageState createState() => _FeastSetmealPageState(); | 27 | _FeastSetmealPageState createState() => _FeastSetmealPageState(); |
| 20 | } | 28 | } |
| 21 | 29 | ||
| 22 | class _FeastSetmealPageState extends State<FeastSetmealPage> { | 30 | class _FeastSetmealPageState extends State<FeastSetmealPage> { |
| 31 | + List<Setmeal> setmealData = []; | ||
| 32 | + FeastModel feastModel; | ||
| 33 | + | ||
| 23 | @override | 34 | @override |
| 24 | void initState() { | 35 | void initState() { |
| 25 | super.initState(); | 36 | super.initState(); |
| 26 | Utils.changeStatusColor(color: MyColours.color_438E93); | 37 | Utils.changeStatusColor(color: MyColours.color_438E93); |
| 38 | + | ||
| 39 | + WidgetsBinding.instance.addPostFrameCallback((_) { | ||
| 40 | + _getSetmeal(); | ||
| 41 | + // scrollController.jumpTo(scrollController.position.minScrollExtent); | ||
| 42 | + }); | ||
| 43 | + } | ||
| 44 | + | ||
| 45 | + ///获取宴会套餐 | ||
| 46 | + Future<bool> _getSetmeal({bool isShowLoading = true}) async { | ||
| 47 | + bool success = | ||
| 48 | + await feastModel.getSetmeal(context, isShowLoading: isShowLoading); | ||
| 49 | + if (success) { | ||
| 50 | + List<String> setmealids = widget.justSelData.map((e) { | ||
| 51 | + return e.setmealId; | ||
| 52 | + }).toList(); | ||
| 53 | + for (SetMealSunModel item in feastModel.setmealData) { | ||
| 54 | + Setmeal setmeal = Setmeal(); | ||
| 55 | + setmeal.setmealId = item.id; | ||
| 56 | + setmeal.name = item.mealName; | ||
| 57 | + setmeal.bargaining = item.bargaining; | ||
| 58 | + setmeal.finalPriceC = TextEditingController(); | ||
| 59 | + setmeal.minC = TextEditingController(); | ||
| 60 | + setmeal.pnumC = TextEditingController(); | ||
| 61 | + setmeal.spareC = TextEditingController(); | ||
| 62 | + | ||
| 63 | + if (setmealids.contains(item.id)) { | ||
| 64 | + setmeal.select = true; | ||
| 65 | + int index = widget.justSelData | ||
| 66 | + .indexWhere((element) => element.setmealId == item.id); | ||
| 67 | + Setmeal widgetData = widget.justSelData[index]; | ||
| 68 | + setmeal.finalPriceC.text = widgetData.finalPrice; | ||
| 69 | + setmeal.minC.text = widgetData.min; | ||
| 70 | + setmeal.pnumC.text = widgetData.pnum; | ||
| 71 | + setmeal.spareC.text = widgetData.spare; | ||
| 72 | + } else { | ||
| 73 | + setmeal.select = false; | ||
| 74 | + } | ||
| 75 | + | ||
| 76 | + setmeal.price = item.price; | ||
| 77 | + setmealData.add(setmeal); | ||
| 78 | + } | ||
| 79 | + setState(() {}); | ||
| 80 | + } | ||
| 27 | } | 81 | } |
| 28 | 82 | ||
| 29 | Widget _callButton( | 83 | Widget _callButton( |
| @@ -114,7 +168,7 @@ class _FeastSetmealPageState extends State<FeastSetmealPage> { | @@ -114,7 +168,7 @@ class _FeastSetmealPageState extends State<FeastSetmealPage> { | ||
| 114 | ); | 168 | ); |
| 115 | } | 169 | } |
| 116 | 170 | ||
| 117 | - Widget buildListItem(BuildContext context, int index, bool select) { | 171 | + Widget buildListItem(Setmeal data) { |
| 118 | return Container( | 172 | return Container( |
| 119 | padding: EdgeInsets.only( | 173 | padding: EdgeInsets.only( |
| 120 | top: h(25), bottom: h(10), left: w(12), right: w(12)), | 174 | top: h(25), bottom: h(10), left: w(12), right: w(12)), |
| @@ -129,21 +183,21 @@ class _FeastSetmealPageState extends State<FeastSetmealPage> { | @@ -129,21 +183,21 @@ class _FeastSetmealPageState extends State<FeastSetmealPage> { | ||
| 129 | InkWell( | 183 | InkWell( |
| 130 | onTap: () { | 184 | onTap: () { |
| 131 | setState(() { | 185 | setState(() { |
| 132 | - select = !select; | 186 | + data.select = !data.select; |
| 133 | }); | 187 | }); |
| 134 | }, | 188 | }, |
| 135 | child: Row( | 189 | child: Row( |
| 136 | children: [ | 190 | children: [ |
| 137 | Image.asset( | 191 | Image.asset( |
| 138 | Utils.getImgPath( | 192 | Utils.getImgPath( |
| 139 | - select ? 'f_select' : 'f_select_not'), | 193 | + data.select ? 'f_select' : 'f_select_not'), |
| 140 | width: w(24), | 194 | width: w(24), |
| 141 | ), | 195 | ), |
| 142 | HEmptyView(24), | 196 | HEmptyView(24), |
| 143 | Text( | 197 | Text( |
| 144 | - '1299套餐', | 198 | + data.name, |
| 145 | style: TextStyle( | 199 | style: TextStyle( |
| 146 | - color: select | 200 | + color: data.select |
| 147 | ? MyColours.color_515151 | 201 | ? MyColours.color_515151 |
| 148 | : MyColours.color_999999, | 202 | : MyColours.color_999999, |
| 149 | fontSize: font(16), | 203 | fontSize: font(16), |
| @@ -168,14 +222,14 @@ class _FeastSetmealPageState extends State<FeastSetmealPage> { | @@ -168,14 +222,14 @@ class _FeastSetmealPageState extends State<FeastSetmealPage> { | ||
| 168 | ), | 222 | ), |
| 169 | ], | 223 | ], |
| 170 | ), | 224 | ), |
| 171 | - select | 225 | + data.select |
| 172 | ? Column( | 226 | ? Column( |
| 173 | children: [ | 227 | children: [ |
| 174 | VEmptyView(42), | 228 | VEmptyView(42), |
| 175 | Row( | 229 | Row( |
| 176 | children: [ | 230 | children: [ |
| 177 | Text( | 231 | Text( |
| 178 | - '原价:1299元', | 232 | + '原价:${data.price}元', |
| 179 | style: TextStyle( | 233 | style: TextStyle( |
| 180 | color: MyColours.color_515151, | 234 | color: MyColours.color_515151, |
| 181 | fontSize: font(14), | 235 | fontSize: font(14), |
| @@ -189,14 +243,27 @@ class _FeastSetmealPageState extends State<FeastSetmealPage> { | @@ -189,14 +243,27 @@ class _FeastSetmealPageState extends State<FeastSetmealPage> { | ||
| 189 | fontSize: font(14), | 243 | fontSize: font(14), |
| 190 | ), | 244 | ), |
| 191 | ), | 245 | ), |
| 192 | - _textfield('1299', null, null, width: w(126)), | ||
| 193 | - Text( | ||
| 194 | - ' 元', | ||
| 195 | - style: TextStyle( | ||
| 196 | - color: MyColours.color_515151, | ||
| 197 | - fontSize: font(14), | ||
| 198 | - ), | ||
| 199 | - ), | 246 | + data.bargaining == '1' |
| 247 | + ? Row( | ||
| 248 | + children: [ | ||
| 249 | + _textfield('', data.finalPriceC, null, | ||
| 250 | + width: w(126)), | ||
| 251 | + Text( | ||
| 252 | + ' 元', | ||
| 253 | + style: TextStyle( | ||
| 254 | + color: MyColours.color_515151, | ||
| 255 | + fontSize: font(14), | ||
| 256 | + ), | ||
| 257 | + ), | ||
| 258 | + ], | ||
| 259 | + ) | ||
| 260 | + : Text( | ||
| 261 | + '不可议价', | ||
| 262 | + style: TextStyle( | ||
| 263 | + color: MyColours.color_515151, | ||
| 264 | + fontSize: font(14), | ||
| 265 | + ), | ||
| 266 | + ), | ||
| 200 | ], | 267 | ], |
| 201 | ), | 268 | ), |
| 202 | VEmptyView(42), | 269 | VEmptyView(42), |
| @@ -209,7 +276,7 @@ class _FeastSetmealPageState extends State<FeastSetmealPage> { | @@ -209,7 +276,7 @@ class _FeastSetmealPageState extends State<FeastSetmealPage> { | ||
| 209 | fontSize: font(14), | 276 | fontSize: font(14), |
| 210 | ), | 277 | ), |
| 211 | ), | 278 | ), |
| 212 | - _textfield('3', null, null, width: w(45)), | 279 | + _textfield('', data.pnumC, null, width: w(45)), |
| 213 | Text( | 280 | Text( |
| 214 | ' 人', | 281 | ' 人', |
| 215 | style: TextStyle( | 282 | style: TextStyle( |
| @@ -225,7 +292,7 @@ class _FeastSetmealPageState extends State<FeastSetmealPage> { | @@ -225,7 +292,7 @@ class _FeastSetmealPageState extends State<FeastSetmealPage> { | ||
| 225 | fontSize: font(14), | 292 | fontSize: font(14), |
| 226 | ), | 293 | ), |
| 227 | ), | 294 | ), |
| 228 | - _textfield('3', null, null, width: w(45)), | 295 | + _textfield('', data.minC, null, width: w(45)), |
| 229 | Text( | 296 | Text( |
| 230 | ' 桌', | 297 | ' 桌', |
| 231 | style: TextStyle( | 298 | style: TextStyle( |
| @@ -241,7 +308,7 @@ class _FeastSetmealPageState extends State<FeastSetmealPage> { | @@ -241,7 +308,7 @@ class _FeastSetmealPageState extends State<FeastSetmealPage> { | ||
| 241 | fontSize: font(14), | 308 | fontSize: font(14), |
| 242 | ), | 309 | ), |
| 243 | ), | 310 | ), |
| 244 | - _textfield('3', null, null, width: w(45)), | 311 | + _textfield('', data.spareC, null, width: w(45)), |
| 245 | Text( | 312 | Text( |
| 246 | ' 桌', | 313 | ' 桌', |
| 247 | style: TextStyle( | 314 | style: TextStyle( |
| @@ -260,6 +327,7 @@ class _FeastSetmealPageState extends State<FeastSetmealPage> { | @@ -260,6 +327,7 @@ class _FeastSetmealPageState extends State<FeastSetmealPage> { | ||
| 260 | 327 | ||
| 261 | @override | 328 | @override |
| 262 | Widget build(BuildContext context) { | 329 | Widget build(BuildContext context) { |
| 330 | + feastModel = Provider.of<FeastModel>(context, listen: true); | ||
| 263 | return Scaffold( | 331 | return Scaffold( |
| 264 | backgroundColor: MyColours.color_ffffff, | 332 | backgroundColor: MyColours.color_ffffff, |
| 265 | appBar: SystemAppBar( | 333 | appBar: SystemAppBar( |
| @@ -271,36 +339,80 @@ class _FeastSetmealPageState extends State<FeastSetmealPage> { | @@ -271,36 +339,80 @@ class _FeastSetmealPageState extends State<FeastSetmealPage> { | ||
| 271 | Navigator.pop(context); | 339 | Navigator.pop(context); |
| 272 | }, | 340 | }, |
| 273 | ), | 341 | ), |
| 274 | - body: Column( | ||
| 275 | - crossAxisAlignment: CrossAxisAlignment.start, | ||
| 276 | - children: [ | ||
| 277 | - Expanded( | ||
| 278 | - child: ListView.builder( | ||
| 279 | - shrinkWrap: true, | ||
| 280 | - itemCount: 10, | ||
| 281 | - itemBuilder: (BuildContext context, int index) { | ||
| 282 | - return buildListItem(context, index, true); | 342 | + body: Consumer<FeastModel>(builder: (context, model, _) { |
| 343 | + if (model.pageStateSetmeal != PageState.Success) { | ||
| 344 | + return ExceptionPage( | ||
| 345 | + pageState: model.pageStateSetmeal, | ||
| 346 | + callback: () { | ||
| 347 | + _getSetmeal(); | ||
| 283 | }, | 348 | }, |
| 284 | - )), | ||
| 285 | - Row( | 349 | + emptyMsg: "暂时没有套餐哦", |
| 350 | + emptyImg: "empty_search", | ||
| 351 | + showMsg: "加载中,请稍后...", | ||
| 352 | + ); | ||
| 353 | + } else { | ||
| 354 | + return Column( | ||
| 355 | + crossAxisAlignment: CrossAxisAlignment.start, | ||
| 286 | children: [ | 356 | children: [ |
| 287 | Expanded( | 357 | Expanded( |
| 288 | - child: _callButton( | ||
| 289 | - onPress: () { | ||
| 290 | - Navigator.pop(context); | ||
| 291 | - }, | ||
| 292 | - content: '返回', | ||
| 293 | - hasLeftBorder: true, | ||
| 294 | - isSelect: false)), | ||
| 295 | - Expanded( | ||
| 296 | - child: _callButton( | ||
| 297 | - onPress: () {}, | ||
| 298 | - content: '保存并返回', | ||
| 299 | - hasLeftBorder: true, | ||
| 300 | - isSelect: true)) | 358 | + child: ListView.builder( |
| 359 | + shrinkWrap: true, | ||
| 360 | + itemCount: setmealData.length, | ||
| 361 | + itemBuilder: (BuildContext context, int index) { | ||
| 362 | + Setmeal data = setmealData[index]; | ||
| 363 | + return buildListItem(data); | ||
| 364 | + }, | ||
| 365 | + )), | ||
| 366 | + Row( | ||
| 367 | + children: [ | ||
| 368 | + Expanded( | ||
| 369 | + child: _callButton( | ||
| 370 | + onPress: () { | ||
| 371 | + Navigator.pop(context); | ||
| 372 | + }, | ||
| 373 | + content: '返回', | ||
| 374 | + hasLeftBorder: true, | ||
| 375 | + isSelect: false)), | ||
| 376 | + Expanded( | ||
| 377 | + child: _callButton( | ||
| 378 | + onPress: () { | ||
| 379 | + List<Setmeal> selectData = []; | ||
| 380 | + if (setmealData.length > 0) { | ||
| 381 | + String setmealIds = ""; | ||
| 382 | + for (Setmeal item in setmealData) { | ||
| 383 | + if (item.select) { | ||
| 384 | + item.finalPrice = | ||
| 385 | + item.finalPriceC.text == '' || | ||
| 386 | + item.bargaining == '0' | ||
| 387 | + ? item.price | ||
| 388 | + : item.finalPriceC.text; | ||
| 389 | + item.pnum = item.pnumC.text; | ||
| 390 | + item.min = item.minC.text; | ||
| 391 | + item.spare = item.spareC.text; | ||
| 392 | + selectData.add(item); | ||
| 393 | + setmealIds += item.setmealId + ","; | ||
| 394 | + } | ||
| 395 | + } | ||
| 396 | + if (setmealIds.length > 0) { | ||
| 397 | + setmealIds = setmealIds.substring( | ||
| 398 | + 0, setmealIds.length - 1); | ||
| 399 | + } | ||
| 400 | + | ||
| 401 | + Map temp = { | ||
| 402 | + 'object': selectData, | ||
| 403 | + 'setmealIds': setmealIds | ||
| 404 | + }; | ||
| 405 | + Navigator.of(context).pop(temp); | ||
| 406 | + } | ||
| 407 | + }, | ||
| 408 | + content: '保存并返回', | ||
| 409 | + hasLeftBorder: true, | ||
| 410 | + isSelect: true)) | ||
| 411 | + ], | ||
| 412 | + ) | ||
| 301 | ], | 413 | ], |
| 302 | - ) | ||
| 303 | - ], | ||
| 304 | - )); | 414 | + ); |
| 415 | + } | ||
| 416 | + })); | ||
| 305 | } | 417 | } |
| 306 | } | 418 | } |
| @@ -45,14 +45,16 @@ class _FeastDishPageState extends State<FeastDishPage> { | @@ -45,14 +45,16 @@ class _FeastDishPageState extends State<FeastDishPage> { | ||
| 45 | } | 45 | } |
| 46 | 46 | ||
| 47 | ///添加宴会套餐菜品分类 | 47 | ///添加宴会套餐菜品分类 |
| 48 | - _setSetmealCook(String name, String per, String trim, {String cookid}) async { | 48 | + _setSetmealCook(String name, String numStr, String per, String trim, |
| 49 | + {String cookid}) async { | ||
| 49 | Map<String, String> params = { | 50 | Map<String, String> params = { |
| 50 | "sid": Provider.of<UserModel>(context, listen: false).user.sellerid, | 51 | "sid": Provider.of<UserModel>(context, listen: false).user.sellerid, |
| 51 | 'cname': name, | 52 | 'cname': name, |
| 52 | 'mid': widget.setmealId, | 53 | 'mid': widget.setmealId, |
| 53 | 'cid': widget.classId, | 54 | 'cid': widget.classId, |
| 54 | 'spec': per, | 55 | 'spec': per, |
| 55 | - 'is_trim': trim | 56 | + 'is_trim': trim, |
| 57 | + 'num': numStr | ||
| 56 | }; | 58 | }; |
| 57 | if (cookid != null) { | 59 | if (cookid != null) { |
| 58 | params['id'] = cookid; | 60 | params['id'] = cookid; |
| @@ -101,8 +103,10 @@ class _FeastDishPageState extends State<FeastDishPage> { | @@ -101,8 +103,10 @@ class _FeastDishPageState extends State<FeastDishPage> { | ||
| 101 | String per = map['per']; | 103 | String per = map['per']; |
| 102 | String name = map['name']; | 104 | String name = map['name']; |
| 103 | String can = map['can']; | 105 | String can = map['can']; |
| 106 | + String numStr = map['num']; | ||
| 107 | + | ||
| 104 | print(can); | 108 | print(can); |
| 105 | - _setSetmealCook(name, per, can); | 109 | + _setSetmealCook(name, numStr, per, can); |
| 106 | }); | 110 | }); |
| 107 | }, | 111 | }, |
| 108 | text: '添加一项', | 112 | text: '添加一项', |
| @@ -160,9 +164,10 @@ class _FeastDishPageState extends State<FeastDishPage> { | @@ -160,9 +164,10 @@ class _FeastDishPageState extends State<FeastDishPage> { | ||
| 160 | can: cook.isTrim == '1' ? true : false, onTap: (Map map) { | 164 | can: cook.isTrim == '1' ? true : false, onTap: (Map map) { |
| 161 | String per = map['per']; | 165 | String per = map['per']; |
| 162 | String name = map['name']; | 166 | String name = map['name']; |
| 167 | + String numStr = map['num']; | ||
| 163 | String can = map['can']; | 168 | String can = map['can']; |
| 164 | print(can); | 169 | print(can); |
| 165 | - _setSetmealCook(name, per, can, cookid: cook.id); | 170 | + _setSetmealCook(name, numStr, per, can, cookid: cook.id); |
| 166 | }); | 171 | }); |
| 167 | }, | 172 | }, |
| 168 | child: Text( | 173 | child: Text( |
| @@ -74,7 +74,7 @@ class _FeastSetmealManageEditPageState | @@ -74,7 +74,7 @@ class _FeastSetmealManageEditPageState | ||
| 74 | } | 74 | } |
| 75 | } | 75 | } |
| 76 | 76 | ||
| 77 | - /// 根据ID获取宴会套餐 | 77 | + /// 获取宴会套餐菜品分类列表 |
| 78 | _getSetmealClass({bool isShowLoading = true}) async { | 78 | _getSetmealClass({bool isShowLoading = true}) async { |
| 79 | Map<String, String> params = {"mid": widget.setmealId}; | 79 | Map<String, String> params = {"mid": widget.setmealId}; |
| 80 | await feastModel.getSetmealClass(context, params, | 80 | await feastModel.getSetmealClass(context, params, |
| @@ -50,12 +50,13 @@ class _FeastSetmealManagePageState extends State<FeastSetmealManagePage> { | @@ -50,12 +50,13 @@ class _FeastSetmealManagePageState extends State<FeastSetmealManagePage> { | ||
| 50 | super.dispose(); | 50 | super.dispose(); |
| 51 | } | 51 | } |
| 52 | 52 | ||
| 53 | - ///获取宴会分类 | 53 | + ///获取宴会套餐 |
| 54 | Future<bool> _getSetmeal({bool isShowLoading = true}) async { | 54 | Future<bool> _getSetmeal({bool isShowLoading = true}) async { |
| 55 | await feastModel.getSetmeal(context, isShowLoading: isShowLoading); | 55 | await feastModel.getSetmeal(context, isShowLoading: isShowLoading); |
| 56 | } | 56 | } |
| 57 | 57 | ||
| 58 | - _setSetmeal(String mealName, String price, String bargaining) async { | 58 | + _setSetmeal( |
| 59 | + String mealName, String price, String bargaining) async { | ||
| 59 | Map<String, String> params = { | 60 | Map<String, String> params = { |
| 60 | "sid": Provider.of<UserModel>(context, listen: false).user.sellerid, | 61 | "sid": Provider.of<UserModel>(context, listen: false).user.sellerid, |
| 61 | 'meal_name': mealName, | 62 | 'meal_name': mealName, |
| @@ -77,13 +78,14 @@ class _FeastSetmealManagePageState extends State<FeastSetmealManagePage> { | @@ -77,13 +78,14 @@ class _FeastSetmealManagePageState extends State<FeastSetmealManagePage> { | ||
| 77 | Widget buildFeastTypeHeader() { | 78 | Widget buildFeastTypeHeader() { |
| 78 | return RoundButton( | 79 | return RoundButton( |
| 79 | onPressed: () async { | 80 | onPressed: () async { |
| 80 | - DialogUtil.feastDishEditDialog(context, | 81 | + DialogUtil.feastSetmealEditDialog(context, |
| 81 | title: '新建套餐', | 82 | title: '新建套餐', |
| 82 | nametitle: '套餐名称', | 83 | nametitle: '套餐名称', |
| 83 | pricetitle: '套餐价格', | 84 | pricetitle: '套餐价格', |
| 84 | swichtitle: '是否议价', onTap: (Map map) { | 85 | swichtitle: '是否议价', onTap: (Map map) { |
| 85 | String per = map['per']; | 86 | String per = map['per']; |
| 86 | String name = map['name']; | 87 | String name = map['name']; |
| 88 | + | ||
| 87 | String can = map['can']; | 89 | String can = map['can']; |
| 88 | print(can); | 90 | print(can); |
| 89 | _setSetmeal(name, per, can); | 91 | _setSetmeal(name, per, can); |
| @@ -58,6 +58,8 @@ class FeastModel extends ChangeNotifier { | @@ -58,6 +58,8 @@ class FeastModel extends ChangeNotifier { | ||
| 58 | PageState pageStateFollowUp = PageState.Loading; //待跟进宴会 | 58 | PageState pageStateFollowUp = PageState.Loading; //待跟进宴会 |
| 59 | PageState pageStateDepositData = PageState.Loading; //定金数据 | 59 | PageState pageStateDepositData = PageState.Loading; //定金数据 |
| 60 | 60 | ||
| 61 | + PageState pageStateMenu = PageState.Loading; //调菜 | ||
| 62 | + | ||
| 61 | String rid; //宴会id | 63 | String rid; //宴会id |
| 62 | 64 | ||
| 63 | /*** | 65 | /*** |
| @@ -92,7 +94,7 @@ class FeastModel extends ChangeNotifier { | @@ -92,7 +94,7 @@ class FeastModel extends ChangeNotifier { | ||
| 92 | } | 94 | } |
| 93 | } | 95 | } |
| 94 | 96 | ||
| 95 | - ///设置选台信息 | 97 | + ///设置选台信息 |
| 96 | 98 | ||
| 97 | Future<dynamic> setBanquetInfo( | 99 | Future<dynamic> setBanquetInfo( |
| 98 | BuildContext context, Map<String, String> params, | 100 | BuildContext context, Map<String, String> params, |
| @@ -120,7 +122,6 @@ class FeastModel extends ChangeNotifier { | @@ -120,7 +122,6 @@ class FeastModel extends ChangeNotifier { | ||
| 120 | } | 122 | } |
| 121 | } | 123 | } |
| 122 | 124 | ||
| 123 | - | ||
| 124 | /*** | 125 | /*** |
| 125 | * | 126 | * |
| 126 | * 宴会员工 | 127 | * 宴会员工 |
| @@ -740,7 +741,19 @@ class FeastModel extends ChangeNotifier { | @@ -740,7 +741,19 @@ class FeastModel extends ChangeNotifier { | ||
| 740 | data: params, showLoading: isShowLoading) | 741 | data: params, showLoading: isShowLoading) |
| 741 | .catchError((error) { | 742 | .catchError((error) { |
| 742 | print(error.toString()); | 743 | print(error.toString()); |
| 743 | - if (error is MyError) {} | 744 | + if (error is MyError) { |
| 745 | + switch (error.type) { | ||
| 746 | + case 1: | ||
| 747 | + pageStateMenu = PageState.ConnectivityError; | ||
| 748 | + break; | ||
| 749 | + case 2: | ||
| 750 | + pageStateMenu = PageState.ConnectivityTimeOut; | ||
| 751 | + break; | ||
| 752 | + default: | ||
| 753 | + pageStateMenu = PageState.ConnectivityError; | ||
| 754 | + break; | ||
| 755 | + } | ||
| 756 | + } | ||
| 744 | notifyListeners(); | 757 | notifyListeners(); |
| 745 | return false; | 758 | return false; |
| 746 | }); | 759 | }); |
| @@ -749,11 +762,17 @@ class FeastModel extends ChangeNotifier { | @@ -749,11 +762,17 @@ class FeastModel extends ChangeNotifier { | ||
| 749 | SetMeaByIdModel.fromJson(baseResp.responseData); | 762 | SetMeaByIdModel.fromJson(baseResp.responseData); |
| 750 | if (setMeaByIdModel.ret == Constant.status_success) { | 763 | if (setMeaByIdModel.ret == Constant.status_success) { |
| 751 | setmealDetail = setMeaByIdModel.data; | 764 | setmealDetail = setMeaByIdModel.data; |
| 765 | + if (setmealDetail.classify != null && setmealDetail.classify.length > 0) { | ||
| 766 | + | ||
| 767 | + } else { | ||
| 768 | + pageStateMenu = PageState.Empty; | ||
| 769 | + } | ||
| 752 | 770 | ||
| 753 | notifyListeners(); | 771 | notifyListeners(); |
| 754 | return true; | 772 | return true; |
| 755 | } else { | 773 | } else { |
| 756 | Utils.showToast(baseResp.msg ?? ""); | 774 | Utils.showToast(baseResp.msg ?? ""); |
| 775 | + pageStateMenu = PageState.ConnectivityError; | ||
| 757 | notifyListeners(); | 776 | notifyListeners(); |
| 758 | return false; | 777 | return false; |
| 759 | } | 778 | } |
| @@ -27,6 +27,7 @@ import 'package:sqflite/sqlite_api.dart'; | @@ -27,6 +27,7 @@ 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/otherset_model.dart'; |
| 30 | +import '../models/set_xuan_tai_model.dart'; | ||
| 30 | import '../models/wine_model.dart'; | 31 | import '../models/wine_model.dart'; |
| 31 | 32 | ||
| 32 | class NavigatorUtil { | 33 | class NavigatorUtil { |
| @@ -865,14 +866,25 @@ class NavigatorUtil { | @@ -865,14 +866,25 @@ class NavigatorUtil { | ||
| 865 | } | 866 | } |
| 866 | 867 | ||
| 867 | ///宴会----调菜 | 868 | ///宴会----调菜 |
| 868 | - static Future<dynamic> goFeastMenuPage(BuildContext context, | ||
| 869 | - {replace = false, bool onlyShow = false}) { | ||
| 870 | - return _navigateTo(context, "${Routes.feast_menu_page}", replace: replace); | 869 | + static Future<dynamic> goFeastMenuPage( |
| 870 | + BuildContext context, | ||
| 871 | + String setmealId, { | ||
| 872 | + replace = false, | ||
| 873 | + bool onlyShow = false, | ||
| 874 | + }) { | ||
| 875 | + return _navigateTo( | ||
| 876 | + context, "${Routes.feast_menu_page}?setmealId=$setmealId", | ||
| 877 | + replace: replace); | ||
| 871 | } | 878 | } |
| 872 | 879 | ||
| 873 | ///宴会----添加套餐 | 880 | ///宴会----添加套餐 |
| 874 | static Future<dynamic> goFeastSetmealPage(BuildContext context, | 881 | static Future<dynamic> goFeastSetmealPage(BuildContext context, |
| 875 | - {replace = false, bool onlyShow = false}) { | 882 | + {replace = false, bool onlyShow = false, Map justSelData}) { |
| 883 | + if (justSelData != null) { | ||
| 884 | + return _navigateTo(context, | ||
| 885 | + "${Routes.feast_setmeal_page}?object=${FluroConvertUtils.object2string(justSelData)}", | ||
| 886 | + replace: replace); | ||
| 887 | + } | ||
| 876 | return _navigateTo(context, "${Routes.feast_setmeal_page}", | 888 | return _navigateTo(context, "${Routes.feast_setmeal_page}", |
| 877 | replace: replace); | 889 | replace: replace); |
| 878 | } | 890 | } |
| @@ -147,6 +147,7 @@ import 'package:one_key/utils/fluro_convert_utils.dart'; | @@ -147,6 +147,7 @@ import 'package:one_key/utils/fluro_convert_utils.dart'; | ||
| 147 | import 'package:one_key/utils/utils.dart'; | 147 | import 'package:one_key/utils/utils.dart'; |
| 148 | import 'package:provider/provider.dart'; | 148 | import 'package:provider/provider.dart'; |
| 149 | 149 | ||
| 150 | +import '../models/set_xuan_tai_model.dart'; | ||
| 150 | import '../pages/feast/feast_board.dart'; | 151 | import '../pages/feast/feast_board.dart'; |
| 151 | import '../pages/feast/feast_create_page.dart'; | 152 | import '../pages/feast/feast_create_page.dart'; |
| 152 | import '../pages/feast/feast_deposit_data_page.dart'; | 153 | import '../pages/feast/feast_deposit_data_page.dart'; |
| @@ -1380,18 +1381,28 @@ var feastMenuPageHandle = new Handler( | @@ -1380,18 +1381,28 @@ var feastMenuPageHandle = new Handler( | ||
| 1380 | // String uids = params["uids"].first; | 1381 | // String uids = params["uids"].first; |
| 1381 | 1382 | ||
| 1382 | // bool onlyShow = FluroConvertUtils.string2bool(params["onlyShow"].first); | 1383 | // bool onlyShow = FluroConvertUtils.string2bool(params["onlyShow"].first); |
| 1384 | + String setmealId = params["setmealId"].first; | ||
| 1383 | return ChangeNotifierProvider<FeastModel>( | 1385 | return ChangeNotifierProvider<FeastModel>( |
| 1384 | - create: (_) => FeastModel(), child: FeastMenuPage()); | 1386 | + create: (_) => FeastModel(), child: FeastMenuPage(setmealId: setmealId)); |
| 1385 | }); | 1387 | }); |
| 1386 | 1388 | ||
| 1387 | ///宴会----添加套餐 | 1389 | ///宴会----添加套餐 |
| 1388 | var feastSetmealPageHandle = new Handler( | 1390 | var feastSetmealPageHandle = new Handler( |
| 1389 | handlerFunc: (BuildContext context, Map<dynamic, List<Object>> params) { | 1391 | handlerFunc: (BuildContext context, Map<dynamic, List<Object>> params) { |
| 1390 | // String uids = params["uids"].first; | 1392 | // String uids = params["uids"].first; |
| 1393 | + List<Setmeal> justSelData = []; | ||
| 1394 | + if (params.keys.contains('object')) { | ||
| 1395 | + Map object = FluroConvertUtils.string2map(params["object"].first); | ||
| 1396 | + List temp = object['object']; | ||
| 1391 | 1397 | ||
| 1398 | + for (var item in temp) { | ||
| 1399 | + justSelData.add(Setmeal.fromJson(item)); | ||
| 1400 | + } | ||
| 1401 | + } | ||
| 1392 | // bool onlyShow = FluroConvertUtils.string2bool(params["onlyShow"].first); | 1402 | // bool onlyShow = FluroConvertUtils.string2bool(params["onlyShow"].first); |
| 1393 | return ChangeNotifierProvider<FeastModel>( | 1403 | return ChangeNotifierProvider<FeastModel>( |
| 1394 | - create: (_) => FeastModel(), child: FeastSetmealPage()); | 1404 | + create: (_) => FeastModel(), |
| 1405 | + child: FeastSetmealPage(justSelData: justSelData)); | ||
| 1395 | }); | 1406 | }); |
| 1396 | 1407 | ||
| 1397 | ///宴会----添加酒水 | 1408 | ///宴会----添加酒水 |
| @@ -697,6 +697,328 @@ class DialogUtil { | @@ -697,6 +697,328 @@ class DialogUtil { | ||
| 697 | String swichtitle = '是否可调菜', | 697 | String swichtitle = '是否可调菜', |
| 698 | String content = '', | 698 | String content = '', |
| 699 | String per = '', | 699 | String per = '', |
| 700 | + String numStr = '', | ||
| 701 | + bool can = true, | ||
| 702 | + }) async { | ||
| 703 | + TextEditingController nameC = TextEditingController(); | ||
| 704 | + TextEditingController perC = TextEditingController(); | ||
| 705 | + TextEditingController numC = TextEditingController(); | ||
| 706 | + nameC.text = content; | ||
| 707 | + perC.text = per; | ||
| 708 | + numC.text = numStr; | ||
| 709 | + // bool isRed = content != '' ? false : true; | ||
| 710 | + final action = await showDialog( | ||
| 711 | + context: context, | ||
| 712 | + barrierDismissible: false, | ||
| 713 | + builder: (BuildContext context) { | ||
| 714 | + return StatefulBuilder(builder: (context, state) { | ||
| 715 | + return Scaffold( | ||
| 716 | + backgroundColor: Colors.transparent, | ||
| 717 | + body: Center( | ||
| 718 | + child: Container( | ||
| 719 | + padding: EdgeInsets.symmetric( | ||
| 720 | + horizontal: ScreenUtil().setWidth(50)), | ||
| 721 | + height: ScreenUtil().setWidth(421 * 2), | ||
| 722 | + decoration: BoxDecoration( | ||
| 723 | + borderRadius: | ||
| 724 | + BorderRadius.circular(ScreenUtil().setWidth(16))), | ||
| 725 | + child: SingleChildScrollView( | ||
| 726 | + child: Card( | ||
| 727 | + shape: RoundedRectangleBorder( | ||
| 728 | + borderRadius: BorderRadius.all( | ||
| 729 | + Radius.circular(ScreenUtil().setWidth(10)))), //设置圆角 | ||
| 730 | + child: Container( | ||
| 731 | + child: Column( | ||
| 732 | + children: [ | ||
| 733 | + VEmptyView(64), | ||
| 734 | + Container( | ||
| 735 | + alignment: Alignment.center, | ||
| 736 | + child: Text(title, | ||
| 737 | + style: TextStyle( | ||
| 738 | + fontWeight: FontWeight.bold, | ||
| 739 | + fontSize: ScreenUtil().setSp(32), | ||
| 740 | + color: MyColours.color_E5000000)), | ||
| 741 | + ), | ||
| 742 | + VEmptyView(32), | ||
| 743 | + Padding( | ||
| 744 | + padding: EdgeInsets.symmetric(horizontal: w(16)), | ||
| 745 | + child: Row(children: [ | ||
| 746 | + Text( | ||
| 747 | + nametitle, | ||
| 748 | + style: TextStyle( | ||
| 749 | + fontSize: ScreenUtil().setSp(32), | ||
| 750 | + color: MyColours.color_000000), | ||
| 751 | + ), | ||
| 752 | + HEmptyView(24), | ||
| 753 | + Expanded( | ||
| 754 | + child: Container( | ||
| 755 | + height: ScreenUtil().setWidth(48 * 2), | ||
| 756 | + decoration: BoxDecoration( | ||
| 757 | + color: MyColours.color_f3f3f3, | ||
| 758 | + borderRadius: BorderRadius.circular( | ||
| 759 | + ScreenUtil().setWidth(8))), | ||
| 760 | + padding: | ||
| 761 | + EdgeInsets.symmetric(horizontal: w(12)), | ||
| 762 | + child: TextField( | ||
| 763 | + controller: nameC, | ||
| 764 | + maxLines: 1, | ||
| 765 | + style: TextStyle( | ||
| 766 | + fontSize: ScreenUtil().setSp(32), | ||
| 767 | + color: MyColours.color_515151), | ||
| 768 | + decoration: InputDecoration( | ||
| 769 | + contentPadding: EdgeInsets.only( | ||
| 770 | + bottom: ScreenUtil() | ||
| 771 | + .setWidth(40)), //设置文字内容与边框距离 | ||
| 772 | + | ||
| 773 | + border: OutlineInputBorder( | ||
| 774 | + borderSide: BorderSide.none), | ||
| 775 | + hintText: '请输入', | ||
| 776 | + hintStyle: TextStyle( | ||
| 777 | + color: MyColours.color_66000000, | ||
| 778 | + fontSize: ScreenUtil().setSp(32), | ||
| 779 | + ), | ||
| 780 | + ), | ||
| 781 | + onChanged: (value) {}, | ||
| 782 | + onEditingComplete: () { | ||
| 783 | + FocusScope.of(context).requestFocus( | ||
| 784 | + FocusNode()); //点击空白处隐藏键盘 | ||
| 785 | + }, | ||
| 786 | + keyboardType: TextInputType.text, | ||
| 787 | + ), | ||
| 788 | + )) | ||
| 789 | + ])), | ||
| 790 | + VEmptyView(32), | ||
| 791 | + Padding( | ||
| 792 | + padding: EdgeInsets.symmetric(horizontal: w(16)), | ||
| 793 | + child: Row(children: [ | ||
| 794 | + Text( | ||
| 795 | + '菜品数量', | ||
| 796 | + style: TextStyle( | ||
| 797 | + fontSize: ScreenUtil().setSp(32), | ||
| 798 | + color: MyColours.color_000000), | ||
| 799 | + ), | ||
| 800 | + HEmptyView(24), | ||
| 801 | + Expanded( | ||
| 802 | + child: Container( | ||
| 803 | + height: ScreenUtil().setWidth(48 * 2), | ||
| 804 | + decoration: BoxDecoration( | ||
| 805 | + color: MyColours.color_f3f3f3, | ||
| 806 | + borderRadius: BorderRadius.circular( | ||
| 807 | + ScreenUtil().setWidth(8))), | ||
| 808 | + padding: | ||
| 809 | + EdgeInsets.symmetric(horizontal: w(12)), | ||
| 810 | + child: TextField( | ||
| 811 | + controller: numC, | ||
| 812 | + maxLines: 1, | ||
| 813 | + style: TextStyle( | ||
| 814 | + fontSize: ScreenUtil().setSp(32), | ||
| 815 | + color: MyColours.color_515151), | ||
| 816 | + decoration: InputDecoration( | ||
| 817 | + contentPadding: EdgeInsets.only( | ||
| 818 | + bottom: ScreenUtil() | ||
| 819 | + .setWidth(40)), //设置文字内容与边框距离 | ||
| 820 | + | ||
| 821 | + border: OutlineInputBorder( | ||
| 822 | + borderSide: BorderSide.none), | ||
| 823 | + hintText: '请输入', | ||
| 824 | + hintStyle: TextStyle( | ||
| 825 | + color: MyColours.color_66000000, | ||
| 826 | + fontSize: ScreenUtil().setSp(32), | ||
| 827 | + ), | ||
| 828 | + ), | ||
| 829 | + onChanged: (value) {}, | ||
| 830 | + onEditingComplete: () { | ||
| 831 | + FocusScope.of(context).requestFocus( | ||
| 832 | + FocusNode()); //点击空白处隐藏键盘 | ||
| 833 | + }, | ||
| 834 | + keyboardType: TextInputType.text, | ||
| 835 | + ), | ||
| 836 | + )) | ||
| 837 | + ])), | ||
| 838 | + VEmptyView(32), | ||
| 839 | + Padding( | ||
| 840 | + padding: EdgeInsets.symmetric(horizontal: w(16)), | ||
| 841 | + child: Row(children: [ | ||
| 842 | + Text( | ||
| 843 | + pricetitle, | ||
| 844 | + style: TextStyle( | ||
| 845 | + fontSize: ScreenUtil().setSp(32), | ||
| 846 | + color: MyColours.color_000000), | ||
| 847 | + ), | ||
| 848 | + HEmptyView(24), | ||
| 849 | + Expanded( | ||
| 850 | + child: Container( | ||
| 851 | + height: ScreenUtil().setWidth(48 * 2), | ||
| 852 | + decoration: BoxDecoration( | ||
| 853 | + color: MyColours.color_f3f3f3, | ||
| 854 | + borderRadius: BorderRadius.circular( | ||
| 855 | + ScreenUtil().setWidth(8))), | ||
| 856 | + padding: | ||
| 857 | + EdgeInsets.symmetric(horizontal: w(12)), | ||
| 858 | + child: TextField( | ||
| 859 | + controller: perC, | ||
| 860 | + maxLines: 1, | ||
| 861 | + style: TextStyle( | ||
| 862 | + fontSize: ScreenUtil().setSp(32), | ||
| 863 | + color: MyColours.color_515151), | ||
| 864 | + decoration: InputDecoration( | ||
| 865 | + contentPadding: EdgeInsets.only( | ||
| 866 | + bottom: ScreenUtil() | ||
| 867 | + .setWidth(40)), //设置文字内容与边框距离 | ||
| 868 | + | ||
| 869 | + border: OutlineInputBorder( | ||
| 870 | + borderSide: BorderSide.none), | ||
| 871 | + hintText: '请输入', | ||
| 872 | + hintStyle: TextStyle( | ||
| 873 | + color: MyColours.color_66000000, | ||
| 874 | + fontSize: ScreenUtil().setSp(32), | ||
| 875 | + ), | ||
| 876 | + ), | ||
| 877 | + onChanged: (value) {}, | ||
| 878 | + onEditingComplete: () { | ||
| 879 | + FocusScope.of(context).requestFocus( | ||
| 880 | + FocusNode()); //点击空白处隐藏键盘 | ||
| 881 | + }, | ||
| 882 | + keyboardType: title == '新建套餐' | ||
| 883 | + ? TextInputType.numberWithOptions() | ||
| 884 | + : TextInputType.text, | ||
| 885 | + ), | ||
| 886 | + )), | ||
| 887 | + title == '新建套餐' | ||
| 888 | + ? Padding( | ||
| 889 | + padding: EdgeInsets.only(left: w(12)), | ||
| 890 | + child: Text('元', | ||
| 891 | + style: TextStyle( | ||
| 892 | + fontSize: font(16), | ||
| 893 | + color: MyColours.color_000000))) | ||
| 894 | + : SizedBox() | ||
| 895 | + ])), | ||
| 896 | + VEmptyView(32), | ||
| 897 | + Container( | ||
| 898 | + height: w(48), | ||
| 899 | + padding: EdgeInsets.only(left: w(16)), | ||
| 900 | + decoration: BoxDecoration( | ||
| 901 | + border: Border( | ||
| 902 | + bottom: BorderSide( | ||
| 903 | + width: h(0.5), | ||
| 904 | + color: MyColours.color_E7E7E7))), | ||
| 905 | + child: Row( | ||
| 906 | + mainAxisAlignment: MainAxisAlignment.spaceBetween, | ||
| 907 | + children: [ | ||
| 908 | + Container( | ||
| 909 | + width: w(81), | ||
| 910 | + height: w(48), | ||
| 911 | + alignment: Alignment.centerLeft, | ||
| 912 | + child: Text( | ||
| 913 | + swichtitle, | ||
| 914 | + style: TextStyle( | ||
| 915 | + fontSize: ScreenUtil().setSp(32), | ||
| 916 | + color: MyColours.color_E6000000), | ||
| 917 | + ), | ||
| 918 | + ), | ||
| 919 | + Spacer(), | ||
| 920 | + InkWell( | ||
| 921 | + onTap: () { | ||
| 922 | + state(() { | ||
| 923 | + can = !can; | ||
| 924 | + }); | ||
| 925 | + }, | ||
| 926 | + child: Container( | ||
| 927 | + padding: EdgeInsets.only( | ||
| 928 | + left: w(16), right: w(16)), | ||
| 929 | + child: Image.asset( | ||
| 930 | + Utils.getImgPath( | ||
| 931 | + can ? 'swich_on' : 'swich_off'), | ||
| 932 | + width: w(44), | ||
| 933 | + ))), | ||
| 934 | + ], | ||
| 935 | + ), | ||
| 936 | + ), | ||
| 937 | + VEmptyView(64), | ||
| 938 | + MyDivider(double.infinity, ScreenUtil().setWidth(2), | ||
| 939 | + color: MyColours.color_f3f3f3), | ||
| 940 | + Row( | ||
| 941 | + // mainAxisAlignment: MainAxisAlignment.spaceBetween, | ||
| 942 | + children: [ | ||
| 943 | + RoundButton( | ||
| 944 | + text: '取消', | ||
| 945 | + width: (ScreenUtil().screenWidth - | ||
| 946 | + ScreenUtil().setWidth(62) * 2) / | ||
| 947 | + 2, | ||
| 948 | + height: ScreenUtil().setWidth(112), | ||
| 949 | + // radius: ScreenUtil().setWidth(10), | ||
| 950 | + gradientStart: Colors.transparent, | ||
| 951 | + gradientEnd: Colors.transparent, | ||
| 952 | + textColor: MyColours.color_E6000000, | ||
| 953 | + isBold: false, | ||
| 954 | + fontSize: 32, | ||
| 955 | + onPressed: () { | ||
| 956 | + Navigator.pop(context); | ||
| 957 | + }), | ||
| 958 | + MyDivider(ScreenUtil().setWidth(2), | ||
| 959 | + ScreenUtil().setWidth(112), | ||
| 960 | + color: MyColours.color_f3f3f3), | ||
| 961 | + RoundButton( | ||
| 962 | + text: '确定', | ||
| 963 | + width: (ScreenUtil().screenWidth - | ||
| 964 | + ScreenUtil().setWidth(62) * 2) / | ||
| 965 | + 2, | ||
| 966 | + height: ScreenUtil().setWidth(112), | ||
| 967 | + // radius: ScreenUtil().setWidth(10), | ||
| 968 | + gradientStart: Colors.transparent, | ||
| 969 | + gradientEnd: Colors.transparent, | ||
| 970 | + textColor: MyColours.color_438E93, | ||
| 971 | + fontSize: 32, | ||
| 972 | + onPressed: () { | ||
| 973 | + if (nameC.text.trim() == '') { | ||
| 974 | + Utils.showToast('请输入${nametitle}!'); | ||
| 975 | + | ||
| 976 | + return; | ||
| 977 | + } | ||
| 978 | + if (numC.text.trim() == '') { | ||
| 979 | + Utils.showToast('请输入菜品数量!'); | ||
| 980 | + | ||
| 981 | + return; | ||
| 982 | + } | ||
| 983 | + if (perC.text.trim() == '') { | ||
| 984 | + Utils.showToast('请输入${pricetitle}!'); | ||
| 985 | + return; | ||
| 986 | + } | ||
| 987 | + onTap({ | ||
| 988 | + 'name': nameC.text, | ||
| 989 | + 'per': perC.text, | ||
| 990 | + 'num':numC.text, | ||
| 991 | + 'can': can ? '1' : '0' | ||
| 992 | + }); | ||
| 993 | + Navigator.pop(context, { | ||
| 994 | + 'name': nameC.text, | ||
| 995 | + 'per': perC.text, | ||
| 996 | + 'can': can | ||
| 997 | + }); | ||
| 998 | + }), | ||
| 999 | + ], | ||
| 1000 | + ) | ||
| 1001 | + ], | ||
| 1002 | + ), | ||
| 1003 | + ), | ||
| 1004 | + )), | ||
| 1005 | + ), | ||
| 1006 | + )); | ||
| 1007 | + }); | ||
| 1008 | + }, | ||
| 1009 | + ); | ||
| 1010 | + } | ||
| 1011 | + | ||
| 1012 | + //宴会---添加菜品 | ||
| 1013 | + static Future feastSetmealEditDialog( | ||
| 1014 | + BuildContext context, { | ||
| 1015 | + CustomCallBackMap onTap, | ||
| 1016 | + String title = '菜品信息', | ||
| 1017 | + String nametitle = '菜品名称', | ||
| 1018 | + String pricetitle = '菜品规格', | ||
| 1019 | + String swichtitle = '是否可调菜', | ||
| 1020 | + String content = '', | ||
| 1021 | + String per = '', | ||
| 700 | bool can = true, | 1022 | bool can = true, |
| 701 | }) async { | 1023 | }) async { |
| 702 | TextEditingController nameC = TextEditingController(); | 1024 | TextEditingController nameC = TextEditingController(); |
| @@ -49,6 +49,11 @@ class FluroConvertUtils { | @@ -49,6 +49,11 @@ class FluroConvertUtils { | ||
| 49 | return json.decode(fluroCnParamsDecode(str)); | 49 | return json.decode(fluroCnParamsDecode(str)); |
| 50 | } | 50 | } |
| 51 | 51 | ||
| 52 | + /// string json 转为 map | ||
| 53 | + static List<dynamic> string2list(String str) { | ||
| 54 | + return json.decode(fluroCnParamsDecode(str)); | ||
| 55 | + } | ||
| 56 | + | ||
| 52 | /// string json 转为 map | 57 | /// string json 转为 map |
| 53 | static Map<String, List<TableList>> string2mapTableList(String str) { | 58 | static Map<String, List<TableList>> string2mapTableList(String str) { |
| 54 | return json.decode(fluroCnParamsDecode(str)); | 59 | return json.decode(fluroCnParamsDecode(str)); |
-
Please register or login to post a comment