invitation_page.dart 53 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
import 'dart:typed_data';
import 'dart:ui';

import 'package:cached_network_image/cached_network_image.dart';
import 'package:common_utils/common_utils.dart';
import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart';
import 'package:flutter/services.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:one_key/models/seller_phone_model.dart';
import 'package:one_key/models/user.dart';
import 'package:one_key/pages/online_check/photo_view_wiget.dart';
import 'package:one_key/provider/base_info_provider.dart';
import 'package:one_key/provider/coupon_provider.dart';
import 'package:one_key/provider/user_model.dart';
import 'package:one_key/res/colors.dart';
import 'package:one_key/utils/misc.dart';
import 'package:one_key/utils/navigator_util.dart';
import 'package:one_key/utils/utils.dart';
import 'package:one_key/widgets/h_empty_view.dart';
import 'package:one_key/widgets/round_button.dart';
import 'package:one_key/widgets/v_empty_view.dart';
import 'package:permission_handler/permission_handler.dart';
import 'package:provider/provider.dart';
import 'dart:ui' as ui;

class InvicationPage extends StatefulWidget {
  final String rid; //预订订单id
  final String tableInfo; //桌位信息
  final String ddate;
  final String ddateStr;
  final String phone;

  InvicationPage(
      this.rid, this.tableInfo, this.ddate, this.ddateStr, this.phone);

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

class InvicationPageState extends State<InvicationPage> {
  User user;
  DateTime dateTime;
  String dateTimeStr = "";
  ScrollController controller = ScrollController();
  double couponHeight = 180.0;
  CouponProvider couponProvider;
  BaseIndoProvider _baseIndoProvider;
  String name = '填写姓名';
  String position = '填写职位';
  String phone = '填写电话';
  String qiniuUrl = '';
  final GlobalKey key = new GlobalKey();
  final GlobalKey globalKey = GlobalKey();

  @override
  void initState() {
    super.initState();

    WidgetsBinding.instance.addPostFrameCallback((_) {
      couponProvider.sendSMS = false;
      _getActivityByRid();
      _getCustomerActivityBaseinfo();
      _getSellerPhotoById();
    });
    Utils.changeStatusColor(color: Colors.transparent);
    dateTime =
        DateTime.fromMillisecondsSinceEpoch(int.parse(widget.ddate) * 1000);
    user = Provider.of<UserModel>(context, listen: false).user;
    dateTimeStr =
        "${dateTime.year}/${Utils.addZeroNumber(dateTime.month)}/${Utils.addZeroNumber(dateTime.day)} 星期${Utils.formatWeekDayNum(dateTime.weekday)} ${widget.ddateStr}";
  }

  _getSellerPhotoById() async {
    Map<String, String> params = {
      'sellerid': Provider.of<UserModel>(context, listen: false).user.sellerid,
      "type": '2',
    };
    bool success = await _baseIndoProvider.getSellerPhotoById(context, params);
  }

  _getCustomerActivityBaseinfo() async {
    Map<String, String> params = {
      'sellerid': Provider.of<UserModel>(context, listen: false).user.sellerid,
      "uid": Provider.of<UserModel>(context, listen: false).user.openid,
    };
    bool success =
        await _baseIndoProvider.getCustomerActivityBaseinfo(context, params);
    if (success) {
      name = _baseIndoProvider.baseInfoSunModel.name;
      qiniuUrl = _baseIndoProvider.baseInfoSunModel.photo;
      // _uploadImageProvider.erweima.qiniuUrl =
      //     _baseIndoProvider.baseInfoSunModel.qrcode;
      phone = _baseIndoProvider.baseInfoSunModel.phone;
      position = _baseIndoProvider.baseInfoSunModel.position;
      setState(() {});
    } else {
      //     name = '请填写姓名';
      //  position = '请填写职位';
      //  phone = '请填写电话';
      //  qiniuUrl = '';
    }
  }

  _getActivityByRid() async {
    Map<String, String> params = {
      "rid": widget.rid,
    };
    await couponProvider.getActivityByRid(context, params, isShowLoading: true);
    //flase默认5个  true 不默认5个
    if (!couponProvider.hasModify) {
      //没有绑定的券,默认给5个,获取优惠券列表
      _couponNetworkData(isShowLoading: true);
    }
  }

  ///消费券默认5张
  _couponNetworkData({bool isShowLoading = true}) async {
    Map<String, String> params = {
      "uid": Provider.of<UserModel>(context, listen: false).user.openid,
      'status': '1'
    };
    await couponProvider.getCustomerSelectActivity(context, params,
        isShowLoading: isShowLoading);
    //此人已经新建好券
    if (couponProvider.couponListSelect.length > 0) {
      couponProvider.initCouponSelect(context);

      if (couponProvider.coupons.length == 0) {
        setState(() {
          couponHeight = 0.0;
        });
      } else {
        setState(() {
          couponHeight = 180.0;
        });
      }
    } else {
      //没有新建的优惠券
      setState(() {
        couponHeight = 0.0;
      });
    }
  }

  @override
  void dispose() {
    Utils.changeStatusColor();
    couponProvider.clearSelect();
    super.dispose();
  }

  //中间内容显示组件
  Widget _middleWidget(String title, String content) {
    return Column(
      children: <Widget>[
        VEmptyView(80),
        Row(
          mainAxisSize: MainAxisSize.min,
          children: <Widget>[
            Image.asset(
              "assets/invication_line_left.png",
              width: ScreenUtil().setWidth(44),
              height: ScreenUtil().setWidth(4),
            ),
            Container(
              margin:
                  EdgeInsets.symmetric(horizontal: ScreenUtil().setWidth(13)),
              child: Text(title,
                  style: TextStyle(
                      color: MyColours.color_CEB689,
                      fontSize: ScreenUtil().setSp(28))),
            ),
            Image.asset(
              "assets/invication_line_right.png",
              width: ScreenUtil().setWidth(44),
              height: ScreenUtil().setWidth(4),
            )
          ],
        ),
        Container(
          margin: EdgeInsets.only(top: ScreenUtil().setHeight(20)),
          child: Text(
            content,
            style: TextStyle(
                color: MyColours.color_F2F2F2,
                fontSize: ScreenUtil().setSp(36)),
          ),
        )
      ],
    );
  }

  _goBaseInfoPage() async {
    bool needRefresh = await NavigatorUtil.goBaseInfoPage(context);
    Utils.changeStatusColor(color: Colors.transparent);
    if (needRefresh != null && needRefresh) {
      //刷新页面数据
      _getCustomerActivityBaseinfo();
    }
  }

  //查看大图
  _showPhotoView(BuildContext context, int index, List imgs,
      {isShow = false, List dashName}) async {
    // if (imgs.length == 1 &&
    //     imgs[0] ==
    //         'http://nosqn.colorcun.com/custom/lite-online/image/def-banner.png') {
    //   imgs[0] = 'http://nosqn.colorcun.com/app/seller-hj-empty.png';
    // }
    Utils.setBarStatus(false, color: Colors.black);
    dynamic result = await showGeneralDialog(
        context: context,
        barrierDismissible: false,
        // barrierColor: Colors.red,
        barrierLabel:
            MaterialLocalizations.of(context).modalBarrierDismissLabel,
        transitionDuration: const Duration(milliseconds: 150),
        pageBuilder: (BuildContext context, Animation animation,
            Animation secondaryAnimation) {
          Widget child = Stack(
            children: <Widget>[
              PhotoPreview(
                  initialIndex: index,
                  photoList: imgs,
                  isShow: isShow,
                  dashName: dashName)
            ],
          );
          return child;
        });
    // Utils.setBarStatus(true, color: Colors.white);
  }

  ///浏览照片
  ///
  void onTapDown(BuildContext context, TapDownDetails details) {
    final RenderBox box = context.findRenderObject();
    final Offset localOffset = box.globalToLocal(details.globalPosition);
    final RenderBox containerBox = key.currentContext.findRenderObject();
    final Offset containerOffset = containerBox.localToGlobal(localOffset);
    final onTap = containerBox.paintBounds.contains(containerOffset);
    if (onTap) {
      _seePhoto();
    }
  }

  _seePhoto() {
    List<String> temp = [];
    if (_baseIndoProvider.photoList.length > 0) {
      for (int i = 0; i < _baseIndoProvider.photoList.length; i++) {
        temp.add(_baseIndoProvider.photoList[i].image);
      }

      ///没有上传完成的不可以点击
      _showPhotoView(context, 0, temp);
    }
  }

  ///获取截图
  Future<Uint8List> _getImage() async {
    BuildContext buildContext = globalKey.currentContext;
    if (null != buildContext) {
      RenderRepaintBoundary boundary = buildContext.findRenderObject();
      ui.Image image = await boundary.toImage(pixelRatio: 6);
      ByteData byteData = await image.toByteData(format: ImageByteFormat.png);
      Uint8List pngBytes = byteData.buffer.asUint8List();
      return pngBytes;
    }
  }

  @override
  Widget build(BuildContext context) {
    // Utils.changeStatusColor(color: Colors.transparent);
    // TODO: implement build
    _baseIndoProvider = Provider.of<BaseIndoProvider>(context, listen: true);
    couponProvider = Provider.of<CouponProvider>(context, listen: true);
    return Container(
        width: double.infinity,
        // height: double.infinity,
        decoration: BoxDecoration(
          image: DecorationImage(
              image: AssetImage("assets/yd_bg_new.png"), fit: BoxFit.fill),
        ),
        child: Scaffold(
            backgroundColor: Colors.transparent,
            body: Stack(
              children: [
                Container(
                    margin: EdgeInsets.only(top: ScreenUtil().setWidth(13 * 2)),
                    padding:
                        EdgeInsets.only(top: ScreenUtil().setWidth(35 * 2)),
                    child: Column(children: [
                      Expanded(
                          child: ListView(
                              controller: controller,
                              physics: BouncingScrollPhysics(),
                              children: <Widget>[
                            Center(
                              child: Column(
                                children: <Widget>[
                                  Image.asset(
                                    "assets/yd_logo.png",
                                    width: ScreenUtil().setWidth(233 * 2),
                                    height: ScreenUtil().setHeight(51 * 2),
                                  ),
                                  VEmptyView(26),
                                  Container(
                                    margin: EdgeInsets.symmetric(
                                        horizontal: ScreenUtil().setWidth(40)),
                                    // padding: EdgeInsets.all(
                                    //     ScreenUtil().setWidth(60)),
                                    // decoration: BoxDecoration(
                                    //     gradient: LinearGradient(
                                    //       begin: Alignment.topCenter,
                                    //       end: Alignment.bottomCenter,
                                    //       colors: [
                                    //         MyColours.color_F7F1E8,
                                    //         MyColours.color_E3D6C7,
                                    //       ],
                                    //     ),
                                    //     borderRadius: BorderRadius.circular(
                                    //         ScreenUtil().setWidth(10))),
                                    child: Column(
                                      crossAxisAlignment:
                                          CrossAxisAlignment.center,
                                      children: [
                                        Container(
                                            // color: Colors.red,
                                            width:
                                                ScreenUtil().setWidth(335 * 2),
                                            height:
                                                ScreenUtil().setWidth(200 * 2),
                                            // decoration: BoxDecoration(
                                            //   image: DecorationImage(
                                            //       alignment:
                                            //           Alignment.topCenter,
                                            //       image: AssetImage(
                                            //           "assets/yd_baiinfo_bg.png"),
                                            //       fit: BoxFit.cover),
                                            // ),
                                            child: Row(
                                              crossAxisAlignment:
                                                  CrossAxisAlignment.start,
                                              children: [
                                                Padding(
                                                  padding: EdgeInsets.only(
                                                      left: ScreenUtil()
                                                          .setWidth(70)),
                                                  child: qiniuUrl == ''
                                                      ? Image.asset(
                                                          Utils.getImgPath(
                                                              'yd_person'),
                                                          width: ScreenUtil().setWidth(
                                                              143 * 2),
                                                          height: ScreenUtil()
                                                              .setWidth(
                                                                  190 * 2))
                                                      : Image.network(qiniuUrl,
                                                          width: ScreenUtil()
                                                              .setWidth(
                                                                  143 * 2),
                                                          height: ScreenUtil()
                                                              .setWidth(190 * 2)),
                                                ),
                                                HEmptyView(10),
                                                Spacer(),
                                                Container(
                                                    padding: EdgeInsets.only(
                                                        top: ScreenUtil()
                                                            .setWidth(37 * 2)),
                                                    // height: ScreenUtil()
                                                    //     .setWidth(200 * 2),
                                                    child: Column(
                                                      mainAxisAlignment:
                                                          MainAxisAlignment
                                                              .start,
                                                      crossAxisAlignment:
                                                          CrossAxisAlignment
                                                              .end,
                                                      children: [
                                                        // VEmptyView(60),
                                                        GestureDetector(
                                                          behavior:
                                                              HitTestBehavior
                                                                  .opaque,
                                                          onTap: () {
                                                            _goBaseInfoPage();
                                                          },
                                                          child: Container(
                                                            width: ScreenUtil()
                                                                .setWidth(
                                                                    120 * 2),
                                                            height: ScreenUtil()
                                                                .setWidth(
                                                                    42 * 2),
                                                            child: Text(
                                                              name,
                                                              overflow:
                                                                  TextOverflow
                                                                      .ellipsis,
                                                              textAlign:
                                                                  TextAlign
                                                                      .right,
                                                              style: TextStyle(
                                                                  color: MyColours
                                                                      .color_ffffff,
                                                                  fontSize:
                                                                      ScreenUtil()
                                                                          .setSp(
                                                                              60)),
                                                            ),
                                                          ),
                                                        ),
                                                        // VEmptyView(6),
                                                        InkWell(
                                                            onTap: () {
                                                              _goBaseInfoPage();
                                                            },
                                                            child: Container(
                                                              width: ScreenUtil()
                                                                  .setWidth(
                                                                      120 * 2),
                                                              height:
                                                                  ScreenUtil()
                                                                      .setWidth(
                                                                          22 *
                                                                              2),
                                                              child: Text(
                                                                phone,
                                                                overflow:
                                                                    TextOverflow
                                                                        .ellipsis,
                                                                textAlign:
                                                                    TextAlign
                                                                        .right,
                                                                style: TextStyle(
                                                                    color: MyColours
                                                                        .color_ffffff,
                                                                    fontSize: ScreenUtil()
                                                                        .setSp(
                                                                            32)),
                                                              ),
                                                            )),
                                                        // VEmptyView(6),
                                                        InkWell(
                                                            onTap: () {
                                                              _goBaseInfoPage();
                                                            },
                                                            child: Container(
                                                              width: ScreenUtil()
                                                                  .setWidth(
                                                                      120 * 2),
                                                              height:
                                                                  ScreenUtil()
                                                                      .setWidth(
                                                                          24 *
                                                                              2),
                                                              child: Text(
                                                                position,
                                                                overflow:
                                                                    TextOverflow
                                                                        .ellipsis,
                                                                textAlign:
                                                                    TextAlign
                                                                        .right,
                                                                style: TextStyle(
                                                                    color: MyColours
                                                                        .color_ffffff,
                                                                    fontSize: ScreenUtil()
                                                                        .setSp(
                                                                            34)),
                                                              ),
                                                            )),

                                                        RoundButton(
                                                          // width: ScreenUtil().setWidth(95),
                                                          height: ScreenUtil()
                                                              .setWidth(60 * 2),
                                                          image:
                                                              Utils.getImgPath(
                                                                  'yd_edit_new'),
                                                          imgWidth: 24,
                                                          radius: 0,
                                                          space: ScreenUtil()
                                                              .setWidth(20),
                                                          text: '编辑',
                                                          textColor: MyColours
                                                              .color_BA9953,
                                                          isBold: false,
                                                          fontSize: 28,
                                                          gradientStart: Colors
                                                              .transparent,
                                                          gradientEnd: Colors
                                                              .transparent,
                                                          onPressed: () {
                                                            _goBaseInfoPage();
                                                          },
                                                        )
                                                      ],
                                                    )),
                                                HEmptyView(60),
                                              ],
                                            )),
                                        //   Positioned(
                                        //       bottom: 0,
                                        //       child: Container(
                                        //         color: MyColours.color_EEDBC4,
                                        //         width: double.infinity,
                                        //         height:
                                        //             ScreenUtil().setWidth(40),
                                        //       ))
                                        // ],
                                        // ),
                                        // Container(
                                        //   color: MyColours.color_EEDBC4,
                                        //   width: double.infinity,
                                        //   height: ScreenUtil().setWidth(40),
                                        // ),
                                        VEmptyView(76),
                                        // Image.asset(
                                        //   "assets/yd_up.png",
                                        //   width: ScreenUtil().setWidth(195 * 2),
                                        //   height:
                                        //       ScreenUtil().setHeight(33 * 2),
                                        // ),
                                        // VEmptyView(50),

                                        RepaintBoundary(
                                          key: globalKey,
                                          child: Container(
                                            padding: EdgeInsets.fromLTRB(
                                                ScreenUtil().setWidth(10),
                                                ScreenUtil().setWidth(10),
                                                ScreenUtil().setWidth(10),
                                                ScreenUtil().setWidth(40)),
                                            // color: Colors.red,
                                            child: Column(
                                              children: [
                                                Container(
                                                  height:
                                                      ScreenUtil().setWidth(58),
                                                  child: Text(
                                                    user.sellername,
                                                    style: TextStyle(
                                                        // letterSpacing: ScreenUtil()
                                                        //     .setWidth(2.13 * 2),
                                                        color: MyColours
                                                            .color_BA9953,
                                                        // fontWeight: FontWeight.bold,
                                                        fontSize: ScreenUtil()
                                                            .setSp(42)),
                                                  ),
                                                ),
                                                VEmptyView(14),
                                                Container(
                                                  height:
                                                      ScreenUtil().setWidth(58),
                                                  child: Text(
                                                    '${dateTimeStr}',
                                                    style: TextStyle(
                                                        letterSpacing:
                                                            ScreenUtil()
                                                                .setWidth(
                                                                    1.8 * 2),
                                                        color: MyColours
                                                            .color_BA9953,
                                                        fontSize: ScreenUtil()
                                                            .setSp(42)),
                                                  ),
                                                ),
                                                VEmptyView(26),
                                                Container(
                                                  height:
                                                      ScreenUtil().setWidth(44),
                                                  child: Text(
                                                    '已为您安排在包间',
                                                    style: TextStyle(
                                                        color: MyColours
                                                            .color_ffffff,
                                                        fontSize: ScreenUtil()
                                                            .setSp(32)),
                                                  ),
                                                ),
                                                VEmptyView(28),
                                                GestureDetector(
                                                    onTapDown: (TapDownDetails
                                                            details) =>
                                                        onTapDown(
                                                            context, details),
                                                    child: Container(
                                                        child: Stack(
                                                      alignment: Alignment
                                                          .bottomCenter,
                                                      overflow:
                                                          Overflow.visible,
                                                      children: [
                                                        Container(
                                                          margin: EdgeInsets.only(
                                                              bottom:
                                                                  ScreenUtil()
                                                                      .setWidth(
                                                                          24)),
                                                          constraints: BoxConstraints(
                                                              maxWidth:
                                                                  ScreenUtil()
                                                                      .setWidth(
                                                                          195 *
                                                                              2)),
                                                          padding: EdgeInsets
                                                              .fromLTRB(
                                                                  ScreenUtil()
                                                                      .setWidth(
                                                                          60),
                                                                  ScreenUtil()
                                                                      .setWidth(
                                                                          30),
                                                                  ScreenUtil()
                                                                      .setWidth(
                                                                          60),
                                                                  ScreenUtil()
                                                                      .setWidth(
                                                                          24 *
                                                                              2)),
                                                          decoration: BoxDecoration(
                                                              borderRadius: BorderRadius.all(
                                                                  Radius.circular(
                                                                      ScreenUtil()
                                                                          .setWidth(13 *
                                                                              2))),
                                                              border: Border.all(
                                                                  color: MyColours
                                                                      .color_BA9953,
                                                                  width: ScreenUtil()
                                                                      .setWidth(
                                                                          4))),
                                                          child: Text(
                                                            widget.tableInfo
                                                                .replaceAll(
                                                                    "\n", ""),
                                                            style: TextStyle(
                                                                // letterSpacing: ScreenUtil()
                                                                //     .setWidth(2.13 * 2),
                                                                color: MyColours
                                                                    .color_BA9953,
                                                                fontWeight:
                                                                    FontWeight
                                                                        .bold,
                                                                fontSize:
                                                                    ScreenUtil()
                                                                        .setSp(
                                                                            52)),
                                                          ),
                                                        ),
                                                        Positioned(
                                                          key: key,
                                                          bottom: 0,
                                                          child: _baseIndoProvider
                                                                      .photoList
                                                                      .length >
                                                                  0
                                                              ? RoundButton(
                                                                  onPressed:
                                                                      () {
                                                                    _seePhoto();
                                                                  },
                                                                  text: '浏览照片',
                                                                  width: ScreenUtil()
                                                                      .setWidth(
                                                                          68 *
                                                                              2),
                                                                  height: ScreenUtil()
                                                                      .setWidth(
                                                                          24 *
                                                                              2),
                                                                  fontSize: 26,
                                                                  textColor:
                                                                      MyColours
                                                                          .color_333333,
                                                                  isBold: false,
                                                                  gradientStart:
                                                                      MyColours
                                                                          .color_BA9953,
                                                                  gradientEnd:
                                                                      MyColours
                                                                          .color_BA9953,
                                                                )
                                                              : Container(),
                                                        )
                                                      ],
                                                    ))),
                                              ],
                                            ),
                                          ),
                                        ),

                                        VEmptyView(30),
                                        Container(
                                          // height: ScreenUtil().setWidth(40),
                                          child: Text(
                                            '${user.sellerAddr}',
                                            maxLines: 3,
                                            overflow: TextOverflow.ellipsis,
                                            textAlign: TextAlign.center,
                                            style: TextStyle(
                                                color: MyColours.color_BA9953,
                                                fontSize:
                                                    ScreenUtil().setSp(28)),
                                          ),
                                        ),
                                        // VEmptyView(20),
                                        // RoundButton(
                                        //   text: '一键导航',
                                        //   width: ScreenUtil().setWidth(68 * 2),
                                        //   height: ScreenUtil().setWidth(24 * 2),
                                        //   fontSize: 24,
                                        //   textColor: MyColours.color_794F28,
                                        //   isBold: false,
                                        //   gradientStart:
                                        //       Color.fromRGBO(121, 79, 40, 0.1),
                                        //   gradientEnd:
                                        //       Color.fromRGBO(121, 79, 40, 0.1),
                                        // ),
                                        // VEmptyView(50),
                                        // Image.asset(
                                        //   "assets/yd_down.png",
                                        //   width: ScreenUtil().setWidth(195 * 2),
                                        //   height:
                                        //       ScreenUtil().setHeight(33 * 2),
                                        // ),
                                        // VEmptyView(60),
                                      ],
                                    ),
                                  )
                                ],
                              ),
                            ),
                            VEmptyView(couponHeight),
                          ])),
                      Container(
                        width: double.infinity,
                        height: ScreenUtil().setHeight(99),
                        child: Row(
                          children: <Widget>[
                            GestureDetector(
                              onTap: () async {
                                if (widget.phone.isEmpty) {
                                  Utils.showToast("没有预订人电话信息");
                                  return;
                                }
                                if (!couponProvider.sendSMS) {
                                  Map<String, String> params = {
                                    "id": widget.rid,
                                    "uid": Provider.of<UserModel>(context,
                                            listen: false)
                                        .user
                                        .openid,
                                    "phone": widget.phone,
                                    "Strtext": user.sellername +
                                        _baseIndoProvider.baseInfoSunModel.name
                                  };
                                  bool success = await couponProvider
                                      .sendSMSWxSendSms(context, params);
                                  print(success);
                                  if (success) {
                                    Utils.showToast('短信已经发送成功!');
                                  } else {
                                    Utils.showToast('发送次数太频繁!');
                                  }
                                } else {
                                  Utils.showToast('短信已经发送成功!');
                                }

                                // NavigatorUtil.goSmsPage(context, widget.rid);
                              },
                              child: Container(
                                width: ScreenUtil().setWidth(135 * 2),
                                height: double.infinity,
                                alignment: Alignment.center,
                                decoration: BoxDecoration(
                                    color: MyColours.color_262628,
                                    border: Border(
                                        top: BorderSide(
                                            width: ScreenUtil().setWidth(1),
                                            color: MyColours.color_ECD9B7))),
                                child: Text(
                                  "发短信",
                                  style: TextStyle(
                                      color: MyColours.color_ECD9B7,
                                      fontSize: ScreenUtil().setSp(28)),
                                ),
                              ),
                            ),
                            Expanded(
                              child: GestureDetector(
                                onTap: () async {
                                  // Uint8List image = await _getImage();

                                  if (ObjectUtil.isEmpty(
                                      _baseIndoProvider.baseInfoSunModel)) {
                                    Utils.showToast('请输入个人资料');
                                    return;
                                  }
                                  if (ObjectUtil.isEmpty(_baseIndoProvider
                                      .baseInfoSunModel.name)) {
                                    Utils.showToast('请填写您的姓名');
                                    return;
                                  }
                                  if (ObjectUtil.isEmpty(_baseIndoProvider
                                      .baseInfoSunModel.phone)) {
                                    Utils.showToast('请填写您的联系电话');
                                    return;
                                  }
                                  if (ObjectUtil.isEmpty(_baseIndoProvider
                                      .baseInfoSunModel.position)) {
                                    Utils.showToast('请填写您在餐厅中的职位');
                                    return;
                                  }
                                  if (ObjectUtil.isEmpty(_baseIndoProvider
                                      .baseInfoSunModel.phone)) {
                                    Utils.showToast('请上传您的头像');
                                    return;
                                  }
                                  if (ObjectUtil.isEmpty(_baseIndoProvider
                                      .baseInfoSunModel.qrcode)) {
                                    Utils.showToast('请上传您的微信二维码');
                                    return;
                                  }
                                  if (!couponProvider.hasModify &&
                                      couponProvider.coupons.length > 0) {
                                    Map<String, String> params = {
                                      "rid": widget.rid,
                                      "aid": Utils.listToStringEnglish(
                                          couponProvider.coupons)
                                    };
                                    bool isSuc = await couponProvider
                                        .setActivityAsReserve(context, params);
                                    if (isSuc) {
                                      couponProvider.hasModify = true;

                                      bool isSuccess =
                                          await Utils.goShareInvicationToWeChat(
                                              widget.rid,
                                              Provider.of<UserModel>(context,
                                                      listen: false)
                                                  .user
                                                  .openid);
                                      print(isSuccess);
                                      // couponProvider.couponsShow = [];
                                      // couponProvider.couponsShow
                                      //     .addAll(couponProvider.coupons);
                                      // couponProvider.coupons = [];
                                      // couponProvider.notifyListeners();
                                    }
                                  } else {
                                    bool isSuccess =
                                        await Utils.goShareInvicationToWeChat(
                                            widget.rid,
                                            Provider.of<UserModel>(context,
                                                    listen: false)
                                                .user
                                                .openid);
                                    print(isSuccess);
                                  }
                                },
                                child: Container(
                                  width: double.infinity,
                                  height: double.infinity,
                                  color: MyColours.color_ECD9B7,
                                  alignment: Alignment.center,
                                  child: Text(
                                    "通知客户",
                                    style: TextStyle(
                                        color: MyColours.color_7B512A,
                                        fontSize: ScreenUtil().setSp(30)),
                                  ),
                                ),
                              ),
                            )
                          ],
                        ),
                      )
                    ])),
                Positioned(
                  left: ScreenUtil().setWidth(0),
                  top: ScreenUtil().setWidth(0),
                  child: SafeArea(
                      child: GestureDetector(
                    onTap: () {
                      Navigator.of(context).pop();
                    },
                    behavior: HitTestBehavior.opaque,
                    child: Container(
                        padding: EdgeInsets.fromLTRB(
                          ScreenUtil().setWidth(40),
                          ScreenUtil().setWidth(28),
                          ScreenUtil().setWidth(200),
                          ScreenUtil().setWidth(100),
                        ),
                        alignment: Alignment.centerLeft,
                        child: Image.asset(
                          "assets/back_white.png",
                          width: ScreenUtil().setWidth(20),
                          height: ScreenUtil().setHeight(31),
                        )),
                  )),
                ),
                Positioned(
                  // left: ScreenUtil().setWidth(180),
                  bottom: ScreenUtil().setWidth(110),
                  right: ScreenUtil().setWidth(40),
                  child: couponProvider.hasModify ||
                          couponProvider.coupons.length > 0 ||
                          couponProvider.couponListSelect.length > 0
                      ? GestureDetector(
                          onTap: () async {
                            NavigatorUtil.goCouponSelectPage(context,
                                rid: widget.rid,
                                hasModify: couponProvider.hasModify);
                          },
                          behavior: HitTestBehavior.opaque,
                          child: Column(
                            crossAxisAlignment: CrossAxisAlignment.center,
                            children: [
                              Container(
                                  padding: EdgeInsets.symmetric(
                                      horizontal: ScreenUtil().setWidth(40),
                                      vertical: ScreenUtil().setWidth(16)),
                                  height: ScreenUtil().setWidth(35 * 2),
                                  decoration: BoxDecoration(
                                      color: MyColours.color_000000,
                                      borderRadius: BorderRadius.circular(
                                          ScreenUtil().setWidth(20))),
                                  child: Row(
                                    children: [
                                      Text(
                                        '并赠送给顾客${couponProvider.coupons.length}张优惠券',
                                        textAlign: TextAlign.center,
                                        style: TextStyle(
                                          color: MyColours.color_f5f5f5,
                                          fontWeight: FontWeight.bold,
                                          fontSize: ScreenUtil().setSp(28),
                                        ),
                                      ),
                                      HEmptyView(40),
                                      RoundButton(
                                        width: ScreenUtil().setWidth(124),
                                        height: ScreenUtil().setWidth(46),
                                        text: '点击查看',
                                        textColor: MyColours.color_FDA31D,
                                        fontSize: 24,
                                        isBold: true,
                                        radius: ScreenUtil().setWidth(10),
                                        gradientStart: MyColours.color_f5f5f5,
                                        gradientEnd: MyColours.color_f5f5f5,
                                        onPressed: () async {
                                          NavigatorUtil.goCouponSelectPage(
                                              context,
                                              rid: widget.rid,
                                              hasModify:
                                                  couponProvider.hasModify);
                                        },
                                      )
                                    ],
                                  )),
                              Image.asset(Utils.getImgPath('jian'),
                                  width: ScreenUtil().setWidth(28),
                                  height: ScreenUtil().setWidth(20))
                            ],
                          ))
                      : Container(),
                )
              ],
            )));
  }
}