notebook_item_f_simple.dart 52.5 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
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:one_key/models/notebook.dart';
import 'package:one_key/res/colors.dart';
import 'package:one_key/route/navigator_util.dart';
import 'package:one_key/utils/utils.dart';
import 'package:one_key/widgets/MyDivider.dart';
import 'package:one_key/widgets/v_empty_view.dart';

/**
 * 简易模式
*/
import 'dart:convert';
import 'dart:ui';

import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:one_key/models/notebook.dart';
import 'package:one_key/pages/notebook/spread_widget.dart';
import 'package:one_key/provider/notebook_detail_model.dart';
import 'package:one_key/provider/user_model.dart';
import 'package:one_key/res/colors.dart';
import 'package:one_key/route/navigator_util.dart';
import 'package:one_key/utils/event_bus.dart';
import 'package:one_key/utils/utils.dart';
import 'package:one_key/widgets/MyDivider.dart';
import 'package:one_key/widgets/h_empty_view.dart';
import 'package:one_key/widgets/loading.dart';
import 'package:one_key/widgets/round_button.dart';
import 'package:one_key/widgets/v_empty_view.dart';
import 'package:provider/provider.dart';

import '../../provider/marketing_center_provider.dart';

/**
 * 详细模式
 */
class NoteBookItemSimple extends StatefulWidget {
  final num index;
  final Notebook notebook;
  final GestureTapCallback onTap;

  NoteBookItemSimple(this.notebook, this.index, this.onTap);

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

class NoteBookItemSimpleState extends State<NoteBookItemSimple>
    with SingleTickerProviderStateMixin {
  // bool _large = false;
  List cancelReasonList = [];
  bool isShowTF = false;
  // int paddingBottom;
  int paddingTop = 138;
  FocusNode _cancelNode = FocusNode();
  TextEditingController _cancelController = TextEditingController();
  StateSetter _cancelState;

  ScrollController _scrollController;

  _onOperateClick() {
    if (widget.notebook.operationText == "通知客户") {
      //  String _nameStr = '';
      //                                               String _tid = '';
      //                                               for (int i = 0;
      //                                                   i <
      //                                                       detailEntity
      //                                                           .tables.length;
      //                                                   i++) {
      //                                                 _nameStr +=
      //                                                     '${detailEntity.tables[i].name},';

      //                                                 _tid +=
      //                                                     '${detailEntity.tables[i].id},';
      //                                               }
      //                                               if (_tid.endsWith(',')) {
      //                                                 _tid = _tid.substring(
      //                                                     0, _tid.length - 1);
      //                                               }
      //                                               if (_nameStr
      //                                                   .endsWith(',')) {
      //                                                 _nameStr =
      //                                                     _nameStr.substring(
      //                                                         0,
      //                                                         _nameStr.length -
      //                                                             1);
      //                                               }
      NavigatorUtil.goInvicationPage(
        context,
        widget.notebook.id,
        // widget.notebook.tableinfoStr,
        // widget.notebook.ddate,
        // widget.notebook.ddateStr,
        // widget.notebook.phone,
        // widget.notebook.ddate_solt,
        // widget.notebook.rname == null ? '' : widget.notebook.rname,
        // widget.notebook.sex == null ? '' : widget.notebook.sex,
        // widget.notebook.cusdem,
        // tid: widget.notebook.tid
      );
    }
  }

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

  _updateSize(bool cando) {
    if (!cando) {
      return;
    }
    setState(() {
      widget.notebook.large = !widget.notebook.large;
    });
  }

  ///处理在线预订
  setReserveStatus(String status, {String desc, String phone}) async {
    // bus.emit("remove_untreated_message",widget.mid);
    UserModel userModel = Provider.of<UserModel>(context, listen: false);

    Map<String, String> params = {
      "rid": widget.notebook.id,
      "status": status, //5安排包间	2:确认到店(到店),3:用餐完成(离店),4:取消预定,5:分配包间:6:拒单
      // "uid": userModel.user.openid,
      'uid': widget.notebook.uid
    };
    if (status == '4') {
      Map<String, String> causeMap = {
        "uid": userModel.user.openid,
        "uname": userModel.user.nickName,
        "desc": desc,
      };
      params["cause"] = json.encode(causeMap);
    }
    params['note_name'] = userModel.user.account;
    NotebookDetailModel detailModel =
        Provider.of<NotebookDetailModel>(context, listen: false);
    bool success =
        await detailModel.setReserveStatus(context, params, ifPush: false,notebook: widget.notebook);
    if (success) {
      bus.emit("refresh_book_list");
      if (status == "4" && phone != null && phone != '') {
        //取消预订
        getDzSellerConf(widget.notebook.id);
      }
      // if (status == "4") {
      //   //取消预订
      //   bus.emit("refresh_tablemanager"); //刷新桌位
      // }
      // _getReserveDetail();
    }
  }

  getDzSellerConf(String rid) async {
    MarketingCenterProvider marketingCenterProvider =
        Provider.of<MarketingCenterProvider>(context, listen: false);
    bool success = await marketingCenterProvider.getDzSellerConf(context);
    if (success && marketingCenterProvider.dzSellerConfModel != null) {
      bool selectSms =
          marketingCenterProvider.dzSellerConfModel.isOpenCancel == '1'
              ? true
              : false;

      if (selectSms) {
        Map<String, String> pramas = {
          'rid': rid,
          'sid': Provider.of<UserModel>(context, listen: false).user.sellerid,
        };
        NotebookDetailModel detailModel =
            Provider.of<NotebookDetailModel>(context, listen: false);
        detailModel.wxSendCancelSms(context, pramas);
      }
    }
  }

  ///取消预订弹框
  _showCancelWidget(context, phone) {
    _scrollController = ScrollController();
    _initCancel();
    showGeneralDialog(
        context: context,
        barrierDismissible: false,
        barrierLabel:
            MaterialLocalizations.of(context).modalBarrierDismissLabel,
        transitionDuration: const Duration(milliseconds: 150),
        barrierColor: Color.fromRGBO(0, 0, 0, 0.25),
        pageBuilder: (BuildContext context, Animation animation,
            Animation secondaryAnimation) {
          return Scaffold(
              backgroundColor: Color.fromRGBO(0, 0, 0, 0.25),
              body: StatefulBuilder(builder: (context, state) {
                _cancelState = state;
                return GestureDetector(
                    behavior: HitTestBehavior.opaque,
                    // onTap: () {
                    //   Navigator.of(context).pop();
                    // },
                    child: Center(
                      child: Container(
                        margin: EdgeInsets.symmetric(
                            horizontal: ScreenUtil().setWidth(28 * 2)),
                        padding: EdgeInsets.symmetric(
                            horizontal: ScreenUtil().setWidth(32)),
                        decoration: BoxDecoration(
                          color: Colors.white,
                          borderRadius:
                              BorderRadius.circular(ScreenUtil().setWidth(10)),
                        ),
                        height: ScreenUtil().setWidth(355 * 2),
                        child: Column(
                          // mainAxisSize: MainAxisSize.min,
                          children: [
                            // Stack(
                            //   children: [
                            VEmptyView(48),
                            Container(
                              height: ScreenUtil().setWidth(48),
                              child: Text(
                                '是否确定取消预订',
                                style: TextStyle(
                                    fontSize: ScreenUtil().setSp(32),
                                    fontWeight: FontWeight.bold,
                                    decoration: TextDecoration.none,
                                    color: Color.fromRGBO(0, 0, 0, 0.9)),
                              ),
                            ),
                            // 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(40),
                            Container(
                                child: Column(
                              // mainAxisSize: MainAxisSize.min,
                              children: cancelReasonList.map((value) {
                                return value['title'] == '其他原因'
                                    ? SizedBox()
                                    : GestureDetector(
                                        onTap: () {
                                          for (var item in cancelReasonList) {
                                            item['select'] = false;
                                            // isShowTF = false;
                                            // paddingBottom =
                                            //     ScreenUtil().screenHeight.ceil() -
                                            //         138 -
                                            //         340;
                                            if (item['title'] ==
                                                value['title']) {
                                              item['select'] = true;
                                              //   if (item['title'] == '其他原因') {
                                              //     // isShowTF = true;
                                              //     // paddingBottom = 130;
                                              //     // paddingBottom =
                                              //     //     ScreenUtil().screenHeight.ceil() -
                                              //     //         138 -
                                              //     //         340 -
                                              //     //         46;
                                              //   }
                                            }
                                          }
                                          state(() {});
                                        },
                                        child: Container(
                                          height: ScreenUtil().setWidth(48),
                                          margin: EdgeInsets.only(
                                              bottom:
                                                  ScreenUtil().setWidth(40)),
                                          child: Row(
                                            children: [
                                              Image.asset(
                                                  value['select']
                                                      ? 'assets/select.png'
                                                      : 'assets/unselect.png',
                                                  width: ScreenUtil()
                                                      .setWidth(42)),
                                              HEmptyView(20),
                                              Container(
                                                  child: Text(value['title'],
                                                      style: TextStyle(
                                                          fontSize: ScreenUtil()
                                                              .setSp(32),
                                                          fontWeight:
                                                              FontWeight.normal,
                                                          decoration:
                                                              TextDecoration
                                                                  .none,
                                                          color: MyColours
                                                              .color_333333)))
                                            ],
                                          ),
                                        ),
                                      );
                              }).toList(),
                            )),
                            Material(
                                child: Container(
                                    color: Colors.white,
                                    height: ScreenUtil().setWidth(42 * 2),
                                    child: Row(children: [
                                      InkWell(
                                          onTap: () {
                                            for (var item in cancelReasonList) {
                                              item['select'] = false;
                                            }
                                            cancelReasonList[4]['select'] =
                                                true;
                                            state(() {});
                                          },
                                          child: Padding(
                                              padding: EdgeInsets.only(
                                                  right: ScreenUtil()
                                                      .setWidth(20)),
                                              child: Image.asset(
                                                  cancelReasonList[4]['select']
                                                      ? 'assets/select.png'
                                                      : 'assets/unselect.png',
                                                  width: ScreenUtil()
                                                      .setWidth(44)))),
                                      Expanded(
                                          child: Container(
                                        decoration: BoxDecoration(
                                            color: Color.fromRGBO(
                                                240, 240, 240, 1),
                                            borderRadius: BorderRadius.circular(
                                                ScreenUtil().setWidth(8))),
                                        // height: ScreenUtil().setWidth(42 * 2),
                                        padding: EdgeInsets.symmetric(
                                            horizontal:
                                                ScreenUtil().setWidth(16)),
                                        child: TextField(
                                          maxLines: 1,
                                          controller: _cancelController,
                                          focusNode: _cancelNode,
                                          style: TextStyle(
                                              textBaseline:
                                                  TextBaseline.alphabetic),
                                          textAlignVertical:
                                              TextAlignVertical.center,
                                          decoration: InputDecoration(
                                            contentPadding: EdgeInsets.zero,
                                            hintText: "其他",
                                            // focusColor: Color.fromRGBO(0, 0, 0, 0.4),
                                            hintStyle: TextStyle(
                                              color:
                                                  Color.fromRGBO(0, 0, 0, 0.4),
                                              fontSize: ScreenUtil().setSp(32),
                                            ),
                                            enabledBorder: OutlineInputBorder(
                                                borderSide: BorderSide(
                                                    width: 0,
                                                    color: Colors.transparent)),
                                            border: OutlineInputBorder(
                                                borderSide: BorderSide(
                                                    width: 0,
                                                    color: Colors.transparent)),
                                            focusedBorder: OutlineInputBorder(
                                                borderSide: BorderSide(
                                                    width: 0,
                                                    color: Colors.transparent)),
                                          ),

                                          // border: InputBorder.none,

                                          onChanged: (_) {
                                            setState(() {});
                                          },
                                          onEditingComplete: () {
                                            print('fff');
                                            _cancelNode.unfocus();
                                          },
                                          // keyboardType: TextInputType.numberWithOptions(decimal: true),
                                        ),
                                      ))
                                    ]))),

                            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, phone: phone);
                                },
                                text: '确认',
                                height: ScreenUtil().setWidth(80),
                                width: ScreenUtil().setWidth(300),
                                radius: ScreenUtil().setWidth(10),
                              ),
                            )
                          ],
                        ),
                      ),
                    ));
              }));
        });
  }

  @override
  Widget build(BuildContext context) {
    // TODO: implement build
    Notebook notebook = widget.notebook;
    UserModel userModel = Provider.of<UserModel>(context, listen: false);
    bool canDo = true;
    // if (userModel.user.role_name != '管理员' &&
    //     userModel.user.role_name != '店长' &&
    //     notebook.uid != "null" &&
    //     (notebook.uid != userModel.user.openid &&
    //         userModel.user.role_name != '前台') &&
    //     userModel.user.role_name != '前台' &&
    //     userModel.user.role_name != '迎宾') {
    //   canDo = false;
    // } else {
    if (notebook.status == '0' ||
        notebook.status == '1' ||
        notebook.status == '2' ||
        notebook.status == '5') {
      canDo = true;
    } else {
      canDo = false;
    }
    // }

    Color bgColor = canDo &&
            (Utils.getAuthority(context, '到店') ||
                notebook.uid == userModel.user.openid)
        ? MyColours.color_438E93
        : MyColours.color_BFC4D4;

    Color roomColor = canDo &&
            (Utils.getAuthority(context, '到店') ||
                notebook.uid == userModel.user.openid)
        ? MyColours.color_438E93
        : MyColours.color_BFC4D4;

    if (notebook.operationText == '未接通') {
      bgColor = MyColours.color_F78D94;
    } else if (notebook.operationText == '待定') {
      bgColor = MyColours.color_F2995F;
    } else if (notebook.operationText == '已确认') {
      bgColor = MyColours.color_8EBBBE;
    }

    String detail = '';
    if (notebook.tid.split(",").length >= 2) {
      //连台
      detail += '[连台]:${notebook.tableinfoStr};';
    }
    if (notebook.cusdem != null && notebook.cusdem != '') {
      //有备注
      detail += '[备注]:${notebook.cusdem};';
    }
    if (notebook.aname != null) {
      //有优惠
      detail += '[优惠]:${notebook.aname}';
    }
    if (detail.endsWith(';')) {
      detail = detail.substring(0, detail.length - 1);
    }
    double widthBtn = 464.0; //三个按钮
    if (notebook.status == '2') {
      //离店和取消预订

      widthBtn = 208.0; //一个按钮

    } else {
      if (!Utils.getAuthority(context, '取消预订') ||
          (!Utils.getAuthority(context, '取消预订') &&
              notebook.uid != userModel.user.openid)) {
        //没有权限
        widthBtn = 328.0; //2个按钮
      }
    }

    return Stack(
        clipBehavior: Clip.none,
        alignment: Alignment.centerRight,
        children: [
          Container(
            padding: EdgeInsets.only(
              left: ScreenUtil().setWidth(16),
              top: ScreenUtil().setWidth(16),
              bottom: ScreenUtil().setWidth(16),
              right: ScreenUtil().setWidth(44),
            ),
            margin: EdgeInsets.only(right: ScreenUtil().setWidth(48)),
            decoration: BoxDecoration(
              color: MyColours.color_ffffff,
              borderRadius: BorderRadius.circular(ScreenUtil().setWidth(32)),
              border: Border.all(
                  color: Color.fromRGBO(191, 196, 212, 0.2),
                  width: ScreenUtil().setWidth(1)),
            ),
            child: Row(
              children: [
                InkWell(
                    onTap: widget.onTap,
                    child: Column(
                      crossAxisAlignment: CrossAxisAlignment.center,
                      children: [
                        Container(
                          width: ScreenUtil().setWidth(82 * 2),
                          alignment: Alignment.center,
                          child: Text(
                            notebook.name,
                            maxLines: 1,
                            overflow: TextOverflow.ellipsis,
                            style: TextStyle(
                                color: roomColor,
                                fontWeight: FontWeight.bold,
                                fontSize: ScreenUtil().setSp(32)),
                          ),
                        ),
                        widget.notebook.operationText == ''
                            ? SizedBox()
                            : VEmptyView(18),
                        widget.notebook.operationText == ''
                            ? SizedBox()
                            : RoundButton(
                                text: widget.notebook.operationText,
                                gradientStart: bgColor,
                                gradientEnd: bgColor,
                                textColor: MyColours.color_ffffff,
                                radius: ScreenUtil().setWidth(6),
                                fontSize: 24,
                                width: ScreenUtil().setWidth(42 * 2),
                                height: ScreenUtil().setWidth(17 * 2),
                              )
                      ],
                    )),
                HEmptyView(24),
                MyDivider(
                  ScreenUtil().setWidth(2),
                  ScreenUtil().setWidth(66 * 2),
                  color: Color.fromRGBO(191, 196, 212, 0.2),
                ),
                HEmptyView(32),
                Expanded(
                    child: GestureDetector(
                        behavior: HitTestBehavior.translucent,
                        onTap: () {
                          NavigatorUtil.goNotebookDetailPage(
                              context, notebook.id, notebook.uid);
                        },
                        child: Column(
                          crossAxisAlignment: CrossAxisAlignment.start,
                          children: [
                            Row(
                              children: [
                                notebook.rnameStr == ''
                                    ? SizedBox()
                                    : Expanded(
                                        child: Text(
                                          notebook.rnameStr,
                                          maxLines: 1,
                                          overflow: TextOverflow.ellipsis,
                                          style: TextStyle(
                                              color: canDo &&
                                                      (Utils.getAuthority(
                                                              context, '到店') ||
                                                          notebook.uid ==
                                                              userModel
                                                                  .user.openid)
                                                  ? MyColours.color_260101
                                                  : MyColours.color_BFC4D4,
                                              fontWeight: FontWeight.bold,
                                              fontSize: ScreenUtil().setSp(24)),
                                        ),
                                      ),
                                notebook.phoneStr.isNotEmpty
                                    ? Text(
                                        '(' +
                                            Utils.showEndPhone(
                                                '${notebook.phoneStr}') +
                                            ')',
                                        maxLines: 1,
                                        overflow: TextOverflow.ellipsis,
                                        style: TextStyle(
                                            color: canDo &&
                                                    (Utils.getAuthority(
                                                            context, '到店') ||
                                                        notebook.uid ==
                                                            userModel
                                                                .user.openid)
                                                ? MyColours.color_260101
                                                : MyColours.color_BFC4D4,
                                            fontWeight: FontWeight.bold,
                                            fontSize: ScreenUtil().setSp(24)),
                                      )
                                    : SizedBox(),
                                notebook.rnameStr == '' &&
                                        notebook.phoneStr.isEmpty
                                    ? SizedBox()
                                    : HEmptyView(8),
                                Text(
                                  notebook.actual_pnum == null
                                      ? notebook.ddateStr
                                      : notebook.actual_pnum +
                                          '人' +
                                          '  ' +
                                          notebook.ddateStr,
                                  maxLines: 1,
                                  overflow: TextOverflow.ellipsis,
                                  style: TextStyle(
                                      color: canDo &&
                                              (Utils.getAuthority(
                                                      context, '到店') ||
                                                  notebook.uid ==
                                                      userModel.user.openid)
                                          ? MyColours.color_260101
                                          : MyColours.color_BFC4D4,
                                      fontWeight: FontWeight.bold,
                                      fontSize: ScreenUtil().setSp(24)),
                                ),
                              ],
                            ),
                            VEmptyView(8),
                            (notebook.place_order_name == null ||
                                        notebook.place_order_name == '') &&
                                    notebook.tid.split(",").length < 2 &&
                                    (notebook.cusdem == null ||
                                        notebook.cusdem == '') &&
                                    notebook.aname == null
                                ? SizedBox()
                                : Row(
                                    children: [
                                      notebook.place_order_name == null ||
                                              notebook.place_order_name == ''
                                          ? SizedBox()
                                          : Padding(
                                              padding: EdgeInsets.only(
                                                  right:
                                                      ScreenUtil().setWidth(6)),
                                              child: Text(
                                                notebook.place_order_name + '订',
                                                maxLines: 1,
                                                overflow: TextOverflow.ellipsis,
                                                style: TextStyle(
                                                    color: canDo &&
                                                            (Utils.getAuthority(
                                                                    context,
                                                                    '到店') ||
                                                                notebook.uid ==
                                                                    userModel
                                                                        .user
                                                                        .openid)
                                                        ? MyColours.color_999999
                                                        : MyColours
                                                            .color_BFC4D4,
                                                    fontSize:
                                                        ScreenUtil().setSp(24)),
                                              )),
                                      canDo &&
                                              (Utils.getAuthority(
                                                      context, '到店') ||
                                                  notebook.uid ==
                                                      userModel.user.openid)
                                          ? Row(
                                              mainAxisAlignment:
                                                  MainAxisAlignment.spaceEvenly,
                                              children: [
                                                Offstage(
                                                  offstage: notebook.tid
                                                          .split(",")
                                                          .length <
                                                      2,
                                                  child: Image.asset(
                                                    Utils.getImgPath(
                                                        'ordered_lian'),
                                                    width: ScreenUtil()
                                                        .setWidth(18 * 2),
                                                  ),
                                                ),
                                                notebook.cusdem == null ||
                                                        notebook.cusdem == ''
                                                    ? SizedBox()
                                                    : HEmptyView(8),
                                                Offstage(
                                                  offstage:
                                                      notebook.cusdem == null ||
                                                          notebook.cusdem == '',
                                                  child: Image.asset(
                                                    Utils.getImgPath(
                                                        'ordered_bei'),
                                                    width: ScreenUtil()
                                                        .setWidth(18 * 2),
                                                  ),
                                                ),
                                                notebook.aname == null
                                                    ? SizedBox()
                                                    : HEmptyView(8),
                                                Offstage(
                                                  offstage:
                                                      notebook.aname == null,
                                                  child: Image.asset(
                                                    Utils.getImgPath(
                                                        'ordered_hui'),
                                                    width: ScreenUtil()
                                                        .setWidth(18 * 2),
                                                  ),
                                                )
                                              ],
                                            )
                                          : SizedBox(),
                                    ],
                                  )
                          ],
                        )))
              ],
            ),
          ),

          Positioned(
              right: ScreenUtil().setWidth(8),
              child: AnimatedSize(
                  curve: Curves.easeIn,
                  duration: Duration(microseconds: 30000),
                  vsync: this,
                  child: InkWell(
                      onTap: () => _updateSize(canDo &&
                          (Utils.getAuthority(context, '到店') ||
                              notebook.uid == userModel.user.openid)),
                      child: widget.notebook.large
                          ? Stack(
                              children: [
                                Container(
                                    width:
                                        ScreenUtil().setWidth(widthBtn + 8 * 2),
                                    height: ScreenUtil().setWidth(80),
                                    decoration: BoxDecoration(
                                      color: Color.fromRGBO(67, 142, 147, 0.2),
                                      borderRadius: BorderRadius.circular(
                                          ScreenUtil().setWidth(16)),
                                    )),
                                Positioned(
                                    top: ScreenUtil().setWidth(8),
                                    left: ScreenUtil().setWidth(8),
                                    child: Container(
                                      width: ScreenUtil().setWidth(widthBtn),
                                      height: ScreenUtil().setWidth(32 * 2),
                                      decoration: BoxDecoration(
                                        color: Color.fromRGBO(125, 174, 177, 1),
                                        borderRadius: BorderRadius.circular(
                                            ScreenUtil().setWidth(8)),
                                      ),
                                      padding: EdgeInsets.symmetric(
                                          horizontal:
                                              ScreenUtil().setWidth(16)),
                                      child: Row(
                                        mainAxisSize: MainAxisSize.min,
                                        children: [
                                          Image.asset(
                                            Utils.getImgPath(
                                                'ordered_arrow_right'),
                                            width:
                                                ScreenUtil().setWidth(24 * 2),
                                          ),
                                          HEmptyView(32),
                                          notebook.status == '2'
                                              ? SizedBox()
                                              : RoundButton(
                                                  text: '到店',
                                                  width: ScreenUtil()
                                                      .setWidth(36 * 2),
                                                  height: ScreenUtil()
                                                      .setWidth(24 * 2),
                                                  gradientStart:
                                                      MyColours.color_ffffff,
                                                  gradientEnd:
                                                      MyColours.color_ffffff,
                                                  textColor:
                                                      MyColours.color_260101,
                                                  isBold: true,
                                                  fontSize: 28,
                                                  radius:
                                                      ScreenUtil().setWidth(8),
                                                  onPressed: () {
                                                    Loading.showLoading(
                                                        context);
                                                    setReserveStatus('2');
                                                  },
                                                ),
                                          notebook.status == '2'
                                              ? SizedBox()
                                              : HEmptyView(44),
                                          RoundButton(
                                            text: '离店',
                                            width:
                                                ScreenUtil().setWidth(36 * 2),
                                            height:
                                                ScreenUtil().setWidth(24 * 2),
                                            gradientStart:
                                                MyColours.color_ffffff,
                                            gradientEnd: MyColours.color_ffffff,
                                            textColor: MyColours.color_260101,
                                            isBold: true,
                                            fontSize: 28,
                                            radius: ScreenUtil().setWidth(8),
                                            onPressed: () {
                                              Loading.showLoading(context);
                                              setReserveStatus('3');
                                            },
                                          ),
                                          if (notebook.status != '2' &&
                                                  Utils.getAuthority(
                                                      context, '取消预订') ||
                                              (!Utils.getAuthority(
                                                      context, '取消预订') &&
                                                  notebook.uid ==
                                                      userModel.user.openid))
                                            HEmptyView(44),
                                          if (notebook.status != '2' &&
                                                  Utils.getAuthority(
                                                      context, '取消预订') ||
                                              (!Utils.getAuthority(
                                                      context, '取消预订') &&
                                                  notebook.uid ==
                                                      userModel.user.openid))
                                            InkWell(
                                                onTap: () {
                                                  _showCancelWidget(
                                                      context, notebook.phone);
                                                },
                                                child: Text(
                                                  '取消预订',
                                                  style: TextStyle(
                                                      decoration: TextDecoration
                                                          .underline,
                                                      color: MyColours
                                                          .color_ffffff,
                                                      fontSize: ScreenUtil()
                                                          .setSp(28),
                                                      fontWeight:
                                                          FontWeight.bold),
                                                ))
                                        ],
                                      ),
                                    ))
                              ],
                            )
                          : Image.asset(
                              Utils.getImgPath(canDo &&
                                      (Utils.getAuthority(context, '到店') ||
                                          notebook.uid == userModel.user.openid)
                                  ? 'ordered_open'
                                  : 'ordered_off'),
                              width: ScreenUtil().setWidth(80),
                            ))))
          // Positioned(
          //     right: ScreenUtil().setWidth(8),
          //     child: Image.asset(
          //       Utils.getImgPath(true ? 'ordered_open' : 'ordered_off'),
          //       width: ScreenUtil().setWidth(80),
          //     ))
        ]);
    //   return Stack(
    //     children: [
    //       Container(
    //         width: double.infinity,
    //         // height: ScreenUtil().setWidth(120),
    //         color: (widget.index % 2 == 0)
    //             ? MyColours.color_f7fdfd
    //             : MyColours.color_ffffff,
    //         child: Row(
    //           children: <Widget>[
    //             GestureDetector(
    //               behavior: HitTestBehavior.translucent,
    //               onTap: () {
    //                 NavigatorUtil.goNotebookDetailPage(
    //                     context, notebook.id, notebook.uid);
    //               },
    //               child: Row(
    //                 children: <Widget>[
    //                   Container(
    //                     width: ScreenUtil().setWidth(86 * 2),
    //                     padding: EdgeInsets.symmetric(
    //                         horizontal: ScreenUtil().setWidth(14),
    //                         vertical: ScreenUtil().setWidth(40)),
    //                     alignment: Alignment.center,
    //                     child: Column(
    //                       children: [
    //                         Text(
    //                           '${notebook.tableinfoStr?.trim()}',
    //                           maxLines: 30,
    //                           overflow: TextOverflow.ellipsis,
    //                           style: TextStyle(
    //                               color: textColor,
    //                               // fontWeight: FontWeight.bold,
    //                               fontSize: ScreenUtil().setSp(30)),
    //                         ),
    //                         notebook.type == '1'
    //                             ? Text('online',
    //                                 style: TextStyle(
    //                                     color: Colors.blue,
    //                                     // fontWeight: FontWeight.bold,
    //                                     fontSize: ScreenUtil().setSp(26)))
    //                             : SizedBox()
    //                       ],
    //                     ),
    //                   ),
    //                   MyDivider(
    //                     ScreenUtil().setWidth(1),
    //                     ScreenUtil().setHeight(90),
    //                     color: MyColours.color_ededed,
    //                   ),
    //                   Container(
    //                     width: ScreenUtil().setWidth(230),
    //                     alignment: Alignment.center,
    //                     child: Column(
    //                       mainAxisSize: MainAxisSize.min,
    //                       mainAxisAlignment: MainAxisAlignment.center,
    //                       children: <Widget>[
    //                         Text(
    //                           notebook.rnameStr,
    //                           // 'nnnnnnnnnnnnnn',
    //                           maxLines: 1,
    //                           overflow: TextOverflow.ellipsis,
    //                           style: TextStyle(
    //                               color: textColor,
    //                               // fontWeight: FontWeight.bold,
    //                               fontSize: ScreenUtil().setSp(30)),
    //                         ),
    //                         notebook.phoneStr.isNotEmpty
    //                             ? Padding(
    //                                 padding: EdgeInsets.only(
    //                                     top: ScreenUtil().setWidth(10)),
    //                                 child: Text(
    //                                   notebook.phoneStr,
    //                                   maxLines: 1,
    //                                   overflow: TextOverflow.ellipsis,
    //                                   style: TextStyle(
    //                                       color: textColor,
    //                                       // fontWeight: FontWeight.bold,
    //                                       fontSize: ScreenUtil().setSp(26)),
    //                                 ))
    //                             : Container()
    //                       ],
    //                     ),
    //                   ),
    //                   MyDivider(
    //                     ScreenUtil().setWidth(1),
    //                     ScreenUtil().setHeight(90),
    //                     color: MyColours.color_ededed,
    //                   ),
    //                   Container(
    //                     width: ScreenUtil().setWidth(159),
    //                     alignment: Alignment.center,
    //                     child: Text(
    //                       notebook.ddateStr,
    //                       style: TextStyle(
    //                           color: textColor,
    //                           // fontWeight: FontWeight.bold,
    //                           fontSize: ScreenUtil().setSp(30)),
    //                     ),
    //                   ),
    //                 ],
    //               ),
    //             ),
    //             MyDivider(
    //               ScreenUtil().setWidth(1),
    //               ScreenUtil().setHeight(90),
    //               color: MyColours.color_ededed,
    //             ),
    //             GestureDetector(
    //               onTap: _onOperateClick,
    //               behavior: HitTestBehavior.opaque,
    //               child: Container(
    //                 padding:
    //                     EdgeInsets.symmetric(vertical: ScreenUtil().setWidth(20)),
    //                 width: ScreenUtil().setWidth(184),
    //                 // color: Colors.red,
    //                 alignment: Alignment.center,
    //                 child: Text(
    //                   notebook.operationText,
    //                   style: TextStyle(
    //                       color: (notebook.status == "3" ||
    //                               notebook.status == "4" ||
    //                               notebook.status == "6")
    //                           ? MyColours.color_bfbfbf
    //                           : MyColours.color_2bb5b7,
    //                       // fontWeight: FontWeight.bold,
    //                       fontSize: ScreenUtil().setSp(30)),
    //                 ),
    //               ),
    //             ),
    //           ],
    //         ),
    //       ),
    //       notebook.orderInfo != null && notebook.orderInfo.status == '3'
    //           ? Container(
    //               alignment: Alignment.center,
    //               width: ScreenUtil().setWidth(52 * 2),
    //               height: ScreenUtil().setWidth(19 * 2),
    //               decoration: BoxDecoration(
    //                 color: MyColours.color_F59A23,
    //                 borderRadius: BorderRadius.only(
    //                     bottomRight: Radius.circular(ScreenUtil().setWidth(10))),
    //               ),
    //               child: Text(
    //                 '已买单',
    //                 style: TextStyle(
    //                     fontSize: ScreenUtil().setSp(24),
    //                     color: MyColours.color_ffffff,
    //                     fontWeight: FontWeight.bold),
    //               ))
    //           : Container()
    //     ],
    //   );
  }
}