notebook_detail_page.dart 56.9 KB
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073
import 'dart:convert';

import 'package:flutter/material.dart';
import 'package:flutter_picker/flutter_picker.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:one_key/constant/state.dart';
import 'package:one_key/models/manager.dart';
import 'package:one_key/models/notebook_detail.dart';
import 'package:one_key/provider/message_dialog_model.dart';
import 'package:one_key/provider/notebook_detail_model.dart';
import 'package:one_key/provider/online_check_edit_provider.dart';
import 'package:one_key/provider/user_model.dart';
import 'package:one_key/res/colors.dart';
import 'package:one_key/utils/dialog_util.dart';
import 'package:one_key/utils/event_bus.dart';
import 'package:one_key/utils/navigator_util.dart';
import 'package:one_key/utils/utils.dart';
import 'package:one_key/widgets/MyDivider.dart';
import 'package:one_key/widgets/app_bar.dart';
import 'package:one_key/widgets/common_button.dart';
import 'package:one_key/widgets/dialog.dart';
import 'package:one_key/widgets/h_empty_view.dart';
import 'package:one_key/widgets/loading.dart';
import 'package:one_key/widgets/need_item.dart';
import 'package:one_key/widgets/page_exception.dart';
import 'package:one_key/widgets/round_button.dart';
import 'package:one_key/widgets/row_multi_text.dart';
import 'package:one_key/widgets/table_item.dart';
import 'package:one_key/models/table.dart' as t;
import 'package:one_key/widgets/v_empty_view.dart';
import 'package:provider/provider.dart';

import '../../app.dart';

class NotebookDetailPage extends StatefulWidget {
  final String rid;
  final String mid;
  final bool fromNotify;

  NotebookDetailPage(this.rid, {this.fromNotify = false, this.mid});

  @override
  State<StatefulWidget> createState() {
    // TODO: implement createState
    return new NotebookDetailPageState();
  }
}

class NotebookDetailPageState extends State<NotebookDetailPage> {
  NotebookDetailModel detailModel;

  NotebookDetail detailEntity;

  String cusmanText = "";

  List<Manager> managers = []; //客户经理

  Manager manager = Manager();
  List cancelReasonList = [];
  bool isShowTF = false;
  // int paddingBottom;
  int paddingTop = 138;
  FocusNode _cancelNode = FocusNode();
  TextEditingController _cancelController = TextEditingController();
  StateSetter _cancelState;

  ScrollController _scrollController;

  String formatPhone = "";
  OnlineCheckEditProvider _onlineCheckEditProvider;

  @override
  void initState() {
    // TODO: implement initState
    super.initState();
    WidgetsBinding.instance.addPostFrameCallback((_) async {
      _initCancel();
      _getReserveDetail();
      _getOrderInfo();
      managers = await detailModel.getManagers(context);
      //添加listener监听
      //对应的TextField失去或者获取焦点都会回调此监听
      _cancelNode.addListener(() {
        if (_cancelNode.hasFocus) {
          print('得到焦点');
          paddingTop = 80;
          _scrollController.jumpTo(_scrollController.position.maxScrollExtent);
        } else {
          print('失去焦点');
          paddingTop = 138;
        }
        _cancelState(() {});
      });
      bus.on("refresh_detail", (args) {
        _getReserveDetail();
      });
    });
  }

  //设置消息状态
  setMessageStatus() {
    if (widget.mid == null || widget.mid.isEmpty) return;
    bus.emit("remove_untreated_message", widget.mid);
    Map<String, String> params = {
      "sid": Provider.of<UserModel>(context, listen: false).user.sellerid,
      "id": widget.mid,
      "status": "is_handle"
    };
    MessageDialogModel messageDialogModel =
        Provider.of<MessageDialogModel>(context, listen: false);
    messageDialogModel.setMessageStatus(context, params);
  }

  @override
  void dispose() {
    super.dispose();
    bus.off("refresh_detail");
  }

  ///获取订单详情
  _getOrderInfo() async {
    UserModel userModel = Provider.of<UserModel>(context, listen: false);
    Map<String, String> params = {"rid": widget.rid};
    //remark信息获取
    await _onlineCheckEditProvider.getOrderInfo(context, params);
  }

  ///订座详情
  _getReserveDetail() async {
    detailEntity = await detailModel.getReserveDetail(context, {
      "rid": widget.rid,
    });
    setState(() {
      cusmanText = detailEntity.cusman.isEmpty ? "请选择" : detailEntity.cusman;
      formatPhone = detailEntity.phone;
      if (App.sp.getString("is_call_tel") != null &&
          App.sp.getString("is_call_tel") == "1") {
      } else {
        if (detailEntity.phone.isNotEmpty &&
            detailEntity.phone.length == 11 &&
            (detailEntity.status == "0" || detailEntity.status == "6")) {
          formatPhone = detailEntity.phone.substring(0, 3) +
              "****" +
              detailEntity.phone.substring(7);
        }
      }
    });
    if (detailEntity.status == "4") {
      setMessageStatus();
    }
  }

  /// 初始化取消原因数据
  _initCancel() {
    isShowTF = false;
    // paddingBottom = ScreenUtil.screenHeightDp.ceil() - 138 - 340;
    cancelReasonList = [
      {'title': '顾客取消', 'select': false},
      {'title': '顾客行程有变', 'select': false},
      {'title': '信息填写有误', 'select': false},
      {'title': '操作失误', 'select': false},
      {'title': '其他原因', 'select': false},
    ];
  }

  //设置当前客户经理
  _setCurrManager() {
    manager = managers.firstWhere((manager) => manager.userName == cusmanText,
        orElse: () => Manager());
    if (manager.id == null || manager.id.toString().isEmpty) return;
    Map<String, String> params = {
      "rid": detailEntity.id,
      "cusman_id": manager.id.toString(),
      "cusman": manager.userName
    };
    detailModel.setReserveCusmnan(context, params);
  }

  ///处理在线预订
  setReserveStatus(String status, {String tid = "", String desc}) async {
    // bus.emit("remove_untreated_message",widget.mid);
    UserModel userModel = Provider.of<UserModel>(context, listen: false);
    Map<String, String> causeMap = {
      "uid": userModel.user.openid,
      "uname": userModel.user.account,
      "desc": desc,
    };
    Map<String, String> params = {
      "rid": widget.rid,
      "status": status, //5安排包间 6 拒绝订单
      "tid": tid,
      // "mid": widget.mid,
      "cause": json.encode(causeMap)
    };
    bool success =
        await detailModel.setReserveStatus(context, params, ifPush: false);
    if (success) {
      bus.emit("refresh_book_list");
      if (status == "4") {
        //取消预订
        bus.emit("refresh_tablemanager"); //刷新桌位
      }
      _getReserveDetail();
    }
  }

  /// 取消预订, 变更预订按钮
  Widget _cancelAndChangeBtn(GestureTapCallback onTap, String title,
      {Color bgColor = MyColours.color_ffffff,
      double width,
      Color fontColor = MyColours.color_199095}) {
    return InkWell(
      onTap: onTap,
      child: Container(
        width: width,
        decoration: BoxDecoration(
          color: bgColor,
          border: Border.all(
              color: Colors.transparent, width: ScreenUtil().setWidth(2)),
          borderRadius: BorderRadius.circular(ScreenUtil().setWidth(10)),
        ),
        child: Align(
          alignment: Alignment.center,
          child: Text(title,
              style: TextStyle(
                  color: fontColor, fontSize: ScreenUtil().setSp(34))),
        ),
      ),
    );
  }

  ///取消预订弹框
  _showCancelWidget(context) {
    _scrollController = ScrollController();
    showGeneralDialog(
        context: context,
        barrierDismissible: false,
        barrierLabel:
            MaterialLocalizations.of(context).modalBarrierDismissLabel,
        transitionDuration: const Duration(milliseconds: 150),
        pageBuilder: (BuildContext context, Animation animation,
            Animation secondaryAnimation) {
          return StatefulBuilder(builder: (context, state) {
            _cancelState = state;
            return GestureDetector(
              behavior: HitTestBehavior.opaque,
              // onTap: () {
              //   Navigator.of(context).pop();
              // },
              child: Container(
                decoration: BoxDecoration(
                  color: Color.fromRGBO(00, 00, 00, 0.5),
                ),
                padding: EdgeInsets.fromLTRB(
                    ScreenUtil().setWidth(50),
                    ScreenUtil().setWidth(paddingTop * 2),
                    ScreenUtil().setWidth(50),
                    ScreenUtil().setWidth(0)),
                child: Align(
                    alignment: Alignment.topCenter,
                    child: Container(
                      padding: EdgeInsets.all(ScreenUtil().setWidth(40)),
                      decoration: BoxDecoration(
                        color: Colors.white,
                        borderRadius:
                            BorderRadius.circular(ScreenUtil().setWidth(10)),
                      ),
                      child: Column(
                        mainAxisSize: MainAxisSize.min,
                        children: [
                          Stack(
                            children: [
                              Container(
                                height: ScreenUtil().setWidth(48),
                                child: Center(
                                  child: Text(
                                    '请选择取消原因',
                                    style: TextStyle(
                                        fontSize: ScreenUtil().setSp(34),
                                        fontWeight: FontWeight.bold,
                                        decoration: TextDecoration.none,
                                        color: MyColours.color_353535),
                                  ),
                                ),
                              ),
                              Positioned(
                                  top: ScreenUtil().setWidth(8),
                                  right: ScreenUtil().setWidth(0),
                                  child: GestureDetector(
                                      onTap: () {
                                        _initCancel();
                                        Navigator.of(context).pop();
                                      },
                                      child: Container(
                                        padding: EdgeInsets.only(left: 20),
                                        child: Image.asset(
                                          'assets/close.png',
                                          width: ScreenUtil().setWidth(32),
                                          height: ScreenUtil().setWidth(32),
                                        ),
                                      )))
                            ],
                          ),
                          VEmptyView(60),
                          SingleChildScrollView(
                            controller: _scrollController,
                            child: Column(
                              mainAxisSize: MainAxisSize.min,
                              children: cancelReasonList.map((value) {
                                return GestureDetector(
                                  onTap: () {
                                    for (var item in cancelReasonList) {
                                      item['select'] = false;
                                      isShowTF = false;
                                      // paddingBottom =
                                      //     ScreenUtil.screenHeightDp.ceil() -
                                      //         138 -
                                      //         340;
                                      if (item['title'] == value['title']) {
                                        item['select'] = true;
                                        if (item['title'] == '其他原因') {
                                          isShowTF = true;
                                          // paddingBottom = 130;
                                          // paddingBottom =
                                          //     ScreenUtil.screenHeightDp.ceil() -
                                          //         138 -
                                          //         340 -
                                          //         46;
                                        }
                                      }
                                    }
                                    state(() {});
                                  },
                                  child: Column(children: [
                                    Row(
                                      children: [
                                        Image.asset(
                                            value['select']
                                                ? 'assets/select.png'
                                                : 'assets/unselect.png',
                                            width: ScreenUtil().setWidth(44)),
                                        HEmptyView(30),
                                        Text(value['title'],
                                            style: TextStyle(
                                                fontSize:
                                                    ScreenUtil().setSp(32),
                                                fontWeight: FontWeight.normal,
                                                decoration: TextDecoration.none,
                                                color: MyColours.color_333333))
                                      ],
                                    ),
                                    value['title'] == '其他原因' && isShowTF
                                        ? Material(
                                            child: Container(
                                            color: Colors.white,
                                            padding: EdgeInsets.only(
                                                left:
                                                    ScreenUtil().setWidth(76)),
                                            child: TextField(
                                              maxLines: 1,
                                              controller: _cancelController,
                                              focusNode: _cancelNode,
                                              textAlignVertical:
                                                  TextAlignVertical.bottom,
                                              decoration: InputDecoration(
                                                hintText: "请填写原因",
                                                hintStyle: TextStyle(
                                                  color: MyColours.color_999999,
                                                  fontSize:
                                                      ScreenUtil().setSp(30),
                                                ),
                                                enabledBorder:
                                                    UnderlineInputBorder(
                                                  borderSide: BorderSide(
                                                      color: MyColours
                                                          .color_d8d8d8),
                                                ),
                                                // border: InputBorder.none,
                                              ),
                                              onChanged: (_) {
                                                setState(() {});
                                              },
                                              onEditingComplete: () {
                                                print('fff');
                                                _cancelNode.unfocus();
                                              },
                                              // keyboardType: TextInputType.number,
                                            ),
                                          ))
                                        : Container(),
                                    VEmptyView(40)
                                  ]),
                                );
                              }).toList(),
                            ),
                          ),
                          VEmptyView(15),
                          Material(
                            child: RoundButton(
                              onPressed: () {
                                String desc = '';
                                for (var value in cancelReasonList) {
                                  if (value['select'] == true) {
                                    desc = value['title'];
                                    if (value['title'] == '其他原因') {
                                      desc = _cancelController.text.trim();
                                      if (desc.isEmpty) {
                                        Utils.showToast("请填写原因");
                                        return;
                                      }
                                    }
                                  }
                                }

                                if (desc == '') {
                                  Utils.showToast('请选择原因');
                                  return;
                                }

                                Navigator.of(context).pop();
                                Loading.showLoading(context);

                                setReserveStatus('4', desc: desc);
                              },
                              text: '确认',
                              height: ScreenUtil().setWidth(80),
                              width: ScreenUtil().setWidth(300),
                              radius: ScreenUtil().setWidth(10),
                            ),
                          )
                        ],
                      ),
                    )),
              ),
            );
          });
        });
  }

  @override
  Widget build(BuildContext context) {
    if (MediaQuery.of(context).viewInsets.bottom == 0) {
      _cancelNode.unfocus();
    }
    detailModel = Provider.of<NotebookDetailModel>(context, listen: true);
    _onlineCheckEditProvider =
        Provider.of<OnlineCheckEditProvider>(context, listen: true);

    return Scaffold(
      body: SafeArea(
          child: WillPopScope(
        child: Container(
          color: MyColours.color_ffffff,
          child: Column(
            children: <Widget>[
              MyAppBar(
                "订座详情",
                showBack: true,
                callback: () {
                  if (widget.fromNotify) {
                    NavigatorUtil.goHomePage(context, initialIndex: 0);
                  } else {
                    Navigator.of(context).pop();
                  }
                },
              ),
              Expanded(child:
                  Consumer<NotebookDetailModel>(builder: (context, model, _) {
                if (model.pageState != PageState.Success) {
                  return ExceptionPage(
                    pageState: model.pageState,
                    callback: () {
                      // _getOrderListData();
                    },
                    emptyMsg: "暂时没有预订列表信息哦",
                    emptyImg: "empty_search",
                    showMsg: "加载中,请稍后...",
                  );
                } else {
                  return Column(
                    children: [
                      Expanded(
                        child: DefaultTextStyle(
                            style: TextStyle(decoration: TextDecoration.none),
                            child: Container(
                              color: MyColours.color_ffffff,
                              child: SingleChildScrollView(
                                child: Container(
                                    color: MyColours.color_ffffff,
                                    padding: EdgeInsets.symmetric(
                                        horizontal: ScreenUtil().setWidth(43)),
                                    child: Column(
                                      children: <Widget>[
                                        RowMultiText(
                                            "用餐时段", detailEntity.ddateMd),
                                        Stack(
                                          alignment: Alignment.center,
                                          children: <Widget>[
                                            Column(
                                              children: <Widget>[
                                                RowMultiText("用餐时间",
                                                    detailEntity.ddateHm),
                                                Offstage(
                                                  offstage:
                                                      detailEntity.type == "0"
                                                          ? false
                                                          : true,
                                                  child: RowMultiText("用餐人数",
                                                      detailEntity.pnum),
                                                )
                                              ],
                                            ),
                                            Image.asset(
                                              detailEntity.statuImgAssets,
                                              width: ScreenUtil().setWidth(114),
                                              height: ScreenUtil().setWidth(56),
                                            )
                                          ],
                                        ),
                                        Offstage(
                                          offstage:
                                              detailEntity.demands.length <= 0
                                                  ? true
                                                  : false,
                                          child: Column(
                                            children: <Widget>[
                                              RowMultiText(
                                                  "包间需求",
                                                  (detailEntity.demands.length
                                                              .toString() +
                                                          "个") ??
                                                      ""),
                                              Align(
                                                  alignment:
                                                      Alignment.centerRight,
                                                  child: Offstage(
                                                    offstage: detailEntity
                                                                .demands
                                                                .length >
                                                            0
                                                        ? false
                                                        : true,
                                                    child: Container(
                                                      height: ScreenUtil()
                                                          .setHeight(210),
                                                      child: ListView.builder(
                                                        itemBuilder:
                                                            (BuildContext
                                                                    contxt,
                                                                int index) {
                                                          return NeedItem(
                                                              detailEntity
                                                                      .demands[
                                                                  index]);
                                                        },
                                                        itemCount: detailEntity
                                                            .demands.length,
                                                        shrinkWrap: true,
                                                        scrollDirection:
                                                            Axis.horizontal,
                                                      ),
                                                    ),
                                                  ))
                                            ],
                                          ),
                                        ),
                                        RowMultiText(
                                            "预订桌位",
                                            (detailEntity.tables.length
                                                    .toString() +
                                                "个")),
                                        Align(
                                            alignment: Alignment.centerRight,
                                            child: Offstage(
                                              offstage:
                                                  detailEntity.tables.length > 0
                                                      ? false
                                                      : true,
                                              child: Container(
                                                height:
                                                    ScreenUtil().setHeight(210),
                                                child: ListView.builder(
                                                  itemBuilder:
                                                      (BuildContext contxt,
                                                          int index) {
                                                    return TableItem(
                                                        detailEntity
                                                            .tables[index]);
                                                  },
                                                  itemCount: detailEntity
                                                      .tables.length,
                                                  shrinkWrap: true,
                                                  scrollDirection:
                                                      Axis.horizontal,
                                                ),
                                              ),
                                            )),
                                        RowMultiText(
                                            "客户姓名", detailEntity.rnameStr),
                                        RowMultiText("客户电话", formatPhone),
                                        Offstage(
                                          offstage: detailEntity.cusdem == '' ||
                                              detailEntity.cusdem == null,
                                          child: RowMultiText("备注信息",
                                              detailEntity.cusdem ?? ""),
                                        ),
                                        MyDivider(double.infinity,
                                            ScreenUtil().setHeight(1)),
                                        Container(
                                          color: MyColours.color_ffffff,
                                          width: double.infinity,
                                          height: ScreenUtil().setHeight(80),
                                          alignment: Alignment.center,
                                          child: Stack(
                                            alignment: Alignment.center,
                                            children: <Widget>[
                                              Positioned(
                                                left: 0,
                                                child: Text(
                                                  "客户经理",
                                                  style: TextStyle(
                                                      color: MyColours
                                                          .color_828282,
                                                      fontSize: ScreenUtil()
                                                          .setSp(30)),
                                                ),
                                              ),
                                              Positioned(
                                                right: 0,
                                                child: GestureDetector(
                                                  onTap: () async {
                                                    List<String> list = [];
                                                    for (Manager manager
                                                        in managers) {
                                                      list.add(
                                                          manager.roleUserName);
                                                    }
                                                    DialogUtil
                                                        .showSelectCusmanDialog(
                                                            context, list,
                                                            (value) {
                                                      if (value != null) {
                                                        setState(() {
                                                          cusmanText = managers[
                                                                  value.first]
                                                              .userName;
                                                        });
                                                        _setCurrManager();
                                                      }
                                                    }).then((value) {});
                                                  },
                                                  child: Text(
                                                    cusmanText,
                                                    style: TextStyle(
                                                      color: MyColours
                                                          .color_353535,
                                                      fontSize: ScreenUtil()
                                                          .setSp(30),
                                                      decoration: TextDecoration
                                                          .underline,
                                                    ),
                                                  ),
                                                ),
                                              )
                                            ],
                                          ),
                                        ),
                                        Offstage(
                                          offstage: detailEntity.note_name ==
                                                  '' ||
                                              detailEntity.note_name == null,
                                          child: RowMultiText("记录人",
                                              detailEntity.note_name ?? ""),
                                        ),
                                        Offstage(
                                          offstage: (detailEntity.status ==
                                                      "4" &&
                                                  detailEntity.cancel != null)
                                              ? false
                                              : true,
                                          child: Column(
                                            children: <Widget>[
                                              MyDivider(double.infinity,
                                                  ScreenUtil().setHeight(2)),
                                              RowMultiText(
                                                  "取消原因",
                                                  detailEntity.cancel?.desc ??
                                                      "",
                                                  textAlign: TextAlign.left),
                                              RowMultiText(
                                                  "取消时间",
                                                  detailEntity
                                                          .cancel?.cdateStr ??
                                                      ""),
                                              RowMultiText(
                                                  "操作人",
                                                  detailEntity.abolition == '2'
                                                      ? '顾客在线取消'
                                                      : detailEntity
                                                              .cancel?.uname ??
                                                          ""),
                                            ],
                                          ),
                                        ),
                                        _onlineCheckEditProvider
                                                        .orderInfoSunModel !=
                                                    null &&
                                                _onlineCheckEditProvider
                                                        .orderInfoSunModel
                                                        .invoice !=
                                                    null &&
                                                detailEntity.status != "4"
                                            ? MyDivider(double.infinity,
                                                ScreenUtil().setHeight(1))
                                            : Container(),
                                        _onlineCheckEditProvider
                                                        .orderInfoSunModel !=
                                                    null &&
                                                _onlineCheckEditProvider
                                                        .orderInfoSunModel
                                                        .invoice !=
                                                    null &&
                                                detailEntity.status != "4"
                                            ? InkWell(
                                                onTap: () {
                                                  NavigatorUtil
                                                      .goInvoiceDetailPage(
                                                          context,
                                                          fromNotify: false,
                                                          rid: widget.rid);
                                                },
                                                child: Container(
                                                  height: ScreenUtil()
                                                      .setWidth(87 * 2),
                                                  child: Row(
                                                    mainAxisAlignment:
                                                        MainAxisAlignment
                                                            .spaceBetween,
                                                    children: [
                                                      Text(
                                                        "发票抬头",
                                                        style: TextStyle(
                                                            color: MyColours
                                                                .color_828282,
                                                            fontSize:
                                                                ScreenUtil()
                                                                    .setSp(30)),
                                                      ),
                                                      Spacer(),
                                                      Column(
                                                        mainAxisAlignment:
                                                            MainAxisAlignment
                                                                .center,
                                                        children: [
                                                          Text(
                                                              _onlineCheckEditProvider
                                                                  .orderInfoSunModel
                                                                  .invoice
                                                                  .title,
                                                              style: TextStyle(
                                                                  color: MyColours
                                                                      .color_353535,
                                                                  fontWeight:
                                                                      FontWeight
                                                                          .bold,
                                                                  fontSize:
                                                                      ScreenUtil()
                                                                          .setSp(
                                                                              33))),
                                                          _onlineCheckEditProvider
                                                                          .orderInfoSunModel
                                                                          .invoice
                                                                          .taxnumber ==
                                                                      null ||
                                                                  _onlineCheckEditProvider
                                                                          .orderInfoSunModel
                                                                          .invoice
                                                                          .taxnumber ==
                                                                      ''
                                                              ? Container()
                                                              : Column(
                                                                  children: [
                                                                    VEmptyView(
                                                                        10),
                                                                    Text(
                                                                        '税号:${_onlineCheckEditProvider.orderInfoSunModel.invoice.taxnumber}',
                                                                        style: TextStyle(
                                                                            color:
                                                                                MyColours.color_707070,
                                                                            fontSize: ScreenUtil().setSp(28)))
                                                                  ],
                                                                )
                                                        ],
                                                      ),
                                                      HEmptyView(20),
                                                      Image.asset(
                                                        Utils.getImgPath(
                                                            'arr_right_gray'),
                                                        width: ScreenUtil()
                                                            .setWidth(12),
                                                        height: ScreenUtil()
                                                            .setWidth(22),
                                                      )
                                                    ],
                                                  ),
                                                ),
                                              )
                                            : Container(),
                                        _onlineCheckEditProvider
                                                        .orderInfoSunModel !=
                                                    null &&
                                                _onlineCheckEditProvider
                                                        .orderInfoSunModel
                                                        .price !=
                                                    null &&
                                                detailEntity.status != "4"
                                            ? MyDivider(double.infinity,
                                                ScreenUtil().setHeight(1))
                                            : Container(),
                                        _onlineCheckEditProvider
                                                        .orderInfoSunModel !=
                                                    null &&
                                                _onlineCheckEditProvider
                                                        .orderInfoSunModel
                                                        .price !=
                                                    null &&
                                                detailEntity.status != "4"
                                            ? InkWell(
                                                onTap: () {
                                                  //在线买单消息 去查看 跳转在线买单详情页面
                                                  NavigatorUtil
                                                      .goOnlineCheckDetailPage(
                                                          context,
                                                          rid: '${widget.rid}');
                                                },
                                                child: Container(
                                                  height: ScreenUtil()
                                                      .setWidth(87 * 2),
                                                  child: Row(
                                                    mainAxisAlignment:
                                                        MainAxisAlignment
                                                            .spaceBetween,
                                                    children: [
                                                      Text(
                                                        "实收金额:",
                                                        style: TextStyle(
                                                            color: MyColours
                                                                .color_707070,
                                                            fontSize:
                                                                ScreenUtil()
                                                                    .setSp(30)),
                                                      ),
                                                      HEmptyView(20),
                                                      Text(
                                                        '¥ ${_onlineCheckEditProvider.orderInfoSunModel.price}',
                                                        style: TextStyle(
                                                            color: MyColours
                                                                .color_353535,
                                                            fontSize:
                                                                ScreenUtil()
                                                                    .setSp(32)),
                                                      ),
                                                      Spacer(),
                                                      Text('查看明细',
                                                          style: TextStyle(
                                                              color: MyColours
                                                                  .color_707070,
                                                              fontSize:
                                                                  ScreenUtil()
                                                                      .setSp(
                                                                          28))),
                                                      HEmptyView(20),
                                                      Image.asset(
                                                        Utils.getImgPath(
                                                            'arr_right_gray'),
                                                        width: ScreenUtil()
                                                            .setWidth(12),
                                                        height: ScreenUtil()
                                                            .setWidth(22),
                                                      )
                                                    ],
                                                  ),
                                                ),
                                              )
                                            : Container(),
                                      ],
                                    )),
                              ),
                            )),
                      ),
                      Offstage(
                          offstage: ((detailEntity.orderInfo != null &&
                                  detailEntity.orderInfo.status == "3") ||
                              detailEntity.status == "3" ||
                              detailEntity.status == "4" ||
                              detailEntity.status == "6"),
                          child: Container(
                              width: double.infinity,
                              height: ScreenUtil().setWidth(84),
                              decoration: BoxDecoration(
                                color: MyColours.color_199095,
                                borderRadius: BorderRadius.circular(
                                    ScreenUtil().setWidth(10)),
                              ),
                              margin: EdgeInsets.symmetric(
                                  vertical: ScreenUtil().setHeight(20),
                                  horizontal: ScreenUtil().setHeight(40)),
                              child: Row(
                                children: [
                                  Offstage(
                                      offstage:
                                          ((detailEntity.orderInfo != null &&
                                                      detailEntity.orderInfo
                                                              .status ==
                                                          "3") ||
                                                  detailEntity.status == "3" ||
                                                  detailEntity.status == "4" ||
                                                  detailEntity.status == "6")
                                              ? true
                                              : false,
                                      child: _cancelAndChangeBtn(() {
                                        DialogUtil.showShareDialog(context)
                                            ?.then((value) {
                                          switch (value) {
                                            case 1: //微信
                                              NavigatorUtil.goInvicationPage(
                                                  context,
                                                  detailEntity.id,
                                                  detailEntity.tableinfoStr,
                                                  detailEntity.ddate,
                                                  detailEntity.ddateStr,
                                                  detailEntity.phone);
                                              break;
                                            case 2: //短信
                                              if (detailEntity.phone == null ||
                                                  detailEntity.phone.isEmpty) {
                                                Utils.showToast("没有预订人电话信息");
                                                return;
                                              }
                                              NavigatorUtil.goSmsPage(
                                                  context, detailEntity.id);
                                              break;
                                            case 3: //电话
                                              if (detailEntity.phone != null &&
                                                  detailEntity
                                                      .phone.isNotEmpty) {
                                                Utils.goPhone(
                                                    detailEntity.phone);
                                              } else {
                                                Utils.showToast("没有预订人电话信息");
                                              }
                                              break;
                                          }
                                        });
                                      }, "通知客户",
                                          bgColor: MyColours.color_199095,
                                          width: detailEntity.order.cookbooklist
                                                      .length ==
                                                  0
                                              ? ScreenUtil.screenWidthDp -
                                                  ScreenUtil().setWidth(91)
                                              : (ScreenUtil.screenWidthDp -
                                                      ScreenUtil()
                                                          .setWidth(91)) /
                                                  2,
                                          fontColor: MyColours.color_ffffff)),
                                  Offstage(
                                      offstage: !(detailEntity
                                                  .order.cookbooklist.length >
                                              0 &&
                                          ((detailEntity.orderInfo != null &&
                                                  detailEntity
                                                          .orderInfo.status ==
                                                      "3") &&
                                              detailEntity.status != "3" &&
                                              detailEntity.status != "4" &&
                                              detailEntity.status != "6")),
                                      child: MyDivider(ScreenUtil().setWidth(2),
                                          ScreenUtil().setWidth(50),
                                          color: MyColours.color_ffffff)),
                                  Offstage(
                                      offstage: detailEntity
                                                  .order.cookbooklist.length ==
                                              0
                                          ? true
                                          : false,
                                      child: _cancelAndChangeBtn(() {
                                        NavigatorUtil.goHasOrderFoodPage(
                                            context,
                                            rid: detailEntity.id);
                                      }, '查看菜品',
                                          bgColor: MyColours.color_199095,
                                          width: ((detailEntity.orderInfo !=
                                                          null &&
                                                      detailEntity.orderInfo
                                                              .status ==
                                                          "3") ||
                                                  detailEntity.status == "3" ||
                                                  detailEntity.status == "4" ||
                                                  detailEntity.status == "6")
                                              ? ScreenUtil.screenWidthDp -
                                                  ScreenUtil().setWidth(91)
                                              : (ScreenUtil.screenWidthDp -
                                                      ScreenUtil()
                                                          .setWidth(91)) /
                                                  2,
                                          fontColor: MyColours.color_ffffff))
                                ],
                              ))),
                      Offstage(
                        offstage: ((detailEntity.orderInfo != null &&
                                    detailEntity.orderInfo.status == "3") ||
                                detailEntity.status == "3" ||
                                detailEntity.status == "4" ||
                                detailEntity.status == "6")
                            ? true
                            : false,
                        child: Container(
                          width: double.infinity,
                          height: ScreenUtil().setWidth(84),
                          margin: EdgeInsets.symmetric(
                              horizontal: ScreenUtil().setHeight(40)),
                          decoration: BoxDecoration(
                            border: Border.all(
                                color: MyColours.color_199095,
                                width: ScreenUtil().setWidth(2)),
                            borderRadius: BorderRadius.circular(
                                ScreenUtil().setWidth(10)),
                          ),
                          // child: Text('fff'),
                          child: Material(
                              color: Colors.transparent,
                              child: Row(
                                children: [
                                  Expanded(
                                      child: _cancelAndChangeBtn(() {
                                    print('点击变更预订');
                                    NavigatorUtil.goNoteBookChangePage(
                                        context, detailEntity, widget.rid);
                                  }, '变更预订')),
                                  MyDivider(
                                    ScreenUtil().setWidth(2),
                                    ScreenUtil().setWidth(50),
                                    color: MyColours.color_199095,
                                  ),
                                  Expanded(
                                      child: _cancelAndChangeBtn(() {
                                    _showCancelWidget(context);
                                  }, '取消预订')),
                                ],
                              )),
                        ),
                      ),
                      VEmptyView(ScreenUtil().setWidth(60))
                    ],
                  );
                }
              })),
            ],
          ),
        ),
        onWillPop: () async {
          if (widget.fromNotify) {
            NavigatorUtil.goHomePage(context, initialIndex: 0);
            return true;
          }
          Navigator.of(context).pop();
          return true;
        },
      )),
    );
  }
}