Showing
19 changed files
with
1297 additions
and
286 deletions
lib/models/feast_menu_set_model.dart
0 → 100644
| 1 | import 'package:flutter/material.dart'; | 1 | import 'package:flutter/material.dart'; |
| 2 | import 'package:one_key/models/dsolt_xt.dart'; | 2 | import 'package:one_key/models/dsolt_xt.dart'; |
| 3 | +import 'package:one_key/models/setmeal_by_id_model.dart'; | ||
| 3 | import 'package:one_key/models/table_list.dart' as t; | 4 | import 'package:one_key/models/table_list.dart' as t; |
| 4 | 5 | ||
| 5 | class SetXuanTaiModel { | 6 | class SetXuanTaiModel { |
| @@ -135,22 +136,26 @@ class Setmeal { | @@ -135,22 +136,26 @@ class Setmeal { | ||
| 135 | TextEditingController pnumC; | 136 | TextEditingController pnumC; |
| 136 | TextEditingController minC; | 137 | TextEditingController minC; |
| 137 | TextEditingController spareC; | 138 | TextEditingController spareC; |
| 139 | + List<Cooklist> cooklist; | ||
| 140 | + Map<String, List<CookByIdSetmeal>> dataMenu = {}; | ||
| 138 | 141 | ||
| 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 | - }); | 142 | + Setmeal( |
| 143 | + {this.setmealId, | ||
| 144 | + this.price, | ||
| 145 | + this.finalPrice, | ||
| 146 | + this.pnum, | ||
| 147 | + this.min, | ||
| 148 | + this.spare, | ||
| 149 | + this.name, | ||
| 150 | + this.select, | ||
| 151 | + this.bargaining, | ||
| 152 | + this.cooklist, | ||
| 153 | + this.dataMenu | ||
| 154 | + // this.finalPriceC, | ||
| 155 | + // this.pnumC, | ||
| 156 | + // this.minC, | ||
| 157 | + // this.spareC, | ||
| 158 | + }); | ||
| 154 | 159 | ||
| 155 | Setmeal.fromJson(Map<String, dynamic> json) { | 160 | Setmeal.fromJson(Map<String, dynamic> json) { |
| 156 | setmealId = json['setmeal_id']; | 161 | setmealId = json['setmeal_id']; |
| @@ -162,6 +167,13 @@ class Setmeal { | @@ -162,6 +167,13 @@ class Setmeal { | ||
| 162 | name = json['name']; | 167 | name = json['name']; |
| 163 | select = json['select']; | 168 | select = json['select']; |
| 164 | bargaining = json['bargaining']; | 169 | bargaining = json['bargaining']; |
| 170 | + if (json['cooklist'] != null) { | ||
| 171 | + cooklist = <Cooklist>[]; | ||
| 172 | + json['cooklist'].forEach((v) { | ||
| 173 | + cooklist.add(new Cooklist.fromJson(v)); | ||
| 174 | + }); | ||
| 175 | + } | ||
| 176 | + | ||
| 165 | // finalPriceC = json['finalPriceC']; | 177 | // finalPriceC = json['finalPriceC']; |
| 166 | // pnumC = json['pnumC']; | 178 | // pnumC = json['pnumC']; |
| 167 | // minC = json['minC']; | 179 | // minC = json['minC']; |
| @@ -183,7 +195,28 @@ class Setmeal { | @@ -183,7 +195,28 @@ class Setmeal { | ||
| 183 | // data['pnumC'] = this.pnumC; | 195 | // data['pnumC'] = this.pnumC; |
| 184 | // data['minC'] = this.minC; | 196 | // data['minC'] = this.minC; |
| 185 | // data['spareC'] = this.spareC; | 197 | // data['spareC'] = this.spareC; |
| 198 | + if (this.cooklist != null) { | ||
| 199 | + data['cooklist'] = this.cooklist.map((v) => v.toJson()).toList(); | ||
| 200 | + } | ||
| 201 | + return data; | ||
| 202 | + } | ||
| 203 | +} | ||
| 186 | 204 | ||
| 205 | +class Cooklist { | ||
| 206 | + String id; | ||
| 207 | + String cname; | ||
| 208 | + | ||
| 209 | + Cooklist({this.cname}); | ||
| 210 | + | ||
| 211 | + Cooklist.fromJson(Map<String, dynamic> json) { | ||
| 212 | + id = json['id']; | ||
| 213 | + cname = json['cname']; | ||
| 214 | + } | ||
| 215 | + | ||
| 216 | + Map<String, dynamic> toJson() { | ||
| 217 | + final Map<String, dynamic> data = new Map<String, dynamic>(); | ||
| 218 | + data['id'] = this.id; | ||
| 219 | + data['cname'] = this.cname; | ||
| 187 | return data; | 220 | return data; |
| 188 | } | 221 | } |
| 189 | } | 222 | } |
| @@ -192,15 +225,22 @@ class Wine { | @@ -192,15 +225,22 @@ class Wine { | ||
| 192 | String wineId; | 225 | String wineId; |
| 193 | String price; | 226 | String price; |
| 194 | String finalPrice; | 227 | String finalPrice; |
| 195 | - String num; | 228 | + String numStr; |
| 229 | + String name; | ||
| 230 | + String bargaining; | ||
| 231 | + bool select = false; | ||
| 232 | + String spec; | ||
| 233 | + | ||
| 234 | + TextEditingController finalPriceC; | ||
| 235 | + TextEditingController numC; | ||
| 196 | 236 | ||
| 197 | - Wine({this.wineId, this.price, this.finalPrice, this.num}); | 237 | + Wine({this.wineId, this.price, this.finalPrice, this.numStr}); |
| 198 | 238 | ||
| 199 | Wine.fromJson(Map<String, dynamic> json) { | 239 | Wine.fromJson(Map<String, dynamic> json) { |
| 200 | wineId = json['wine_id']; | 240 | wineId = json['wine_id']; |
| 201 | price = json['price']; | 241 | price = json['price']; |
| 202 | finalPrice = json['final_price']; | 242 | finalPrice = json['final_price']; |
| 203 | - num = json['num']; | 243 | + numStr = json['num']; |
| 204 | } | 244 | } |
| 205 | 245 | ||
| 206 | Map<String, dynamic> toJson() { | 246 | Map<String, dynamic> toJson() { |
| @@ -208,7 +248,7 @@ class Wine { | @@ -208,7 +248,7 @@ class Wine { | ||
| 208 | data['wine_id'] = this.wineId; | 248 | data['wine_id'] = this.wineId; |
| 209 | data['price'] = this.price; | 249 | data['price'] = this.price; |
| 210 | data['final_price'] = this.finalPrice; | 250 | data['final_price'] = this.finalPrice; |
| 211 | - data['num'] = this.num; | 251 | + data['num'] = this.numStr; |
| 212 | return data; | 252 | return data; |
| 213 | } | 253 | } |
| 214 | } | 254 | } |
| @@ -217,15 +257,23 @@ class Other { | @@ -217,15 +257,23 @@ class Other { | ||
| 217 | String otherId; | 257 | String otherId; |
| 218 | String price; | 258 | String price; |
| 219 | String finalPrice; | 259 | String finalPrice; |
| 220 | - String num; | 260 | + String numStr; |
| 221 | 261 | ||
| 222 | - Other({this.otherId, this.price, this.finalPrice, this.num}); | 262 | + String name; |
| 263 | + String bargaining; | ||
| 264 | + bool select = false; | ||
| 265 | + String spec; | ||
| 266 | + | ||
| 267 | + TextEditingController finalPriceC; | ||
| 268 | + TextEditingController numC; | ||
| 269 | + | ||
| 270 | + Other({this.otherId, this.price, this.finalPrice, this.numStr}); | ||
| 223 | 271 | ||
| 224 | Other.fromJson(Map<String, dynamic> json) { | 272 | Other.fromJson(Map<String, dynamic> json) { |
| 225 | otherId = json['other_id']; | 273 | otherId = json['other_id']; |
| 226 | price = json['price']; | 274 | price = json['price']; |
| 227 | finalPrice = json['final_price']; | 275 | finalPrice = json['final_price']; |
| 228 | - num = json['num']; | 276 | + numStr = json['num']; |
| 229 | } | 277 | } |
| 230 | 278 | ||
| 231 | Map<String, dynamic> toJson() { | 279 | Map<String, dynamic> toJson() { |
| @@ -233,7 +281,7 @@ class Other { | @@ -233,7 +281,7 @@ class Other { | ||
| 233 | data['other_id'] = this.otherId; | 281 | data['other_id'] = this.otherId; |
| 234 | data['price'] = this.price; | 282 | data['price'] = this.price; |
| 235 | data['final_price'] = this.finalPrice; | 283 | data['final_price'] = this.finalPrice; |
| 236 | - data['num'] = this.num; | 284 | + data['num'] = this.numStr; |
| 237 | return data; | 285 | return data; |
| 238 | } | 286 | } |
| 239 | } | 287 | } |
| 1 | +import 'package:flutter/material.dart'; | ||
| 2 | + | ||
| 1 | class SetMeaByIdModel { | 3 | class SetMeaByIdModel { |
| 2 | int ret; | 4 | int ret; |
| 3 | SetMeaByIdSunModel data; | 5 | SetMeaByIdSunModel data; |
| @@ -24,6 +26,7 @@ class SetMeaByIdModel { | @@ -24,6 +26,7 @@ class SetMeaByIdModel { | ||
| 24 | } | 26 | } |
| 25 | } | 27 | } |
| 26 | 28 | ||
| 29 | + | ||
| 27 | class SetMeaByIdSunModel { | 30 | class SetMeaByIdSunModel { |
| 28 | String id; | 31 | String id; |
| 29 | String sid; | 32 | String sid; |
| @@ -128,6 +131,8 @@ class CookByIdSetmeal { | @@ -128,6 +131,8 @@ class CookByIdSetmeal { | ||
| 128 | String spec; | 131 | String spec; |
| 129 | String isTrim; | 132 | String isTrim; |
| 130 | String status; | 133 | String status; |
| 134 | + TextEditingController numC = TextEditingController(); //数量 | ||
| 135 | + TextEditingController nameC = TextEditingController(); //菜名 | ||
| 131 | 136 | ||
| 132 | CookByIdSetmeal( | 137 | CookByIdSetmeal( |
| 133 | {this.id, | 138 | {this.id, |
| @@ -292,8 +292,9 @@ class HttpUrl { | @@ -292,8 +292,9 @@ class HttpUrl { | ||
| 292 | static const String del_deposit = "?service=App.Banquet.DelDeposit"; // 删除宴会定金 | 292 | static const String del_deposit = "?service=App.Banquet.DelDeposit"; // 删除宴会定金 |
| 293 | static const String create_banquet = | 293 | static const String create_banquet = |
| 294 | "?service=App.Banquet.CreateBanquet"; //创建意向 | 294 | "?service=App.Banquet.CreateBanquet"; //创建意向 |
| 295 | - static const String set_banquet_info = | 295 | + static const String set_banquet_info = |
| 296 | "?service=App.Banquet.SetBanquetInfo"; //设置选台信息 | 296 | "?service=App.Banquet.SetBanquetInfo"; //设置选台信息 |
| 297 | + static const String set_banquet_info_cook = | ||
| 298 | + "?service=App.Banquet.SetBanquetInfoCook"; //调菜 | ||
| 297 | 299 | ||
| 298 | - | ||
| 299 | } | 300 | } |
| @@ -74,6 +74,7 @@ class _FeastCreatePageState extends State<FeastCreatePage> { | @@ -74,6 +74,7 @@ class _FeastCreatePageState extends State<FeastCreatePage> { | ||
| 74 | List<SetXuanTaiModel> xuantaiData = []; | 74 | List<SetXuanTaiModel> xuantaiData = []; |
| 75 | int xuantaiSelIndex = 0; | 75 | int xuantaiSelIndex = 0; |
| 76 | List<DsoltXt> dsoltList = []; | 76 | List<DsoltXt> dsoltList = []; |
| 77 | + UserModel userModel; | ||
| 77 | 78 | ||
| 78 | @override | 79 | @override |
| 79 | void initState() { | 80 | void initState() { |
| @@ -732,13 +733,13 @@ class _FeastCreatePageState extends State<FeastCreatePage> { | @@ -732,13 +733,13 @@ class _FeastCreatePageState extends State<FeastCreatePage> { | ||
| 732 | Expanded( | 733 | Expanded( |
| 733 | child: _callButton( | 734 | child: _callButton( |
| 734 | onPress: () async { | 735 | onPress: () async { |
| 735 | - // bool success = await yxSave(); | ||
| 736 | - // if (success) { | ||
| 737 | - selectMenu = '选台'; | ||
| 738 | - menuSet.add('意向'); | ||
| 739 | - menuSet.add('选台'); | ||
| 740 | - setState(() {}); | ||
| 741 | - // } | 736 | + bool success = await yxSave(); |
| 737 | + if (success) { | ||
| 738 | + selectMenu = '选台'; | ||
| 739 | + menuSet.add('意向'); | ||
| 740 | + menuSet.add('选台'); | ||
| 741 | + setState(() {}); | ||
| 742 | + } | ||
| 742 | }, | 743 | }, |
| 743 | content: '保存并下一步', | 744 | content: '保存并下一步', |
| 744 | hasLeftBorder: true, | 745 | hasLeftBorder: true, |
| @@ -1333,11 +1334,42 @@ class _FeastCreatePageState extends State<FeastCreatePage> { | @@ -1333,11 +1334,42 @@ class _FeastCreatePageState extends State<FeastCreatePage> { | ||
| 1333 | fontSize: font(16)), | 1334 | fontSize: font(16)), |
| 1334 | )), | 1335 | )), |
| 1335 | InkWell( | 1336 | InkWell( |
| 1336 | - onTap: () { | ||
| 1337 | - NavigatorUtil | ||
| 1338 | - .goFeastMenuPage( | ||
| 1339 | - context, | ||
| 1340 | - setmeal.setmealId); | 1337 | + onTap: () async { |
| 1338 | + Map temp = {}; | ||
| 1339 | + if (setmeal.dataMenu != | ||
| 1340 | + null && | ||
| 1341 | + setmeal.dataMenu | ||
| 1342 | + .length > | ||
| 1343 | + 0) { | ||
| 1344 | + temp = await NavigatorUtil | ||
| 1345 | + .goFeastMenuPage( | ||
| 1346 | + context, | ||
| 1347 | + setmeal.setmealId, | ||
| 1348 | + justSelData: { | ||
| 1349 | + 'object': | ||
| 1350 | + setmeal.dataMenu | ||
| 1351 | + }); | ||
| 1352 | + } else { | ||
| 1353 | + temp = await NavigatorUtil | ||
| 1354 | + .goFeastMenuPage( | ||
| 1355 | + context, | ||
| 1356 | + setmeal.setmealId, | ||
| 1357 | + ); | ||
| 1358 | + } | ||
| 1359 | + | ||
| 1360 | + if (temp == null) { | ||
| 1361 | + } else if (temp['object'] | ||
| 1362 | + .length == | ||
| 1363 | + 0) { | ||
| 1364 | + } else { | ||
| 1365 | + setmeal.dataMenu = | ||
| 1366 | + temp['object']; | ||
| 1367 | + xuantaiData[xuantaiSelIndex] | ||
| 1368 | + .setmeal[index] | ||
| 1369 | + .dataMenu = | ||
| 1370 | + temp['object']; | ||
| 1371 | + } | ||
| 1372 | + setState(() {}); | ||
| 1341 | }, | 1373 | }, |
| 1342 | child: Row( | 1374 | child: Row( |
| 1343 | children: [ | 1375 | children: [ |
| @@ -1365,24 +1397,22 @@ class _FeastCreatePageState extends State<FeastCreatePage> { | @@ -1365,24 +1397,22 @@ class _FeastCreatePageState extends State<FeastCreatePage> { | ||
| 1365 | )) | 1397 | )) |
| 1366 | ], | 1398 | ], |
| 1367 | ), | 1399 | ), |
| 1368 | - setmeal.finalPrice.isEmpty && | ||
| 1369 | - setmeal.min.isEmpty && | ||
| 1370 | - setmeal.spare.isEmpty && | ||
| 1371 | - setmeal.pnum.isEmpty | ||
| 1372 | - ? SizedBox() | ||
| 1373 | - : VEmptyView(32), | 1400 | + VEmptyView(32), |
| 1374 | Row( | 1401 | Row( |
| 1375 | mainAxisAlignment: | 1402 | mainAxisAlignment: |
| 1376 | MainAxisAlignment.start, | 1403 | MainAxisAlignment.start, |
| 1377 | children: [ | 1404 | children: [ |
| 1378 | - setmeal.finalPrice.isNotEmpty | ||
| 1379 | - ? Padding( | ||
| 1380 | - padding: EdgeInsets.only( | ||
| 1381 | - right: w(16)), | ||
| 1382 | - child: taocanText( | ||
| 1383 | - setmeal.finalPrice, | ||
| 1384 | - ' 元/桌')) | ||
| 1385 | - : SizedBox(), | 1405 | + Padding( |
| 1406 | + padding: EdgeInsets.only( | ||
| 1407 | + right: w(16)), | ||
| 1408 | + child: taocanText( | ||
| 1409 | + setmeal.bargaining == | ||
| 1410 | + '0' || | ||
| 1411 | + setmeal.finalPrice | ||
| 1412 | + .isEmpty | ||
| 1413 | + ? setmeal.price | ||
| 1414 | + : setmeal.finalPrice, | ||
| 1415 | + ' 元/桌')), | ||
| 1386 | setmeal.pnum.isNotEmpty | 1416 | setmeal.pnum.isNotEmpty |
| 1387 | ? Padding( | 1417 | ? Padding( |
| 1388 | padding: EdgeInsets.only( | 1418 | padding: EdgeInsets.only( |
| @@ -1421,22 +1451,45 @@ class _FeastCreatePageState extends State<FeastCreatePage> { | @@ -1421,22 +1451,45 @@ class _FeastCreatePageState extends State<FeastCreatePage> { | ||
| 1421 | gradientStart: MyColours.color_438E93, | 1451 | gradientStart: MyColours.color_438E93, |
| 1422 | gradientEnd: MyColours.color_438E93, | 1452 | gradientEnd: MyColours.color_438E93, |
| 1423 | onPressed: () async { | 1453 | onPressed: () async { |
| 1454 | + String dateData = ''; | ||
| 1455 | + if (xuantaiData[xuantaiSelIndex] | ||
| 1456 | + .dateTimeShowxt != | ||
| 1457 | + '暂未选择') { | ||
| 1458 | + DateTime day = | ||
| 1459 | + xuantaiData[xuantaiSelIndex].dateTimext; | ||
| 1460 | + String ymd = "${day.year}-" + | ||
| 1461 | + Utils.addZeroNumber(day.month) + | ||
| 1462 | + "-" + | ||
| 1463 | + Utils.addZeroNumber(day.day); | ||
| 1464 | + dateData += ymd; | ||
| 1465 | + } | ||
| 1466 | + if (dateData.length > 0) { | ||
| 1467 | + dateData += ' ${feastModel.reserve}'; | ||
| 1468 | + } else { | ||
| 1469 | + dateData += '${feastModel.reserve}'; | ||
| 1470 | + } | ||
| 1471 | + | ||
| 1472 | + dateData += ' ${feastModel.type}'; | ||
| 1473 | + | ||
| 1424 | Map temp = {}; | 1474 | Map temp = {}; |
| 1425 | if (xuantaiData[xuantaiSelIndex] | 1475 | if (xuantaiData[xuantaiSelIndex] |
| 1426 | .setmeal | 1476 | .setmeal |
| 1427 | .length > | 1477 | .length > |
| 1428 | 0) { | 1478 | 0) { |
| 1479 | + print(xuantaiData[xuantaiSelIndex].setmeal); | ||
| 1480 | + userModel.justSelData = | ||
| 1481 | + xuantaiData[xuantaiSelIndex].setmeal; | ||
| 1429 | temp = | 1482 | temp = |
| 1430 | await NavigatorUtil.goFeastSetmealPage( | 1483 | await NavigatorUtil.goFeastSetmealPage( |
| 1431 | - context, | ||
| 1432 | - justSelData: { | ||
| 1433 | - 'object': xuantaiData[xuantaiSelIndex] | ||
| 1434 | - .setmeal | ||
| 1435 | - }); | 1484 | + context, dateData, justSelData: { |
| 1485 | + 'object': | ||
| 1486 | + xuantaiData[xuantaiSelIndex].setmeal | ||
| 1487 | + }); | ||
| 1436 | } else { | 1488 | } else { |
| 1437 | temp = | 1489 | temp = |
| 1438 | await NavigatorUtil.goFeastSetmealPage( | 1490 | await NavigatorUtil.goFeastSetmealPage( |
| 1439 | context, | 1491 | context, |
| 1492 | + dateData, | ||
| 1440 | ); | 1493 | ); |
| 1441 | } | 1494 | } |
| 1442 | 1495 | ||
| @@ -1460,11 +1513,14 @@ class _FeastCreatePageState extends State<FeastCreatePage> { | @@ -1460,11 +1513,14 @@ class _FeastCreatePageState extends State<FeastCreatePage> { | ||
| 1460 | fontSize: ScreenUtil().setSp(28)), | 1513 | fontSize: ScreenUtil().setSp(28)), |
| 1461 | ), | 1514 | ), |
| 1462 | ListView.builder( | 1515 | ListView.builder( |
| 1463 | - itemCount: 2, | 1516 | + itemCount: |
| 1517 | + xuantaiData[xuantaiSelIndex].wine.length, | ||
| 1464 | shrinkWrap: true, | 1518 | shrinkWrap: true, |
| 1465 | controller: controller, | 1519 | controller: controller, |
| 1466 | itemBuilder: | 1520 | itemBuilder: |
| 1467 | (BuildContext context, int index) { | 1521 | (BuildContext context, int index) { |
| 1522 | + Wine wine = xuantaiData[xuantaiSelIndex] | ||
| 1523 | + .wine[index]; | ||
| 1468 | return Container( | 1524 | return Container( |
| 1469 | height: h(42), | 1525 | height: h(42), |
| 1470 | decoration: BoxDecoration( | 1526 | decoration: BoxDecoration( |
| @@ -1479,21 +1535,52 @@ class _FeastCreatePageState extends State<FeastCreatePage> { | @@ -1479,21 +1535,52 @@ class _FeastCreatePageState extends State<FeastCreatePage> { | ||
| 1479 | children: [ | 1535 | children: [ |
| 1480 | Expanded( | 1536 | Expanded( |
| 1481 | child: Text( | 1537 | child: Text( |
| 1482 | - '剑南春52度500ml', | 1538 | + wine.name, |
| 1483 | overflow: TextOverflow.ellipsis, | 1539 | overflow: TextOverflow.ellipsis, |
| 1484 | style: TextStyle( | 1540 | style: TextStyle( |
| 1485 | color: MyColours.color_515151, | 1541 | color: MyColours.color_515151, |
| 1486 | fontSize: font(16)), | 1542 | fontSize: font(16)), |
| 1487 | )), | 1543 | )), |
| 1488 | - taocanText('1299', ' 元/份'), | ||
| 1489 | - HEmptyView(32), | ||
| 1490 | - taocanText('12', ' 份'), | 1544 | + taocanText( |
| 1545 | + wine.bargaining == '1' && | ||
| 1546 | + wine.finalPrice.isNotEmpty | ||
| 1547 | + ? wine.finalPrice | ||
| 1548 | + : wine.price, | ||
| 1549 | + ' 元/${wine.spec}'), | ||
| 1550 | + wine.numStr.isEmpty | ||
| 1551 | + ? SizedBox() | ||
| 1552 | + : HEmptyView(32), | ||
| 1553 | + wine.numStr.isEmpty | ||
| 1554 | + ? SizedBox() | ||
| 1555 | + : taocanText( | ||
| 1556 | + wine.numStr, ' ${wine.spec}'), | ||
| 1491 | HEmptyView(32), | 1557 | HEmptyView(32), |
| 1492 | InkWell( | 1558 | InkWell( |
| 1559 | + onTap: () { | ||
| 1560 | + FocusScope.of(context) | ||
| 1561 | + .requestFocus( | ||
| 1562 | + FocusNode()); //点击空白处隐藏键盘 | ||
| 1563 | + //弹框确认是否删除 | ||
| 1564 | + DialogUtil.cupertinoAlertDialog( | ||
| 1565 | + context, | ||
| 1566 | + title: "", | ||
| 1567 | + content: "是否确定删除?", | ||
| 1568 | + isBoldContent: true, | ||
| 1569 | + contentColor: MyColours | ||
| 1570 | + .color_E6000000, | ||
| 1571 | + rTitle: "删除", | ||
| 1572 | + rCallback: () { | ||
| 1573 | + xuantaiData[xuantaiSelIndex] | ||
| 1574 | + .wine | ||
| 1575 | + .removeAt(index); | ||
| 1576 | + setState(() {}); | ||
| 1577 | + }); | ||
| 1578 | + }, | ||
| 1493 | child: Image.asset( | 1579 | child: Image.asset( |
| 1494 | - Utils.getImgPath('f_delete_red'), | ||
| 1495 | - width: w(20), | ||
| 1496 | - )) | 1580 | + Utils.getImgPath( |
| 1581 | + 'f_delete_red'), | ||
| 1582 | + width: w(20), | ||
| 1583 | + )) | ||
| 1497 | ], | 1584 | ], |
| 1498 | ), | 1585 | ), |
| 1499 | ); | 1586 | ); |
| @@ -1509,8 +1596,31 @@ class _FeastCreatePageState extends State<FeastCreatePage> { | @@ -1509,8 +1596,31 @@ class _FeastCreatePageState extends State<FeastCreatePage> { | ||
| 1509 | isBold: false, | 1596 | isBold: false, |
| 1510 | gradientStart: MyColours.color_438E93, | 1597 | gradientStart: MyColours.color_438E93, |
| 1511 | gradientEnd: MyColours.color_438E93, | 1598 | gradientEnd: MyColours.color_438E93, |
| 1512 | - onPressed: () { | ||
| 1513 | - NavigatorUtil.goFeastWinePage(context); | 1599 | + onPressed: () async { |
| 1600 | + Map temp = {}; | ||
| 1601 | + if (xuantaiData[xuantaiSelIndex].wine.length > | ||
| 1602 | + 0) { | ||
| 1603 | + temp = await NavigatorUtil.goFeastWinePage( | ||
| 1604 | + context, | ||
| 1605 | + justSelData: { | ||
| 1606 | + 'object': | ||
| 1607 | + xuantaiData[xuantaiSelIndex].wine | ||
| 1608 | + }); | ||
| 1609 | + } else { | ||
| 1610 | + temp = await NavigatorUtil.goFeastWinePage( | ||
| 1611 | + context); | ||
| 1612 | + } | ||
| 1613 | + | ||
| 1614 | + if (temp == null) { | ||
| 1615 | + } else if (temp['object'].length == 0) { | ||
| 1616 | + } else { | ||
| 1617 | + xuantaiData[xuantaiSelIndex].wine = | ||
| 1618 | + temp['object']; | ||
| 1619 | + print(xuantaiData[xuantaiSelIndex] | ||
| 1620 | + .wine | ||
| 1621 | + .toString()); | ||
| 1622 | + } | ||
| 1623 | + setState(() {}); | ||
| 1514 | }, | 1624 | }, |
| 1515 | ), | 1625 | ), |
| 1516 | VEmptyView(52), | 1626 | VEmptyView(52), |
| @@ -1521,11 +1631,14 @@ class _FeastCreatePageState extends State<FeastCreatePage> { | @@ -1521,11 +1631,14 @@ class _FeastCreatePageState extends State<FeastCreatePage> { | ||
| 1521 | fontSize: ScreenUtil().setSp(28)), | 1631 | fontSize: ScreenUtil().setSp(28)), |
| 1522 | ), | 1632 | ), |
| 1523 | ListView.builder( | 1633 | ListView.builder( |
| 1524 | - itemCount: 2, | 1634 | + itemCount: |
| 1635 | + xuantaiData[xuantaiSelIndex].other.length, | ||
| 1525 | shrinkWrap: true, | 1636 | shrinkWrap: true, |
| 1526 | controller: controller, | 1637 | controller: controller, |
| 1527 | itemBuilder: | 1638 | itemBuilder: |
| 1528 | (BuildContext context, int index) { | 1639 | (BuildContext context, int index) { |
| 1640 | + Other other = xuantaiData[xuantaiSelIndex] | ||
| 1641 | + .other[index]; | ||
| 1529 | return Container( | 1642 | return Container( |
| 1530 | height: h(42), | 1643 | height: h(42), |
| 1531 | decoration: BoxDecoration( | 1644 | decoration: BoxDecoration( |
| @@ -1540,21 +1653,53 @@ class _FeastCreatePageState extends State<FeastCreatePage> { | @@ -1540,21 +1653,53 @@ class _FeastCreatePageState extends State<FeastCreatePage> { | ||
| 1540 | children: [ | 1653 | children: [ |
| 1541 | Expanded( | 1654 | Expanded( |
| 1542 | child: Text( | 1655 | child: Text( |
| 1543 | - 'LED大屏', | 1656 | + other.name, |
| 1544 | overflow: TextOverflow.ellipsis, | 1657 | overflow: TextOverflow.ellipsis, |
| 1545 | style: TextStyle( | 1658 | style: TextStyle( |
| 1546 | color: MyColours.color_515151, | 1659 | color: MyColours.color_515151, |
| 1547 | fontSize: font(16)), | 1660 | fontSize: font(16)), |
| 1548 | )), | 1661 | )), |
| 1549 | - taocanText('1299', ' 元/份'), | ||
| 1550 | - HEmptyView(32), | ||
| 1551 | - taocanText('12', ' 份'), | 1662 | + taocanText( |
| 1663 | + other.bargaining == '1' && | ||
| 1664 | + other | ||
| 1665 | + .finalPrice.isNotEmpty | ||
| 1666 | + ? other.finalPrice | ||
| 1667 | + : other.price, | ||
| 1668 | + ' 元/${other.spec}'), | ||
| 1669 | + other.numStr.isEmpty | ||
| 1670 | + ? SizedBox() | ||
| 1671 | + : HEmptyView(32), | ||
| 1672 | + other.numStr.isEmpty | ||
| 1673 | + ? SizedBox() | ||
| 1674 | + : taocanText(other.numStr, | ||
| 1675 | + ' ${other.spec}'), | ||
| 1552 | HEmptyView(32), | 1676 | HEmptyView(32), |
| 1553 | InkWell( | 1677 | InkWell( |
| 1678 | + onTap: () { | ||
| 1679 | + FocusScope.of(context) | ||
| 1680 | + .requestFocus( | ||
| 1681 | + FocusNode()); //点击空白处隐藏键盘 | ||
| 1682 | + //弹框确认是否删除 | ||
| 1683 | + DialogUtil.cupertinoAlertDialog( | ||
| 1684 | + context, | ||
| 1685 | + title: "", | ||
| 1686 | + content: "是否确定删除?", | ||
| 1687 | + isBoldContent: true, | ||
| 1688 | + contentColor: MyColours | ||
| 1689 | + .color_E6000000, | ||
| 1690 | + rTitle: "删除", | ||
| 1691 | + rCallback: () { | ||
| 1692 | + xuantaiData[xuantaiSelIndex] | ||
| 1693 | + .other | ||
| 1694 | + .removeAt(index); | ||
| 1695 | + setState(() {}); | ||
| 1696 | + }); | ||
| 1697 | + }, | ||
| 1554 | child: Image.asset( | 1698 | child: Image.asset( |
| 1555 | - Utils.getImgPath('f_delete_red'), | ||
| 1556 | - width: w(20), | ||
| 1557 | - )) | 1699 | + Utils.getImgPath( |
| 1700 | + 'f_delete_red'), | ||
| 1701 | + width: w(20), | ||
| 1702 | + )) | ||
| 1558 | ], | 1703 | ], |
| 1559 | ), | 1704 | ), |
| 1560 | ); | 1705 | ); |
| @@ -1570,8 +1715,31 @@ class _FeastCreatePageState extends State<FeastCreatePage> { | @@ -1570,8 +1715,31 @@ class _FeastCreatePageState extends State<FeastCreatePage> { | ||
| 1570 | isBold: false, | 1715 | isBold: false, |
| 1571 | gradientStart: MyColours.color_438E93, | 1716 | gradientStart: MyColours.color_438E93, |
| 1572 | gradientEnd: MyColours.color_438E93, | 1717 | gradientEnd: MyColours.color_438E93, |
| 1573 | - onPressed: () { | ||
| 1574 | - NavigatorUtil.goFeastSetPage(context); | 1718 | + onPressed: () async { |
| 1719 | + Map temp = {}; | ||
| 1720 | + if (xuantaiData[xuantaiSelIndex].wine.length > | ||
| 1721 | + 0) { | ||
| 1722 | + temp = await NavigatorUtil.goFeastSetPage( | ||
| 1723 | + context, | ||
| 1724 | + justSelData: { | ||
| 1725 | + 'object': | ||
| 1726 | + xuantaiData[xuantaiSelIndex].other | ||
| 1727 | + }); | ||
| 1728 | + } else { | ||
| 1729 | + temp = await NavigatorUtil.goFeastSetPage( | ||
| 1730 | + context); | ||
| 1731 | + } | ||
| 1732 | + | ||
| 1733 | + if (temp == null) { | ||
| 1734 | + } else if (temp['object'].length == 0) { | ||
| 1735 | + } else { | ||
| 1736 | + xuantaiData[xuantaiSelIndex].other = | ||
| 1737 | + temp['object']; | ||
| 1738 | + print(xuantaiData[xuantaiSelIndex] | ||
| 1739 | + .other | ||
| 1740 | + .toString()); | ||
| 1741 | + } | ||
| 1742 | + setState(() {}); | ||
| 1575 | }, | 1743 | }, |
| 1576 | ), | 1744 | ), |
| 1577 | ], | 1745 | ], |
| @@ -3112,6 +3280,7 @@ class _FeastCreatePageState extends State<FeastCreatePage> { | @@ -3112,6 +3280,7 @@ class _FeastCreatePageState extends State<FeastCreatePage> { | ||
| 3112 | @override | 3280 | @override |
| 3113 | Widget build(BuildContext context) { | 3281 | Widget build(BuildContext context) { |
| 3114 | feastModel = Provider.of<FeastModel>(context, listen: true); | 3282 | feastModel = Provider.of<FeastModel>(context, listen: true); |
| 3283 | + userModel = Provider.of<UserModel>(context, listen: false); | ||
| 3115 | _uploadImageProvider = | 3284 | _uploadImageProvider = |
| 3116 | Provider.of<UploadImageProvider>(context, listen: true); | 3285 | Provider.of<UploadImageProvider>(context, listen: true); |
| 3117 | return Scaffold( | 3286 | return Scaffold( |
| 1 | +import 'dart:convert'; | ||
| 2 | + | ||
| 1 | import 'package:flutter/material.dart'; | 3 | import 'package:flutter/material.dart'; |
| 2 | import 'package:flutter_screenutil/flutter_screenutil.dart'; | 4 | import 'package:flutter_screenutil/flutter_screenutil.dart'; |
| 3 | import 'package:one_key/models/get_setmeal_class_by_id_model.dart'; | 5 | import 'package:one_key/models/get_setmeal_class_by_id_model.dart'; |
| @@ -8,6 +10,7 @@ import 'package:one_key/widgets/h_empty_view.dart'; | @@ -8,6 +10,7 @@ import 'package:one_key/widgets/h_empty_view.dart'; | ||
| 8 | import 'package:provider/provider.dart'; | 10 | import 'package:provider/provider.dart'; |
| 9 | 11 | ||
| 10 | import '../../constant/state.dart'; | 12 | import '../../constant/state.dart'; |
| 13 | +import '../../models/feast_menu_set_model.dart'; | ||
| 11 | import '../../provider/feast_model.dart'; | 14 | import '../../provider/feast_model.dart'; |
| 12 | import '../../res/colors.dart'; | 15 | import '../../res/colors.dart'; |
| 13 | import '../../utils/screen_util.dart'; | 16 | import '../../utils/screen_util.dart'; |
| @@ -22,7 +25,8 @@ import '../../widgets/v_empty_view.dart'; | @@ -22,7 +25,8 @@ import '../../widgets/v_empty_view.dart'; | ||
| 22 | */ | 25 | */ |
| 23 | class FeastMenuPage extends StatefulWidget { | 26 | class FeastMenuPage extends StatefulWidget { |
| 24 | final String setmealId; | 27 | final String setmealId; |
| 25 | - FeastMenuPage({Key key, this.setmealId}) : super(key: key); | 28 | + final Map<String, List<CookByIdSetmeal>> justSelData; |
| 29 | + FeastMenuPage({Key key, this.setmealId, this.justSelData}) : super(key: key); | ||
| 26 | 30 | ||
| 27 | @override | 31 | @override |
| 28 | _FeastMenuPageState createState() => _FeastMenuPageState(); | 32 | _FeastMenuPageState createState() => _FeastMenuPageState(); |
| @@ -33,6 +37,10 @@ class _FeastMenuPageState extends State<FeastMenuPage> { | @@ -33,6 +37,10 @@ class _FeastMenuPageState extends State<FeastMenuPage> { | ||
| 33 | FeastModel feastModel; | 37 | FeastModel feastModel; |
| 34 | Map<String, List<CookByIdSetmeal>> data = {}; | 38 | Map<String, List<CookByIdSetmeal>> data = {}; |
| 35 | List<String> classNames = []; | 39 | List<String> classNames = []; |
| 40 | + List<Map<String, String>> setModel = []; | ||
| 41 | + | ||
| 42 | + Map<String, List<CookByIdSetmeal>> dataNew = {}; | ||
| 43 | + | ||
| 36 | @override | 44 | @override |
| 37 | void initState() { | 45 | void initState() { |
| 38 | // TODO: implement initState | 46 | // TODO: implement initState |
| @@ -50,19 +58,26 @@ class _FeastMenuPageState extends State<FeastMenuPage> { | @@ -50,19 +58,26 @@ class _FeastMenuPageState extends State<FeastMenuPage> { | ||
| 50 | bool success = await feastModel.getSetmealById(context, params, | 58 | bool success = await feastModel.getSetmealById(context, params, |
| 51 | isShowLoading: isShowLoading); | 59 | isShowLoading: isShowLoading); |
| 52 | if (success) { | 60 | 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; | 61 | + if (widget.justSelData.length > 0) { |
| 62 | + data = widget.justSelData; | ||
| 63 | + data.forEach((key, value) { | ||
| 64 | + classNames.add(key); | ||
| 65 | + }); | ||
| 66 | + } else { | ||
| 67 | + for (ClassifyById item in feastModel.setmealDetail.classify) { | ||
| 68 | + // Map<String, List<CookByIdSetmeal>> map = {}; | ||
| 69 | + String cid = item.id; | ||
| 70 | + String className = item.className; | ||
| 57 | 71 | ||
| 58 | - List<CookByIdSetmeal> temp = []; | ||
| 59 | - for (CookByIdSetmeal itemCook in feastModel.setmealDetail.cook) { | ||
| 60 | - if (cid == itemCook.cid) { | ||
| 61 | - temp.add(itemCook); | 72 | + List<CookByIdSetmeal> temp = []; |
| 73 | + for (CookByIdSetmeal itemCook in feastModel.setmealDetail.cook) { | ||
| 74 | + if (cid == itemCook.cid) { | ||
| 75 | + temp.add(itemCook); | ||
| 76 | + } | ||
| 62 | } | 77 | } |
| 78 | + classNames.add(className); | ||
| 79 | + data[className] = temp; | ||
| 63 | } | 80 | } |
| 64 | - classNames.add(className); | ||
| 65 | - data[className] = temp; | ||
| 66 | } | 81 | } |
| 67 | feastModel.pageStateMenu = PageState.Success; | 82 | feastModel.pageStateMenu = PageState.Success; |
| 68 | setState(() {}); | 83 | setState(() {}); |
| @@ -166,7 +181,7 @@ class _FeastMenuPageState extends State<FeastMenuPage> { | @@ -166,7 +181,7 @@ class _FeastMenuPageState extends State<FeastMenuPage> { | ||
| 166 | return ListView.builder( | 181 | return ListView.builder( |
| 167 | shrinkWrap: true, | 182 | shrinkWrap: true, |
| 168 | controller: controller, | 183 | controller: controller, |
| 169 | - padding: EdgeInsets.only(right: w(12)), | 184 | + // padding: EdgeInsets.only(right: w(12)), |
| 170 | itemCount: cookList.length + 1, | 185 | itemCount: cookList.length + 1, |
| 171 | itemBuilder: (BuildContext context, int index) { | 186 | itemBuilder: (BuildContext context, int index) { |
| 172 | if (index < 1) { | 187 | if (index < 1) { |
| @@ -200,7 +215,7 @@ class _FeastMenuPageState extends State<FeastMenuPage> { | @@ -200,7 +215,7 @@ class _FeastMenuPageState extends State<FeastMenuPage> { | ||
| 200 | Container( | 215 | Container( |
| 201 | width: h(36), | 216 | width: h(36), |
| 202 | child: Text( | 217 | child: Text( |
| 203 | - '10${setmeal.spec}', | 218 | + '${setmeal.spec}', |
| 204 | overflow: TextOverflow.ellipsis, | 219 | overflow: TextOverflow.ellipsis, |
| 205 | maxLines: 1, | 220 | maxLines: 1, |
| 206 | style: TextStyle( | 221 | style: TextStyle( |
| @@ -229,9 +244,11 @@ class _FeastMenuPageState extends State<FeastMenuPage> { | @@ -229,9 +244,11 @@ class _FeastMenuPageState extends State<FeastMenuPage> { | ||
| 229 | fontSize: ScreenUtil().setSp(32)), | 244 | fontSize: ScreenUtil().setSp(32)), |
| 230 | ), | 245 | ), |
| 231 | HEmptyView(16), | 246 | HEmptyView(16), |
| 232 | - Expanded(child: _textfield('菜名', null, null)), | ||
| 233 | - HEmptyView(16), | ||
| 234 | - _textfield('数量', null, null, width: w(56)) | 247 | + Expanded( |
| 248 | + child: | ||
| 249 | + _textfield('菜名', setmeal.nameC, null)), | ||
| 250 | + // HEmptyView(16), | ||
| 251 | + // _textfield('数量', null, null, width: w(56)) | ||
| 235 | ], | 252 | ], |
| 236 | )) | 253 | )) |
| 237 | ], | 254 | ], |
| @@ -280,7 +297,7 @@ class _FeastMenuPageState extends State<FeastMenuPage> { | @@ -280,7 +297,7 @@ class _FeastMenuPageState extends State<FeastMenuPage> { | ||
| 280 | return ExceptionPage( | 297 | return ExceptionPage( |
| 281 | pageState: model.pageStateMenu, | 298 | pageState: model.pageStateMenu, |
| 282 | callback: () { | 299 | callback: () { |
| 283 | - // _getSellerUserBySellerid(); | 300 | + _getSetmealById(); |
| 284 | }, | 301 | }, |
| 285 | emptyMsg: "暂时没有菜品哦", | 302 | emptyMsg: "暂时没有菜品哦", |
| 286 | emptyImg: "empty_search", | 303 | emptyImg: "empty_search", |
| @@ -336,7 +353,38 @@ class _FeastMenuPageState extends State<FeastMenuPage> { | @@ -336,7 +353,38 @@ class _FeastMenuPageState extends State<FeastMenuPage> { | ||
| 336 | isSelect: false)), | 353 | isSelect: false)), |
| 337 | Expanded( | 354 | Expanded( |
| 338 | child: _callButton( | 355 | child: _callButton( |
| 339 | - onPress: () {}, | 356 | + onPress: () async { |
| 357 | + FocusScope.of(context).requestFocus(FocusNode()); | ||
| 358 | + // setModel = []; | ||
| 359 | + data.forEach((key, value) { | ||
| 360 | + List<CookByIdSetmeal> temp = []; | ||
| 361 | + value.forEach((element) { | ||
| 362 | + if (element.nameC.text.trim().length > 0) { | ||
| 363 | + //已调菜 | ||
| 364 | + // setModel.add({ | ||
| 365 | + // 'id': element.id, | ||
| 366 | + // 'cname': element.nameC.text | ||
| 367 | + // }); | ||
| 368 | + element.cname = element.nameC.text; | ||
| 369 | + temp.add(element); | ||
| 370 | + } else { | ||
| 371 | + temp.add(element); | ||
| 372 | + } | ||
| 373 | + }); | ||
| 374 | + dataNew[key] = temp; | ||
| 375 | + }); | ||
| 376 | + // if (setModel.length > 0) { | ||
| 377 | + // bool success = await feastModel | ||
| 378 | + // .setBanquetInfoCook(context, | ||
| 379 | + // {'data': json.encode(setModel)}); | ||
| 380 | + // if (success) { | ||
| 381 | + | ||
| 382 | + Map temp = { | ||
| 383 | + 'object': dataNew, | ||
| 384 | + }; | ||
| 385 | + Navigator.of(context).pop(temp); | ||
| 386 | + // } | ||
| 387 | + }, | ||
| 340 | content: '保存并返回', | 388 | content: '保存并返回', |
| 341 | hasLeftBorder: true, | 389 | hasLeftBorder: true, |
| 342 | isSelect: true)) | 390 | isSelect: true)) |
lib/pages/feast/feast_menu_show_page.dart
0 → 100644
| 1 | +import 'dart:convert'; | ||
| 2 | + | ||
| 3 | +import 'package:flutter/material.dart'; | ||
| 4 | +import 'package:flutter_screenutil/flutter_screenutil.dart'; | ||
| 5 | +import 'package:one_key/models/get_setmeal_class_by_id_model.dart'; | ||
| 6 | +import 'package:one_key/models/setmeal_by_id_model.dart'; | ||
| 7 | +import 'package:one_key/models/setmeal_model.dart'; | ||
| 8 | +import 'package:one_key/widgets/MyDivider.dart'; | ||
| 9 | +import 'package:one_key/widgets/h_empty_view.dart'; | ||
| 10 | +import 'package:provider/provider.dart'; | ||
| 11 | + | ||
| 12 | +import '../../constant/state.dart'; | ||
| 13 | +import '../../models/feast_menu_set_model.dart'; | ||
| 14 | +import '../../provider/feast_model.dart'; | ||
| 15 | +import '../../res/colors.dart'; | ||
| 16 | +import '../../utils/screen_util.dart'; | ||
| 17 | +import '../../utils/utils.dart'; | ||
| 18 | +import '../../widgets/page_exception.dart'; | ||
| 19 | +import '../../widgets/system_app_bar.dart'; | ||
| 20 | +import '../../widgets/v_empty_view.dart'; | ||
| 21 | + | ||
| 22 | +/** | ||
| 23 | + * | ||
| 24 | + * 菜单信息 | ||
| 25 | + */ | ||
| 26 | +class FeastMenuShowPage extends StatefulWidget { | ||
| 27 | + final String setmealId; | ||
| 28 | + final String mealName; | ||
| 29 | + final String dateData; | ||
| 30 | + final String needtable; | ||
| 31 | + | ||
| 32 | + final Map<String, List<CookByIdSetmeal>> justSelData; | ||
| 33 | + FeastMenuShowPage( | ||
| 34 | + {Key key, | ||
| 35 | + this.setmealId, | ||
| 36 | + this.mealName, | ||
| 37 | + this.dateData, | ||
| 38 | + this.needtable, | ||
| 39 | + this.justSelData}) | ||
| 40 | + : super(key: key); | ||
| 41 | + | ||
| 42 | + @override | ||
| 43 | + _FeastMenuShowPageState createState() => _FeastMenuShowPageState(); | ||
| 44 | +} | ||
| 45 | + | ||
| 46 | +class _FeastMenuShowPageState extends State<FeastMenuShowPage> { | ||
| 47 | + ScrollController controller = ScrollController(); | ||
| 48 | + FeastModel feastModel; | ||
| 49 | + Map<String, List<CookByIdSetmeal>> data = {}; | ||
| 50 | + List<String> classNames = []; | ||
| 51 | + List<Map<String, String>> setModel = []; | ||
| 52 | + | ||
| 53 | + Map<String, List<CookByIdSetmeal>> dataNew = {}; | ||
| 54 | + | ||
| 55 | + @override | ||
| 56 | + void initState() { | ||
| 57 | + // TODO: implement initState | ||
| 58 | + super.initState(); | ||
| 59 | + | ||
| 60 | + Utils.changeStatusColor(color: MyColours.color_438E93); | ||
| 61 | + WidgetsBinding.instance.addPostFrameCallback((_) { | ||
| 62 | + _getSetmealById(); | ||
| 63 | + }); | ||
| 64 | + } | ||
| 65 | + | ||
| 66 | + /// 根据ID获取宴会套餐 | ||
| 67 | + _getSetmealById({bool isShowLoading = true}) async { | ||
| 68 | + Map<String, String> params = {"id": widget.setmealId}; | ||
| 69 | + bool success = await feastModel.getSetmealById(context, params, | ||
| 70 | + isShowLoading: isShowLoading); | ||
| 71 | + if (success) { | ||
| 72 | + if (widget.justSelData.length > 0) { | ||
| 73 | + data = widget.justSelData; | ||
| 74 | + data.forEach((key, value) { | ||
| 75 | + classNames.add(key); | ||
| 76 | + }); | ||
| 77 | + } else { | ||
| 78 | + for (ClassifyById item in feastModel.setmealDetail.classify) { | ||
| 79 | + // Map<String, List<CookByIdSetmeal>> map = {}; | ||
| 80 | + String cid = item.id; | ||
| 81 | + String className = item.className; | ||
| 82 | + | ||
| 83 | + List<CookByIdSetmeal> temp = []; | ||
| 84 | + for (CookByIdSetmeal itemCook in feastModel.setmealDetail.cook) { | ||
| 85 | + if (cid == itemCook.cid) { | ||
| 86 | + temp.add(itemCook); | ||
| 87 | + } | ||
| 88 | + } | ||
| 89 | + classNames.add(className); | ||
| 90 | + data[className] = temp; | ||
| 91 | + } | ||
| 92 | + } | ||
| 93 | + feastModel.pageStateMenu = PageState.Success; | ||
| 94 | + setState(() {}); | ||
| 95 | + } | ||
| 96 | + } | ||
| 97 | + | ||
| 98 | + Widget _callButton( | ||
| 99 | + {GestureTapCallback onPress, | ||
| 100 | + content, | ||
| 101 | + hasLeftBorder = true, | ||
| 102 | + isSelect = false}) { | ||
| 103 | + return InkWell( | ||
| 104 | + onTap: onPress, | ||
| 105 | + child: Container( | ||
| 106 | + height: h(48), | ||
| 107 | + decoration: BoxDecoration( | ||
| 108 | + color: isSelect ? MyColours.color_438E93 : MyColours.color_ffffff, | ||
| 109 | + border: Border( | ||
| 110 | + bottom: BorderSide( | ||
| 111 | + color: MyColours.color_438E93, | ||
| 112 | + width: ScreenUtil().setWidth(2)), | ||
| 113 | + top: BorderSide( | ||
| 114 | + color: MyColours.color_438E93, | ||
| 115 | + width: ScreenUtil().setWidth(2)), | ||
| 116 | + left: hasLeftBorder | ||
| 117 | + ? BorderSide( | ||
| 118 | + color: MyColours.color_438E93, | ||
| 119 | + width: ScreenUtil().setWidth(2)) | ||
| 120 | + : BorderSide.none, | ||
| 121 | + right: BorderSide( | ||
| 122 | + color: MyColours.color_438E93, | ||
| 123 | + width: ScreenUtil().setWidth(2)))), | ||
| 124 | + child: Align( | ||
| 125 | + alignment: Alignment.center, | ||
| 126 | + child: Text( | ||
| 127 | + content, | ||
| 128 | + style: TextStyle( | ||
| 129 | + color: | ||
| 130 | + isSelect ? MyColours.color_F6F6F6 : MyColours.color_438E93, | ||
| 131 | + fontSize: ScreenUtil().setSp(36)), | ||
| 132 | + ), | ||
| 133 | + ), | ||
| 134 | + ), | ||
| 135 | + ); | ||
| 136 | + } | ||
| 137 | + | ||
| 138 | + // 根据index展示不同的widget | ||
| 139 | + Widget buildItemWidget(BuildContext context, int index) { | ||
| 140 | + return _itemBuildWidget(context, index); | ||
| 141 | + } | ||
| 142 | + | ||
| 143 | + ///输入框 | ||
| 144 | + Widget _textfield(String hintText, TextEditingController editingController, | ||
| 145 | + FocusNode focusNode, | ||
| 146 | + {TextInputType inputType = TextInputType.text, double width}) { | ||
| 147 | + return Container( | ||
| 148 | + width: width, | ||
| 149 | + padding: EdgeInsets.symmetric(horizontal: w(6)), | ||
| 150 | + decoration: BoxDecoration( | ||
| 151 | + border: Border.all(width: h(1), color: MyColours.color_DBDBDB)), | ||
| 152 | + child: Container( | ||
| 153 | + // height: ScreenUtil().setHeight(120), | ||
| 154 | + height: ScreenUtil().setWidth(64), | ||
| 155 | + child: TextField( | ||
| 156 | + controller: editingController, | ||
| 157 | + // textAlign: TextAlign.right, | ||
| 158 | + // textAlignVertical: TextAlignVertical.bottom, | ||
| 159 | + maxLines: 1, | ||
| 160 | + inputFormatters: [], | ||
| 161 | + | ||
| 162 | + // //光标颜色 | ||
| 163 | + // cursorColor: | ||
| 164 | + // widget.isSelect ? Colors.white : MyColours.color_199095, | ||
| 165 | + //输入文本的样式 | ||
| 166 | + style: TextStyle( | ||
| 167 | + fontSize: ScreenUtil().setSp(32), | ||
| 168 | + ), | ||
| 169 | + focusNode: focusNode, | ||
| 170 | + decoration: InputDecoration( | ||
| 171 | + border: OutlineInputBorder(borderSide: BorderSide.none), | ||
| 172 | + hintText: hintText, | ||
| 173 | + hintStyle: TextStyle( | ||
| 174 | + color: hintText == '菜名' || hintText == '数量' | ||
| 175 | + ? MyColours.color_999999 | ||
| 176 | + : MyColours.color_515151, | ||
| 177 | + fontSize: ScreenUtil().setSp(24), | ||
| 178 | + ), | ||
| 179 | + contentPadding: EdgeInsets.zero, | ||
| 180 | + ), | ||
| 181 | + onChanged: (value) {}, | ||
| 182 | + onEditingComplete: () { | ||
| 183 | + FocusScope.of(context).requestFocus(FocusNode()); //点击空白处隐藏键盘 | ||
| 184 | + }, | ||
| 185 | + keyboardType: inputType, | ||
| 186 | + )), | ||
| 187 | + ); | ||
| 188 | + } | ||
| 189 | + | ||
| 190 | + Widget _itemBuildWidget(BuildContext context, int index1) { | ||
| 191 | + List<CookByIdSetmeal> cookList = data[classNames[index1]]; | ||
| 192 | + return ListView.builder( | ||
| 193 | + shrinkWrap: true, | ||
| 194 | + controller: controller, | ||
| 195 | + // padding: EdgeInsets.only(right: w(12)), | ||
| 196 | + itemCount: cookList.length + 1, | ||
| 197 | + itemBuilder: (BuildContext context, int index) { | ||
| 198 | + if (index < 1) { | ||
| 199 | + return _buildHeaderWidget(context, classNames[index1]); | ||
| 200 | + } else { | ||
| 201 | + int itemIndex = index - 1; | ||
| 202 | + CookByIdSetmeal setmeal = cookList[itemIndex]; | ||
| 203 | + | ||
| 204 | + return Container( | ||
| 205 | + margin: new EdgeInsets.only(bottom: h(12)), | ||
| 206 | + color: MyColours.color_ffffff, | ||
| 207 | + child: new GestureDetector( | ||
| 208 | + onTap: () { | ||
| 209 | + // _gotoProjectDetail(projectModelList[index]); | ||
| 210 | + }, | ||
| 211 | + child: new Container( | ||
| 212 | + color: MyColours.color_ffffff, | ||
| 213 | + child: Row( | ||
| 214 | + children: [ | ||
| 215 | + Container( | ||
| 216 | + width: h(119), | ||
| 217 | + child: Text( | ||
| 218 | + setmeal.cname, | ||
| 219 | + overflow: TextOverflow.ellipsis, | ||
| 220 | + maxLines: 10, | ||
| 221 | + style: TextStyle( | ||
| 222 | + color: MyColours.color_515151, | ||
| 223 | + fontSize: ScreenUtil().setSp(32)), | ||
| 224 | + )), | ||
| 225 | + HEmptyView(16), | ||
| 226 | + Container( | ||
| 227 | + width: h(36), | ||
| 228 | + child: Text( | ||
| 229 | + '${setmeal.spec}', | ||
| 230 | + overflow: TextOverflow.ellipsis, | ||
| 231 | + maxLines: 1, | ||
| 232 | + style: TextStyle( | ||
| 233 | + color: MyColours.color_515151, | ||
| 234 | + fontSize: ScreenUtil().setSp(32)), | ||
| 235 | + )), | ||
| 236 | + ], | ||
| 237 | + )), | ||
| 238 | + ), | ||
| 239 | + ); | ||
| 240 | + } | ||
| 241 | + }, | ||
| 242 | + ); | ||
| 243 | + } | ||
| 244 | + | ||
| 245 | + // // 总count数 | ||
| 246 | + // int _getItemListCount() { | ||
| 247 | + // return data.length + 1; | ||
| 248 | + // } | ||
| 249 | + | ||
| 250 | + // header内容 | ||
| 251 | + Widget _buildHeaderWidget(BuildContext context, String title) { | ||
| 252 | + return Padding( | ||
| 253 | + padding: EdgeInsets.only(bottom: h(12)), | ||
| 254 | + child: Text( | ||
| 255 | + title, | ||
| 256 | + style: TextStyle( | ||
| 257 | + color: MyColours.color_515151, | ||
| 258 | + fontSize: font(16), | ||
| 259 | + fontWeight: FontWeight.bold), | ||
| 260 | + )); | ||
| 261 | + } | ||
| 262 | + | ||
| 263 | + @override | ||
| 264 | + Widget build(BuildContext context) { | ||
| 265 | + feastModel = Provider.of(context); | ||
| 266 | + return Scaffold( | ||
| 267 | + backgroundColor: MyColours.color_ffffff, | ||
| 268 | + appBar: SystemAppBar( | ||
| 269 | + '查看菜单', | ||
| 270 | + needWhite: true, | ||
| 271 | + bgColor: MyColours.color_438E93, | ||
| 272 | + titleColor: MyColours.color_F6F6F6, | ||
| 273 | + onTap: () { | ||
| 274 | + Navigator.pop(context); | ||
| 275 | + }, | ||
| 276 | + ), | ||
| 277 | + body: Consumer<FeastModel>(builder: (context, model, _) { | ||
| 278 | + if (model.pageStateMenu != PageState.Success) { | ||
| 279 | + return ExceptionPage( | ||
| 280 | + pageState: model.pageStateMenu, | ||
| 281 | + callback: () { | ||
| 282 | + _getSetmealById(); | ||
| 283 | + }, | ||
| 284 | + emptyMsg: "暂时没有菜单信息哦", | ||
| 285 | + emptyImg: "empty_search", | ||
| 286 | + showMsg: "加载中,请稍后...", | ||
| 287 | + ); | ||
| 288 | + } else { | ||
| 289 | + return SingleChildScrollView( | ||
| 290 | + controller: controller, | ||
| 291 | + child: Padding( | ||
| 292 | + padding: EdgeInsets.only(left: w(16)), | ||
| 293 | + child: Column( | ||
| 294 | + crossAxisAlignment: CrossAxisAlignment.start, | ||
| 295 | + children: [ | ||
| 296 | + VEmptyView(20), | ||
| 297 | + Container( | ||
| 298 | + width: double.infinity, | ||
| 299 | + height: h(48), | ||
| 300 | + alignment: Alignment.centerLeft, | ||
| 301 | + child: Text( | ||
| 302 | + widget.mealName, | ||
| 303 | + style: TextStyle( | ||
| 304 | + color: MyColours.color_E6000000, | ||
| 305 | + fontSize: font(16)), | ||
| 306 | + ), | ||
| 307 | + decoration: BoxDecoration( | ||
| 308 | + border: Border( | ||
| 309 | + bottom: BorderSide( | ||
| 310 | + width: h(0.5), | ||
| 311 | + color: MyColours.color_E7E7E7))), | ||
| 312 | + ), | ||
| 313 | + VEmptyView(22), | ||
| 314 | + Container( | ||
| 315 | + width: double.infinity, | ||
| 316 | + height: h(48), | ||
| 317 | + alignment: Alignment.centerLeft, | ||
| 318 | + child: Text( | ||
| 319 | + widget.dateData, | ||
| 320 | + style: TextStyle( | ||
| 321 | + color: MyColours.color_E6000000, | ||
| 322 | + fontSize: font(16)), | ||
| 323 | + ), | ||
| 324 | + decoration: BoxDecoration( | ||
| 325 | + border: Border( | ||
| 326 | + bottom: BorderSide( | ||
| 327 | + width: h(0.5), | ||
| 328 | + color: MyColours.color_E7E7E7))), | ||
| 329 | + ), | ||
| 330 | + widget.needtable.isEmpty ? SizedBox() : VEmptyView(22), | ||
| 331 | + widget.needtable.isEmpty | ||
| 332 | + ? SizedBox() | ||
| 333 | + : Container( | ||
| 334 | + width: double.infinity, | ||
| 335 | + height: h(48), | ||
| 336 | + child: Text( | ||
| 337 | + widget.needtable, | ||
| 338 | + style: TextStyle( | ||
| 339 | + color: MyColours.color_E6000000, | ||
| 340 | + fontSize: font(16)), | ||
| 341 | + ), | ||
| 342 | + decoration: BoxDecoration( | ||
| 343 | + border: Border( | ||
| 344 | + bottom: BorderSide( | ||
| 345 | + width: h(0.5), | ||
| 346 | + color: MyColours.color_E7E7E7))), | ||
| 347 | + ), | ||
| 348 | + VEmptyView(36), | ||
| 349 | + ListView.builder( | ||
| 350 | + shrinkWrap: true, | ||
| 351 | + controller: controller, | ||
| 352 | + padding: EdgeInsets.only(right: w(12)), | ||
| 353 | + itemCount: data.length, | ||
| 354 | + itemBuilder: (BuildContext context, int index) { | ||
| 355 | + return buildItemWidget(context, index); | ||
| 356 | + }, | ||
| 357 | + ) | ||
| 358 | + ], | ||
| 359 | + )), | ||
| 360 | + ); | ||
| 361 | + } | ||
| 362 | + })); | ||
| 363 | + } | ||
| 364 | +} |
| 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/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 '../../provider/feast_model.dart'; | ||
| 5 | import '../../res/colors.dart'; | 10 | import '../../res/colors.dart'; |
| 6 | import '../../utils/screen_util.dart'; | 11 | import '../../utils/screen_util.dart'; |
| 7 | import '../../utils/utils.dart'; | 12 | import '../../utils/utils.dart'; |
| 13 | +import '../../widgets/page_exception.dart'; | ||
| 8 | import '../../widgets/round_button.dart'; | 14 | import '../../widgets/round_button.dart'; |
| 9 | import '../../widgets/system_app_bar.dart'; | 15 | import '../../widgets/system_app_bar.dart'; |
| 10 | import '../../widgets/v_empty_view.dart'; | 16 | import '../../widgets/v_empty_view.dart'; |
| @@ -13,17 +19,60 @@ import '../../widgets/v_empty_view.dart'; | @@ -13,17 +19,60 @@ import '../../widgets/v_empty_view.dart'; | ||
| 13 | * 添加配置 | 19 | * 添加配置 |
| 14 | */ | 20 | */ |
| 15 | class FeastSetPage extends StatefulWidget { | 21 | class FeastSetPage extends StatefulWidget { |
| 16 | - FeastSetPage({Key key}) : super(key: key); | 22 | + final List<Other> justSelData; |
| 23 | + FeastSetPage({Key key, this.justSelData}) : super(key: key); | ||
| 17 | 24 | ||
| 18 | @override | 25 | @override |
| 19 | _FeastSetPageState createState() => _FeastSetPageState(); | 26 | _FeastSetPageState createState() => _FeastSetPageState(); |
| 20 | } | 27 | } |
| 21 | 28 | ||
| 22 | class _FeastSetPageState extends State<FeastSetPage> { | 29 | class _FeastSetPageState extends State<FeastSetPage> { |
| 30 | + FeastModel feastModel; | ||
| 31 | + List<Other> otherData = []; | ||
| 23 | @override | 32 | @override |
| 24 | void initState() { | 33 | void initState() { |
| 25 | super.initState(); | 34 | super.initState(); |
| 26 | Utils.changeStatusColor(color: MyColours.color_438E93); | 35 | Utils.changeStatusColor(color: MyColours.color_438E93); |
| 36 | + WidgetsBinding.instance.addPostFrameCallback((_) { | ||
| 37 | + _getOthersetList(); | ||
| 38 | + // scrollController.jumpTo(scrollController.position.minScrollExtent); | ||
| 39 | + }); | ||
| 40 | + } | ||
| 41 | + | ||
| 42 | + ///获取其他配置 | ||
| 43 | + Future<bool> _getOthersetList({bool isShowLoading = true}) async { | ||
| 44 | + bool success = | ||
| 45 | + await feastModel.getOthersetList(context, isShowLoading: isShowLoading); | ||
| 46 | + if (success) { | ||
| 47 | + List<String> otherids = widget.justSelData.map((e) { | ||
| 48 | + return e.otherId; | ||
| 49 | + }).toList(); | ||
| 50 | + for (OthersetSunModel item in feastModel.otherData) { | ||
| 51 | + Other other = Other(); | ||
| 52 | + other.otherId = item.id; | ||
| 53 | + other.name = item.otherName; | ||
| 54 | + other.bargaining = item.bargaining; | ||
| 55 | + other.price = item.price; | ||
| 56 | + other.finalPriceC = TextEditingController(); | ||
| 57 | + other.numC = TextEditingController(); | ||
| 58 | + other.spec = item.spec; | ||
| 59 | + | ||
| 60 | + if (otherids.contains(item.id)) { | ||
| 61 | + other.select = true; | ||
| 62 | + int index = widget.justSelData | ||
| 63 | + .indexWhere((element) => element.otherId == item.id); | ||
| 64 | + Other widgetData = widget.justSelData[index]; | ||
| 65 | + other.finalPriceC.text = widgetData.finalPrice; | ||
| 66 | + other.numC.text = widgetData.numStr; | ||
| 67 | + } else { | ||
| 68 | + other.select = false; | ||
| 69 | + } | ||
| 70 | + | ||
| 71 | + other.price = item.price; | ||
| 72 | + otherData.add(other); | ||
| 73 | + } | ||
| 74 | + setState(() {}); | ||
| 75 | + } | ||
| 27 | } | 76 | } |
| 28 | 77 | ||
| 29 | Widget _callButton( | 78 | Widget _callButton( |
| @@ -114,7 +163,7 @@ class _FeastSetPageState extends State<FeastSetPage> { | @@ -114,7 +163,7 @@ class _FeastSetPageState extends State<FeastSetPage> { | ||
| 114 | ); | 163 | ); |
| 115 | } | 164 | } |
| 116 | 165 | ||
| 117 | - Widget buildListItem(BuildContext context, int index, bool select) { | 166 | + Widget buildListItem(Other data) { |
| 118 | return Container( | 167 | return Container( |
| 119 | padding: EdgeInsets.only( | 168 | padding: EdgeInsets.only( |
| 120 | top: h(25), bottom: h(10), left: w(12), right: w(12)), | 169 | top: h(25), bottom: h(10), left: w(12), right: w(12)), |
| @@ -130,21 +179,21 @@ class _FeastSetPageState extends State<FeastSetPage> { | @@ -130,21 +179,21 @@ class _FeastSetPageState extends State<FeastSetPage> { | ||
| 130 | InkWell( | 179 | InkWell( |
| 131 | onTap: () { | 180 | onTap: () { |
| 132 | setState(() { | 181 | setState(() { |
| 133 | - select = !select; | 182 | + data.select = !data.select; |
| 134 | }); | 183 | }); |
| 135 | }, | 184 | }, |
| 136 | child: Row( | 185 | child: Row( |
| 137 | children: [ | 186 | children: [ |
| 138 | Image.asset( | 187 | Image.asset( |
| 139 | Utils.getImgPath( | 188 | Utils.getImgPath( |
| 140 | - select ? 'f_select' : 'f_select_not'), | 189 | + data.select ? 'f_select' : 'f_select_not'), |
| 141 | width: w(24), | 190 | width: w(24), |
| 142 | ), | 191 | ), |
| 143 | HEmptyView(24), | 192 | HEmptyView(24), |
| 144 | Text( | 193 | Text( |
| 145 | - 'LED大屏', | 194 | + data.name, |
| 146 | style: TextStyle( | 195 | style: TextStyle( |
| 147 | - color: select | 196 | + color: data.select |
| 148 | ? MyColours.color_515151 | 197 | ? MyColours.color_515151 |
| 149 | : MyColours.color_999999, | 198 | : MyColours.color_999999, |
| 150 | fontSize: font(16), | 199 | fontSize: font(16), |
| @@ -155,7 +204,7 @@ class _FeastSetPageState extends State<FeastSetPage> { | @@ -155,7 +204,7 @@ class _FeastSetPageState extends State<FeastSetPage> { | ||
| 155 | ]), | 204 | ]), |
| 156 | Spacer(), | 205 | Spacer(), |
| 157 | Text( | 206 | Text( |
| 158 | - '原价:1100元/份', | 207 | + '原价:${data.price}元/${data.spec}', |
| 159 | style: TextStyle( | 208 | style: TextStyle( |
| 160 | color: MyColours.color_999999, | 209 | color: MyColours.color_999999, |
| 161 | fontSize: font(14), | 210 | fontSize: font(14), |
| @@ -163,25 +212,31 @@ class _FeastSetPageState extends State<FeastSetPage> { | @@ -163,25 +212,31 @@ class _FeastSetPageState extends State<FeastSetPage> { | ||
| 163 | ), | 212 | ), |
| 164 | ], | 213 | ], |
| 165 | ), | 214 | ), |
| 166 | - select ? VEmptyView(42) : SizedBox(), | ||
| 167 | - select | 215 | + data.select ? VEmptyView(42) : SizedBox(), |
| 216 | + data.select | ||
| 168 | ? Row( | 217 | ? Row( |
| 169 | children: [ | 218 | children: [ |
| 170 | - Text( | ||
| 171 | - '议价:不可议价', | ||
| 172 | - style: TextStyle( | ||
| 173 | - color: MyColours.color_515151, | ||
| 174 | - fontSize: font(14), | ||
| 175 | - ), | ||
| 176 | - ), | ||
| 177 | - // _textfield('1299', null, null, width: w(103)), | ||
| 178 | - // Text( | ||
| 179 | - // ' 元', | ||
| 180 | - // style: TextStyle( | ||
| 181 | - // color: MyColours.color_515151, | ||
| 182 | - // fontSize: font(14), | ||
| 183 | - // ), | ||
| 184 | - // ), | 219 | + data.bargaining == '1' |
| 220 | + ? Row( | ||
| 221 | + children: [ | ||
| 222 | + _textfield('', data.finalPriceC, null, | ||
| 223 | + width: w(103)), | ||
| 224 | + Text( | ||
| 225 | + ' 元', | ||
| 226 | + style: TextStyle( | ||
| 227 | + color: MyColours.color_515151, | ||
| 228 | + fontSize: font(14), | ||
| 229 | + ), | ||
| 230 | + ), | ||
| 231 | + ], | ||
| 232 | + ) | ||
| 233 | + : Text( | ||
| 234 | + '议价:不可议价', | ||
| 235 | + style: TextStyle( | ||
| 236 | + color: MyColours.color_515151, | ||
| 237 | + fontSize: font(14), | ||
| 238 | + ), | ||
| 239 | + ), | ||
| 185 | Spacer(), | 240 | Spacer(), |
| 186 | Text( | 241 | Text( |
| 187 | '数量:', | 242 | '数量:', |
| @@ -190,9 +245,9 @@ class _FeastSetPageState extends State<FeastSetPage> { | @@ -190,9 +245,9 @@ class _FeastSetPageState extends State<FeastSetPage> { | ||
| 190 | fontSize: font(14), | 245 | fontSize: font(14), |
| 191 | ), | 246 | ), |
| 192 | ), | 247 | ), |
| 193 | - _textfield('1299', null, null, width: w(103)), | 248 | + _textfield('', data.numC, null, width: w(103)), |
| 194 | Text( | 249 | Text( |
| 195 | - ' 份', | 250 | + ' ${data.spec}', |
| 196 | style: TextStyle( | 251 | style: TextStyle( |
| 197 | color: MyColours.color_515151, | 252 | color: MyColours.color_515151, |
| 198 | fontSize: font(14), | 253 | fontSize: font(14), |
| @@ -207,10 +262,11 @@ class _FeastSetPageState extends State<FeastSetPage> { | @@ -207,10 +262,11 @@ class _FeastSetPageState extends State<FeastSetPage> { | ||
| 207 | 262 | ||
| 208 | @override | 263 | @override |
| 209 | Widget build(BuildContext context) { | 264 | Widget build(BuildContext context) { |
| 265 | + feastModel = Provider.of<FeastModel>(context, listen: true); | ||
| 210 | return Scaffold( | 266 | return Scaffold( |
| 211 | backgroundColor: MyColours.color_ffffff, | 267 | backgroundColor: MyColours.color_ffffff, |
| 212 | appBar: SystemAppBar( | 268 | appBar: SystemAppBar( |
| 213 | - '选择酒水', | 269 | + '选择配置', |
| 214 | needWhite: true, | 270 | needWhite: true, |
| 215 | bgColor: MyColours.color_438E93, | 271 | bgColor: MyColours.color_438E93, |
| 216 | titleColor: MyColours.color_F6F6F6, | 272 | titleColor: MyColours.color_F6F6F6, |
| @@ -218,36 +274,75 @@ class _FeastSetPageState extends State<FeastSetPage> { | @@ -218,36 +274,75 @@ class _FeastSetPageState extends State<FeastSetPage> { | ||
| 218 | Navigator.pop(context); | 274 | Navigator.pop(context); |
| 219 | }, | 275 | }, |
| 220 | ), | 276 | ), |
| 221 | - body: Column( | ||
| 222 | - crossAxisAlignment: CrossAxisAlignment.start, | ||
| 223 | - children: [ | ||
| 224 | - Expanded( | ||
| 225 | - child: ListView.builder( | ||
| 226 | - shrinkWrap: true, | ||
| 227 | - itemCount: 10, | ||
| 228 | - itemBuilder: (BuildContext context, int index) { | ||
| 229 | - return buildListItem(context, index, true); | 277 | + body: Consumer<FeastModel>(builder: (context, model, _) { |
| 278 | + if (model.pageStateOther != PageState.Success) { | ||
| 279 | + return ExceptionPage( | ||
| 280 | + pageState: model.pageStateOther, | ||
| 281 | + callback: () { | ||
| 282 | + _getOthersetList(); | ||
| 230 | }, | 283 | }, |
| 231 | - )), | ||
| 232 | - Row( | 284 | + emptyMsg: "暂时没有配置列表哦", |
| 285 | + emptyImg: "empty_search", | ||
| 286 | + showMsg: "加载中,请稍后...", | ||
| 287 | + ); | ||
| 288 | + } else { | ||
| 289 | + return Column( | ||
| 290 | + crossAxisAlignment: CrossAxisAlignment.start, | ||
| 233 | children: [ | 291 | children: [ |
| 234 | Expanded( | 292 | Expanded( |
| 235 | - child: _callButton( | ||
| 236 | - onPress: () { | ||
| 237 | - Navigator.pop(context); | ||
| 238 | - }, | ||
| 239 | - content: '返回', | ||
| 240 | - hasLeftBorder: true, | ||
| 241 | - isSelect: false)), | ||
| 242 | - Expanded( | ||
| 243 | - child: _callButton( | ||
| 244 | - onPress: () {}, | ||
| 245 | - content: '保存并返回', | ||
| 246 | - hasLeftBorder: true, | ||
| 247 | - isSelect: true)) | 293 | + child: ListView.builder( |
| 294 | + shrinkWrap: true, | ||
| 295 | + itemCount: otherData.length, | ||
| 296 | + itemBuilder: (BuildContext context, int index) { | ||
| 297 | + Other data = otherData[index]; | ||
| 298 | + return buildListItem(data); | ||
| 299 | + }, | ||
| 300 | + )), | ||
| 301 | + Row( | ||
| 302 | + children: [ | ||
| 303 | + Expanded( | ||
| 304 | + child: _callButton( | ||
| 305 | + onPress: () { | ||
| 306 | + Navigator.pop(context); | ||
| 307 | + }, | ||
| 308 | + content: '返回', | ||
| 309 | + hasLeftBorder: true, | ||
| 310 | + isSelect: false)), | ||
| 311 | + Expanded( | ||
| 312 | + child: _callButton( | ||
| 313 | + onPress: () { | ||
| 314 | + List<Other> selectData = []; | ||
| 315 | + if (otherData.length > 0) { | ||
| 316 | + String otherIds = ""; | ||
| 317 | + for (Other item in otherData) { | ||
| 318 | + if (item.select) { | ||
| 319 | + item.finalPrice = item.finalPriceC.text; | ||
| 320 | + item.numStr = item.numC.text; | ||
| 321 | + | ||
| 322 | + selectData.add(item); | ||
| 323 | + otherIds += item.otherId + ","; | ||
| 324 | + } | ||
| 325 | + } | ||
| 326 | + if (otherIds.length > 0) { | ||
| 327 | + otherIds = otherIds.substring( | ||
| 328 | + 0, otherIds.length - 1); | ||
| 329 | + } | ||
| 330 | + | ||
| 331 | + Map temp = { | ||
| 332 | + 'object': selectData, | ||
| 333 | + 'otherIds': otherIds | ||
| 334 | + }; | ||
| 335 | + Navigator.of(context).pop(temp); | ||
| 336 | + } | ||
| 337 | + }, | ||
| 338 | + content: '保存并返回', | ||
| 339 | + hasLeftBorder: true, | ||
| 340 | + isSelect: true)) | ||
| 341 | + ], | ||
| 342 | + ) | ||
| 248 | ], | 343 | ], |
| 249 | - ) | ||
| 250 | - ], | ||
| 251 | - )); | 344 | + ); |
| 345 | + } | ||
| 346 | + })); | ||
| 252 | } | 347 | } |
| 253 | } | 348 | } |
| 1 | import 'package:contacts_service/contacts_service.dart'; | 1 | import 'package:contacts_service/contacts_service.dart'; |
| 2 | import 'package:flutter/material.dart'; | 2 | import 'package:flutter/material.dart'; |
| 3 | import 'package:flutter_screenutil/flutter_screenutil.dart'; | 3 | import 'package:flutter_screenutil/flutter_screenutil.dart'; |
| 4 | +import 'package:one_key/provider/user_model.dart'; | ||
| 4 | import 'package:one_key/widgets/h_empty_view.dart'; | 5 | import 'package:one_key/widgets/h_empty_view.dart'; |
| 5 | import 'package:provider/provider.dart'; | 6 | import 'package:provider/provider.dart'; |
| 6 | 7 | ||
| @@ -9,6 +10,7 @@ import '../../models/set_xuan_tai_model.dart'; | @@ -9,6 +10,7 @@ import '../../models/set_xuan_tai_model.dart'; | ||
| 9 | import '../../models/setmeal_model.dart'; | 10 | import '../../models/setmeal_model.dart'; |
| 10 | import '../../provider/feast_model.dart'; | 11 | import '../../provider/feast_model.dart'; |
| 11 | import '../../res/colors.dart'; | 12 | import '../../res/colors.dart'; |
| 13 | +import '../../route/navigator_util.dart'; | ||
| 12 | import '../../utils/screen_util.dart'; | 14 | import '../../utils/screen_util.dart'; |
| 13 | import '../../utils/utils.dart'; | 15 | import '../../utils/utils.dart'; |
| 14 | import '../../widgets/page_exception.dart'; | 16 | import '../../widgets/page_exception.dart'; |
| @@ -21,7 +23,10 @@ import '../../widgets/v_empty_view.dart'; | @@ -21,7 +23,10 @@ import '../../widgets/v_empty_view.dart'; | ||
| 21 | */ | 23 | */ |
| 22 | class FeastSetmealPage extends StatefulWidget { | 24 | class FeastSetmealPage extends StatefulWidget { |
| 23 | final List<Setmeal> justSelData; | 25 | final List<Setmeal> justSelData; |
| 24 | - FeastSetmealPage({Key key, this.justSelData}) : super(key: key); | 26 | + final String dateData; |
| 27 | + | ||
| 28 | + FeastSetmealPage({Key key, this.justSelData, this.dateData}) | ||
| 29 | + : super(key: key); | ||
| 25 | 30 | ||
| 26 | @override | 31 | @override |
| 27 | _FeastSetmealPageState createState() => _FeastSetmealPageState(); | 32 | _FeastSetmealPageState createState() => _FeastSetmealPageState(); |
| @@ -30,6 +35,7 @@ class FeastSetmealPage extends StatefulWidget { | @@ -30,6 +35,7 @@ class FeastSetmealPage extends StatefulWidget { | ||
| 30 | class _FeastSetmealPageState extends State<FeastSetmealPage> { | 35 | class _FeastSetmealPageState extends State<FeastSetmealPage> { |
| 31 | List<Setmeal> setmealData = []; | 36 | List<Setmeal> setmealData = []; |
| 32 | FeastModel feastModel; | 37 | FeastModel feastModel; |
| 38 | + UserModel userModel; | ||
| 33 | 39 | ||
| 34 | @override | 40 | @override |
| 35 | void initState() { | 41 | void initState() { |
| @@ -47,7 +53,7 @@ class _FeastSetmealPageState extends State<FeastSetmealPage> { | @@ -47,7 +53,7 @@ class _FeastSetmealPageState extends State<FeastSetmealPage> { | ||
| 47 | bool success = | 53 | bool success = |
| 48 | await feastModel.getSetmeal(context, isShowLoading: isShowLoading); | 54 | await feastModel.getSetmeal(context, isShowLoading: isShowLoading); |
| 49 | if (success) { | 55 | if (success) { |
| 50 | - List<String> setmealids = widget.justSelData.map((e) { | 56 | + List<String> setmealids = userModel.justSelData.map((e) { |
| 51 | return e.setmealId; | 57 | return e.setmealId; |
| 52 | }).toList(); | 58 | }).toList(); |
| 53 | for (SetMealSunModel item in feastModel.setmealData) { | 59 | for (SetMealSunModel item in feastModel.setmealData) { |
| @@ -62,13 +68,14 @@ class _FeastSetmealPageState extends State<FeastSetmealPage> { | @@ -62,13 +68,14 @@ class _FeastSetmealPageState extends State<FeastSetmealPage> { | ||
| 62 | 68 | ||
| 63 | if (setmealids.contains(item.id)) { | 69 | if (setmealids.contains(item.id)) { |
| 64 | setmeal.select = true; | 70 | setmeal.select = true; |
| 65 | - int index = widget.justSelData | 71 | + int index = userModel.justSelData |
| 66 | .indexWhere((element) => element.setmealId == item.id); | 72 | .indexWhere((element) => element.setmealId == item.id); |
| 67 | - Setmeal widgetData = widget.justSelData[index]; | 73 | + Setmeal widgetData = userModel.justSelData[index]; |
| 68 | setmeal.finalPriceC.text = widgetData.finalPrice; | 74 | setmeal.finalPriceC.text = widgetData.finalPrice; |
| 69 | setmeal.minC.text = widgetData.min; | 75 | setmeal.minC.text = widgetData.min; |
| 70 | setmeal.pnumC.text = widgetData.pnum; | 76 | setmeal.pnumC.text = widgetData.pnum; |
| 71 | setmeal.spareC.text = widgetData.spare; | 77 | setmeal.spareC.text = widgetData.spare; |
| 78 | + setmeal.dataMenu = widgetData.dataMenu; | ||
| 72 | } else { | 79 | } else { |
| 73 | setmeal.select = false; | 80 | setmeal.select = false; |
| 74 | } | 81 | } |
| @@ -216,8 +223,30 @@ class _FeastSetmealPageState extends State<FeastSetmealPage> { | @@ -216,8 +223,30 @@ class _FeastSetmealPageState extends State<FeastSetmealPage> { | ||
| 216 | isBold: false, | 223 | isBold: false, |
| 217 | gradientStart: MyColours.color_438E93, | 224 | gradientStart: MyColours.color_438E93, |
| 218 | gradientEnd: MyColours.color_438E93, | 225 | gradientEnd: MyColours.color_438E93, |
| 219 | - onPressed: () { | ||
| 220 | - // NavigatorUtil.goFeastSetmealPage(context); | 226 | + onPressed: () async { |
| 227 | + String tableData = ''; | ||
| 228 | + if (data.pnumC.text.trim().length > 0) { | ||
| 229 | + tableData += '${data.pnumC.text}人/桌'; | ||
| 230 | + } | ||
| 231 | + if (data.minC.text.trim().length > 0) { | ||
| 232 | + tableData += ' 保证 ${data.minC.text} 桌'; | ||
| 233 | + } | ||
| 234 | + if (data.spareC.text.trim().length > 0) { | ||
| 235 | + tableData += ' 备用 ${data.spareC.text} 桌'; | ||
| 236 | + } | ||
| 237 | + | ||
| 238 | + if (data.dataMenu != null && data.dataMenu.length > 0) { | ||
| 239 | + await NavigatorUtil.goFeastMenuShowPage(context, | ||
| 240 | + data.setmealId, data.name, widget.dateData, tableData, | ||
| 241 | + justSelData: {'object': data.dataMenu}); | ||
| 242 | + } else { | ||
| 243 | + await NavigatorUtil.goFeastMenuShowPage( | ||
| 244 | + context, | ||
| 245 | + data.setmealId, | ||
| 246 | + data.name, | ||
| 247 | + widget.dateData, | ||
| 248 | + tableData); | ||
| 249 | + } | ||
| 221 | }, | 250 | }, |
| 222 | ), | 251 | ), |
| 223 | ], | 252 | ], |
| @@ -328,6 +357,7 @@ class _FeastSetmealPageState extends State<FeastSetmealPage> { | @@ -328,6 +357,7 @@ class _FeastSetmealPageState extends State<FeastSetmealPage> { | ||
| 328 | @override | 357 | @override |
| 329 | Widget build(BuildContext context) { | 358 | Widget build(BuildContext context) { |
| 330 | feastModel = Provider.of<FeastModel>(context, listen: true); | 359 | feastModel = Provider.of<FeastModel>(context, listen: true); |
| 360 | + userModel = Provider.of<UserModel>(context, listen: false); | ||
| 331 | return Scaffold( | 361 | return Scaffold( |
| 332 | backgroundColor: MyColours.color_ffffff, | 362 | backgroundColor: MyColours.color_ffffff, |
| 333 | appBar: SystemAppBar( | 363 | appBar: SystemAppBar( |
| @@ -381,11 +411,7 @@ class _FeastSetmealPageState extends State<FeastSetmealPage> { | @@ -381,11 +411,7 @@ class _FeastSetmealPageState extends State<FeastSetmealPage> { | ||
| 381 | String setmealIds = ""; | 411 | String setmealIds = ""; |
| 382 | for (Setmeal item in setmealData) { | 412 | for (Setmeal item in setmealData) { |
| 383 | if (item.select) { | 413 | if (item.select) { |
| 384 | - item.finalPrice = | ||
| 385 | - item.finalPriceC.text == '' || | ||
| 386 | - item.bargaining == '0' | ||
| 387 | - ? item.price | ||
| 388 | - : item.finalPriceC.text; | 414 | + item.finalPrice = item.finalPriceC.text; |
| 389 | item.pnum = item.pnumC.text; | 415 | item.pnum = item.pnumC.text; |
| 390 | item.min = item.minC.text; | 416 | item.min = item.minC.text; |
| 391 | item.spare = item.spareC.text; | 417 | item.spare = item.spareC.text; |
| 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/wine_model.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 '../../provider/feast_model.dart'; | ||
| 5 | import '../../res/colors.dart'; | 10 | import '../../res/colors.dart'; |
| 6 | import '../../utils/screen_util.dart'; | 11 | import '../../utils/screen_util.dart'; |
| 7 | import '../../utils/utils.dart'; | 12 | import '../../utils/utils.dart'; |
| 13 | +import '../../widgets/page_exception.dart'; | ||
| 8 | import '../../widgets/round_button.dart'; | 14 | import '../../widgets/round_button.dart'; |
| 9 | import '../../widgets/system_app_bar.dart'; | 15 | import '../../widgets/system_app_bar.dart'; |
| 10 | import '../../widgets/v_empty_view.dart'; | 16 | import '../../widgets/v_empty_view.dart'; |
| @@ -13,17 +19,60 @@ import '../../widgets/v_empty_view.dart'; | @@ -13,17 +19,60 @@ import '../../widgets/v_empty_view.dart'; | ||
| 13 | * 添加酒水 | 19 | * 添加酒水 |
| 14 | */ | 20 | */ |
| 15 | class FeastWinePage extends StatefulWidget { | 21 | class FeastWinePage extends StatefulWidget { |
| 16 | - FeastWinePage({Key key}) : super(key: key); | 22 | + final List<Wine> justSelData; |
| 23 | + FeastWinePage({Key key, this.justSelData}) : super(key: key); | ||
| 17 | 24 | ||
| 18 | @override | 25 | @override |
| 19 | _FeastWinePageState createState() => _FeastWinePageState(); | 26 | _FeastWinePageState createState() => _FeastWinePageState(); |
| 20 | } | 27 | } |
| 21 | 28 | ||
| 22 | class _FeastWinePageState extends State<FeastWinePage> { | 29 | class _FeastWinePageState extends State<FeastWinePage> { |
| 30 | + FeastModel feastModel; | ||
| 31 | + List<Wine> wineData = []; | ||
| 23 | @override | 32 | @override |
| 24 | void initState() { | 33 | void initState() { |
| 25 | super.initState(); | 34 | super.initState(); |
| 26 | Utils.changeStatusColor(color: MyColours.color_438E93); | 35 | Utils.changeStatusColor(color: MyColours.color_438E93); |
| 36 | + WidgetsBinding.instance.addPostFrameCallback((_) { | ||
| 37 | + _getWine(); | ||
| 38 | + // scrollController.jumpTo(scrollController.position.minScrollExtent); | ||
| 39 | + }); | ||
| 40 | + } | ||
| 41 | + | ||
| 42 | + ///获取酒水 | ||
| 43 | + Future<bool> _getWine({bool isShowLoading = true}) async { | ||
| 44 | + bool success = | ||
| 45 | + await feastModel.getWine(context, isShowLoading: isShowLoading); | ||
| 46 | + if (success) { | ||
| 47 | + List<String> wineids = widget.justSelData.map((e) { | ||
| 48 | + return e.wineId; | ||
| 49 | + }).toList(); | ||
| 50 | + for (WineSunModel item in feastModel.wineData) { | ||
| 51 | + Wine wine = Wine(); | ||
| 52 | + wine.wineId = item.id; | ||
| 53 | + wine.name = item.wineName; | ||
| 54 | + wine.bargaining = item.bargaining; | ||
| 55 | + wine.price = item.price; | ||
| 56 | + wine.finalPriceC = TextEditingController(); | ||
| 57 | + wine.numC = TextEditingController(); | ||
| 58 | + wine.spec = item.spec; | ||
| 59 | + | ||
| 60 | + if (wineids.contains(item.id)) { | ||
| 61 | + wine.select = true; | ||
| 62 | + int index = widget.justSelData | ||
| 63 | + .indexWhere((element) => element.wineId == item.id); | ||
| 64 | + Wine widgetData = widget.justSelData[index]; | ||
| 65 | + wine.finalPriceC.text = widgetData.finalPrice; | ||
| 66 | + wine.numC.text = widgetData.numStr; | ||
| 67 | + } else { | ||
| 68 | + wine.select = false; | ||
| 69 | + } | ||
| 70 | + | ||
| 71 | + wine.price = item.price; | ||
| 72 | + wineData.add(wine); | ||
| 73 | + } | ||
| 74 | + setState(() {}); | ||
| 75 | + } | ||
| 27 | } | 76 | } |
| 28 | 77 | ||
| 29 | Widget _callButton( | 78 | Widget _callButton( |
| @@ -69,7 +118,7 @@ class _FeastWinePageState extends State<FeastWinePage> { | @@ -69,7 +118,7 @@ class _FeastWinePageState extends State<FeastWinePage> { | ||
| 69 | ///输入框 | 118 | ///输入框 |
| 70 | Widget _textfield(String hintText, TextEditingController editingController, | 119 | Widget _textfield(String hintText, TextEditingController editingController, |
| 71 | FocusNode focusNode, | 120 | FocusNode focusNode, |
| 72 | - {TextInputType inputType = TextInputType.text, double width}) { | 121 | + {TextInputType inputType = TextInputType.number, double width}) { |
| 73 | return Container( | 122 | return Container( |
| 74 | width: width, | 123 | width: width, |
| 75 | padding: EdgeInsets.symmetric(horizontal: w(6)), | 124 | padding: EdgeInsets.symmetric(horizontal: w(6)), |
| @@ -114,7 +163,7 @@ class _FeastWinePageState extends State<FeastWinePage> { | @@ -114,7 +163,7 @@ class _FeastWinePageState extends State<FeastWinePage> { | ||
| 114 | ); | 163 | ); |
| 115 | } | 164 | } |
| 116 | 165 | ||
| 117 | - Widget buildListItem(BuildContext context, int index, bool select) { | 166 | + Widget buildListItem(Wine data) { |
| 118 | return Container( | 167 | return Container( |
| 119 | padding: EdgeInsets.only( | 168 | padding: EdgeInsets.only( |
| 120 | top: h(25), bottom: h(10), left: w(12), right: w(12)), | 169 | top: h(25), bottom: h(10), left: w(12), right: w(12)), |
| @@ -130,21 +179,21 @@ class _FeastWinePageState extends State<FeastWinePage> { | @@ -130,21 +179,21 @@ class _FeastWinePageState extends State<FeastWinePage> { | ||
| 130 | InkWell( | 179 | InkWell( |
| 131 | onTap: () { | 180 | onTap: () { |
| 132 | setState(() { | 181 | setState(() { |
| 133 | - select = !select; | 182 | + data.select = !data.select; |
| 134 | }); | 183 | }); |
| 135 | }, | 184 | }, |
| 136 | child: Row( | 185 | child: Row( |
| 137 | children: [ | 186 | children: [ |
| 138 | Image.asset( | 187 | Image.asset( |
| 139 | Utils.getImgPath( | 188 | Utils.getImgPath( |
| 140 | - select ? 'f_select' : 'f_select_not'), | 189 | + data.select ? 'f_select' : 'f_select_not'), |
| 141 | width: w(24), | 190 | width: w(24), |
| 142 | ), | 191 | ), |
| 143 | HEmptyView(24), | 192 | HEmptyView(24), |
| 144 | Text( | 193 | Text( |
| 145 | - '剑南春52度500ml', | 194 | + data.name, |
| 146 | style: TextStyle( | 195 | style: TextStyle( |
| 147 | - color: select | 196 | + color: data.select |
| 148 | ? MyColours.color_515151 | 197 | ? MyColours.color_515151 |
| 149 | : MyColours.color_999999, | 198 | : MyColours.color_999999, |
| 150 | fontSize: font(16), | 199 | fontSize: font(16), |
| @@ -155,7 +204,7 @@ class _FeastWinePageState extends State<FeastWinePage> { | @@ -155,7 +204,7 @@ class _FeastWinePageState extends State<FeastWinePage> { | ||
| 155 | ]), | 204 | ]), |
| 156 | Spacer(), | 205 | Spacer(), |
| 157 | Text( | 206 | Text( |
| 158 | - '原价:460元/份', | 207 | + '原价:${data.price}元/${data.spec}', |
| 159 | style: TextStyle( | 208 | style: TextStyle( |
| 160 | color: MyColours.color_999999, | 209 | color: MyColours.color_999999, |
| 161 | fontSize: font(14), | 210 | fontSize: font(14), |
| @@ -163,8 +212,8 @@ class _FeastWinePageState extends State<FeastWinePage> { | @@ -163,8 +212,8 @@ class _FeastWinePageState extends State<FeastWinePage> { | ||
| 163 | ), | 212 | ), |
| 164 | ], | 213 | ], |
| 165 | ), | 214 | ), |
| 166 | - select ? VEmptyView(42) : SizedBox(), | ||
| 167 | - select | 215 | + data.select ? VEmptyView(42) : SizedBox(), |
| 216 | + data.select | ||
| 168 | ? Row( | 217 | ? Row( |
| 169 | children: [ | 218 | children: [ |
| 170 | Text( | 219 | Text( |
| @@ -174,14 +223,25 @@ class _FeastWinePageState extends State<FeastWinePage> { | @@ -174,14 +223,25 @@ class _FeastWinePageState extends State<FeastWinePage> { | ||
| 174 | fontSize: font(14), | 223 | fontSize: font(14), |
| 175 | ), | 224 | ), |
| 176 | ), | 225 | ), |
| 177 | - _textfield('1299', null, null, width: w(103)), | ||
| 178 | - Text( | ||
| 179 | - ' 元', | ||
| 180 | - style: TextStyle( | ||
| 181 | - color: MyColours.color_515151, | ||
| 182 | - fontSize: font(14), | ||
| 183 | - ), | ||
| 184 | - ), | 226 | + data.bargaining == '1' |
| 227 | + ? _textfield('', data.finalPriceC, null, | ||
| 228 | + width: w(103)) | ||
| 229 | + : Text( | ||
| 230 | + '不可议价', | ||
| 231 | + style: TextStyle( | ||
| 232 | + color: MyColours.color_515151, | ||
| 233 | + fontSize: font(14), | ||
| 234 | + ), | ||
| 235 | + ), | ||
| 236 | + data.bargaining == '1' | ||
| 237 | + ? Text( | ||
| 238 | + ' 元', | ||
| 239 | + style: TextStyle( | ||
| 240 | + color: MyColours.color_515151, | ||
| 241 | + fontSize: font(14), | ||
| 242 | + ), | ||
| 243 | + ) | ||
| 244 | + : SizedBox(), | ||
| 185 | Spacer(), | 245 | Spacer(), |
| 186 | Text( | 246 | Text( |
| 187 | '数量:', | 247 | '数量:', |
| @@ -190,9 +250,9 @@ class _FeastWinePageState extends State<FeastWinePage> { | @@ -190,9 +250,9 @@ class _FeastWinePageState extends State<FeastWinePage> { | ||
| 190 | fontSize: font(14), | 250 | fontSize: font(14), |
| 191 | ), | 251 | ), |
| 192 | ), | 252 | ), |
| 193 | - _textfield('1299', null, null, width: w(103)), | 253 | + _textfield('', data.numC, null, width: w(103)), |
| 194 | Text( | 254 | Text( |
| 195 | - ' 份', | 255 | + ' ${data.spec}', |
| 196 | style: TextStyle( | 256 | style: TextStyle( |
| 197 | color: MyColours.color_515151, | 257 | color: MyColours.color_515151, |
| 198 | fontSize: font(14), | 258 | fontSize: font(14), |
| @@ -207,6 +267,7 @@ class _FeastWinePageState extends State<FeastWinePage> { | @@ -207,6 +267,7 @@ class _FeastWinePageState extends State<FeastWinePage> { | ||
| 207 | 267 | ||
| 208 | @override | 268 | @override |
| 209 | Widget build(BuildContext context) { | 269 | Widget build(BuildContext context) { |
| 270 | + feastModel = Provider.of<FeastModel>(context, listen: true); | ||
| 210 | return Scaffold( | 271 | return Scaffold( |
| 211 | backgroundColor: MyColours.color_ffffff, | 272 | backgroundColor: MyColours.color_ffffff, |
| 212 | appBar: SystemAppBar( | 273 | appBar: SystemAppBar( |
| @@ -218,36 +279,75 @@ class _FeastWinePageState extends State<FeastWinePage> { | @@ -218,36 +279,75 @@ class _FeastWinePageState extends State<FeastWinePage> { | ||
| 218 | Navigator.pop(context); | 279 | Navigator.pop(context); |
| 219 | }, | 280 | }, |
| 220 | ), | 281 | ), |
| 221 | - body: Column( | ||
| 222 | - crossAxisAlignment: CrossAxisAlignment.start, | ||
| 223 | - children: [ | ||
| 224 | - Expanded( | ||
| 225 | - child: ListView.builder( | ||
| 226 | - shrinkWrap: true, | ||
| 227 | - itemCount: 10, | ||
| 228 | - itemBuilder: (BuildContext context, int index) { | ||
| 229 | - return buildListItem(context, index, true); | 282 | + body: Consumer<FeastModel>(builder: (context, model, _) { |
| 283 | + if (model.pageStateWine != PageState.Success) { | ||
| 284 | + return ExceptionPage( | ||
| 285 | + pageState: model.pageStateWine, | ||
| 286 | + callback: () { | ||
| 287 | + _getWine(); | ||
| 230 | }, | 288 | }, |
| 231 | - )), | ||
| 232 | - Row( | 289 | + emptyMsg: "暂时没有酒水哦", |
| 290 | + emptyImg: "empty_search", | ||
| 291 | + showMsg: "加载中,请稍后...", | ||
| 292 | + ); | ||
| 293 | + } else { | ||
| 294 | + return Column( | ||
| 295 | + crossAxisAlignment: CrossAxisAlignment.start, | ||
| 233 | children: [ | 296 | children: [ |
| 234 | Expanded( | 297 | Expanded( |
| 235 | - child: _callButton( | ||
| 236 | - onPress: () { | ||
| 237 | - Navigator.pop(context); | ||
| 238 | - }, | ||
| 239 | - content: '返回', | ||
| 240 | - hasLeftBorder: true, | ||
| 241 | - isSelect: false)), | ||
| 242 | - Expanded( | ||
| 243 | - child: _callButton( | ||
| 244 | - onPress: () {}, | ||
| 245 | - content: '保存并返回', | ||
| 246 | - hasLeftBorder: true, | ||
| 247 | - isSelect: true)) | 298 | + child: ListView.builder( |
| 299 | + shrinkWrap: true, | ||
| 300 | + itemCount: wineData.length, | ||
| 301 | + itemBuilder: (BuildContext context, int index) { | ||
| 302 | + Wine data = wineData[index]; | ||
| 303 | + return buildListItem(data); | ||
| 304 | + }, | ||
| 305 | + )), | ||
| 306 | + Row( | ||
| 307 | + children: [ | ||
| 308 | + Expanded( | ||
| 309 | + child: _callButton( | ||
| 310 | + onPress: () { | ||
| 311 | + Navigator.pop(context); | ||
| 312 | + }, | ||
| 313 | + content: '返回', | ||
| 314 | + hasLeftBorder: true, | ||
| 315 | + isSelect: false)), | ||
| 316 | + Expanded( | ||
| 317 | + child: _callButton( | ||
| 318 | + onPress: () { | ||
| 319 | + List<Wine> selectData = []; | ||
| 320 | + if (wineData.length > 0) { | ||
| 321 | + String wineIds = ""; | ||
| 322 | + for (Wine item in wineData) { | ||
| 323 | + if (item.select) { | ||
| 324 | + item.finalPrice = item.finalPriceC.text; | ||
| 325 | + item.numStr = item.numC.text; | ||
| 326 | + | ||
| 327 | + selectData.add(item); | ||
| 328 | + wineIds += item.wineId + ","; | ||
| 329 | + } | ||
| 330 | + } | ||
| 331 | + if (wineIds.length > 0) { | ||
| 332 | + wineIds = | ||
| 333 | + wineIds.substring(0, wineIds.length - 1); | ||
| 334 | + } | ||
| 335 | + | ||
| 336 | + Map temp = { | ||
| 337 | + 'object': selectData, | ||
| 338 | + 'wineIds': wineIds | ||
| 339 | + }; | ||
| 340 | + Navigator.of(context).pop(temp); | ||
| 341 | + } | ||
| 342 | + }, | ||
| 343 | + content: '保存并返回', | ||
| 344 | + hasLeftBorder: true, | ||
| 345 | + isSelect: true)) | ||
| 346 | + ], | ||
| 347 | + ) | ||
| 248 | ], | 348 | ], |
| 249 | - ) | ||
| 250 | - ], | ||
| 251 | - )); | 349 | + ); |
| 350 | + } | ||
| 351 | + })); | ||
| 252 | } | 352 | } |
| 253 | } | 353 | } |
| @@ -45,8 +45,7 @@ class _FeastDishPageState extends State<FeastDishPage> { | @@ -45,8 +45,7 @@ class _FeastDishPageState extends State<FeastDishPage> { | ||
| 45 | } | 45 | } |
| 46 | 46 | ||
| 47 | ///添加宴会套餐菜品分类 | 47 | ///添加宴会套餐菜品分类 |
| 48 | - _setSetmealCook(String name, String numStr, String per, String trim, | ||
| 49 | - {String cookid}) async { | 48 | + _setSetmealCook(String name, String per, String trim, {String cookid}) async { |
| 50 | Map<String, String> params = { | 49 | Map<String, String> params = { |
| 51 | "sid": Provider.of<UserModel>(context, listen: false).user.sellerid, | 50 | "sid": Provider.of<UserModel>(context, listen: false).user.sellerid, |
| 52 | 'cname': name, | 51 | 'cname': name, |
| @@ -54,7 +53,7 @@ class _FeastDishPageState extends State<FeastDishPage> { | @@ -54,7 +53,7 @@ class _FeastDishPageState extends State<FeastDishPage> { | ||
| 54 | 'cid': widget.classId, | 53 | 'cid': widget.classId, |
| 55 | 'spec': per, | 54 | 'spec': per, |
| 56 | 'is_trim': trim, | 55 | 'is_trim': trim, |
| 57 | - 'num': numStr | 56 | + // 'num': numStr |
| 58 | }; | 57 | }; |
| 59 | if (cookid != null) { | 58 | if (cookid != null) { |
| 60 | params['id'] = cookid; | 59 | params['id'] = cookid; |
| @@ -103,10 +102,10 @@ class _FeastDishPageState extends State<FeastDishPage> { | @@ -103,10 +102,10 @@ class _FeastDishPageState extends State<FeastDishPage> { | ||
| 103 | String per = map['per']; | 102 | String per = map['per']; |
| 104 | String name = map['name']; | 103 | String name = map['name']; |
| 105 | String can = map['can']; | 104 | String can = map['can']; |
| 106 | - String numStr = map['num']; | 105 | + // String numStr = map['num']; |
| 107 | 106 | ||
| 108 | print(can); | 107 | print(can); |
| 109 | - _setSetmealCook(name, numStr, per, can); | 108 | + _setSetmealCook(name, per, can); |
| 110 | }); | 109 | }); |
| 111 | }, | 110 | }, |
| 112 | text: '添加一项', | 111 | text: '添加一项', |
| @@ -164,10 +163,10 @@ class _FeastDishPageState extends State<FeastDishPage> { | @@ -164,10 +163,10 @@ class _FeastDishPageState extends State<FeastDishPage> { | ||
| 164 | can: cook.isTrim == '1' ? true : false, onTap: (Map map) { | 163 | can: cook.isTrim == '1' ? true : false, onTap: (Map map) { |
| 165 | String per = map['per']; | 164 | String per = map['per']; |
| 166 | String name = map['name']; | 165 | String name = map['name']; |
| 167 | - String numStr = map['num']; | 166 | + // String numStr = map['num']; |
| 168 | String can = map['can']; | 167 | String can = map['can']; |
| 169 | print(can); | 168 | print(can); |
| 170 | - _setSetmealCook(name, numStr, per, can, cookid: cook.id); | 169 | + _setSetmealCook(name, per, can, cookid: cook.id); |
| 171 | }); | 170 | }); |
| 172 | }, | 171 | }, |
| 173 | child: Text( | 172 | child: Text( |
| @@ -50,7 +50,7 @@ class _FeastOthersetManagePageState extends State<FeastOthersetManagePage> { | @@ -50,7 +50,7 @@ class _FeastOthersetManagePageState extends State<FeastOthersetManagePage> { | ||
| 50 | super.dispose(); | 50 | super.dispose(); |
| 51 | } | 51 | } |
| 52 | 52 | ||
| 53 | - ///获取宴会分类 | 53 | + ///获取其他配置 |
| 54 | Future<bool> _getOthersetList({bool isShowLoading = true}) async { | 54 | Future<bool> _getOthersetList({bool isShowLoading = true}) async { |
| 55 | await feastModel.getOthersetList(context, isShowLoading: isShowLoading); | 55 | await feastModel.getOthersetList(context, isShowLoading: isShowLoading); |
| 56 | } | 56 | } |
| @@ -50,7 +50,7 @@ class _FeastWineManagePageState extends State<FeastWineManagePage> { | @@ -50,7 +50,7 @@ class _FeastWineManagePageState extends State<FeastWineManagePage> { | ||
| 50 | super.dispose(); | 50 | super.dispose(); |
| 51 | } | 51 | } |
| 52 | 52 | ||
| 53 | - ///获取宴会分类 | 53 | + ///获取酒水 |
| 54 | Future<bool> _getWine({bool isShowLoading = true}) async { | 54 | Future<bool> _getWine({bool isShowLoading = true}) async { |
| 55 | await feastModel.getWine(context, isShowLoading: isShowLoading); | 55 | await feastModel.getWine(context, isShowLoading: isShowLoading); |
| 56 | } | 56 | } |
| @@ -14,6 +14,7 @@ import '../models/get_setmeal_class_by_id_model.dart'; | @@ -14,6 +14,7 @@ import '../models/get_setmeal_class_by_id_model.dart'; | ||
| 14 | import '../models/get_staff_model.dart'; | 14 | import '../models/get_staff_model.dart'; |
| 15 | import '../models/otherset_model.dart'; | 15 | import '../models/otherset_model.dart'; |
| 16 | import '../models/personnel_manage_model.dart'; | 16 | import '../models/personnel_manage_model.dart'; |
| 17 | +import '../models/set_xuan_tai_model.dart'; | ||
| 17 | import '../models/setmeal_by_id_model.dart'; | 18 | import '../models/setmeal_by_id_model.dart'; |
| 18 | import '../models/setmeal_model.dart'; | 19 | import '../models/setmeal_model.dart'; |
| 19 | import '../models/wine_model.dart'; | 20 | import '../models/wine_model.dart'; |
| @@ -61,6 +62,9 @@ class FeastModel extends ChangeNotifier { | @@ -61,6 +62,9 @@ class FeastModel extends ChangeNotifier { | ||
| 61 | PageState pageStateMenu = PageState.Loading; //调菜 | 62 | PageState pageStateMenu = PageState.Loading; //调菜 |
| 62 | 63 | ||
| 63 | String rid; //宴会id | 64 | String rid; //宴会id |
| 65 | + String reserve; //宴会预订人 | ||
| 66 | + String type; //宴会类型 | ||
| 67 | + | ||
| 64 | 68 | ||
| 65 | /*** | 69 | /*** |
| 66 | * | 70 | * |
| @@ -82,6 +86,22 @@ class FeastModel extends ChangeNotifier { | @@ -82,6 +86,22 @@ class FeastModel extends ChangeNotifier { | ||
| 82 | if (baseResp.code == Constant.status_success) { | 86 | if (baseResp.code == Constant.status_success) { |
| 83 | // if (baseResp.data == 1) { | 87 | // if (baseResp.data == 1) { |
| 84 | rid = baseResp.data['id']; | 88 | rid = baseResp.data['id']; |
| 89 | + reserve = baseResp.data['rname']; | ||
| 90 | + dynamic sex = baseResp.data['sex']; | ||
| 91 | + if (sex.toString() == '1') { | ||
| 92 | + reserve += '先生'; | ||
| 93 | + } else if (sex.toString() == '2') { | ||
| 94 | + reserve += '女士'; | ||
| 95 | + } else if (sex.toString() == '3') { | ||
| 96 | + reserve += '公司'; | ||
| 97 | + } | ||
| 98 | + | ||
| 99 | + classifyData.forEach((element) { | ||
| 100 | + if (element.id == baseResp.data['classify_id'].toString()) { | ||
| 101 | + type = element.className; | ||
| 102 | + } | ||
| 103 | + }); | ||
| 104 | + | ||
| 85 | return true; | 105 | return true; |
| 86 | // } else { | 106 | // } else { |
| 87 | // return false; | 107 | // return false; |
| @@ -122,6 +142,33 @@ class FeastModel extends ChangeNotifier { | @@ -122,6 +142,33 @@ class FeastModel extends ChangeNotifier { | ||
| 122 | } | 142 | } |
| 123 | } | 143 | } |
| 124 | 144 | ||
| 145 | + ///调菜 | ||
| 146 | + Future<dynamic> setBanquetInfoCook( | ||
| 147 | + BuildContext context, Map<String, String> params, | ||
| 148 | + {isShowLoading = true}) async { | ||
| 149 | + BaseResp<dynamic> baseResp = await DioUtil() | ||
| 150 | + .request<dynamic>(context, Method.get, HttpUrl.set_banquet_info_cook, | ||
| 151 | + data: params, showLoading: isShowLoading) | ||
| 152 | + .catchError((error) { | ||
| 153 | + print(error.toString()); | ||
| 154 | + if (error is MyError) {} | ||
| 155 | + return false; | ||
| 156 | + }); | ||
| 157 | + if (baseResp.code == Constant.status_success) { | ||
| 158 | + // if (baseResp.data == 1) { | ||
| 159 | + // rid = baseResp.data['id']; | ||
| 160 | + return true; | ||
| 161 | + // } else { | ||
| 162 | + // return false; | ||
| 163 | + // } | ||
| 164 | + } else { | ||
| 165 | + if (baseResp != null) { | ||
| 166 | + Utils.showToast(baseResp.msg ?? ""); | ||
| 167 | + } | ||
| 168 | + return false; | ||
| 169 | + } | ||
| 170 | + } | ||
| 171 | + | ||
| 125 | /*** | 172 | /*** |
| 126 | * | 173 | * |
| 127 | * 宴会员工 | 174 | * 宴会员工 |
| @@ -763,7 +810,6 @@ class FeastModel extends ChangeNotifier { | @@ -763,7 +810,6 @@ class FeastModel extends ChangeNotifier { | ||
| 763 | if (setMeaByIdModel.ret == Constant.status_success) { | 810 | if (setMeaByIdModel.ret == Constant.status_success) { |
| 764 | setmealDetail = setMeaByIdModel.data; | 811 | setmealDetail = setMeaByIdModel.data; |
| 765 | if (setmealDetail.classify != null && setmealDetail.classify.length > 0) { | 812 | if (setmealDetail.classify != null && setmealDetail.classify.length > 0) { |
| 766 | - | ||
| 767 | } else { | 813 | } else { |
| 768 | pageStateMenu = PageState.Empty; | 814 | pageStateMenu = PageState.Empty; |
| 769 | } | 815 | } |
| @@ -19,6 +19,7 @@ import 'package:provider/provider.dart'; | @@ -19,6 +19,7 @@ import 'package:provider/provider.dart'; | ||
| 19 | import 'package:tpns_flutter_plugin/tpns_flutter_plugin.dart'; | 19 | import 'package:tpns_flutter_plugin/tpns_flutter_plugin.dart'; |
| 20 | 20 | ||
| 21 | import '../app.dart'; | 21 | import '../app.dart'; |
| 22 | +import '../models/set_xuan_tai_model.dart'; | ||
| 22 | 23 | ||
| 23 | class UserModel with ChangeNotifier { | 24 | class UserModel with ChangeNotifier { |
| 24 | User _user; | 25 | User _user; |
| @@ -27,6 +28,8 @@ class UserModel with ChangeNotifier { | @@ -27,6 +28,8 @@ class UserModel with ChangeNotifier { | ||
| 27 | List<PullMarketingByUidSunModel> pullMarketingByUidSunModel; | 28 | List<PullMarketingByUidSunModel> pullMarketingByUidSunModel; |
| 28 | // bool accountLogin = false; | 29 | // bool accountLogin = false; |
| 29 | 30 | ||
| 31 | + List<Setmeal> justSelData = []; | ||
| 32 | + | ||
| 30 | User get user => _user; | 33 | User get user => _user; |
| 31 | 34 | ||
| 32 | set registrationId(String registrationId) => _registrationId = registrationId; | 35 | set registrationId(String registrationId) => _registrationId = registrationId; |
| @@ -866,38 +866,51 @@ class NavigatorUtil { | @@ -866,38 +866,51 @@ class NavigatorUtil { | ||
| 866 | } | 866 | } |
| 867 | 867 | ||
| 868 | ///宴会----调菜 | 868 | ///宴会----调菜 |
| 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", | 869 | + static Future<dynamic> goFeastMenuPage(BuildContext context, String setmealId, |
| 870 | + {replace = false, bool onlyShow = false, Map justSelData}) { | ||
| 871 | + if (justSelData == null) { | ||
| 872 | + return _navigateTo( | ||
| 873 | + context, "${Routes.feast_menu_page}?setmealId=$setmealId", | ||
| 874 | + replace: replace); | ||
| 875 | + } | ||
| 876 | + return _navigateTo(context, | ||
| 877 | + "${Routes.feast_menu_page}?setmealId=$setmealId&object=${FluroConvertUtils.object2string(justSelData)}", | ||
| 877 | replace: replace); | 878 | replace: replace); |
| 878 | } | 879 | } |
| 879 | 880 | ||
| 880 | ///宴会----添加套餐 | 881 | ///宴会----添加套餐 |
| 881 | - static Future<dynamic> goFeastSetmealPage(BuildContext context, | 882 | + static Future<dynamic> goFeastSetmealPage( |
| 883 | + BuildContext context, String dateData, | ||
| 882 | {replace = false, bool onlyShow = false, Map justSelData}) { | 884 | {replace = false, bool onlyShow = false, Map justSelData}) { |
| 883 | - if (justSelData != null) { | 885 | + if (justSelData == null) { |
| 884 | return _navigateTo(context, | 886 | return _navigateTo(context, |
| 885 | - "${Routes.feast_setmeal_page}?object=${FluroConvertUtils.object2string(justSelData)}", | 887 | + "${Routes.feast_setmeal_page}?dateData=${Uri.encodeComponent(dateData)}", |
| 886 | replace: replace); | 888 | replace: replace); |
| 887 | } | 889 | } |
| 888 | - return _navigateTo(context, "${Routes.feast_setmeal_page}", | 890 | + return _navigateTo(context, |
| 891 | + "${Routes.feast_setmeal_page}?object=${FluroConvertUtils.object2string(justSelData)}&dateData=${Uri.encodeComponent(dateData)}", | ||
| 889 | replace: replace); | 892 | replace: replace); |
| 890 | } | 893 | } |
| 891 | 894 | ||
| 892 | ///宴会----添加酒水 | 895 | ///宴会----添加酒水 |
| 893 | static Future<dynamic> goFeastWinePage(BuildContext context, | 896 | static Future<dynamic> goFeastWinePage(BuildContext context, |
| 894 | - {replace = false, bool onlyShow = false}) { | 897 | + {replace = false, bool onlyShow = false, Map justSelData}) { |
| 898 | + if (justSelData != null) { | ||
| 899 | + return _navigateTo(context, | ||
| 900 | + "${Routes.feast_wine_page}?object=${FluroConvertUtils.object2string(justSelData)}", | ||
| 901 | + replace: replace); | ||
| 902 | + } | ||
| 895 | return _navigateTo(context, "${Routes.feast_wine_page}", replace: replace); | 903 | return _navigateTo(context, "${Routes.feast_wine_page}", replace: replace); |
| 896 | } | 904 | } |
| 897 | 905 | ||
| 898 | ///宴会----添加配置 | 906 | ///宴会----添加配置 |
| 899 | static Future<dynamic> goFeastSetPage(BuildContext context, | 907 | static Future<dynamic> goFeastSetPage(BuildContext context, |
| 900 | - {replace = false, bool onlyShow = false}) { | 908 | + {replace = false, bool onlyShow = false, Map justSelData}) { |
| 909 | + if (justSelData != null) { | ||
| 910 | + return _navigateTo(context, | ||
| 911 | + "${Routes.feast_set_page}?object=${FluroConvertUtils.object2string(justSelData)}", | ||
| 912 | + replace: replace); | ||
| 913 | + } | ||
| 901 | return _navigateTo(context, "${Routes.feast_set_page}", replace: replace); | 914 | return _navigateTo(context, "${Routes.feast_set_page}", replace: replace); |
| 902 | } | 915 | } |
| 903 | 916 | ||
| @@ -1021,4 +1034,18 @@ class NavigatorUtil { | @@ -1021,4 +1034,18 @@ class NavigatorUtil { | ||
| 1021 | // object = {'object': [], "tid": ''}; | 1034 | // object = {'object': [], "tid": ''}; |
| 1022 | return _navigateTo(context, "${Routes.feast_select_table_page}?tid=$tid"); | 1035 | return _navigateTo(context, "${Routes.feast_select_table_page}?tid=$tid"); |
| 1023 | } | 1036 | } |
| 1037 | + | ||
| 1038 | + ///宴会----菜单信息 | ||
| 1039 | + static Future<dynamic> goFeastMenuShowPage(BuildContext context, | ||
| 1040 | + String setmealId, String mealName, String dateData, String needtable, | ||
| 1041 | + {replace = false, bool onlyShow = false, Map justSelData}) { | ||
| 1042 | + if (justSelData == null) { | ||
| 1043 | + return _navigateTo(context, | ||
| 1044 | + "${Routes.feast_menu_show_page}?setmealId=$setmealId&mealName=${Uri.encodeComponent(mealName)}&dateData=${Uri.encodeComponent(dateData)}&needtable=${Uri.encodeComponent(needtable)}", | ||
| 1045 | + replace: replace); | ||
| 1046 | + } | ||
| 1047 | + return _navigateTo(context, | ||
| 1048 | + "${Routes.feast_menu_show_page}?setmealId=$setmealId&object=${FluroConvertUtils.object2string(justSelData)}&mealName=${Uri.encodeComponent(mealName)}&dateData=${Uri.encodeComponent(dateData)}&needtable=${Uri.encodeComponent(needtable)}", | ||
| 1049 | + replace: replace); | ||
| 1050 | + } | ||
| 1024 | } | 1051 | } |
| @@ -148,6 +148,7 @@ import 'package:one_key/utils/utils.dart'; | @@ -148,6 +148,7 @@ 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 '../models/set_xuan_tai_model.dart'; |
| 151 | +import '../models/setmeal_by_id_model.dart'; | ||
| 151 | import '../pages/feast/feast_board.dart'; | 152 | import '../pages/feast/feast_board.dart'; |
| 152 | import '../pages/feast/feast_create_page.dart'; | 153 | import '../pages/feast/feast_create_page.dart'; |
| 153 | import '../pages/feast/feast_deposit_data_page.dart'; | 154 | import '../pages/feast/feast_deposit_data_page.dart'; |
| @@ -155,6 +156,7 @@ import '../pages/feast/feast_deposit_page.dart'; | @@ -155,6 +156,7 @@ import '../pages/feast/feast_deposit_page.dart'; | ||
| 155 | import '../pages/feast/feast_followup_page.dart'; | 156 | import '../pages/feast/feast_followup_page.dart'; |
| 156 | import '../pages/feast/feast_invoice_page.dart'; | 157 | import '../pages/feast/feast_invoice_page.dart'; |
| 157 | import '../pages/feast/feast_menu_page.dart'; | 158 | import '../pages/feast/feast_menu_page.dart'; |
| 159 | +import '../pages/feast/feast_menu_show_page.dart'; | ||
| 158 | import '../pages/feast/feast_set_page.dart'; | 160 | import '../pages/feast/feast_set_page.dart'; |
| 159 | import '../pages/feast/feast_setmeal_page.dart'; | 161 | import '../pages/feast/feast_setmeal_page.dart'; |
| 160 | import '../pages/feast/feast_wine_page.dart'; | 162 | import '../pages/feast/feast_wine_page.dart'; |
| @@ -1382,14 +1384,32 @@ var feastMenuPageHandle = new Handler( | @@ -1382,14 +1384,32 @@ var feastMenuPageHandle = new Handler( | ||
| 1382 | 1384 | ||
| 1383 | // bool onlyShow = FluroConvertUtils.string2bool(params["onlyShow"].first); | 1385 | // bool onlyShow = FluroConvertUtils.string2bool(params["onlyShow"].first); |
| 1384 | String setmealId = params["setmealId"].first; | 1386 | String setmealId = params["setmealId"].first; |
| 1387 | + Map<String, List<CookByIdSetmeal>> justSelData = {}; | ||
| 1388 | + if (params.keys.contains('object')) { | ||
| 1389 | + Map object = FluroConvertUtils.string2map(params["object"].first); | ||
| 1390 | + Map<String, dynamic> temp = object['object']; | ||
| 1391 | + | ||
| 1392 | + temp.forEach((key, value) { | ||
| 1393 | + List<CookByIdSetmeal> cook = []; | ||
| 1394 | + for (var item in value) { | ||
| 1395 | + cook.add(CookByIdSetmeal.fromJson(item)); | ||
| 1396 | + } | ||
| 1397 | + justSelData[key] = cook; | ||
| 1398 | + }); | ||
| 1399 | + } | ||
| 1385 | return ChangeNotifierProvider<FeastModel>( | 1400 | return ChangeNotifierProvider<FeastModel>( |
| 1386 | - create: (_) => FeastModel(), child: FeastMenuPage(setmealId: setmealId)); | 1401 | + create: (_) => FeastModel(), |
| 1402 | + child: FeastMenuPage( | ||
| 1403 | + setmealId: setmealId, | ||
| 1404 | + justSelData: justSelData, | ||
| 1405 | + )); | ||
| 1387 | }); | 1406 | }); |
| 1388 | 1407 | ||
| 1389 | ///宴会----添加套餐 | 1408 | ///宴会----添加套餐 |
| 1390 | var feastSetmealPageHandle = new Handler( | 1409 | var feastSetmealPageHandle = new Handler( |
| 1391 | handlerFunc: (BuildContext context, Map<dynamic, List<Object>> params) { | 1410 | handlerFunc: (BuildContext context, Map<dynamic, List<Object>> params) { |
| 1392 | // String uids = params["uids"].first; | 1411 | // String uids = params["uids"].first; |
| 1412 | + String dateData = params["dateData"].first; | ||
| 1393 | List<Setmeal> justSelData = []; | 1413 | List<Setmeal> justSelData = []; |
| 1394 | if (params.keys.contains('object')) { | 1414 | if (params.keys.contains('object')) { |
| 1395 | Map object = FluroConvertUtils.string2map(params["object"].first); | 1415 | Map object = FluroConvertUtils.string2map(params["object"].first); |
| @@ -1402,27 +1422,43 @@ var feastSetmealPageHandle = new Handler( | @@ -1402,27 +1422,43 @@ var feastSetmealPageHandle = new Handler( | ||
| 1402 | // bool onlyShow = FluroConvertUtils.string2bool(params["onlyShow"].first); | 1422 | // bool onlyShow = FluroConvertUtils.string2bool(params["onlyShow"].first); |
| 1403 | return ChangeNotifierProvider<FeastModel>( | 1423 | return ChangeNotifierProvider<FeastModel>( |
| 1404 | create: (_) => FeastModel(), | 1424 | create: (_) => FeastModel(), |
| 1405 | - child: FeastSetmealPage(justSelData: justSelData)); | 1425 | + child: FeastSetmealPage(justSelData: justSelData, dateData: dateData)); |
| 1406 | }); | 1426 | }); |
| 1407 | 1427 | ||
| 1408 | ///宴会----添加酒水 | 1428 | ///宴会----添加酒水 |
| 1409 | var feastWinePageHandle = new Handler( | 1429 | var feastWinePageHandle = new Handler( |
| 1410 | handlerFunc: (BuildContext context, Map<dynamic, List<Object>> params) { | 1430 | handlerFunc: (BuildContext context, Map<dynamic, List<Object>> params) { |
| 1411 | - // String uids = params["uids"].first; | 1431 | + List<Wine> justSelData = []; |
| 1432 | + if (params.keys.contains('object')) { | ||
| 1433 | + Map object = FluroConvertUtils.string2map(params["object"].first); | ||
| 1434 | + List temp = object['object']; | ||
| 1412 | 1435 | ||
| 1413 | - // bool onlyShow = FluroConvertUtils.string2bool(params["onlyShow"].first); | 1436 | + for (var item in temp) { |
| 1437 | + justSelData.add(Wine.fromJson(item)); | ||
| 1438 | + } | ||
| 1439 | + } | ||
| 1414 | return ChangeNotifierProvider<FeastModel>( | 1440 | return ChangeNotifierProvider<FeastModel>( |
| 1415 | - create: (_) => FeastModel(), child: FeastWinePage()); | 1441 | + create: (_) => FeastModel(), |
| 1442 | + child: FeastWinePage(justSelData: justSelData)); | ||
| 1416 | }); | 1443 | }); |
| 1417 | 1444 | ||
| 1418 | ///宴会----添加配置 | 1445 | ///宴会----添加配置 |
| 1419 | var feastSetPageHandle = new Handler( | 1446 | var feastSetPageHandle = new Handler( |
| 1420 | handlerFunc: (BuildContext context, Map<dynamic, List<Object>> params) { | 1447 | handlerFunc: (BuildContext context, Map<dynamic, List<Object>> params) { |
| 1421 | - // String uids = params["uids"].first; | 1448 | + List<Other> justSelData = []; |
| 1449 | + if (params.keys.contains('object')) { | ||
| 1450 | + Map object = FluroConvertUtils.string2map(params["object"].first); | ||
| 1451 | + List temp = object['object']; | ||
| 1422 | 1452 | ||
| 1423 | - // bool onlyShow = FluroConvertUtils.string2bool(params["onlyShow"].first); | 1453 | + for (var item in temp) { |
| 1454 | + justSelData.add(Other.fromJson(item)); | ||
| 1455 | + } | ||
| 1456 | + } | ||
| 1424 | return ChangeNotifierProvider<FeastModel>( | 1457 | return ChangeNotifierProvider<FeastModel>( |
| 1425 | - create: (_) => FeastModel(), child: FeastSetPage()); | 1458 | + create: (_) => FeastModel(), |
| 1459 | + child: FeastSetPage( | ||
| 1460 | + justSelData: justSelData, | ||
| 1461 | + )); | ||
| 1426 | }); | 1462 | }); |
| 1427 | 1463 | ||
| 1428 | ///宴会----添加发票 | 1464 | ///宴会----添加发票 |
| @@ -1621,3 +1657,38 @@ var feastSelectTablePageHandle = new Handler( | @@ -1621,3 +1657,38 @@ var feastSelectTablePageHandle = new Handler( | ||
| 1621 | create: (_) => ChooseTableModel(), | 1657 | create: (_) => ChooseTableModel(), |
| 1622 | child: FeastSelectTablePage(tableList: res, tid: tid)); | 1658 | child: FeastSelectTablePage(tableList: res, tid: tid)); |
| 1623 | }); | 1659 | }); |
| 1660 | + | ||
| 1661 | +///宴会----菜单信息 | ||
| 1662 | +var feastMenuShowPageHandle = new Handler( | ||
| 1663 | + handlerFunc: (BuildContext context, Map<dynamic, List<Object>> params) { | ||
| 1664 | + // String uids = params["uids"].first; | ||
| 1665 | + | ||
| 1666 | + // bool onlyShow = FluroConvertUtils.string2bool(params["onlyShow"].first); | ||
| 1667 | + String setmealId = params["setmealId"].first; | ||
| 1668 | + String mealName = params["mealName"].first; | ||
| 1669 | + String dateData = params["dateData"].first; | ||
| 1670 | + String needtable = params["needtable"].first; | ||
| 1671 | + | ||
| 1672 | + Map<String, List<CookByIdSetmeal>> justSelData = {}; | ||
| 1673 | + if (params.keys.contains('object')) { | ||
| 1674 | + Map object = FluroConvertUtils.string2map(params["object"].first); | ||
| 1675 | + Map<String, dynamic> temp = object['object']; | ||
| 1676 | + | ||
| 1677 | + temp.forEach((key, value) { | ||
| 1678 | + List<CookByIdSetmeal> cook = []; | ||
| 1679 | + for (var item in value) { | ||
| 1680 | + cook.add(CookByIdSetmeal.fromJson(item)); | ||
| 1681 | + } | ||
| 1682 | + justSelData[key] = cook; | ||
| 1683 | + }); | ||
| 1684 | + } | ||
| 1685 | + return ChangeNotifierProvider<FeastModel>( | ||
| 1686 | + create: (_) => FeastModel(), | ||
| 1687 | + child: FeastMenuShowPage( | ||
| 1688 | + setmealId: setmealId, | ||
| 1689 | + justSelData: justSelData, | ||
| 1690 | + mealName: mealName, | ||
| 1691 | + dateData: dateData, | ||
| 1692 | + needtable: needtable, | ||
| 1693 | + )); | ||
| 1694 | +}); |
| @@ -149,6 +149,9 @@ class Routes { | @@ -149,6 +149,9 @@ class Routes { | ||
| 149 | "/feast_deposit_data_page"; //宴会-----定金数据 | 149 | "/feast_deposit_data_page"; //宴会-----定金数据 |
| 150 | static String feast_select_table_page = | 150 | static String feast_select_table_page = |
| 151 | "/feast_select_table_page"; //宴会-----新建宴会---选择桌位 | 151 | "/feast_select_table_page"; //宴会-----新建宴会---选择桌位 |
| 152 | + static String feast_menu_show_page = | ||
| 153 | + "/feast_menu_show_page"; //宴会-----新建宴会---菜单信息 | ||
| 154 | + | ||
| 152 | 155 | ||
| 153 | static void configureRoutes(FluroRouter router) { | 156 | static void configureRoutes(FluroRouter router) { |
| 154 | router.notFoundHandler = new Handler( | 157 | router.notFoundHandler = new Handler( |
| @@ -300,6 +303,8 @@ class Routes { | @@ -300,6 +303,8 @@ class Routes { | ||
| 300 | 303 | ||
| 301 | router.define(feast_deposit_data_page, handler: feastDepositDataPageHandle); | 304 | router.define(feast_deposit_data_page, handler: feastDepositDataPageHandle); |
| 302 | router.define(feast_select_table_page, handler: feastSelectTablePageHandle); | 305 | router.define(feast_select_table_page, handler: feastSelectTablePageHandle); |
| 306 | +router.define(feast_menu_show_page, handler: feastMenuShowPageHandle); | ||
| 307 | + | ||
| 303 | 308 | ||
| 304 | } | 309 | } |
| 305 | } | 310 | } |
| @@ -788,54 +788,54 @@ class DialogUtil { | @@ -788,54 +788,54 @@ class DialogUtil { | ||
| 788 | )) | 788 | )) |
| 789 | ])), | 789 | ])), |
| 790 | VEmptyView(32), | 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)), //设置文字内容与边框距离 | 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 | 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), | 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( | 839 | Padding( |
| 840 | padding: EdgeInsets.symmetric(horizontal: w(16)), | 840 | padding: EdgeInsets.symmetric(horizontal: w(16)), |
| 841 | child: Row(children: [ | 841 | child: Row(children: [ |
| @@ -987,7 +987,7 @@ class DialogUtil { | @@ -987,7 +987,7 @@ class DialogUtil { | ||
| 987 | onTap({ | 987 | onTap({ |
| 988 | 'name': nameC.text, | 988 | 'name': nameC.text, |
| 989 | 'per': perC.text, | 989 | 'per': perC.text, |
| 990 | - 'num':numC.text, | 990 | + 'num': numC.text, |
| 991 | 'can': can ? '1' : '0' | 991 | 'can': can ? '1' : '0' |
| 992 | }); | 992 | }); |
| 993 | Navigator.pop(context, { | 993 | Navigator.pop(context, { |
-
Please register or login to post a comment