Commit f25bdcccdf257fb3e25762b14220a796f09e3872

Authored by weixin_45529955
1 parent 7937c37b

确定变更预订之前提示变更前变更后信息

@@ -111,6 +111,9 @@ class _NoteBookChangeFPageOnlyState extends State<NoteBookChangeFPageOnly> { @@ -111,6 +111,9 @@ class _NoteBookChangeFPageOnlyState extends State<NoteBookChangeFPageOnly> {
111 bool isSetOver = true; 111 bool isSetOver = true;
112 bool isReserveOver = true; 112 bool isReserveOver = true;
113 bool cancelCan = true; 113 bool cancelCan = true;
  114 +
  115 + String oldInfo = '';
  116 +
114 @override 117 @override
115 void initState() { 118 void initState() {
116 super.initState(); 119 super.initState();
@@ -307,6 +310,9 @@ class _NoteBookChangeFPageOnlyState extends State<NoteBookChangeFPageOnly> { @@ -307,6 +310,9 @@ class _NoteBookChangeFPageOnlyState extends State<NoteBookChangeFPageOnly> {
307 310
308 _notebookDetailChangeModel.initSexList(); 311 _notebookDetailChangeModel.initSexList();
309 312
  313 + DateTime createtime = DateTime.fromMillisecondsSinceEpoch(
  314 + int.parse(detailEntity!.ddate.toString() + '000'));
  315 +
310 await _initDateList(detailEntity!); //获取到订单时间 316 await _initDateList(detailEntity!); //获取到订单时间
311 currTimeIndex = int.parse(detailEntity!.ddate_solt!); 317 currTimeIndex = int.parse(detailEntity!.ddate_solt!);
312 _initData(); 318 _initData();
@@ -316,6 +322,25 @@ class _NoteBookChangeFPageOnlyState extends State<NoteBookChangeFPageOnly> { @@ -316,6 +322,25 @@ class _NoteBookChangeFPageOnlyState extends State<NoteBookChangeFPageOnly> {
316 detailEntity!.ddate_solt, 322 detailEntity!.ddate_solt,
317 detailEntity!.pnum, 323 detailEntity!.pnum,
318 detailEntity!.tables); 324 detailEntity!.tables);
  325 + oldInfo = _returnOldDayDateWeek(createtime);
  326 +
  327 + oldInfo += ' ${detailEntity!.mname!}';
  328 +
  329 + String result = '';
  330 +
  331 + detailEntity!.tables!.forEach((element) {
  332 + result += element!.name! + '、';
  333 + });
  334 +
  335 + if (result.endsWith('、')) {
  336 + result = result.substring(0, result.length - 1);
  337 + }
  338 +
  339 + oldInfo += ' ${result}';
  340 +
  341 + // oldInfo = detailEntity!.ddateYMD + detailEntity!.tableinfoStr;
  342 +
  343 + print(oldInfo);
319 } 344 }
320 345
321 /// 早市、午市、晚市对应的半个小时间隔时间段 346 /// 早市、午市、晚市对应的半个小时间隔时间段
@@ -400,6 +425,31 @@ class _NoteBookChangeFPageOnlyState extends State<NoteBookChangeFPageOnly> { @@ -400,6 +425,31 @@ class _NoteBookChangeFPageOnlyState extends State<NoteBookChangeFPageOnly> {
400 return date; 425 return date;
401 } 426 }
402 427
  428 + String _returnOldDayDateWeek(DateTime day) {
  429 + String date = '';
  430 + DateTime dateNow = DateTime.now();
  431 + dateShowNow = "";
  432 + // if (Utils.isOneDay(day, dateNow)) {
  433 + // dateShowNow = "今天 ";
  434 + // } else if (Utils.isOneDay(day, dateNow.add(Duration(days: 1)))) {
  435 + // dateShowNow = "明天 ";
  436 + // } else if (Utils.isOneDay(day, dateNow.add(Duration(days: 2)))) {
  437 + // dateShowNow = "后天 ";
  438 + // }
  439 + String ymd = "${day.year}年" +
  440 + Utils.addZeroNumber(day.month) +
  441 + "月" +
  442 + Utils.addZeroNumber(day.day) +
  443 + '日';
  444 +
  445 + date += ymd;
  446 + // date += ' ';
  447 + // date += Utils.lunarCalendarHolidays(day)!;
  448 + // date += ' ';
  449 + date += "星期${Utils.formatWeekDayNum(day.weekday)}";
  450 + return date;
  451 + }
  452 +
403 @override 453 @override
404 void dispose() { 454 void dispose() {
405 _nameNode.unfocus(); 455 _nameNode.unfocus();
@@ -2365,132 +2415,184 @@ class _NoteBookChangeFPageOnlyState extends State<NoteBookChangeFPageOnly> { @@ -2365,132 +2415,184 @@ class _NoteBookChangeFPageOnlyState extends State<NoteBookChangeFPageOnly> {
2365 return; 2415 return;
2366 } 2416 }
2367 } 2417 }
  2418 +
  2419 + //提示客户是否确定变更
  2420 +
2368 FocusScope.of(context) 2421 FocusScope.of(context)
2369 .requestFocus(FocusNode()); //点击空白处隐藏键盘 2422 .requestFocus(FocusNode()); //点击空白处隐藏键盘
2370 - print(detailEntity!.uid);  
2371 - String? times = '00:00-00:00'; 2423 +
  2424 + String newInfo = '';
  2425 +
  2426 + newInfo = _returnOldDayDateWeek(dateTime);
  2427 +
2372 //找到当前餐段对应的时间段 2428 //找到当前餐段对应的时间段
2373 int index = storeBaseIndoProvider.dayDateData! 2429 int index = storeBaseIndoProvider.dayDateData!
2374 .indexWhere((element) => 2430 .indexWhere((element) =>
2375 element.ddateSolt == 2431 element.ddateSolt ==
2376 '${currTimeIndex}'); 2432 '${currTimeIndex}');
  2433 + String mname = '';
2377 if (index != -1) { 2434 if (index != -1) {
2378 - times = storeBaseIndoProvider  
2379 - .dayDateData![index].mdate; 2435 + mname = storeBaseIndoProvider
  2436 + .dayDateData![index].mname ??
  2437 + '';
  2438 + }
  2439 +
  2440 + newInfo += ' ${mname}';
  2441 +
  2442 + String result = '';
  2443 +
  2444 + _notebookDetailChangeModel.tableListOrReserve!
  2445 + .forEach((element) {
  2446 + result += element.name! + '、';
  2447 + });
  2448 +
  2449 + if (result.endsWith('、')) {
  2450 + result =
  2451 + result.substring(0, result.length - 1);
2380 } 2452 }
2381 2453
2382 - SunReserveInfoModel? _model =  
2383 - _notebookDetailChangeModel  
2384 - .detailEntity!.type ==  
2385 - "1"  
2386 - ? //判断是否在线预订  
2387 - await _notebookDetailChangeModel  
2388 - .updateOnlineReserveInfoOnly(  
2389 - context,  
2390 - nameStr,  
2391 - detailEntity!.uid,  
2392 - currTimeIndex,  
2393 - dateTime,  
2394 - times)  
2395 - : await _notebookDetailChangeModel  
2396 - .setReserveInfoOnly(  
2397 - context,  
2398 - nameStr,  
2399 - detailEntity!.uid,  
2400 - currTimeIndex,  
2401 - dateTime,  
2402 - times);  
2403 - if (_model != null) {  
2404 - if (ObjectUtil.isNotEmpty(_model.row) ||  
2405 - ObjectUtil.isNotEmpty(_model.row!.id)) {  
2406 - print('成功');  
2407 - // _notebookDetailChangeModel.clearData();  
2408 - bus.emit("refresh_detail");  
2409 - bus.emit("refresh_book_list"); //刷新已预订列表  
2410 - if (widget.back!) {  
2411 - EventBus().emit(  
2412 - "refresh_invitaion_info"); //刷新预订安排页面  
2413 - if (Navigator.canPop(context)) {  
2414 - Navigator.pop(context); 2454 + newInfo += ' ${result}';
  2455 +
  2456 + // oldInfo = detailEntity!.ddateYMD + detailEntity!.tableinfoStr;
  2457 +
  2458 + print(newInfo);
  2459 +
  2460 + DialogUtil.cupertinoAlertDialogChangeReseve(
  2461 + context,
  2462 + title: '',
  2463 + // content1:
  2464 + // '确定要将${oldInfo}的预订 变更为 ${newInfo}?',
  2465 + contentold: oldInfo,
  2466 + contentnew: newInfo,
  2467 + lTitle: '取消',
  2468 + lCallback: () {},
  2469 + rTitle: '确定变更', rCallback: () async {
  2470 + print(detailEntity!.uid);
  2471 + String? times = '00:00-00:00';
  2472 + //找到当前餐段对应的时间段
  2473 + int index = storeBaseIndoProvider.dayDateData!
  2474 + .indexWhere((element) =>
  2475 + element.ddateSolt ==
  2476 + '${currTimeIndex}');
  2477 + if (index != -1) {
  2478 + times = storeBaseIndoProvider
  2479 + .dayDateData![index].mdate;
  2480 + }
  2481 +
  2482 + SunReserveInfoModel? _model =
  2483 + _notebookDetailChangeModel
  2484 + .detailEntity!.type ==
  2485 + "1"
  2486 + ? //判断是否在线预订
  2487 + await _notebookDetailChangeModel
  2488 + .updateOnlineReserveInfoOnly(
  2489 + context,
  2490 + nameStr,
  2491 + detailEntity!.uid,
  2492 + currTimeIndex,
  2493 + dateTime,
  2494 + times)
  2495 + : await _notebookDetailChangeModel
  2496 + .setReserveInfoOnly(
  2497 + context,
  2498 + nameStr,
  2499 + detailEntity!.uid,
  2500 + currTimeIndex,
  2501 + dateTime,
  2502 + times);
  2503 + if (_model != null) {
  2504 + if (ObjectUtil.isNotEmpty(_model.row) ||
  2505 + ObjectUtil.isNotEmpty(_model.row!.id)) {
  2506 + print('成功');
  2507 + // _notebookDetailChangeModel.clearData();
  2508 + bus.emit("refresh_detail");
  2509 + bus.emit("refresh_book_list"); //刷新已预订列表
  2510 + if (widget.back!) {
  2511 + EventBus().emit(
  2512 + "refresh_invitaion_info"); //刷新预订安排页面
  2513 + if (Navigator.canPop(context)) {
  2514 + Navigator.pop(context);
  2515 + }
  2516 + } else {
  2517 + // String ddate_solt = '';
  2518 + // if (_model.row!.isSetDdate == '1') {
  2519 + // String createtime =
  2520 + // _model.row!.ddate.toString() +
  2521 + // '000';
  2522 + // DateTime createTime =
  2523 + // DateTime.fromMillisecondsSinceEpoch(
  2524 + // int.parse(createtime));
  2525 + // // ddate_solt = DateUtil.formatDate(
  2526 + // // createTime,
  2527 + // // format: DateFormats.h_m);
  2528 + // } else {
  2529 + // // if (_model.row!.ddateSolt == '1') {
  2530 + // // ddate_solt = '早餐';
  2531 + // // } else if (_model.row!.ddateSolt ==
  2532 + // // '2') {
  2533 + // // ddate_solt = '午餐';
  2534 + // // } else if (_model.row!.ddateSolt ==
  2535 + // // '3') {
  2536 + // // ddate_solt = '晚餐';
  2537 + // // }
  2538 + // }
  2539 + List<dynamic> tableinfo = convert
  2540 + .jsonDecode(_model.row!.tableinfo!);
  2541 + print(tableinfo);
  2542 +
  2543 + // if (tableinfo.length > 1) {
  2544 + // _nameStr =
  2545 + // t.TableList.fromJson(tableinfo[0]).name +
  2546 + // '等${tableinfo.length}桌';
  2547 + // }
  2548 + String _nameStr = '';
  2549 + String _tid = '';
  2550 + for (int i = 0;
  2551 + i < tableinfo.length;
  2552 + i++) {
  2553 + _nameStr +=
  2554 + '${t.TableList.fromJson(tableinfo[i]).name},';
  2555 +
  2556 + _tid +=
  2557 + '${t.TableList.fromJson(tableinfo[i]).id},';
  2558 + }
  2559 + if (_tid.endsWith(',')) {
  2560 + _tid = _tid.substring(
  2561 + 0, _tid.length - 1);
  2562 + }
  2563 + if (_nameStr.endsWith(',')) {
  2564 + _nameStr = _nameStr.substring(
  2565 + 0, _nameStr.length - 1);
  2566 + }
  2567 + LogUtil.v(_nameStr);
  2568 + NavigatorUtil.goInvicationPage(
  2569 + context, _model.row!.id,
  2570 + // _nameStr,
  2571 + // _model.row.ddate,
  2572 + // ddate_solt,
  2573 + // _model.row.phone,
  2574 + // _model.row.ddateSolt,
  2575 + // _model.row.rname == null
  2576 + // ? ''
  2577 + // : _model.row.rname,
  2578 + // _model.row.sex == null ? '' : _model.row.sex,
  2579 + // _model.row.cusdem,
  2580 + // tid: _tid,
  2581 + replace: true);
2415 } 2582 }
  2583 + EventBus()
  2584 + .emit("refresh_tablemanager"); //刷新桌位
  2585 + EventBus()
  2586 + .emit("refresh_detail"); //刷新订座详情页
  2587 + EventBus()
  2588 + .emit("refresh_action_log"); //获取变更记录
2416 } else { 2589 } else {
2417 - // String ddate_solt = '';  
2418 - // if (_model.row!.isSetDdate == '1') {  
2419 - // String createtime =  
2420 - // _model.row!.ddate.toString() +  
2421 - // '000';  
2422 - // DateTime createTime =  
2423 - // DateTime.fromMillisecondsSinceEpoch(  
2424 - // int.parse(createtime));  
2425 - // // ddate_solt = DateUtil.formatDate(  
2426 - // // createTime,  
2427 - // // format: DateFormats.h_m);  
2428 - // } else {  
2429 - // // if (_model.row!.ddateSolt == '1') {  
2430 - // // ddate_solt = '早餐';  
2431 - // // } else if (_model.row!.ddateSolt ==  
2432 - // // '2') {  
2433 - // // ddate_solt = '午餐';  
2434 - // // } else if (_model.row!.ddateSolt ==  
2435 - // // '3') {  
2436 - // // ddate_solt = '晚餐';  
2437 - // // }  
2438 - // }  
2439 - List<dynamic> tableinfo = convert  
2440 - .jsonDecode(_model.row!.tableinfo!);  
2441 - print(tableinfo);  
2442 -  
2443 - // if (tableinfo.length > 1) {  
2444 - // _nameStr =  
2445 - // t.TableList.fromJson(tableinfo[0]).name +  
2446 - // '等${tableinfo.length}桌';  
2447 - // }  
2448 - String _nameStr = '';  
2449 - String _tid = '';  
2450 - for (int i = 0;  
2451 - i < tableinfo.length;  
2452 - i++) {  
2453 - _nameStr +=  
2454 - '${t.TableList.fromJson(tableinfo[i]).name},';  
2455 -  
2456 - _tid +=  
2457 - '${t.TableList.fromJson(tableinfo[i]).id},';  
2458 - }  
2459 - if (_tid.endsWith(',')) {  
2460 - _tid =  
2461 - _tid.substring(0, _tid.length - 1);  
2462 - }  
2463 - if (_nameStr.endsWith(',')) {  
2464 - _nameStr = _nameStr.substring(  
2465 - 0, _nameStr.length - 1);  
2466 - }  
2467 - LogUtil.v(_nameStr);  
2468 - NavigatorUtil.goInvicationPage(  
2469 - context, _model.row!.id,  
2470 - // _nameStr,  
2471 - // _model.row.ddate,  
2472 - // ddate_solt,  
2473 - // _model.row.phone,  
2474 - // _model.row.ddateSolt,  
2475 - // _model.row.rname == null  
2476 - // ? ''  
2477 - // : _model.row.rname,  
2478 - // _model.row.sex == null ? '' : _model.row.sex,  
2479 - // _model.row.cusdem,  
2480 - // tid: _tid,  
2481 - replace: true); 2590 + Utils.showToast(detailEntity!.id == "-1"
  2591 + ? "录入预订订单失败,请重试!"
  2592 + : "变更预订订单失败,请重试!");
2482 } 2593 }
2483 - EventBus()  
2484 - .emit("refresh_tablemanager"); //刷新桌位  
2485 - EventBus().emit("refresh_detail"); //刷新订座详情页  
2486 - EventBus()  
2487 - .emit("refresh_action_log"); //获取变更记录  
2488 - } else {  
2489 - Utils.showToast(detailEntity!.id == "-1"  
2490 - ? "录入预订订单失败,请重试!"  
2491 - : "变更预订订单失败,请重试!");  
2492 } 2594 }
2493 - } 2595 + });
2494 }, 2596 },
2495 ), 2597 ),
2496 HEmptyView(30), 2598 HEmptyView(30),
@@ -11821,6 +11821,89 @@ class DialogUtil { @@ -11821,6 +11821,89 @@ class DialogUtil {
11821 ); 11821 );
11822 } 11822 }
11823 11823
  11824 + static cupertinoAlertDialogChangeReseve(BuildContext context,
  11825 + {String title = "",
  11826 + String contentold = "内容",
  11827 + String contentnew = "内容",
  11828 + String lTitle = "取消",
  11829 + String rTitle = "确定",
  11830 + Color rColor = MyColours.color_438E93,
  11831 + bool isBold = false,
  11832 + bool isBoldContent = false,
  11833 + bool showlTitle = true,
  11834 + Color contentColor = MyColours.color_99000000,
  11835 + VoidCallback? lCallback,
  11836 + TextAlign textAlign = TextAlign.center,
  11837 + VoidCallback? rCallback}) {
  11838 + showCupertinoDialog(
  11839 + context: context,
  11840 + builder: (context) {
  11841 + return CupertinoAlertDialog(
  11842 + title: title != ''
  11843 + ? Text(title,
  11844 + style: TextStyle(
  11845 + fontWeight: FontWeight.bold,
  11846 + fontSize: ScreenUtil().setSp(32),
  11847 + color: MyColours.color_E6000000))
  11848 + : SizedBox(),
  11849 + content: RichText(
  11850 + text: TextSpan(
  11851 + style: TextStyle(
  11852 + fontSize: ScreenUtil().setSp(28),
  11853 + ),
  11854 + children: [
  11855 + TextSpan(
  11856 + text: '确定要将', style: TextStyle(color: contentColor)),
  11857 + TextSpan(
  11858 + text: contentold,
  11859 + style: TextStyle(color: MyColours.color_438E93)),
  11860 + TextSpan(text: '的预订变更为', style: TextStyle(color: contentColor)),
  11861 + TextSpan(
  11862 + text: contentnew,
  11863 + style: TextStyle(color: MyColours.color_438E93)),
  11864 + TextSpan(text: '?', style: TextStyle(color: contentColor)),
  11865 + ])),
  11866 + // content: Text(content,
  11867 + // textAlign: textAlign,
  11868 + // style: TextStyle(
  11869 + // fontWeight:
  11870 + // isBoldContent ? FontWeight.bold : FontWeight.normal,
  11871 + // fontSize: ScreenUtil().setSp(30),
  11872 + // color: contentColor)),
  11873 + actions: [
  11874 + if (showlTitle)
  11875 + CupertinoDialogAction(
  11876 + child: Text(lTitle,
  11877 + style: TextStyle(
  11878 + fontSize: ScreenUtil().setSp(32),
  11879 + color: MyColours.color_E6000000)),
  11880 + onPressed: () {
  11881 + Navigator.of(context).pop();
  11882 + if (lCallback != null) {
  11883 + lCallback();
  11884 + }
  11885 + },
  11886 + ),
  11887 + CupertinoDialogAction(
  11888 + child: Text(rTitle,
  11889 + style: TextStyle(
  11890 + fontWeight: isBold ? FontWeight.bold : FontWeight.normal,
  11891 + fontSize: ScreenUtil().setSp(32),
  11892 + color: rColor)),
  11893 + onPressed: () {
  11894 + Navigator.of(context).pop();
  11895 +
  11896 + if (rCallback != null) {
  11897 + rCallback();
  11898 + }
  11899 + },
  11900 + ),
  11901 + ],
  11902 + );
  11903 + },
  11904 + );
  11905 + }
  11906 +
11824 static Future festivalAlertDialog( 11907 static Future festivalAlertDialog(
11825 BuildContext context, String name, double height, 11908 BuildContext context, String name, double height,
11826 {CustomCallBack? rCallback, 11909 {CustomCallBack? rCallback,
@@ -12196,7 +12279,8 @@ class DialogUtil { @@ -12196,7 +12279,8 @@ class DialogUtil {
12196 .getYear() 12279 .getYear()
12197 .toString(); 12280 .toString();
12198 monthStr = currentLunarTime 12281 monthStr = currentLunarTime
12199 - .getMonth().abs() 12282 + .getMonth()
  12283 + .abs()
12200 .toString(); 12284 .toString();
12201 dayStr = currentLunarTime 12285 dayStr = currentLunarTime
12202 .getDay() 12286 .getDay()