Showing
11 changed files
with
1104 additions
and
255 deletions
| @@ -33,9 +33,9 @@ if (flutterRoot == null) { | @@ -33,9 +33,9 @@ if (flutterRoot == null) { | ||
| 33 | 33 | ||
| 34 | 34 | ||
| 35 | 35 | ||
| 36 | -def flutterVersionCode = "505" | 36 | +def flutterVersionCode = "506" |
| 37 | if (flutterVersionCode == null) { | 37 | if (flutterVersionCode == null) { |
| 38 | - flutterVersionCode = '505' | 38 | + flutterVersionCode = '506' |
| 39 | 39 | ||
| 40 | 40 | ||
| 41 | 41 | ||
| @@ -46,9 +46,11 @@ if (flutterVersionCode == null) { | @@ -46,9 +46,11 @@ if (flutterVersionCode == null) { | ||
| 46 | 46 | ||
| 47 | 47 | ||
| 48 | 48 | ||
| 49 | -def flutterVersionName = "5.0.5" | 49 | + |
| 50 | +def flutterVersionName = "5.0.6" | ||
| 51 | + | ||
| 50 | if (flutterVersionName == null) { | 52 | if (flutterVersionName == null) { |
| 51 | - flutterVersionName = '5.0.5' | 53 | + flutterVersionName = '5.0.6' |
| 52 | 54 | ||
| 53 | 55 | ||
| 54 | } | 56 | } |
| @@ -518,7 +518,10 @@ | @@ -518,7 +518,10 @@ | ||
| 518 | CODE_SIGN_ENTITLEMENTS = Runner/RunnerProfile.entitlements; | 518 | CODE_SIGN_ENTITLEMENTS = Runner/RunnerProfile.entitlements; |
| 519 | CODE_SIGN_IDENTITY = "Apple Development"; | 519 | CODE_SIGN_IDENTITY = "Apple Development"; |
| 520 | CODE_SIGN_STYLE = Automatic; | 520 | CODE_SIGN_STYLE = Automatic; |
| 521 | - CURRENT_PROJECT_VERSION = 504; | 521 | + |
| 522 | + | ||
| 523 | + | ||
| 524 | + CURRENT_PROJECT_VERSION = 506; | ||
| 522 | 525 | ||
| 523 | DEVELOPMENT_TEAM = 8J59HM8B82; | 526 | DEVELOPMENT_TEAM = 8J59HM8B82; |
| 524 | ENABLE_BITCODE = NO; | 527 | ENABLE_BITCODE = NO; |
| @@ -668,7 +671,7 @@ | @@ -668,7 +671,7 @@ | ||
| 668 | CODE_SIGN_IDENTITY = "Apple Development"; | 671 | CODE_SIGN_IDENTITY = "Apple Development"; |
| 669 | CODE_SIGN_STYLE = Automatic; | 672 | CODE_SIGN_STYLE = Automatic; |
| 670 | 673 | ||
| 671 | - CURRENT_PROJECT_VERSION = 504; | 674 | + CURRENT_PROJECT_VERSION = 506; |
| 672 | 675 | ||
| 673 | DEVELOPMENT_TEAM = 8J59HM8B82; | 676 | DEVELOPMENT_TEAM = 8J59HM8B82; |
| 674 | ENABLE_BITCODE = NO; | 677 | ENABLE_BITCODE = NO; |
| @@ -707,7 +710,8 @@ | @@ -707,7 +710,8 @@ | ||
| 707 | CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; | 710 | CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; |
| 708 | CODE_SIGN_IDENTITY = "Apple Development"; | 711 | CODE_SIGN_IDENTITY = "Apple Development"; |
| 709 | CODE_SIGN_STYLE = Automatic; | 712 | CODE_SIGN_STYLE = Automatic; |
| 710 | - CURRENT_PROJECT_VERSION = 504; | 713 | + |
| 714 | + CURRENT_PROJECT_VERSION = 506; | ||
| 711 | 715 | ||
| 712 | DEVELOPMENT_TEAM = 8J59HM8B82; | 716 | DEVELOPMENT_TEAM = 8J59HM8B82; |
| 713 | ENABLE_BITCODE = NO; | 717 | ENABLE_BITCODE = NO; |
| @@ -285,7 +285,8 @@ class _VerificationCouponPageState extends State<VerificationCouponPage> { | @@ -285,7 +285,8 @@ class _VerificationCouponPageState extends State<VerificationCouponPage> { | ||
| 285 | : model.orderRechargeByidSunModel | 285 | : model.orderRechargeByidSunModel |
| 286 | .activity.use.isDish | 286 | .activity.use.isDish |
| 287 | ? model | 287 | ? model |
| 288 | - .couponSunModel.use.dish | 288 | + .orderRechargeByidSunModel |
| 289 | + .activity.use.dish | ||
| 289 | : '', | 290 | : '', |
| 290 | textColor: MyColours.color_438E93, | 291 | textColor: MyColours.color_438E93, |
| 291 | fontSize: 20), | 292 | fontSize: 20), |
| @@ -40,9 +40,19 @@ class SelectTableFPage extends StatefulWidget { | @@ -40,9 +40,19 @@ class SelectTableFPage extends StatefulWidget { | ||
| 40 | final List<TableList> tableList; | 40 | final List<TableList> tableList; |
| 41 | final String fromPage; | 41 | final String fromPage; |
| 42 | final String tid; | 42 | final String tid; |
| 43 | - | 43 | + final String hmS; |
| 44 | + final String hmE; | ||
| 45 | + final String source; | ||
| 46 | + final String ridFeast; //宴会id | ||
| 44 | SelectTableFPage(this.rid, this.dateTime, this.ddate_slot, | 47 | SelectTableFPage(this.rid, this.dateTime, this.ddate_slot, |
| 45 | - {this.canChoose = false, this.tableList, this.fromPage, this.tid}); | 48 | + {this.canChoose = false, |
| 49 | + this.tableList, | ||
| 50 | + this.fromPage, | ||
| 51 | + this.tid, | ||
| 52 | + this.hmS, | ||
| 53 | + this.hmE, | ||
| 54 | + this.source = '0', | ||
| 55 | + this.ridFeast}); | ||
| 46 | 56 | ||
| 47 | @override | 57 | @override |
| 48 | State<StatefulWidget> createState() { | 58 | State<StatefulWidget> createState() { |
| @@ -232,18 +242,65 @@ class SelectTableFPageState extends State<SelectTableFPage> { | @@ -232,18 +242,65 @@ class SelectTableFPageState extends State<SelectTableFPage> { | ||
| 232 | //获取预订(原来普通预订和宴会预订) | 242 | //获取预订(原来普通预订和宴会预订) |
| 233 | _getReserveListAndFeastData(context, params, showloading) async { | 243 | _getReserveListAndFeastData(context, params, showloading) async { |
| 234 | UserModel userModel = Provider.of<UserModel>(context, listen: false); | 244 | UserModel userModel = Provider.of<UserModel>(context, listen: false); |
| 235 | - String timeStrStart = widget.dateTime.year.toString() + | ||
| 236 | - "-" + | ||
| 237 | - Utils.addZeroNumber(widget.dateTime.month) + | ||
| 238 | - "-" + | ||
| 239 | - Utils.addZeroNumber(widget.dateTime.day) + | ||
| 240 | - " 00:00:00"; | ||
| 241 | - String timeStrEnd = widget.dateTime.year.toString() + | ||
| 242 | - "-" + | ||
| 243 | - Utils.addZeroNumber(widget.dateTime.month) + | ||
| 244 | - "-" + | ||
| 245 | - Utils.addZeroNumber(widget.dateTime.day) + | ||
| 246 | - " 23:59:59"; | 245 | + String timeStrStart = ''; |
| 246 | + String timeStrEnd = ''; | ||
| 247 | + | ||
| 248 | + String hmsS = " ${widget.hmS}:00"; //起始 | ||
| 249 | + String hmsE = " ${widget.hmE}:59"; //结束 | ||
| 250 | + | ||
| 251 | + if (widget.hmS == 'null' || widget.hmE == 'null') { | ||
| 252 | + //用餐段对应的时间段作为起始时间 | ||
| 253 | + String keys = ''; | ||
| 254 | + | ||
| 255 | + if (widget.ddate_slot == '1') { | ||
| 256 | + //早市 | ||
| 257 | + keys = 'morning'; | ||
| 258 | + } else if (widget.ddate_slot == '2') { | ||
| 259 | + //午市 | ||
| 260 | + keys = 'noon'; | ||
| 261 | + } else if (widget.ddate_slot == '3') { | ||
| 262 | + //晚市 | ||
| 263 | + keys = 'night'; | ||
| 264 | + } | ||
| 265 | + String ymd = | ||
| 266 | + DateUtil.formatDate(widget.dateTime, format: DateFormats.y_mo_d); | ||
| 267 | + if (keys != '') { | ||
| 268 | + List temp = dailyMap[keys]; | ||
| 269 | + timeStrStart = ymd + ' ' + temp.first + ':00'; | ||
| 270 | + timeStrEnd = ymd + ' ' + temp.last + ':00'; | ||
| 271 | + } else { | ||
| 272 | + hmsS = " 00:00:00"; | ||
| 273 | + hmsE = " 23:59:59"; | ||
| 274 | + timeStrStart = widget.dateTime.year.toString() + | ||
| 275 | + "-" + | ||
| 276 | + Utils.addZeroNumber(widget.dateTime.month) + | ||
| 277 | + "-" + | ||
| 278 | + Utils.addZeroNumber(widget.dateTime.day) + | ||
| 279 | + hmsS; | ||
| 280 | + timeStrEnd = widget.dateTime.year.toString() + | ||
| 281 | + "-" + | ||
| 282 | + Utils.addZeroNumber(widget.dateTime.month) + | ||
| 283 | + "-" + | ||
| 284 | + Utils.addZeroNumber(widget.dateTime.day) + | ||
| 285 | + hmsE; | ||
| 286 | + } | ||
| 287 | + } else { | ||
| 288 | + hmsS = " ${widget.hmS}:00"; //起始 | ||
| 289 | + hmsE = " ${widget.hmE}:59"; //结束 | ||
| 290 | + timeStrStart = widget.dateTime.year.toString() + | ||
| 291 | + "-" + | ||
| 292 | + Utils.addZeroNumber(widget.dateTime.month) + | ||
| 293 | + "-" + | ||
| 294 | + Utils.addZeroNumber(widget.dateTime.day) + | ||
| 295 | + hmsS; | ||
| 296 | + timeStrEnd = widget.dateTime.year.toString() + | ||
| 297 | + "-" + | ||
| 298 | + Utils.addZeroNumber(widget.dateTime.month) + | ||
| 299 | + "-" + | ||
| 300 | + Utils.addZeroNumber(widget.dateTime.day) + | ||
| 301 | + hmsE; | ||
| 302 | + } | ||
| 303 | + | ||
| 247 | String start = | 304 | String start = |
| 248 | (DateUtil.getDateMsByTimeStr(timeStrStart) / 1000).floor().toString(); | 305 | (DateUtil.getDateMsByTimeStr(timeStrStart) / 1000).floor().toString(); |
| 249 | String end = | 306 | String end = |
| @@ -253,7 +310,7 @@ class SelectTableFPageState extends State<SelectTableFPage> { | @@ -253,7 +310,7 @@ class SelectTableFPageState extends State<SelectTableFPage> { | ||
| 253 | 'sid': userModel.user.sellerid, | 310 | 'sid': userModel.user.sellerid, |
| 254 | 'rdate': '${start}', | 311 | 'rdate': '${start}', |
| 255 | 'edate': '${end}', | 312 | 'edate': '${end}', |
| 256 | - 'ddate_interval': widget.ddate_slot | 313 | + // 'ddate_interval': widget.ddate_slot |
| 257 | }; | 314 | }; |
| 258 | return await Future.wait<bool>([ | 315 | return await Future.wait<bool>([ |
| 259 | _getOldReserve(context, params, showloading), | 316 | _getOldReserve(context, params, showloading), |
| @@ -290,12 +347,15 @@ class SelectTableFPageState extends State<SelectTableFPage> { | @@ -290,12 +347,15 @@ class SelectTableFPageState extends State<SelectTableFPage> { | ||
| 290 | Map<String, String> params = { | 347 | Map<String, String> params = { |
| 291 | "sid": sid, | 348 | "sid": sid, |
| 292 | "rdate": _getRdate(), | 349 | "rdate": _getRdate(), |
| 293 | - "ddate_solt": widget.ddate_slot, | 350 | + // "ddate_solt": widget.ddate_slot, |
| 294 | "y": "200", | 351 | "y": "200", |
| 295 | "x": "1", | 352 | "x": "1", |
| 296 | "keywords": "", | 353 | "keywords": "", |
| 297 | "sort": "1" | 354 | "sort": "1" |
| 298 | }; | 355 | }; |
| 356 | + if (widget.source == '1') { | ||
| 357 | + params['source'] = '1'; | ||
| 358 | + } | ||
| 299 | // List<Notebook> noteBooks = | 359 | // List<Notebook> noteBooks = |
| 300 | // await model.getReserveList(context, params, needLoading: needLoading); | 360 | // await model.getReserveList(context, params, needLoading: needLoading); |
| 301 | bool success = | 361 | bool success = |
| @@ -313,29 +373,97 @@ class SelectTableFPageState extends State<SelectTableFPage> { | @@ -313,29 +373,97 @@ class SelectTableFPageState extends State<SelectTableFPage> { | ||
| 313 | }); | 373 | }); |
| 314 | }); | 374 | }); |
| 315 | // banquetByDateData.map((e) => null) | 375 | // banquetByDateData.map((e) => null) |
| 316 | - String banquetKey = ''; | ||
| 317 | - if (widget.ddate_slot == '1') { | ||
| 318 | - banquetKey = '早餐'; | ||
| 319 | - } else if (widget.ddate_slot == '2') { | ||
| 320 | - banquetKey = '午餐'; | ||
| 321 | - } else if (widget.ddate_slot == '3') { | ||
| 322 | - banquetKey = '晚餐'; | ||
| 323 | - } | 376 | + // String banquetKey = ''; |
| 377 | + // if (widget.ddate_slot == '1') { | ||
| 378 | + // banquetKey = '早餐'; | ||
| 379 | + // } else if (widget.ddate_slot == '2') { | ||
| 380 | + // banquetKey = '午餐'; | ||
| 381 | + // } else if (widget.ddate_slot == '3') { | ||
| 382 | + // banquetKey = '晚餐'; | ||
| 383 | + // } | ||
| 384 | + | ||
| 385 | + Map<String, List<FeastBoardSunModel>> banquetData = {}; | ||
| 324 | banquetByDateDataTemp.forEach((element) { | 386 | banquetByDateDataTemp.forEach((element) { |
| 325 | - FeastBoardSunModel feastBoardSunModel = element.data[banquetKey][0]; | ||
| 326 | - if (feastBoardSunModel.lost == null || feastBoardSunModel.lost == '') { | ||
| 327 | - //未丢单的宴会 | ||
| 328 | - Notebook notebook = Notebook(); | ||
| 329 | - notebook.tid = element.title; | ||
| 330 | - notebook.status = '10'; //宴会类型 | ||
| 331 | - notebook.className = feastBoardSunModel.className; | ||
| 332 | - notebook.id = feastBoardSunModel.rid; | ||
| 333 | - notebook.rname = feastBoardSunModel.rname; | ||
| 334 | - notebook.nick_name = | ||
| 335 | - feastBoardSunModel.nickName ?? feastBoardSunModel.account; | ||
| 336 | - noteBooks.add(notebook); | 387 | + List<FeastBoardSunModel> data = []; |
| 388 | + | ||
| 389 | + if (element.data['其他'].length > 0) { | ||
| 390 | + FeastBoardSunModel feastBoardSunModel = element.data['其他'][0]; | ||
| 391 | + if (feastBoardSunModel.lost == null || | ||
| 392 | + feastBoardSunModel.lost == '') { | ||
| 393 | + data.add(feastBoardSunModel); //未丢单宴会合集 | ||
| 394 | + } | ||
| 395 | + } | ||
| 396 | + if (element.data['早餐'].length > 0) { | ||
| 397 | + FeastBoardSunModel feastBoardSunModel = element.data['早餐'][0]; | ||
| 398 | + if (feastBoardSunModel.lost == null || | ||
| 399 | + feastBoardSunModel.lost == '') { | ||
| 400 | + data.add(feastBoardSunModel); //未丢单宴会合集 | ||
| 401 | + } | ||
| 402 | + } | ||
| 403 | + if (element.data['午餐'].length > 0) { | ||
| 404 | + FeastBoardSunModel feastBoardSunModel = element.data['午餐'][0]; | ||
| 405 | + if (feastBoardSunModel.lost == null || | ||
| 406 | + feastBoardSunModel.lost == '') { | ||
| 407 | + data.add(feastBoardSunModel); //未丢单宴会合集 | ||
| 408 | + } | ||
| 409 | + } | ||
| 410 | + if (element.data['晚餐'].length > 0) { | ||
| 411 | + FeastBoardSunModel feastBoardSunModel = element.data['晚餐'][0]; | ||
| 412 | + if (feastBoardSunModel.lost == null || | ||
| 413 | + feastBoardSunModel.lost == '') { | ||
| 414 | + data.add(feastBoardSunModel); //未丢单宴会合集 | ||
| 415 | + } | ||
| 416 | + } | ||
| 417 | + // 不是丢单宴会&&不是当前宴会 | ||
| 418 | + // 移除当前宴会订单 | ||
| 419 | + if (widget.ridFeast != null) { | ||
| 420 | + print(data); | ||
| 421 | + data.removeWhere((element) => element.rid == widget.ridFeast); | ||
| 422 | + print(data); | ||
| 423 | + } | ||
| 424 | + | ||
| 425 | + if (!banquetData.containsKey(element.title) && data.length > 0) { | ||
| 426 | + banquetData[element.title] = data; | ||
| 337 | } | 427 | } |
| 338 | }); | 428 | }); |
| 429 | + | ||
| 430 | + List<String> tidsWidget = | ||
| 431 | + widget.tableList.map((element) => element.id).toList(); | ||
| 432 | + print(tidsWidget); | ||
| 433 | + banquetData.forEach((key, value) { | ||
| 434 | + value.forEach((element) { | ||
| 435 | + //未丢单的宴会 | ||
| 436 | + | ||
| 437 | + if (!tidsWidget.contains(key)) { | ||
| 438 | + //带过来的桌子,不能标记已预订,或者已经有宴会 | ||
| 439 | + Notebook notebook = Notebook(); | ||
| 440 | + notebook.tid = key; | ||
| 441 | + notebook.status = '10'; //宴会类型 | ||
| 442 | + notebook.className = element.className; | ||
| 443 | + notebook.id = element.rid; | ||
| 444 | + notebook.rname = element.rname; | ||
| 445 | + notebook.nick_name = element.nickName ?? element.account; | ||
| 446 | + noteBooks.add(notebook); | ||
| 447 | + } | ||
| 448 | + | ||
| 449 | + print(noteBooks); | ||
| 450 | + | ||
| 451 | + // banquetByDateDataTemp.forEach((element) { | ||
| 452 | + // FeastBoardSunModel feastBoardSunModel = element.data[banquetKey][0]; | ||
| 453 | + // if (feastBoardSunModel.lost == null || feastBoardSunModel.lost == '') { | ||
| 454 | + //未丢单的宴会 | ||
| 455 | + // Notebook notebook = Notebook(); | ||
| 456 | + // notebook.tid = element.title; | ||
| 457 | + // notebook.status = '10'; //宴会类型 | ||
| 458 | + // notebook.className = feastBoardSunModel.className; | ||
| 459 | + // notebook.id = feastBoardSunModel.rid; | ||
| 460 | + // notebook.rname = feastBoardSunModel.rname; | ||
| 461 | + // notebook.nick_name = | ||
| 462 | + // feastBoardSunModel.nickName ?? feastBoardSunModel.account; | ||
| 463 | + // noteBooks.add(notebook); | ||
| 464 | + // } | ||
| 465 | + }); | ||
| 466 | + }); | ||
| 339 | for (Notebook notebook in noteBooks) { | 467 | for (Notebook notebook in noteBooks) { |
| 340 | if (notebook.tid.isEmpty) continue; | 468 | if (notebook.tid.isEmpty) continue; |
| 341 | if (notebook.status == "1" || | 469 | if (notebook.status == "1" || |
| @@ -493,43 +621,69 @@ class SelectTableFPageState extends State<SelectTableFPage> { | @@ -493,43 +621,69 @@ class SelectTableFPageState extends State<SelectTableFPage> { | ||
| 493 | 621 | ||
| 494 | //获取一天开始-结束时间字符串 | 622 | //获取一天开始-结束时间字符串 |
| 495 | String _getRdate() { | 623 | String _getRdate() { |
| 496 | - // String keys = ''; | ||
| 497 | - | ||
| 498 | - // if (widget.ddate_slot == '1') { | ||
| 499 | - // //早市 | ||
| 500 | - // keys = 'morning'; | ||
| 501 | - // } else if (widget.ddate_slot == '2') { | ||
| 502 | - // //午市 | ||
| 503 | - // keys = 'noon'; | ||
| 504 | - // } else if (widget.ddate_slot == '3') { | ||
| 505 | - // //晚市 | ||
| 506 | - // keys = 'night'; | ||
| 507 | - // } | ||
| 508 | - // String ymd = | ||
| 509 | - // DateUtil.formatDate(widget.dateTime, format: DateFormats.y_mo_d); | ||
| 510 | String timeStrStart = ''; | 624 | String timeStrStart = ''; |
| 511 | String timeStrEnd = ''; | 625 | String timeStrEnd = ''; |
| 512 | //一天开始时间 | 626 | //一天开始时间 |
| 513 | double startDay; | 627 | double startDay; |
| 514 | //一天结束时间 | 628 | //一天结束时间 |
| 515 | double endDay; | 629 | double endDay; |
| 516 | - // if (keys != '') { | ||
| 517 | - // List temp = dailyMap[keys]; | ||
| 518 | - // timeStrStart = ymd + ' ' + temp.first + ':00'; | ||
| 519 | - // timeStrEnd = ymd + ' ' + temp.last + ':00'; | ||
| 520 | - // } else { | ||
| 521 | - timeStrStart = widget.dateTime.year.toString() + | ||
| 522 | - "-" + | ||
| 523 | - Utils.addZeroNumber(widget.dateTime.month) + | ||
| 524 | - "-" + | ||
| 525 | - Utils.addZeroNumber(widget.dateTime.day) + | ||
| 526 | - " 00:00:00"; | ||
| 527 | - timeStrEnd = widget.dateTime.year.toString() + | ||
| 528 | - "-" + | ||
| 529 | - Utils.addZeroNumber(widget.dateTime.month) + | ||
| 530 | - "-" + | ||
| 531 | - Utils.addZeroNumber(widget.dateTime.day) + | ||
| 532 | - " 23:59:59"; | 630 | + |
| 631 | + String hmsS = " ${widget.hmS}:00"; //起始 | ||
| 632 | + String hmsE = " ${widget.hmE}:59"; //结束 | ||
| 633 | + | ||
| 634 | + if (widget.hmS == 'null' || widget.hmE == 'null') { | ||
| 635 | + //用餐段对应的时间段作为起始时间 | ||
| 636 | + String keys = ''; | ||
| 637 | + | ||
| 638 | + if (widget.ddate_slot == '1') { | ||
| 639 | + //早市 | ||
| 640 | + keys = 'morning'; | ||
| 641 | + } else if (widget.ddate_slot == '2') { | ||
| 642 | + //午市 | ||
| 643 | + keys = 'noon'; | ||
| 644 | + } else if (widget.ddate_slot == '3') { | ||
| 645 | + //晚市 | ||
| 646 | + keys = 'night'; | ||
| 647 | + } | ||
| 648 | + String ymd = | ||
| 649 | + DateUtil.formatDate(widget.dateTime, format: DateFormats.y_mo_d); | ||
| 650 | + if (keys != '') { | ||
| 651 | + List temp = dailyMap[keys]; | ||
| 652 | + timeStrStart = ymd + ' ' + temp.first + ':00'; | ||
| 653 | + timeStrEnd = ymd + ' ' + temp.last + ':00'; | ||
| 654 | + } else { | ||
| 655 | + hmsS = " 00:00:00"; | ||
| 656 | + hmsE = " 23:59:59"; | ||
| 657 | + timeStrStart = widget.dateTime.year.toString() + | ||
| 658 | + "-" + | ||
| 659 | + Utils.addZeroNumber(widget.dateTime.month) + | ||
| 660 | + "-" + | ||
| 661 | + Utils.addZeroNumber(widget.dateTime.day) + | ||
| 662 | + hmsS; | ||
| 663 | + timeStrEnd = widget.dateTime.year.toString() + | ||
| 664 | + "-" + | ||
| 665 | + Utils.addZeroNumber(widget.dateTime.month) + | ||
| 666 | + "-" + | ||
| 667 | + Utils.addZeroNumber(widget.dateTime.day) + | ||
| 668 | + hmsE; | ||
| 669 | + } | ||
| 670 | + } else { | ||
| 671 | + hmsS = " ${widget.hmS}:00"; //起始 | ||
| 672 | + hmsE = " ${widget.hmE}:59"; //结束 | ||
| 673 | + timeStrStart = widget.dateTime.year.toString() + | ||
| 674 | + "-" + | ||
| 675 | + Utils.addZeroNumber(widget.dateTime.month) + | ||
| 676 | + "-" + | ||
| 677 | + Utils.addZeroNumber(widget.dateTime.day) + | ||
| 678 | + hmsS; | ||
| 679 | + timeStrEnd = widget.dateTime.year.toString() + | ||
| 680 | + "-" + | ||
| 681 | + Utils.addZeroNumber(widget.dateTime.month) + | ||
| 682 | + "-" + | ||
| 683 | + Utils.addZeroNumber(widget.dateTime.day) + | ||
| 684 | + hmsE; | ||
| 685 | + } | ||
| 686 | + | ||
| 533 | // } | 687 | // } |
| 534 | startDay = (DateTime.parse(timeStrStart).millisecondsSinceEpoch) / 1000; | 688 | startDay = (DateTime.parse(timeStrStart).millisecondsSinceEpoch) / 1000; |
| 535 | endDay = (DateTime.parse(timeStrEnd).millisecondsSinceEpoch) / 1000; | 689 | endDay = (DateTime.parse(timeStrEnd).millisecondsSinceEpoch) / 1000; |
| @@ -16,14 +16,20 @@ import 'package:one_key/widgets/round_button.dart'; | @@ -16,14 +16,20 @@ import 'package:one_key/widgets/round_button.dart'; | ||
| 16 | import 'package:one_key/widgets/v_empty_view.dart'; | 16 | import 'package:one_key/widgets/v_empty_view.dart'; |
| 17 | import 'package:provider/provider.dart'; | 17 | import 'package:provider/provider.dart'; |
| 18 | 18 | ||
| 19 | +import '../../app.dart'; | ||
| 19 | import '../../constant/state.dart'; | 20 | import '../../constant/state.dart'; |
| 20 | import '../../models/dsolt_xt.dart'; | 21 | import '../../models/dsolt_xt.dart'; |
| 21 | import '../../models/feast_menu_model.dart'; | 22 | import '../../models/feast_menu_model.dart'; |
| 22 | import '../../models/get_banquet_by_id_new_model.dart'; | 23 | import '../../models/get_banquet_by_id_new_model.dart'; |
| 24 | +import '../../models/get_board_model.dart'; | ||
| 25 | +import '../../models/notebook.dart'; | ||
| 23 | import '../../models/set_xuan_tai_model.dart'; | 26 | import '../../models/set_xuan_tai_model.dart'; |
| 24 | import '../../models/setmeal_by_id_model.dart'; | 27 | import '../../models/setmeal_by_id_model.dart'; |
| 28 | +import '../../models/tableOuter.dart'; | ||
| 25 | import '../../models/upload_img_model.dart'; | 29 | import '../../models/upload_img_model.dart'; |
| 30 | +import '../../provider/choose_table_model.dart'; | ||
| 26 | import '../../provider/feast_model.dart'; | 31 | import '../../provider/feast_model.dart'; |
| 32 | +import '../../provider/notebook_model.dart'; | ||
| 27 | import '../../provider/upload_img_provider.dart'; | 33 | import '../../provider/upload_img_provider.dart'; |
| 28 | import '../../provider/user_model.dart'; | 34 | import '../../provider/user_model.dart'; |
| 29 | import '../../res/colors.dart'; | 35 | import '../../res/colors.dart'; |
| @@ -43,6 +49,8 @@ import 'package:one_key/models/table_list.dart' as t; | @@ -43,6 +49,8 @@ import 'package:one_key/models/table_list.dart' as t; | ||
| 43 | import 'package:flutter_keyboard_visibility/flutter_keyboard_visibility.dart'; | 49 | import 'package:flutter_keyboard_visibility/flutter_keyboard_visibility.dart'; |
| 44 | import '../../widgets/special_text/my_extended_text_selection_controls.dart'; | 50 | import '../../widgets/special_text/my_extended_text_selection_controls.dart'; |
| 45 | 51 | ||
| 52 | +import 'package:one_key/models/table.dart' as table; | ||
| 53 | + | ||
| 46 | class FeastCreatePage extends StatefulWidget { | 54 | class FeastCreatePage extends StatefulWidget { |
| 47 | final GetBanquetByIdNewSunModel banquetDetail; | 55 | final GetBanquetByIdNewSunModel banquetDetail; |
| 48 | final bool isCreate; | 56 | final bool isCreate; |
| @@ -99,6 +107,11 @@ class _FeastCreatePageState extends State<FeastCreatePage> { | @@ -99,6 +107,11 @@ class _FeastCreatePageState extends State<FeastCreatePage> { | ||
| 99 | MyTextSelectionControls _myExtendedMaterialTextSelectionControls = | 107 | MyTextSelectionControls _myExtendedMaterialTextSelectionControls = |
| 100 | MyTextSelectionControls(); | 108 | MyTextSelectionControls(); |
| 101 | 109 | ||
| 110 | + ChooseTableModel _chooseTableModel; | ||
| 111 | + List<Notebook> noteBooks; | ||
| 112 | + Map<String, Notebook> tableMap = {}; //记录已预订桌位对应的订单 | ||
| 113 | + List<TableOuter> tableOuterList = []; //区域-桌位列表 | ||
| 114 | + | ||
| 102 | @override | 115 | @override |
| 103 | void initState() { | 116 | void initState() { |
| 104 | // TODO: implement initState | 117 | // TODO: implement initState |
| @@ -252,7 +265,10 @@ class _FeastCreatePageState extends State<FeastCreatePage> { | @@ -252,7 +265,10 @@ class _FeastCreatePageState extends State<FeastCreatePage> { | ||
| 252 | setXuanTaiModel.endDate; //起始时间 | 265 | setXuanTaiModel.endDate; //起始时间 |
| 253 | setXuanTaiModel.tableList = element.tableList; | 266 | setXuanTaiModel.tableList = element.tableList; |
| 254 | 267 | ||
| 255 | - setXuanTaiModel.tableSum = int.parse('${element.tableNum}'); //桌位总数 | 268 | + setXuanTaiModel.tableSum = |
| 269 | + element.tableNum == null || element.tableNum == '' | ||
| 270 | + ? 0 | ||
| 271 | + : int.parse('${element.tableNum}'); //桌位总数 | ||
| 256 | setXuanTaiModel.customCxt.text = element.remark; //选台备注 | 272 | setXuanTaiModel.customCxt.text = element.remark; //选台备注 |
| 257 | setXuanTaiModel.feastRemarkXtImageList = | 273 | setXuanTaiModel.feastRemarkXtImageList = |
| 258 | element.feastRemarkImages; //宴会备注图片信息列表----选台 | 274 | element.feastRemarkImages; //宴会备注图片信息列表----选台 |
| @@ -1225,6 +1241,351 @@ class _FeastCreatePageState extends State<FeastCreatePage> { | @@ -1225,6 +1241,351 @@ class _FeastCreatePageState extends State<FeastCreatePage> { | ||
| 1225 | return startDay.floor().toString() + "-" + endDay.floor().toString(); | 1241 | return startDay.floor().toString() + "-" + endDay.floor().toString(); |
| 1226 | } | 1242 | } |
| 1227 | 1243 | ||
| 1244 | + //获取一天开始-结束时间字符串 | ||
| 1245 | + String _getRdateGetNotebook() { | ||
| 1246 | + String timeStrStart = ''; | ||
| 1247 | + String timeStrEnd = ''; | ||
| 1248 | + //一天开始时间 | ||
| 1249 | + double startDay; | ||
| 1250 | + //一天结束时间 | ||
| 1251 | + double endDay; | ||
| 1252 | + | ||
| 1253 | + SetXuanTaiModel setXuanTaiModel = xuantaiData[xuantaiSelIndex]; | ||
| 1254 | + | ||
| 1255 | + String hmsS = " ${setXuanTaiModel.startDate}:00"; //起始 | ||
| 1256 | + String hmsE = " ${setXuanTaiModel.endDate}:59"; //结束 | ||
| 1257 | + timeStrStart = setXuanTaiModel.dateTimext.year.toString() + | ||
| 1258 | + "-" + | ||
| 1259 | + Utils.addZeroNumber(setXuanTaiModel.dateTimext.month) + | ||
| 1260 | + "-" + | ||
| 1261 | + Utils.addZeroNumber(setXuanTaiModel.dateTimext.day) + | ||
| 1262 | + hmsS; | ||
| 1263 | + timeStrEnd = setXuanTaiModel.dateTimext.year.toString() + | ||
| 1264 | + "-" + | ||
| 1265 | + Utils.addZeroNumber(setXuanTaiModel.dateTimext.month) + | ||
| 1266 | + "-" + | ||
| 1267 | + Utils.addZeroNumber(setXuanTaiModel.dateTimext.day) + | ||
| 1268 | + hmsE; | ||
| 1269 | + // } | ||
| 1270 | + startDay = (DateTime.parse(timeStrStart).millisecondsSinceEpoch) / 1000; | ||
| 1271 | + endDay = (DateTime.parse(timeStrEnd).millisecondsSinceEpoch) / 1000; | ||
| 1272 | + return startDay.floor().toString() + "-" + endDay.floor().toString(); | ||
| 1273 | + } | ||
| 1274 | + | ||
| 1275 | + //获取预订(原来普通预订和宴会预订) | ||
| 1276 | + _getReserveListAndFeastData(context, params, showloading) async { | ||
| 1277 | + UserModel userModel = Provider.of<UserModel>(context, listen: false); | ||
| 1278 | + SetXuanTaiModel setXuanTaiModel = xuantaiData[xuantaiSelIndex]; | ||
| 1279 | + String timeStrStart = ''; | ||
| 1280 | + String timeStrEnd = ''; | ||
| 1281 | + String hmsS = " ${setXuanTaiModel.startDate}:00"; //起始 | ||
| 1282 | + String hmsE = " ${setXuanTaiModel.endDate}:59"; //结束 | ||
| 1283 | + timeStrStart = setXuanTaiModel.dateTimext.year.toString() + | ||
| 1284 | + "-" + | ||
| 1285 | + Utils.addZeroNumber(setXuanTaiModel.dateTimext.month) + | ||
| 1286 | + "-" + | ||
| 1287 | + Utils.addZeroNumber(setXuanTaiModel.dateTimext.day) + | ||
| 1288 | + hmsS; | ||
| 1289 | + timeStrEnd = setXuanTaiModel.dateTimext.year.toString() + | ||
| 1290 | + "-" + | ||
| 1291 | + Utils.addZeroNumber(setXuanTaiModel.dateTimext.month) + | ||
| 1292 | + "-" + | ||
| 1293 | + Utils.addZeroNumber(setXuanTaiModel.dateTimext.day) + | ||
| 1294 | + hmsE; | ||
| 1295 | + String start = | ||
| 1296 | + (DateUtil.getDateMsByTimeStr(timeStrStart) / 1000).floor().toString(); | ||
| 1297 | + String end = | ||
| 1298 | + (DateUtil.getDateMsByTimeStr(timeStrEnd) / 1000).floor().toString(); | ||
| 1299 | + | ||
| 1300 | + Map<String, String> banquetmap = { | ||
| 1301 | + 'sid': userModel.user.sellerid, | ||
| 1302 | + 'rdate': '${start}', | ||
| 1303 | + 'edate': '${end}', | ||
| 1304 | + // 'ddate_interval': widget.ddate_slot | ||
| 1305 | + }; | ||
| 1306 | + return await Future.wait<bool>([ | ||
| 1307 | + _getOldReserve(context, params, showloading), | ||
| 1308 | + _chooseTableModel.getBanquetByDate(context, banquetmap, | ||
| 1309 | + showLoading: showloading) | ||
| 1310 | + ]).then((results) { | ||
| 1311 | + if (results[0] && results[1]) { | ||
| 1312 | + //成功 | ||
| 1313 | + return true; | ||
| 1314 | + } else { | ||
| 1315 | + if (!results[0]) { | ||
| 1316 | + // Utils.showToast(''); | ||
| 1317 | + } else { | ||
| 1318 | + // Utils.showToast(''); | ||
| 1319 | + } | ||
| 1320 | + return false; | ||
| 1321 | + } | ||
| 1322 | + }).catchError((e) { | ||
| 1323 | + print(e); | ||
| 1324 | + return false; | ||
| 1325 | + }); | ||
| 1326 | + } | ||
| 1327 | + | ||
| 1328 | + Future<bool> _getOldReserve(context, params, showloading) async { | ||
| 1329 | + NoteBookModel model = new NoteBookModel(); | ||
| 1330 | + noteBooks = | ||
| 1331 | + await model.getReserveList(context, params, needLoading: showloading); | ||
| 1332 | + return true; | ||
| 1333 | + } | ||
| 1334 | + | ||
| 1335 | + List<TableOuter> getSpTableList() { | ||
| 1336 | + String tableList = App.sp.getString('table_list'); | ||
| 1337 | + if (tableList == null) { | ||
| 1338 | + return []; | ||
| 1339 | + } | ||
| 1340 | + List<TableOuter> temp = []; | ||
| 1341 | + List list = json.decode(tableList); | ||
| 1342 | + if (list.length > 0) { | ||
| 1343 | + list.forEach((element) { | ||
| 1344 | + temp.add(TableOuter.fromJson2(element)); | ||
| 1345 | + }); | ||
| 1346 | + } | ||
| 1347 | + | ||
| 1348 | + return temp; | ||
| 1349 | + } | ||
| 1350 | + | ||
| 1351 | + //获取桌位列表 | ||
| 1352 | + _getTableList({needLoading = true}) async { | ||
| 1353 | + UserModel userModel = Provider.of<UserModel>(context, listen: false); | ||
| 1354 | + Map<String, String> params = {"sellerid": userModel.user.sellerid}; | ||
| 1355 | + | ||
| 1356 | + String tableSp = App.sp.getString('table_list'); | ||
| 1357 | + | ||
| 1358 | + if (tableSp == null) { | ||
| 1359 | + //接口请求桌位 | ||
| 1360 | + tableOuterList = await _chooseTableModel.getTableList(context, params, | ||
| 1361 | + needLoading: needLoading); | ||
| 1362 | + } else { | ||
| 1363 | + tableOuterList = getSpTableList(); | ||
| 1364 | + } | ||
| 1365 | + | ||
| 1366 | + _chooseTableModel.tablesAll = []; | ||
| 1367 | + | ||
| 1368 | + for (TableOuter item in tableOuterList) { | ||
| 1369 | + // if (item.name == "推荐") { | ||
| 1370 | + // itemModelList.remove(item); | ||
| 1371 | + // } | ||
| 1372 | + for (var item1 in item.list) { | ||
| 1373 | + item1.selected = false; | ||
| 1374 | + } | ||
| 1375 | + _chooseTableModel.tablesAll.addAll(item.list); | ||
| 1376 | + } | ||
| 1377 | + | ||
| 1378 | + if (tableOuterList.isEmpty) { | ||
| 1379 | + // _chooseTableModel.pageState = PageState.Success; | ||
| 1380 | + // _chooseTableModel.notifyListeners(); | ||
| 1381 | + } else { | ||
| 1382 | + _getReserveList(needLoading: needLoading); | ||
| 1383 | + } | ||
| 1384 | + // if (_chooseTableModel.pageState == PageState.Success) { | ||
| 1385 | + | ||
| 1386 | + // } | ||
| 1387 | + } | ||
| 1388 | + | ||
| 1389 | + //获取已预订列表 | ||
| 1390 | + _getReserveList({needLoading = true}) async { | ||
| 1391 | + Map<String, String> params = { | ||
| 1392 | + "sid": Provider.of<UserModel>(context, listen: false).user.sellerid, | ||
| 1393 | + "rdate": _getRdateGetNotebook(), | ||
| 1394 | + // "ddate_solt": widget.ddate_slot, | ||
| 1395 | + "y": "200", | ||
| 1396 | + "x": "1", | ||
| 1397 | + "keywords": "", | ||
| 1398 | + "sort": "1" | ||
| 1399 | + }; | ||
| 1400 | + | ||
| 1401 | + params['source'] = '1'; | ||
| 1402 | + | ||
| 1403 | + bool success = | ||
| 1404 | + await _getReserveListAndFeastData(context, params, needLoading); | ||
| 1405 | + if (success) { | ||
| 1406 | + List<FeastBoardModel> banquetByDateDataTemp = []; //转换为桌子id为key,data为value | ||
| 1407 | + _chooseTableModel.banquetByDateData.forEach((element) { | ||
| 1408 | + _chooseTableModel.tablesAll.forEach((table) { | ||
| 1409 | + if (table.name == element.title) { | ||
| 1410 | + FeastBoardModel feastBoardModel = FeastBoardModel(); | ||
| 1411 | + feastBoardModel.title = table.id; | ||
| 1412 | + feastBoardModel.data = element.data; | ||
| 1413 | + banquetByDateDataTemp.add(feastBoardModel); | ||
| 1414 | + } | ||
| 1415 | + }); | ||
| 1416 | + }); | ||
| 1417 | + | ||
| 1418 | + Map<String, List<FeastBoardSunModel>> banquetData = {}; | ||
| 1419 | + banquetByDateDataTemp.forEach((element) { | ||
| 1420 | + List<FeastBoardSunModel> data = []; | ||
| 1421 | + if (element.data['其他'].length > 0) { | ||
| 1422 | + FeastBoardSunModel feastBoardSunModel = element.data['其他'][0]; | ||
| 1423 | + if (feastBoardSunModel.lost == null || | ||
| 1424 | + feastBoardSunModel.lost == '') { | ||
| 1425 | + data.add(feastBoardSunModel); //未丢单宴会合集 | ||
| 1426 | + } | ||
| 1427 | + } | ||
| 1428 | + if (element.data['早餐'].length > 0) { | ||
| 1429 | + FeastBoardSunModel feastBoardSunModel = element.data['早餐'][0]; | ||
| 1430 | + if (feastBoardSunModel.lost == null || | ||
| 1431 | + feastBoardSunModel.lost == '') { | ||
| 1432 | + data.add(feastBoardSunModel); //未丢单宴会合集 | ||
| 1433 | + } | ||
| 1434 | + } | ||
| 1435 | + if (element.data['午餐'].length > 0) { | ||
| 1436 | + FeastBoardSunModel feastBoardSunModel = element.data['午餐'][0]; | ||
| 1437 | + if (feastBoardSunModel.lost == null || | ||
| 1438 | + feastBoardSunModel.lost == '') { | ||
| 1439 | + data.add(feastBoardSunModel); //未丢单宴会合集 | ||
| 1440 | + } | ||
| 1441 | + } | ||
| 1442 | + if (element.data['晚餐'].length > 0) { | ||
| 1443 | + FeastBoardSunModel feastBoardSunModel = element.data['晚餐'][0]; | ||
| 1444 | + if (feastBoardSunModel.lost == null || | ||
| 1445 | + feastBoardSunModel.lost == '') { | ||
| 1446 | + data.add(feastBoardSunModel); //未丢单宴会合集 | ||
| 1447 | + } | ||
| 1448 | + } | ||
| 1449 | + if (!banquetData.containsKey(element.title)) { | ||
| 1450 | + banquetData[element.title] = data; | ||
| 1451 | + } | ||
| 1452 | + }); | ||
| 1453 | + | ||
| 1454 | + // List<String> tidsWidget = xuantaiData[xuantaiSelIndex] | ||
| 1455 | + // .tableList | ||
| 1456 | + // .map((element) => element.id) | ||
| 1457 | + // .toList(); | ||
| 1458 | + // print(tidsWidget); | ||
| 1459 | + banquetData.forEach((key, value) { | ||
| 1460 | + value.forEach((element) { | ||
| 1461 | + //未丢单的宴会 | ||
| 1462 | + | ||
| 1463 | + // if (!tidsWidget.contains(key)) { | ||
| 1464 | + //带过来的桌子,不能标记已预订,或者已经有宴会 | ||
| 1465 | + Notebook notebook = Notebook(); | ||
| 1466 | + notebook.tid = key; | ||
| 1467 | + notebook.status = '10'; //宴会类型 | ||
| 1468 | + notebook.className = element.className; | ||
| 1469 | + notebook.id = element.rid; | ||
| 1470 | + notebook.rname = element.rname; | ||
| 1471 | + notebook.nick_name = element.nickName ?? element.account; | ||
| 1472 | + noteBooks.add(notebook); | ||
| 1473 | + // } | ||
| 1474 | + | ||
| 1475 | + print(noteBooks); | ||
| 1476 | + }); | ||
| 1477 | + }); | ||
| 1478 | + for (Notebook notebook in noteBooks) { | ||
| 1479 | + if (notebook.tid.isEmpty) continue; | ||
| 1480 | + if (notebook.status == "1" || | ||
| 1481 | + notebook.status == "2" || | ||
| 1482 | + notebook.status == "5" || | ||
| 1483 | + notebook.status == "10") { | ||
| 1484 | + //已预订,用餐中,已安排 | ||
| 1485 | + List<String> tids = notebook.tid.split(","); | ||
| 1486 | + for (String tid in tids) { | ||
| 1487 | + tableMap["$tid"] = notebook; | ||
| 1488 | + } | ||
| 1489 | + } | ||
| 1490 | + } | ||
| 1491 | + | ||
| 1492 | + // List<Notebook> noteBooks = | ||
| 1493 | + // await newGetReserveList(context, params, showLoading: showloading); | ||
| 1494 | + List<t.TableList> tempSelectTables = []; | ||
| 1495 | + tempSelectTables.addAll(xuantaiData[xuantaiSelIndex].tableList); | ||
| 1496 | + String msg = ''; | ||
| 1497 | + for (Notebook notebook in noteBooks) { | ||
| 1498 | + if (notebook.tid.isEmpty) continue; | ||
| 1499 | + | ||
| 1500 | + //已预订,用餐中,已安排 | ||
| 1501 | + List<String> tids = notebook.tid.split(","); | ||
| 1502 | + for (String tid in tids) { | ||
| 1503 | + if (notebook.status == "1" || | ||
| 1504 | + notebook.status == "2" || | ||
| 1505 | + notebook.status == "5" || | ||
| 1506 | + notebook.status == "10") { | ||
| 1507 | + tableMap["$tid"] = notebook; | ||
| 1508 | + | ||
| 1509 | + ///预订按钮点击的时候提醒已经被预订的桌子 | ||
| 1510 | + /// | ||
| 1511 | + if (xuantaiData[xuantaiSelIndex].tableList.length > 0) { | ||
| 1512 | + for (t.TableList item in xuantaiData[xuantaiSelIndex].tableList) { | ||
| 1513 | + // if (item.isMerge == '1') { | ||
| 1514 | + // // (tids.contains(item.tids)) | ||
| 1515 | + // List<String> mergetids = item.tids.split(','); | ||
| 1516 | + // outerloop: | ||
| 1517 | + // for (int i = 0; i < mergetids.length; i++) { | ||
| 1518 | + // String mergetid = mergetids[i]; | ||
| 1519 | + // if (tids.contains(mergetid)) { | ||
| 1520 | + // msg += '${item.name},'; | ||
| 1521 | + // tempSelectTables.remove(item); | ||
| 1522 | + // break outerloop; | ||
| 1523 | + // } | ||
| 1524 | + // } | ||
| 1525 | + // } | ||
| 1526 | + if (item.id == tid) { | ||
| 1527 | + msg += '${item.name},'; | ||
| 1528 | + tempSelectTables.remove(item); | ||
| 1529 | + xuantaiData[xuantaiSelIndex] | ||
| 1530 | + .tids | ||
| 1531 | + .removeWhere((element) => element.tid == tid); | ||
| 1532 | + } | ||
| 1533 | + } | ||
| 1534 | + } | ||
| 1535 | + } | ||
| 1536 | + } | ||
| 1537 | + // if (xuantaiData[xuantaiSelIndex].tableList.length > 0 && | ||
| 1538 | + // notebook.status == "1" || | ||
| 1539 | + // notebook.status == "2" || | ||
| 1540 | + // notebook.status == "5" || | ||
| 1541 | + // notebook.status == "10") { | ||
| 1542 | + // outerloop: | ||
| 1543 | + // for (t.TableList item in xuantaiData[xuantaiSelIndex].tableList) { | ||
| 1544 | + // if (item.isMerge == '1') { | ||
| 1545 | + // // (tids.contains(item.tids)) | ||
| 1546 | + // List<String> mergetids = item.tids.split(','); | ||
| 1547 | + | ||
| 1548 | + // for (int i = 0; i < mergetids.length; i++) { | ||
| 1549 | + // String mergetid = mergetids[i]; | ||
| 1550 | + // if (tids.contains(mergetid)) { | ||
| 1551 | + // msg += '${item.name},'; | ||
| 1552 | + // tempSelectTables.remove(item); | ||
| 1553 | + // break outerloop; | ||
| 1554 | + // } | ||
| 1555 | + // } | ||
| 1556 | + // } | ||
| 1557 | + // } | ||
| 1558 | + // } | ||
| 1559 | + } | ||
| 1560 | + if (msg != '' && xuantaiData[xuantaiSelIndex].tableList.length > 0) { | ||
| 1561 | + if (msg.endsWith(',')) { | ||
| 1562 | + msg = msg.substring(0, msg.length - 1); | ||
| 1563 | + } | ||
| 1564 | + xuantaiData[xuantaiSelIndex].tableList = tempSelectTables; | ||
| 1565 | + Utils.showToast('${msg}已被预订,请选择其他桌位!'); | ||
| 1566 | + print(tableMap); | ||
| 1567 | + | ||
| 1568 | + xuantaiData[xuantaiSelIndex].tableSum = 0; | ||
| 1569 | + | ||
| 1570 | + xuantaiData[xuantaiSelIndex].tids.forEach((element) { | ||
| 1571 | + xuantaiData[xuantaiSelIndex].tableSum += int.parse( | ||
| 1572 | + element.numStr == '' || element.numStr == null | ||
| 1573 | + ? '0' | ||
| 1574 | + : element.numStr); | ||
| 1575 | + }); | ||
| 1576 | + | ||
| 1577 | + setState(() {}); | ||
| 1578 | + // initData(needKeep: needKeep); | ||
| 1579 | + | ||
| 1580 | + // notifyListeners(); | ||
| 1581 | + return false; | ||
| 1582 | + } | ||
| 1583 | + | ||
| 1584 | + // print(tableMap); | ||
| 1585 | + } | ||
| 1586 | + return true; | ||
| 1587 | + } | ||
| 1588 | + | ||
| 1228 | /// 选台保存接口 | 1589 | /// 选台保存接口 |
| 1229 | Future<bool> xtSave() async { | 1590 | Future<bool> xtSave() async { |
| 1230 | //判断非空选项,并弹窗提醒用户填写信息 | 1591 | //判断非空选项,并弹窗提醒用户填写信息 |
| @@ -1245,7 +1606,8 @@ class _FeastCreatePageState extends State<FeastCreatePage> { | @@ -1245,7 +1606,8 @@ class _FeastCreatePageState extends State<FeastCreatePage> { | ||
| 1245 | canRequest = false; | 1606 | canRequest = false; |
| 1246 | break outerloop; | 1607 | break outerloop; |
| 1247 | } | 1608 | } |
| 1248 | - if (element.cdShow == '不带餐' && element.qsDateShow == '暂未选择') { | 1609 | + // if (element.cdShow == '不带餐' && element.qsDateShow == '暂未选择') { |
| 1610 | + if (element.qsDateShow == '暂未选择') { | ||
| 1249 | Utils.showToast('请选择${reserveOrder}起始时间'); | 1611 | Utils.showToast('请选择${reserveOrder}起始时间'); |
| 1250 | canRequest = false; | 1612 | canRequest = false; |
| 1251 | break outerloop; | 1613 | break outerloop; |
| @@ -1658,13 +2020,19 @@ class _FeastCreatePageState extends State<FeastCreatePage> { | @@ -1658,13 +2020,19 @@ class _FeastCreatePageState extends State<FeastCreatePage> { | ||
| 1658 | .then((day) async { | 2020 | .then((day) async { |
| 1659 | if (day != null) { | 2021 | if (day != null) { |
| 1660 | setState(() { | 2022 | setState(() { |
| 1661 | - xuantaiData[xuantaiSelIndex].tids = []; | ||
| 1662 | - xuantaiData[xuantaiSelIndex].tableList = []; | ||
| 1663 | - xuantaiData[xuantaiSelIndex].tableSum = 0; | 2023 | + // xuantaiData[xuantaiSelIndex].tids = []; |
| 2024 | + // xuantaiData[xuantaiSelIndex].tableList = []; | ||
| 2025 | + // xuantaiData[xuantaiSelIndex].tableSum = 0; | ||
| 1664 | xuantaiData[xuantaiSelIndex].dateTimext = day; | 2026 | xuantaiData[xuantaiSelIndex].dateTimext = day; |
| 1665 | xuantaiData[xuantaiSelIndex].dateTimeShowxt = | 2027 | xuantaiData[xuantaiSelIndex].dateTimeShowxt = |
| 1666 | createDateText(context, day); | 2028 | createDateText(context, day); |
| 1667 | }); | 2029 | }); |
| 2030 | + if (xuantaiData[xuantaiSelIndex].startDate != '' && | ||
| 2031 | + xuantaiData[xuantaiSelIndex].endDate != '' && | ||
| 2032 | + xuantaiData[xuantaiSelIndex].tableList != | ||
| 2033 | + null) { | ||
| 2034 | + _getTableList(); | ||
| 2035 | + } | ||
| 1668 | } | 2036 | } |
| 1669 | }); | 2037 | }); |
| 1670 | }), | 2038 | }), |
| @@ -1677,9 +2045,9 @@ class _FeastCreatePageState extends State<FeastCreatePage> { | @@ -1677,9 +2045,9 @@ class _FeastCreatePageState extends State<FeastCreatePage> { | ||
| 1677 | return item.title; | 2045 | return item.title; |
| 1678 | }).toList(), (value) { | 2046 | }).toList(), (value) { |
| 1679 | if (value != null) { | 2047 | if (value != null) { |
| 1680 | - xuantaiData[xuantaiSelIndex].tids = []; | ||
| 1681 | - xuantaiData[xuantaiSelIndex].tableList = []; | ||
| 1682 | - xuantaiData[xuantaiSelIndex].tableSum = 0; | 2048 | + // xuantaiData[xuantaiSelIndex].tids = []; |
| 2049 | + // xuantaiData[xuantaiSelIndex].tableList = []; | ||
| 2050 | + // xuantaiData[xuantaiSelIndex].tableSum = 0; | ||
| 1683 | setState(() { | 2051 | setState(() { |
| 1684 | xuantaiData[xuantaiSelIndex].cdSelIndex = | 2052 | xuantaiData[xuantaiSelIndex].cdSelIndex = |
| 1685 | value.first; | 2053 | value.first; |
| @@ -1703,16 +2071,22 @@ class _FeastCreatePageState extends State<FeastCreatePage> { | @@ -1703,16 +2071,22 @@ class _FeastCreatePageState extends State<FeastCreatePage> { | ||
| 1703 | }), | 2071 | }), |
| 1704 | _selectWidget( | 2072 | _selectWidget( |
| 1705 | '起始时间', xuantaiData[xuantaiSelIndex].qsDateShow, | 2073 | '起始时间', xuantaiData[xuantaiSelIndex].qsDateShow, |
| 1706 | - need: xuantaiData[xuantaiSelIndex].cdShow == '不带餐' | ||
| 1707 | - ? true | ||
| 1708 | - : false, onTap: () { | 2074 | + // need: xuantaiData[xuantaiSelIndex].cdShow == '不带餐' |
| 2075 | + // ? true | ||
| 2076 | + // : false, | ||
| 2077 | + need: true, onTap: () { | ||
| 1709 | FocusScope.of(context).requestFocus(FocusNode()); //隐藏键盘 | 2078 | FocusScope.of(context).requestFocus(FocusNode()); //隐藏键盘 |
| 1710 | 2079 | ||
| 1711 | SetTimeWidget.init.showFeastTimeSelector( | 2080 | SetTimeWidget.init.showFeastTimeSelector( |
| 1712 | context, | 2081 | context, |
| 1713 | SetTimeWidget.init.getFeastDateData('00:00-23:30'), | 2082 | SetTimeWidget.init.getFeastDateData('00:00-23:30'), |
| 1714 | - xuantaiData[xuantaiSelIndex].startDate, | ||
| 1715 | - xuantaiData[xuantaiSelIndex].endDate, (value) { | 2083 | + xuantaiData[xuantaiSelIndex].startDate == '' |
| 2084 | + ? '8:00' | ||
| 2085 | + : xuantaiData[xuantaiSelIndex].startDate, | ||
| 2086 | + xuantaiData[xuantaiSelIndex].endDate == '' | ||
| 2087 | + ? '8:00' | ||
| 2088 | + : xuantaiData[xuantaiSelIndex].endDate, | ||
| 2089 | + (value) { | ||
| 1716 | if (value != null) { | 2090 | if (value != null) { |
| 1717 | xuantaiData[xuantaiSelIndex].startDate = | 2091 | xuantaiData[xuantaiSelIndex].startDate = |
| 1718 | SetTimeWidget.init.getSelectTitle(value[0]); | 2092 | SetTimeWidget.init.getSelectTitle(value[0]); |
| @@ -1723,6 +2097,14 @@ class _FeastCreatePageState extends State<FeastCreatePage> { | @@ -1723,6 +2097,14 @@ class _FeastCreatePageState extends State<FeastCreatePage> { | ||
| 1723 | '-' + | 2097 | '-' + |
| 1724 | xuantaiData[xuantaiSelIndex].endDate; | 2098 | xuantaiData[xuantaiSelIndex].endDate; |
| 1725 | setState(() {}); | 2099 | setState(() {}); |
| 2100 | + if (xuantaiData[xuantaiSelIndex].startDate != '' && | ||
| 2101 | + xuantaiData[xuantaiSelIndex].endDate != '' && | ||
| 2102 | + xuantaiData[xuantaiSelIndex].dateTimeShowxt != | ||
| 2103 | + '请选择' && | ||
| 2104 | + xuantaiData[xuantaiSelIndex].tableList != | ||
| 2105 | + null) { | ||
| 2106 | + _getTableList(); | ||
| 2107 | + } | ||
| 1726 | } | 2108 | } |
| 1727 | }); | 2109 | }); |
| 1728 | // DialogUtil.showSelectCusmanDialog( | 2110 | // DialogUtil.showSelectCusmanDialog( |
| @@ -1855,19 +2237,28 @@ class _FeastCreatePageState extends State<FeastCreatePage> { | @@ -1855,19 +2237,28 @@ class _FeastCreatePageState extends State<FeastCreatePage> { | ||
| 1855 | ), | 2237 | ), |
| 1856 | onChanged: (value) { | 2238 | onChanged: (value) { |
| 1857 | print('ggg'); | 2239 | print('ggg'); |
| 2240 | + print(value); | ||
| 2241 | + | ||
| 1858 | xuantaiData[xuantaiSelIndex] | 2242 | xuantaiData[xuantaiSelIndex] |
| 1859 | .tableSum = 0; | 2243 | .tableSum = 0; |
| 1860 | for (Tids item | 2244 | for (Tids item |
| 1861 | in xuantaiData[ | 2245 | in xuantaiData[ |
| 1862 | xuantaiSelIndex] | 2246 | xuantaiSelIndex] |
| 1863 | .tids) { | 2247 | .tids) { |
| 2248 | + item.numStr = | ||
| 2249 | + item.tableNumC.text; | ||
| 1864 | xuantaiData[xuantaiSelIndex] | 2250 | xuantaiData[xuantaiSelIndex] |
| 1865 | .tableSum += | 2251 | .tableSum += |
| 1866 | int.parse(item | 2252 | int.parse(item |
| 1867 | - .tableNumC.text); | 2253 | + .tableNumC |
| 2254 | + .text == | ||
| 2255 | + '' | ||
| 2256 | + ? '0' | ||
| 2257 | + : item.tableNumC | ||
| 2258 | + .text); | ||
| 2259 | + | ||
| 2260 | + setState(() {}); | ||
| 1868 | } | 2261 | } |
| 1869 | - | ||
| 1870 | - setState(() {}); | ||
| 1871 | }, | 2262 | }, |
| 1872 | onEditingComplete: () { | 2263 | onEditingComplete: () { |
| 1873 | // print('fff'); | 2264 | // print('fff'); |
| @@ -1906,23 +2297,42 @@ class _FeastCreatePageState extends State<FeastCreatePage> { | @@ -1906,23 +2297,42 @@ class _FeastCreatePageState extends State<FeastCreatePage> { | ||
| 1906 | .color_E6000000, | 2297 | .color_E6000000, |
| 1907 | rTitle: "删除", | 2298 | rTitle: "删除", |
| 1908 | rCallback: () { | 2299 | rCallback: () { |
| 1909 | - if (xuantaiData[ | ||
| 1910 | - xuantaiSelIndex] | ||
| 1911 | - .tableSum > | ||
| 1912 | - 0) { | 2300 | + if (xuantaiData[xuantaiSelIndex] |
| 2301 | + .tableSum > | ||
| 2302 | + 0 && | ||
| 2303 | + xuantaiData[xuantaiSelIndex] | ||
| 2304 | + .tids[index] | ||
| 2305 | + .tableNumC | ||
| 2306 | + .text != | ||
| 2307 | + '') { | ||
| 1913 | xuantaiData[xuantaiSelIndex] | 2308 | xuantaiData[xuantaiSelIndex] |
| 1914 | .tableSum -= | 2309 | .tableSum -= |
| 1915 | int.parse(xuantaiData[ | 2310 | int.parse(xuantaiData[ |
| 1916 | - xuantaiSelIndex] | ||
| 1917 | - .tids[index] | ||
| 1918 | - .tableNumC | ||
| 1919 | - .text); | 2311 | + xuantaiSelIndex] |
| 2312 | + .tids[index] | ||
| 2313 | + .tableNumC | ||
| 2314 | + .text == | ||
| 2315 | + '' | ||
| 2316 | + ? '0' | ||
| 2317 | + : xuantaiData[ | ||
| 2318 | + xuantaiSelIndex] | ||
| 2319 | + .tids[index] | ||
| 2320 | + .tableNumC | ||
| 2321 | + .text); | ||
| 1920 | } | 2322 | } |
| 1921 | 2323 | ||
| 1922 | xuantaiData[xuantaiSelIndex] | 2324 | xuantaiData[xuantaiSelIndex] |
| 2325 | + .tableList | ||
| 2326 | + .removeWhere((element) => | ||
| 2327 | + element.id == | ||
| 2328 | + xuantaiData[ | ||
| 2329 | + xuantaiSelIndex] | ||
| 2330 | + .tids[index] | ||
| 2331 | + .tid); | ||
| 2332 | + xuantaiData[xuantaiSelIndex] | ||
| 1923 | .tids | 2333 | .tids |
| 1924 | .removeAt(index); | 2334 | .removeAt(index); |
| 1925 | - print('eeeeeee'); | 2335 | + |
| 1926 | setState(() {}); | 2336 | setState(() {}); |
| 1927 | // _delGuestInfocDay(model.cday[index].id); | 2337 | // _delGuestInfocDay(model.cday[index].id); |
| 1928 | }); | 2338 | }); |
| @@ -1950,121 +2360,172 @@ class _FeastCreatePageState extends State<FeastCreatePage> { | @@ -1950,121 +2360,172 @@ class _FeastCreatePageState extends State<FeastCreatePage> { | ||
| 1950 | onPressed: () async { | 2360 | onPressed: () async { |
| 1951 | FocusScope.of(context) | 2361 | FocusScope.of(context) |
| 1952 | .requestFocus(FocusNode()); //点击空白处隐藏键盘 | 2362 | .requestFocus(FocusNode()); //点击空白处隐藏键盘 |
| 2363 | + if (xuantaiData[xuantaiSelIndex] | ||
| 2364 | + .dateTimeShowxt == | ||
| 2365 | + '请选择') { | ||
| 2366 | + Utils.showToast('请选择宴会日期'); | ||
| 2367 | + return; | ||
| 2368 | + } | ||
| 1953 | if (xuantaiData[xuantaiSelIndex].cdShow == | 2369 | if (xuantaiData[xuantaiSelIndex].cdShow == |
| 1954 | '请选择') { | 2370 | '请选择') { |
| 1955 | Utils.showToast('请选择餐段'); | 2371 | Utils.showToast('请选择餐段'); |
| 1956 | return; | 2372 | return; |
| 1957 | } | 2373 | } |
| 2374 | + if (xuantaiData[xuantaiSelIndex].qsDateShow == | ||
| 2375 | + '暂未选择') { | ||
| 2376 | + Utils.showToast('请选择起始时间'); | ||
| 2377 | + return; | ||
| 2378 | + } | ||
| 1958 | 2379 | ||
| 1959 | - if (xuantaiData[xuantaiSelIndex].cdShow == | ||
| 1960 | - '不带餐') { | ||
| 1961 | - Map temp = {}; | ||
| 1962 | - if (xuantaiData[xuantaiSelIndex] | ||
| 1963 | - .tableList != | ||
| 1964 | - null && | ||
| 1965 | - xuantaiData[xuantaiSelIndex] | ||
| 1966 | - .tableList | ||
| 1967 | - .length > | ||
| 1968 | - 0) { | ||
| 1969 | - temp = await NavigatorUtil | ||
| 1970 | - .goFeastSelectTablePage(context, | ||
| 1971 | - object: { | ||
| 1972 | - 'object': | ||
| 1973 | - xuantaiData[xuantaiSelIndex] | ||
| 1974 | - .tableList | ||
| 1975 | - }); | ||
| 1976 | - } else { | ||
| 1977 | - temp = await NavigatorUtil | ||
| 1978 | - .goFeastSelectTablePage( | ||
| 1979 | - context, | ||
| 1980 | - ); | ||
| 1981 | - } | 2380 | + // if (xuantaiData[xuantaiSelIndex].cdShow == |
| 2381 | + // '不带餐') { | ||
| 2382 | + // Map temp = {}; | ||
| 2383 | + // if (xuantaiData[xuantaiSelIndex] | ||
| 2384 | + // .tableList != | ||
| 2385 | + // null && | ||
| 2386 | + // xuantaiData[xuantaiSelIndex] | ||
| 2387 | + // .tableList | ||
| 2388 | + // .length > | ||
| 2389 | + // 0) { | ||
| 2390 | + // temp = await NavigatorUtil | ||
| 2391 | + // .goFeastSelectTablePage(context, | ||
| 2392 | + // object: { | ||
| 2393 | + // 'object': | ||
| 2394 | + // xuantaiData[xuantaiSelIndex] | ||
| 2395 | + // .tableList | ||
| 2396 | + // }); | ||
| 2397 | + // } else { | ||
| 2398 | + // temp = await NavigatorUtil | ||
| 2399 | + // .goFeastSelectTablePage( | ||
| 2400 | + // context, | ||
| 2401 | + // ); | ||
| 2402 | + // } | ||
| 2403 | + | ||
| 2404 | + // if (temp == null) { | ||
| 2405 | + // } else if (temp['object'].length == 0) { | ||
| 2406 | + // } else { | ||
| 2407 | + // xuantaiData[xuantaiSelIndex].tids = []; | ||
| 2408 | + // xuantaiData[xuantaiSelIndex].tableList = | ||
| 2409 | + // temp['object']; | ||
| 2410 | + | ||
| 2411 | + // for (t.TableList item | ||
| 2412 | + // in xuantaiData[xuantaiSelIndex] | ||
| 2413 | + // .tableList) { | ||
| 2414 | + // item.selected = true; | ||
| 2415 | + // Tids tids = Tids(); | ||
| 2416 | + // tids.tid = item.id; | ||
| 2417 | + // tids.name = item.name ?? ""; | ||
| 2418 | + // xuantaiData[xuantaiSelIndex] | ||
| 2419 | + // .tids | ||
| 2420 | + // .add(tids); | ||
| 2421 | + // } | ||
| 2422 | + // setState(() {}); | ||
| 2423 | + // } | ||
| 2424 | + // } else { | ||
| 2425 | + // if (xuantaiData[xuantaiSelIndex] | ||
| 2426 | + // .dateTimeShowxt == | ||
| 2427 | + // '请选择') { | ||
| 2428 | + // Utils.showToast('请选择宴会日期'); | ||
| 2429 | + // return; | ||
| 2430 | + // } | ||
| 2431 | + //带餐 | ||
| 2432 | + int ddate = xuantaiData[xuantaiSelIndex] | ||
| 2433 | + .dateTimext | ||
| 2434 | + .millisecondsSinceEpoch; | ||
| 2435 | + String ddateSolt = dsoltList[ | ||
| 2436 | + xuantaiData[xuantaiSelIndex] | ||
| 2437 | + .cdSelIndex] | ||
| 2438 | + .id; | ||
| 1982 | 2439 | ||
| 1983 | - if (temp == null) { | ||
| 1984 | - } else if (temp['object'].length == 0) { | ||
| 1985 | - } else { | ||
| 1986 | - xuantaiData[xuantaiSelIndex].tids = []; | ||
| 1987 | - xuantaiData[xuantaiSelIndex].tableList = | ||
| 1988 | - temp['object']; | ||
| 1989 | - | ||
| 1990 | - for (t.TableList item | ||
| 1991 | - in xuantaiData[xuantaiSelIndex] | ||
| 1992 | - .tableList) { | ||
| 1993 | - item.selected = true; | ||
| 1994 | - Tids tids = Tids(); | ||
| 1995 | - tids.tid = item.id; | ||
| 1996 | - tids.name = item.name ?? ""; | ||
| 1997 | - xuantaiData[xuantaiSelIndex] | ||
| 1998 | - .tids | ||
| 1999 | - .add(tids); | ||
| 2000 | - } | ||
| 2001 | - setState(() {}); | ||
| 2002 | - } | 2440 | + Map temp = {}; |
| 2441 | + if (xuantaiData[xuantaiSelIndex].tableList != | ||
| 2442 | + null && | ||
| 2443 | + xuantaiData[xuantaiSelIndex] | ||
| 2444 | + .tableList | ||
| 2445 | + .length > | ||
| 2446 | + 0) { | ||
| 2447 | + temp = | ||
| 2448 | + await NavigatorUtil.goSelectTableFPage( | ||
| 2449 | + context, '', ddate, ddateSolt, | ||
| 2450 | + canChoose: true, | ||
| 2451 | + hmS: xuantaiData[xuantaiSelIndex] | ||
| 2452 | + .startDate, | ||
| 2453 | + hmE: xuantaiData[xuantaiSelIndex] | ||
| 2454 | + .endDate, | ||
| 2455 | + source: '1', | ||
| 2456 | + ridFeast: | ||
| 2457 | + xuantaiData[xuantaiSelIndex] | ||
| 2458 | + .rid, | ||
| 2459 | + object: { | ||
| 2460 | + 'object': xuantaiData[xuantaiSelIndex] | ||
| 2461 | + .tableList | ||
| 2462 | + }); | ||
| 2003 | } else { | 2463 | } else { |
| 2004 | - if (xuantaiData[xuantaiSelIndex] | ||
| 2005 | - .dateTimeShowxt == | ||
| 2006 | - '请选择') { | ||
| 2007 | - Utils.showToast('请选择宴会日期'); | ||
| 2008 | - return; | ||
| 2009 | - } | ||
| 2010 | - //带餐 | ||
| 2011 | - int ddate = xuantaiData[xuantaiSelIndex] | ||
| 2012 | - .dateTimext | ||
| 2013 | - .millisecondsSinceEpoch; | ||
| 2014 | - String ddateSolt = dsoltList[ | ||
| 2015 | - xuantaiData[xuantaiSelIndex] | ||
| 2016 | - .cdSelIndex] | ||
| 2017 | - .id; | 2464 | + temp = |
| 2465 | + await NavigatorUtil.goSelectTableFPage( | ||
| 2466 | + context, | ||
| 2467 | + '', | ||
| 2468 | + ddate, | ||
| 2469 | + ddateSolt, | ||
| 2470 | + hmS: xuantaiData[xuantaiSelIndex] | ||
| 2471 | + .startDate, | ||
| 2472 | + hmE: xuantaiData[xuantaiSelIndex].endDate, | ||
| 2473 | + source: '1', | ||
| 2474 | + ridFeast: | ||
| 2475 | + xuantaiData[xuantaiSelIndex].rid, | ||
| 2476 | + canChoose: true, | ||
| 2477 | + ); | ||
| 2478 | + } | ||
| 2018 | 2479 | ||
| 2019 | - Map temp = {}; | ||
| 2020 | - if (xuantaiData[xuantaiSelIndex] | ||
| 2021 | - .tableList != | ||
| 2022 | - null && | ||
| 2023 | - xuantaiData[xuantaiSelIndex] | ||
| 2024 | - .tableList | ||
| 2025 | - .length > | ||
| 2026 | - 0) { | ||
| 2027 | - temp = await NavigatorUtil | ||
| 2028 | - .goSelectTableFPage( | ||
| 2029 | - context, '', ddate, ddateSolt, | ||
| 2030 | - canChoose: true, | ||
| 2031 | - object: { | ||
| 2032 | - 'object': | ||
| 2033 | - xuantaiData[xuantaiSelIndex] | ||
| 2034 | - .tableList | ||
| 2035 | - }); | ||
| 2036 | - } else { | ||
| 2037 | - temp = await NavigatorUtil | ||
| 2038 | - .goSelectTableFPage( | ||
| 2039 | - context, | ||
| 2040 | - '', | ||
| 2041 | - ddate, | ||
| 2042 | - ddateSolt, | ||
| 2043 | - canChoose: true, | ||
| 2044 | - ); | ||
| 2045 | - } | 2480 | + if (temp == null) { |
| 2481 | + } else if (temp['object'].length == 0) { | ||
| 2482 | + print('----------'); | ||
| 2483 | + xuantaiData[xuantaiSelIndex].tableList = []; | ||
| 2484 | + xuantaiData[xuantaiSelIndex].tids = []; | ||
| 2485 | + xuantaiData[xuantaiSelIndex].tableSum = 0; | ||
| 2046 | 2486 | ||
| 2047 | - if (temp == null) { | ||
| 2048 | - } else if (temp['object'].length == 0) { | ||
| 2049 | - } else { | ||
| 2050 | - xuantaiData[xuantaiSelIndex].tids = []; | ||
| 2051 | - xuantaiData[xuantaiSelIndex].tableList = | ||
| 2052 | - temp['object']; | ||
| 2053 | - | ||
| 2054 | - for (t.TableList item | ||
| 2055 | - in xuantaiData[xuantaiSelIndex] | ||
| 2056 | - .tableList) { | ||
| 2057 | - item.selected = true; | ||
| 2058 | - Tids tids = Tids(); | ||
| 2059 | - tids.tid = item.id; | ||
| 2060 | - tids.name = item.name ?? ""; | ||
| 2061 | - xuantaiData[xuantaiSelIndex] | ||
| 2062 | - .tids | ||
| 2063 | - .add(tids); | 2487 | + setState(() {}); |
| 2488 | + } else { | ||
| 2489 | + // xuantaiData[xuantaiSelIndex].tids = []; | ||
| 2490 | + xuantaiData[xuantaiSelIndex].tableList = | ||
| 2491 | + temp['object']; | ||
| 2492 | + xuantaiData[xuantaiSelIndex].tableSum = 0; | ||
| 2493 | + List<Tids> tidsTemp = []; | ||
| 2494 | + for (t.TableList item | ||
| 2495 | + in xuantaiData[xuantaiSelIndex] | ||
| 2496 | + .tableList) { | ||
| 2497 | + item.selected = true; | ||
| 2498 | + | ||
| 2499 | + Tids tids = Tids(); | ||
| 2500 | + tids.tid = item.id; | ||
| 2501 | + tids.name = item.name ?? ""; | ||
| 2502 | + List<Tids> temp = | ||
| 2503 | + xuantaiData[xuantaiSelIndex] | ||
| 2504 | + .tids | ||
| 2505 | + .where((element) => | ||
| 2506 | + element.tid == tids.tid) | ||
| 2507 | + .toList(); | ||
| 2508 | + if (temp != null && temp.length > 0) { | ||
| 2509 | + tids.numStr = temp[0].tableNumC.text; | ||
| 2510 | + tids.tableNumC.text = temp[0].numStr; | ||
| 2064 | } | 2511 | } |
| 2065 | - setState(() {}); | 2512 | + tidsTemp.add(tids); |
| 2066 | } | 2513 | } |
| 2514 | + xuantaiData[xuantaiSelIndex].tids = | ||
| 2515 | + tidsTemp; | ||
| 2516 | + xuantaiData[xuantaiSelIndex] | ||
| 2517 | + .tids | ||
| 2518 | + .forEach((element) { | ||
| 2519 | + xuantaiData[xuantaiSelIndex].tableSum += | ||
| 2520 | + int.parse(element.numStr == '' || | ||
| 2521 | + element.numStr == null | ||
| 2522 | + ? '0' | ||
| 2523 | + : element.numStr); | ||
| 2524 | + }); | ||
| 2525 | + | ||
| 2526 | + setState(() {}); | ||
| 2067 | } | 2527 | } |
| 2528 | + // } | ||
| 2068 | }, | 2529 | }, |
| 2069 | ), | 2530 | ), |
| 2070 | VEmptyView(52), | 2531 | VEmptyView(52), |
| @@ -3224,7 +3685,10 @@ class _FeastCreatePageState extends State<FeastCreatePage> { | @@ -3224,7 +3685,10 @@ class _FeastCreatePageState extends State<FeastCreatePage> { | ||
| 3224 | total = sum + double.parse(costInfoModel.serviceC.text); | 3685 | total = sum + double.parse(costInfoModel.serviceC.text); |
| 3225 | } else { | 3686 | } else { |
| 3226 | //选中百分比 | 3687 | //选中百分比 |
| 3227 | - if (int.parse(costInfoModel.serviceC.text) > 100) { | 3688 | + if (int.parse(costInfoModel.serviceC.text == '' |
| 3689 | + ? '0' | ||
| 3690 | + : costInfoModel.serviceC.text) > | ||
| 3691 | + 100) { | ||
| 3228 | Utils.showToast('请输入小于100的数字'); | 3692 | Utils.showToast('请输入小于100的数字'); |
| 3229 | 3693 | ||
| 3230 | return; | 3694 | return; |
| @@ -3251,7 +3715,10 @@ class _FeastCreatePageState extends State<FeastCreatePage> { | @@ -3251,7 +3715,10 @@ class _FeastCreatePageState extends State<FeastCreatePage> { | ||
| 3251 | total -= double.parse(costInfoModel.discountC.text); | 3715 | total -= double.parse(costInfoModel.discountC.text); |
| 3252 | } else { | 3716 | } else { |
| 3253 | //选中百分比 | 3717 | //选中百分比 |
| 3254 | - if (int.parse(costInfoModel.discountC.text) > 100) { | 3718 | + if (int.parse(costInfoModel.discountC.text == '' |
| 3719 | + ? '0' | ||
| 3720 | + : costInfoModel.discountC.text) > | ||
| 3721 | + 100) { | ||
| 3255 | Utils.showToast('请输入小于100的数字'); | 3722 | Utils.showToast('请输入小于100的数字'); |
| 3256 | 3723 | ||
| 3257 | return; | 3724 | return; |
| @@ -4646,6 +5113,8 @@ class _FeastCreatePageState extends State<FeastCreatePage> { | @@ -4646,6 +5113,8 @@ class _FeastCreatePageState extends State<FeastCreatePage> { | ||
| 4646 | userModel = Provider.of<UserModel>(context, listen: false); | 5113 | userModel = Provider.of<UserModel>(context, listen: false); |
| 4647 | _uploadImageProvider = | 5114 | _uploadImageProvider = |
| 4648 | Provider.of<UploadImageProvider>(context, listen: true); | 5115 | Provider.of<UploadImageProvider>(context, listen: true); |
| 5116 | + | ||
| 5117 | + _chooseTableModel = Provider.of<ChooseTableModel>(context, listen: false); | ||
| 4649 | return KeyboardDismissOnTap( | 5118 | return KeyboardDismissOnTap( |
| 4650 | child: Scaffold( | 5119 | child: Scaffold( |
| 4651 | backgroundColor: MyColours.color_ffffff, | 5120 | backgroundColor: MyColours.color_ffffff, |
| @@ -87,7 +87,7 @@ class _MessageHasOrderFoodPageState extends State<MessageHasOrderFoodPage> { | @@ -87,7 +87,7 @@ class _MessageHasOrderFoodPageState extends State<MessageHasOrderFoodPage> { | ||
| 87 | sumMemberPrice += double.parse( | 87 | sumMemberPrice += double.parse( |
| 88 | element.specMemberPrice == '0' || element.specMemberPrice == null | 88 | element.specMemberPrice == '0' || element.specMemberPrice == null |
| 89 | ? element.specPrice == null | 89 | ? element.specPrice == null |
| 90 | - ? 0 | 90 | + ? '0' |
| 91 | : element.specPrice | 91 | : element.specPrice |
| 92 | : element.specMemberPrice); | 92 | : element.specMemberPrice); |
| 93 | }); | 93 | }); |
| @@ -499,8 +499,7 @@ class _MessageHasOrderFoodPageState extends State<MessageHasOrderFoodPage> { | @@ -499,8 +499,7 @@ class _MessageHasOrderFoodPageState extends State<MessageHasOrderFoodPage> { | ||
| 499 | Utils.goShareOrderFoodToWeChat(context, | 499 | Utils.goShareOrderFoodToWeChat(context, |
| 500 | rid: widget.rid, | 500 | rid: widget.rid, |
| 501 | title: '菜品已点好,快来看看都点了什么~', | 501 | title: '菜品已点好,快来看看都点了什么~', |
| 502 | - oid: _orderFoodProvider | ||
| 503 | - .createdOrderSunModel.id, | 502 | + oid: _orderFoodProvider.createdOrderSunModel.id, |
| 504 | img: | 503 | img: |
| 505 | 'http://nosqn.colorcun.com/reserve/images/%E5%BE%AE%E4%BF%A1%E5%9B%BE%E7%89%87_201911151148571.jpg'); | 504 | 'http://nosqn.colorcun.com/reserve/images/%E5%BE%AE%E4%BF%A1%E5%9B%BE%E7%89%87_201911151148571.jpg'); |
| 506 | }, | 505 | }, |
| @@ -671,27 +671,27 @@ class TableManagerModel with ChangeNotifier { | @@ -671,27 +671,27 @@ class TableManagerModel with ChangeNotifier { | ||
| 671 | String hmsS = ''; //起始 | 671 | String hmsS = ''; //起始 |
| 672 | String hmsE = ''; //结束 | 672 | String hmsE = ''; //结束 |
| 673 | String keys = ''; | 673 | String keys = ''; |
| 674 | - // if (currTimeIndex == 1) { | ||
| 675 | - // //早市 | ||
| 676 | - // keys = 'morning'; | ||
| 677 | - // } else if (currTimeIndex == 2) { | ||
| 678 | - // //午市 | ||
| 679 | - // keys = 'noon'; | ||
| 680 | - // } else if (currTimeIndex == 3) { | ||
| 681 | - // //晚市 | ||
| 682 | - // keys = 'night'; | ||
| 683 | - // } | 674 | + if (currTimeIndex == 1) { |
| 675 | + //早市 | ||
| 676 | + keys = 'morning'; | ||
| 677 | + } else if (currTimeIndex == 2) { | ||
| 678 | + //午市 | ||
| 679 | + keys = 'noon'; | ||
| 680 | + } else if (currTimeIndex == 3) { | ||
| 681 | + //晚市 | ||
| 682 | + keys = 'night'; | ||
| 683 | + } | ||
| 684 | 684 | ||
| 685 | - // if (keys != '') { | ||
| 686 | - // List temp = dailyMap[keys]; | ||
| 687 | - // hmsS = " ${temp.first}:00"; | ||
| 688 | - // hmsE = " ${temp.last}:59"; | ||
| 689 | - // } else { | ||
| 690 | - // hmsS = " 00:00:00"; | ||
| 691 | - // hmsE = " 23:59:59"; | ||
| 692 | - // } | ||
| 693 | - hmsS = " 00:00:00"; | ||
| 694 | - hmsE = " 23:59:59"; | 685 | + if (keys != '') { |
| 686 | + List temp = dailyMap[keys]; | ||
| 687 | + hmsS = " ${temp.first}:00"; | ||
| 688 | + hmsE = " ${temp.last}:59"; | ||
| 689 | + } else { | ||
| 690 | + hmsS = " 00:00:00"; | ||
| 691 | + hmsE = " 23:59:59"; | ||
| 692 | + } | ||
| 693 | + // hmsS = " 00:00:00"; | ||
| 694 | + // hmsE = " 23:59:59"; | ||
| 695 | 695 | ||
| 696 | UserModel userModel = Provider.of<UserModel>(context, listen: false); | 696 | UserModel userModel = Provider.of<UserModel>(context, listen: false); |
| 697 | String timeStrStart = dateTime.year.toString() + | 697 | String timeStrStart = dateTime.year.toString() + |
| @@ -716,7 +716,7 @@ class TableManagerModel with ChangeNotifier { | @@ -716,7 +716,7 @@ class TableManagerModel with ChangeNotifier { | ||
| 716 | 'sid': userModel.user.sellerid, | 716 | 'sid': userModel.user.sellerid, |
| 717 | 'rdate': '${start}', | 717 | 'rdate': '${start}', |
| 718 | 'edate': '${end}', | 718 | 'edate': '${end}', |
| 719 | - 'ddate_interval': currTimeIndex.toString() | 719 | + // 'ddate_interval': currTimeIndex.toString() |
| 720 | }; | 720 | }; |
| 721 | return await Future.wait<bool>([ | 721 | return await Future.wait<bool>([ |
| 722 | _getOldReserve(context, params, showloading, selfDismiss: selfDismiss), | 722 | _getOldReserve(context, params, showloading, selfDismiss: selfDismiss), |
| @@ -788,28 +788,61 @@ class TableManagerModel with ChangeNotifier { | @@ -788,28 +788,61 @@ class TableManagerModel with ChangeNotifier { | ||
| 788 | }); | 788 | }); |
| 789 | }); | 789 | }); |
| 790 | // banquetByDateData.map((e) => null) | 790 | // banquetByDateData.map((e) => null) |
| 791 | - String banquetKey = ''; | ||
| 792 | - if (currTimeIndex == 1) { | ||
| 793 | - banquetKey = '早餐'; | ||
| 794 | - } else if (currTimeIndex == 2) { | ||
| 795 | - banquetKey = '午餐'; | ||
| 796 | - } else if (currTimeIndex == 3) { | ||
| 797 | - banquetKey = '晚餐'; | ||
| 798 | - } | 791 | + // String banquetKey = ''; |
| 792 | + // if (currTimeIndex == 1) { | ||
| 793 | + // banquetKey = '早餐'; | ||
| 794 | + // } else if (currTimeIndex == 2) { | ||
| 795 | + // banquetKey = '午餐'; | ||
| 796 | + // } else if (currTimeIndex == 3) { | ||
| 797 | + // banquetKey = '晚餐'; | ||
| 798 | + // } | ||
| 799 | + | ||
| 800 | + Map<String, List<FeastBoardSunModel>> banquetData = {}; | ||
| 799 | banquetByDateDataTemp.forEach((element) { | 801 | banquetByDateDataTemp.forEach((element) { |
| 800 | - FeastBoardSunModel feastBoardSunModel = element.data[banquetKey][0]; | ||
| 801 | - if (feastBoardSunModel.lost == null || feastBoardSunModel.lost == '') { | 802 | + List<FeastBoardSunModel> data = []; |
| 803 | + if (element.data['其他'].length > 0) { | ||
| 804 | + FeastBoardSunModel feastBoardSunModel = element.data['其他'][0]; | ||
| 805 | + if (feastBoardSunModel.lost == null || | ||
| 806 | + feastBoardSunModel.lost == '') { | ||
| 807 | + data.add(feastBoardSunModel); //未丢单宴会合集 | ||
| 808 | + } | ||
| 809 | + } | ||
| 810 | + if (element.data['早餐'].length > 0) { | ||
| 811 | + FeastBoardSunModel feastBoardSunModel = element.data['早餐'][0]; | ||
| 812 | + if (feastBoardSunModel.lost == null || | ||
| 813 | + feastBoardSunModel.lost == '') { | ||
| 814 | + data.add(feastBoardSunModel); //未丢单宴会合集 | ||
| 815 | + } | ||
| 816 | + } | ||
| 817 | + if (element.data['午餐'].length > 0) { | ||
| 818 | + FeastBoardSunModel feastBoardSunModel = element.data['午餐'][0]; | ||
| 819 | + if (feastBoardSunModel.lost == null || | ||
| 820 | + feastBoardSunModel.lost == '') { | ||
| 821 | + data.add(feastBoardSunModel); //未丢单宴会合集 | ||
| 822 | + } | ||
| 823 | + } | ||
| 824 | + if (element.data['晚餐'].length > 0) { | ||
| 825 | + FeastBoardSunModel feastBoardSunModel = element.data['晚餐'][0]; | ||
| 826 | + if (feastBoardSunModel.lost == null || | ||
| 827 | + feastBoardSunModel.lost == '') { | ||
| 828 | + data.add(feastBoardSunModel); //未丢单宴会合集 | ||
| 829 | + } | ||
| 830 | + } | ||
| 831 | + | ||
| 832 | + banquetData[element.title] = data; | ||
| 833 | + }); | ||
| 834 | + banquetData.forEach((key, value) { | ||
| 835 | + value.forEach((element) { | ||
| 802 | //未丢单的宴会 | 836 | //未丢单的宴会 |
| 803 | Notebook notebook = Notebook(); | 837 | Notebook notebook = Notebook(); |
| 804 | - notebook.tid = element.title; | 838 | + notebook.tid = key; |
| 805 | notebook.status = '10'; //宴会类型 | 839 | notebook.status = '10'; //宴会类型 |
| 806 | - notebook.className = feastBoardSunModel.className; | ||
| 807 | - notebook.id = feastBoardSunModel.rid; | ||
| 808 | - notebook.rname = feastBoardSunModel.rname; | ||
| 809 | - notebook.nick_name = | ||
| 810 | - feastBoardSunModel.nickName ?? feastBoardSunModel.account; | 840 | + notebook.className = element.className; |
| 841 | + notebook.id = element.rid; | ||
| 842 | + notebook.rname = element.rname; | ||
| 843 | + notebook.nick_name = element.nickName ?? element.account; | ||
| 811 | noteBooks.add(notebook); | 844 | noteBooks.add(notebook); |
| 812 | - } | 845 | + }); |
| 813 | }); | 846 | }); |
| 814 | 847 | ||
| 815 | // List<Notebook> noteBooks = | 848 | // List<Notebook> noteBooks = |
| @@ -140,14 +140,18 @@ class NavigatorUtil { | @@ -140,14 +140,18 @@ class NavigatorUtil { | ||
| 140 | {bool canChoose = false, | 140 | {bool canChoose = false, |
| 141 | Map object, | 141 | Map object, |
| 142 | String fromPage = 'change', | 142 | String fromPage = 'change', |
| 143 | - String tid = ''}) { | 143 | + String hmS, |
| 144 | + String hmE, | ||
| 145 | + String source, | ||
| 146 | + String tid = '', | ||
| 147 | + String ridFeast}) { | ||
| 144 | if (object != null) { | 148 | if (object != null) { |
| 145 | return _navigateTo(context, | 149 | return _navigateTo(context, |
| 146 | - "${Routes.select_table_f}?rid=$rid&tid=$tid&dateTime=$dateTime&fromPage=$fromPage&ddate_slot=$ddate_slot&canChoose=$canChoose&object=${FluroConvertUtils.object2string(object)}"); | 150 | + "${Routes.select_table_f}?rid=$rid&ridFeast=$ridFeast&tid=$tid&dateTime=$dateTime&fromPage=$fromPage&ddate_slot=$ddate_slot&canChoose=$canChoose&object=${FluroConvertUtils.object2string(object)}&hmS=$hmS&hmE=$hmE&source=$source"); |
| 147 | } | 151 | } |
| 148 | // object = {'object': [], "tid": ''}; | 152 | // object = {'object': [], "tid": ''}; |
| 149 | return _navigateTo(context, | 153 | return _navigateTo(context, |
| 150 | - "${Routes.select_table_f}?rid=$rid&tid=$tid&dateTime=$dateTime&fromPage=$fromPage&ddate_slot=$ddate_slot&canChoose=$canChoose"); | 154 | + "${Routes.select_table_f}?rid=$rid&ridFeast=$ridFeast&tid=$tid&dateTime=$dateTime&fromPage=$fromPage&ddate_slot=$ddate_slot&canChoose=$canChoose&hmS=$hmS&hmE=$hmE&source=$source"); |
| 151 | } | 155 | } |
| 152 | 156 | ||
| 153 | /// 邀请函 | 157 | /// 邀请函 |
| @@ -374,9 +374,13 @@ var handleSelectTableFHandler = new Handler( | @@ -374,9 +374,13 @@ var handleSelectTableFHandler = new Handler( | ||
| 374 | String tid = params['tid'].first; | 374 | String tid = params['tid'].first; |
| 375 | DateTime dateTime = | 375 | DateTime dateTime = |
| 376 | DateTime.fromMillisecondsSinceEpoch(int.parse(params["dateTime"].first)); | 376 | DateTime.fromMillisecondsSinceEpoch(int.parse(params["dateTime"].first)); |
| 377 | - String ddate_slot = params["ddate_slot"].first; | 377 | + String ddateSlot = params["ddate_slot"].first; |
| 378 | + String source = params["source"].first; | ||
| 379 | + | ||
| 378 | String fromPage = params["fromPage"].first; | 380 | String fromPage = params["fromPage"].first; |
| 379 | bool canChoose = params["canChoose"].first == "true" ? true : false; | 381 | bool canChoose = params["canChoose"].first == "true" ? true : false; |
| 382 | + String hmS = params["hmS"].first; | ||
| 383 | + String hmE = params["hmE"].first; | ||
| 380 | List<TableList> res = []; | 384 | List<TableList> res = []; |
| 381 | if (params.keys.contains('object')) { | 385 | if (params.keys.contains('object')) { |
| 382 | Map object = FluroConvertUtils.string2map(params["object"].first); | 386 | Map object = FluroConvertUtils.string2map(params["object"].first); |
| @@ -387,11 +391,20 @@ var handleSelectTableFHandler = new Handler( | @@ -387,11 +391,20 @@ var handleSelectTableFHandler = new Handler( | ||
| 387 | } | 391 | } |
| 388 | } | 392 | } |
| 389 | 393 | ||
| 394 | + String ridFeast = params["ridFeast"].first; | ||
| 395 | + | ||
| 390 | // return SelectTablePage(rid, dateTime, ddate_slot,canChoose: canChoose); | 396 | // return SelectTablePage(rid, dateTime, ddate_slot,canChoose: canChoose); |
| 391 | return ChangeNotifierProvider<ChooseTableModel>( | 397 | return ChangeNotifierProvider<ChooseTableModel>( |
| 392 | create: (_) => ChooseTableModel(), | 398 | create: (_) => ChooseTableModel(), |
| 393 | - child: SelectTableFPage(rid, dateTime, ddate_slot, | ||
| 394 | - canChoose: canChoose, tableList: res, fromPage: fromPage, tid: tid)); | 399 | + child: SelectTableFPage(rid, dateTime, ddateSlot, |
| 400 | + canChoose: canChoose, | ||
| 401 | + tableList: res, | ||
| 402 | + fromPage: fromPage, | ||
| 403 | + tid: tid, | ||
| 404 | + hmS: hmS, | ||
| 405 | + hmE: hmE, | ||
| 406 | + source: source, | ||
| 407 | + ridFeast: ridFeast)); | ||
| 395 | }); | 408 | }); |
| 396 | 409 | ||
| 397 | // 跳转到照片管理的选择桌位_方硕新修改的页面 | 410 | // 跳转到照片管理的选择桌位_方硕新修改的页面 |
| @@ -1535,12 +1548,17 @@ var feastCreatePageHandle = new Handler( | @@ -1535,12 +1548,17 @@ var feastCreatePageHandle = new Handler( | ||
| 1535 | String rid = params["rid"].first; | 1548 | String rid = params["rid"].first; |
| 1536 | return ChangeNotifierProvider<FeastModel>( | 1549 | return ChangeNotifierProvider<FeastModel>( |
| 1537 | create: (_) => FeastModel(), | 1550 | create: (_) => FeastModel(), |
| 1538 | - child: FeastCreatePage( | ||
| 1539 | - banquetDetail: banquetDetail, isCreate: isCreate, rid: rid)); | 1551 | + child: ChangeNotifierProvider<ChooseTableModel>( |
| 1552 | + create: (_) => ChooseTableModel(), | ||
| 1553 | + child: FeastCreatePage( | ||
| 1554 | + banquetDetail: banquetDetail, isCreate: isCreate, rid: rid))); | ||
| 1540 | } | 1555 | } |
| 1541 | return ChangeNotifierProvider<FeastModel>( | 1556 | return ChangeNotifierProvider<FeastModel>( |
| 1542 | create: (_) => FeastModel(), | 1557 | create: (_) => FeastModel(), |
| 1543 | - child: FeastCreatePage(banquetDetail: banquetDetail, isCreate: isCreate)); | 1558 | + child: ChangeNotifierProvider<ChooseTableModel>( |
| 1559 | + create: (_) => ChooseTableModel(), | ||
| 1560 | + child: FeastCreatePage( | ||
| 1561 | + banquetDetail: banquetDetail, isCreate: isCreate))); | ||
| 1544 | }); | 1562 | }); |
| 1545 | 1563 | ||
| 1546 | ///宴会----添加定金 | 1564 | ///宴会----添加定金 |
| @@ -63,6 +63,7 @@ class DialogUtil { | @@ -63,6 +63,7 @@ class DialogUtil { | ||
| 63 | backgroundColor: Colors.transparent, | 63 | backgroundColor: Colors.transparent, |
| 64 | isDismissible: true, | 64 | isDismissible: true, |
| 65 | builder: (BuildContext context) { | 65 | builder: (BuildContext context) { |
| 66 | + | ||
| 66 | return Scaffold( | 67 | return Scaffold( |
| 67 | resizeToAvoidBottomInset: false, | 68 | resizeToAvoidBottomInset: false, |
| 68 | body: Column(mainAxisSize: MainAxisSize.min, children: [ | 69 | body: Column(mainAxisSize: MainAxisSize.min, children: [ |
| @@ -154,6 +155,77 @@ class DialogUtil { | @@ -154,6 +155,77 @@ class DialogUtil { | ||
| 154 | ), | 155 | ), |
| 155 | ) | 156 | ) |
| 156 | ])); | 157 | ])); |
| 158 | + | ||
| 159 | + // return Container( | ||
| 160 | + // // height: ScreenUtil().setWidth(180 * 2), | ||
| 161 | + // decoration: BoxDecoration( | ||
| 162 | + // color: MyColours.color_DBDBDB, | ||
| 163 | + // // borderRadius: BorderRadius.only( | ||
| 164 | + // // topLeft: Radius.circular(ScreenUtil().setWidth(24)), | ||
| 165 | + // // topRight: Radius.circular(ScreenUtil().setWidth(24))) | ||
| 166 | + // ), | ||
| 167 | + // child: Row( | ||
| 168 | + // children: <Widget>[ | ||
| 169 | + // InkWell( | ||
| 170 | + // onTap: lCallback, | ||
| 171 | + // child: Container( | ||
| 172 | + // width: double.infinity, | ||
| 173 | + // height: ScreenUtil().setWidth(58 * 2), | ||
| 174 | + // child: Center( | ||
| 175 | + // child: Text( | ||
| 176 | + // '拍摄', | ||
| 177 | + // style: TextStyle( | ||
| 178 | + // fontSize: ScreenUtil().setSp(32), | ||
| 179 | + // color: MyColours.color_353535, | ||
| 180 | + // fontWeight: FontWeight.bold), | ||
| 181 | + // ), | ||
| 182 | + // )), | ||
| 183 | + // ), | ||
| 184 | + // MyDivider( | ||
| 185 | + // double.infinity, | ||
| 186 | + // ScreenUtil().setWidth(2), | ||
| 187 | + // color: MyColours.color_EEEEEE, | ||
| 188 | + // ), | ||
| 189 | + // InkWell( | ||
| 190 | + // onTap: rCallback, | ||
| 191 | + // child: Container( | ||
| 192 | + // width: double.infinity, | ||
| 193 | + // height: ScreenUtil().setWidth(58 * 2), | ||
| 194 | + // child: Center( | ||
| 195 | + // child: Text( | ||
| 196 | + // '从相册选择', | ||
| 197 | + // style: TextStyle( | ||
| 198 | + // fontSize: ScreenUtil().setSp(32), | ||
| 199 | + // color: MyColours.color_353535, | ||
| 200 | + // fontWeight: FontWeight.bold), | ||
| 201 | + // ), | ||
| 202 | + // )), | ||
| 203 | + // ), | ||
| 204 | + // MyDivider( | ||
| 205 | + // double.infinity, | ||
| 206 | + // ScreenUtil().setWidth(10), | ||
| 207 | + // color: MyColours.color_EEEEEE, | ||
| 208 | + // ), | ||
| 209 | + // InkWell( | ||
| 210 | + // onTap: () { | ||
| 211 | + // Navigator.pop(context, '取消'); | ||
| 212 | + // }, | ||
| 213 | + // child: Container( | ||
| 214 | + // width: double.infinity, | ||
| 215 | + // height: ScreenUtil().setWidth(58 * 2), | ||
| 216 | + // child: Center( | ||
| 217 | + // child: Text( | ||
| 218 | + // '取消', | ||
| 219 | + // style: TextStyle( | ||
| 220 | + // fontSize: ScreenUtil().setSp(32), | ||
| 221 | + // color: MyColours.color_353535, | ||
| 222 | + // fontWeight: FontWeight.bold), | ||
| 223 | + // ), | ||
| 224 | + // ))) | ||
| 225 | + // ], | ||
| 226 | + // ), | ||
| 227 | + // ); | ||
| 228 | + | ||
| 157 | }); | 229 | }); |
| 158 | } | 230 | } |
| 159 | 231 | ||
| @@ -5944,6 +6016,85 @@ class DialogUtil { | @@ -5944,6 +6016,85 @@ class DialogUtil { | ||
| 5944 | }); | 6016 | }); |
| 5945 | } | 6017 | } |
| 5946 | 6018 | ||
| 6019 | + static showPickerDurationSelect(BuildContext context) async { | ||
| 6020 | + final range = <DateTime>[ | ||
| 6021 | + DateTime(0, 1, 1, 8, 30), | ||
| 6022 | + DateTime(0, 1, 1, 14, 30) | ||
| 6023 | + ]; | ||
| 6024 | + final p1 = Picker( | ||
| 6025 | + adapter: DateTimePickerAdapter( | ||
| 6026 | + customColumnType: [6, 7, 4], | ||
| 6027 | + value: range[0], | ||
| 6028 | + ), | ||
| 6029 | + delimiter: [ | ||
| 6030 | + PickerDelimiter( | ||
| 6031 | + column: 0, | ||
| 6032 | + child: Container( | ||
| 6033 | + alignment: Alignment.center, | ||
| 6034 | + width: 100, | ||
| 6035 | + padding: EdgeInsets.fromLTRB(12, 0, 8, 0), | ||
| 6036 | + child: Text('Start', | ||
| 6037 | + style: TextStyle( | ||
| 6038 | + fontWeight: FontWeight.bold, | ||
| 6039 | + color: Colors.red, | ||
| 6040 | + fontSize: 14)), | ||
| 6041 | + color: Colors.white, | ||
| 6042 | + )), | ||
| 6043 | + ], | ||
| 6044 | + onSelect: (Picker picker, int index, List<int> selected) { | ||
| 6045 | + range[0] = (picker.adapter as DateTimePickerAdapter).value; | ||
| 6046 | + }, | ||
| 6047 | + onConfirmBefore: (picker, selected) async { | ||
| 6048 | + if (range[0] == null) { | ||
| 6049 | + // showMsg("Please select the start time."); | ||
| 6050 | + return false; | ||
| 6051 | + } | ||
| 6052 | + if (range[1] == null) { | ||
| 6053 | + // showMsg("Please select the end time."); | ||
| 6054 | + return false; | ||
| 6055 | + } | ||
| 6056 | + return true; | ||
| 6057 | + }, | ||
| 6058 | + onConfirm: (picker, selected) { | ||
| 6059 | + // showMsg( | ||
| 6060 | + // "Start: ${range[0].toString()}, End: ${range[1].toString()}, ${picker.adapter}"); | ||
| 6061 | + }); | ||
| 6062 | + final p2 = Picker( | ||
| 6063 | + adapter: DateTimePickerAdapter( | ||
| 6064 | + customColumnType: [6, 7, 4], | ||
| 6065 | + value: range[1], | ||
| 6066 | + ), | ||
| 6067 | + hideHeader: true, | ||
| 6068 | + delimiter: [ | ||
| 6069 | + PickerDelimiter( | ||
| 6070 | + column: 0, | ||
| 6071 | + child: Container( | ||
| 6072 | + alignment: Alignment.center, | ||
| 6073 | + padding: EdgeInsets.fromLTRB(12, 0, 8, 0), | ||
| 6074 | + width: 100, | ||
| 6075 | + child: Text('End', | ||
| 6076 | + style: TextStyle( | ||
| 6077 | + fontWeight: FontWeight.bold, | ||
| 6078 | + color: Colors.red, | ||
| 6079 | + fontSize: 14)), | ||
| 6080 | + color: Colors.white, | ||
| 6081 | + )), | ||
| 6082 | + ], | ||
| 6083 | + onSelect: (Picker picker, int index, List<int> selected) { | ||
| 6084 | + range[1] = (picker.adapter as DateTimePickerAdapter).value; | ||
| 6085 | + }); | ||
| 6086 | + await showModalBottomSheet( | ||
| 6087 | + context: context, | ||
| 6088 | + backgroundColor: Colors.transparent, | ||
| 6089 | + isDismissible: false, | ||
| 6090 | + builder: (BuildContext context) { | ||
| 6091 | + return Column( | ||
| 6092 | + mainAxisSize: MainAxisSize.min, | ||
| 6093 | + children: [p1.makePicker(), p2.makePicker()], | ||
| 6094 | + ); | ||
| 6095 | + }); | ||
| 6096 | + } | ||
| 6097 | + | ||
| 5947 | //显示选择客户经理弹框 | 6098 | //显示选择客户经理弹框 |
| 5948 | static Future<List<int>> showSelectCusmanDialogNeedCustomHeader( | 6099 | static Future<List<int>> showSelectCusmanDialogNeedCustomHeader( |
| 5949 | BuildContext context, List<dynamic> data, ValueChanged valueChanged, | 6100 | BuildContext context, List<dynamic> data, ValueChanged valueChanged, |
| @@ -5953,6 +6104,8 @@ class DialogUtil { | @@ -5953,6 +6104,8 @@ class DialogUtil { | ||
| 5953 | VoidCallback onCancel, | 6104 | VoidCallback onCancel, |
| 5954 | String cancelText = '取消'}) { | 6105 | String cancelText = '取消'}) { |
| 5955 | return Picker( | 6106 | return Picker( |
| 6107 | + // changeToFirst: true, | ||
| 6108 | + looping: true, | ||
| 5956 | selecteds: selecteds, | 6109 | selecteds: selecteds, |
| 5957 | adapter: PickerDataAdapter<String>(pickerdata: data), | 6110 | adapter: PickerDataAdapter<String>(pickerdata: data), |
| 5958 | height: ScreenUtil().setWidth(480), | 6111 | height: ScreenUtil().setWidth(480), |
| @@ -6029,6 +6182,15 @@ class DialogUtil { | @@ -6029,6 +6182,15 @@ class DialogUtil { | ||
| 6029 | width: ScreenUtil().setWidth(2), | 6182 | width: ScreenUtil().setWidth(2), |
| 6030 | color: MyColours.color_E7E7E7))), | 6183 | color: MyColours.color_E7E7E7))), |
| 6031 | ), | 6184 | ), |
| 6185 | + onSelect: (Picker picker, int index, List<int> selecteds) { | ||
| 6186 | + print(selecteds); | ||
| 6187 | + print(index); | ||
| 6188 | + print(picker); | ||
| 6189 | + // picker.selecteds = [selecteds[0],selecteds[0]]; | ||
| 6190 | + // this.setState(() { | ||
| 6191 | + // // stateText = picker.adapter.toString(); | ||
| 6192 | + // }); | ||
| 6193 | + }, | ||
| 6032 | onCancel: onCancel, | 6194 | onCancel: onCancel, |
| 6033 | onConfirm: (Picker picker, List value) { | 6195 | onConfirm: (Picker picker, List value) { |
| 6034 | print(value.toString()); | 6196 | print(value.toString()); |
| @@ -7083,7 +7245,9 @@ class DialogUtil { | @@ -7083,7 +7245,9 @@ class DialogUtil { | ||
| 7083 | color: MyColours.color_E6000000)), | 7245 | color: MyColours.color_E6000000)), |
| 7084 | onPressed: () { | 7246 | onPressed: () { |
| 7085 | Navigator.of(context).pop(); | 7247 | Navigator.of(context).pop(); |
| 7086 | - lCallback(); | 7248 | + if (lCallback != null) { |
| 7249 | + lCallback(); | ||
| 7250 | + } | ||
| 7087 | }, | 7251 | }, |
| 7088 | ), | 7252 | ), |
| 7089 | CupertinoDialogAction( | 7253 | CupertinoDialogAction( |
| @@ -165,6 +165,7 @@ class SetTimeWidget { | @@ -165,6 +165,7 @@ class SetTimeWidget { | ||
| 165 | 165 | ||
| 166 | showFeastTimeSelector( | 166 | showFeastTimeSelector( |
| 167 | context, data, start, end, SetTimeCallback setTimeCallback) { | 167 | context, data, start, end, SetTimeCallback setTimeCallback) { |
| 168 | + // DialogUtil.showPickerDurationSelect(context); | ||
| 168 | DialogUtil.showSelectCusmanDialogNeedCustomHeader(context, data, (value) { | 169 | DialogUtil.showSelectCusmanDialogNeedCustomHeader(context, data, (value) { |
| 169 | setTimeCallback(value); | 170 | setTimeCallback(value); |
| 170 | }, cancelText: '', title: '选择时间', selecteds: [ | 171 | }, cancelText: '', title: '选择时间', selecteds: [ |
-
Please register or login to post a comment