get_banquet_by_id_new_model.dart 22.6 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
import 'dart:convert' as convert;

import 'package:flutter/material.dart';
import 'package:one_key/models/set_xuan_tai_model.dart';
import 'package:one_key/models/upload_img_model.dart';
import 'package:one_key/utils/ConvertNumberToChineseMoneyWords.dart';
import 'package:one_key/models/table_list.dart' as t;

class GetBanquetByIdNewModel {
  int ret;
  GetBanquetByIdNewSunModel data;
  String msg;

  GetBanquetByIdNewModel({this.ret, this.data, this.msg});

  GetBanquetByIdNewModel.fromJson(Map<String, dynamic> json) {
    ret = json['ret'];
    data = json['data'] != null
        ? new GetBanquetByIdNewSunModel.fromJson(json['data'])
        : null;
    msg = json['msg'];
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    data['ret'] = this.ret;
    if (this.data != null) {
      data['data'] = this.data.toJson();
    }
    data['msg'] = this.msg;
    return data;
  }
}

class GetBanquetByIdNewSunModel {
  BasicInfo basicInfo;
  List<SessionsInfo> sessionsInfo;
  List<CostInfoModel> costInfo; //费用信息
  ContractInfo contractInfo;
  Invoice invoice;

  GetBanquetByIdNewSunModel(
      {this.basicInfo,
      this.sessionsInfo,
      this.costInfo,
      this.contractInfo,
      this.invoice});

  GetBanquetByIdNewSunModel.fromJson(Map<String, dynamic> json) {
    basicInfo = json['basic_info'] != null
        ? new BasicInfo.fromJson(json['basic_info'])
        : null;
    if (json['sessions_info'] != null) {
      sessionsInfo = <SessionsInfo>[];
      json['sessions_info'].forEach((v) {
        sessionsInfo.add(new SessionsInfo.fromJson(v));
      });
    }

    contractInfo = ContractInfo();
    contractInfo = json['contract_info'] != null
        ? new ContractInfo.fromJson(json['contract_info'])
        : null;
    if (json['invoice'] is Map) {
      invoice = json['invoice'] != null
          ? new Invoice.fromJson(json['invoice'])
          : null; //发票信息
    } else {
      invoice = json['invoice'] != null
          ? new Invoice.fromJson(convert.jsonDecode(json['invoice']))
          : null; //发票信息
    }

    costInfo = <CostInfoModel>[];
    if (json['cost_info'] != null && json['cost_info'].length > 0) {
      double totalP = 0.0;
      Map map = json['cost_info'];
      map.forEach((key, v) {
        CostInfoModel model = CostInfoModel.fromJson(v);
        model.title = '${key}费用';
        int start = key.indexOf('第');
        int end = key.indexOf('场');
        String numstr = key.substring(start + 1, end);
        int index = ConvertNumberToChineseMoneyWords.toInt(numstr);
        SessionsInfo info = sessionsInfo[index];

        model.discounttype = info.discounttype;
        model.discountper = info.discountper;
        model.discountprice = info.discountprice;
        model.servicetype = info.servicetype;
        model.serviceper = info.serviceper;
        model.serviceprice = info.serviceprice;
        model.totalprice = info.totalprice;
        model.service = info.servicetype == '1' ? true : false;
        model.discount = info.discounttype == '1' ? true : false;
        costInfo.add(model);
        totalP += double.parse(model.sumPrice);
      });
      contractInfo.contractTotalPrice = totalP == 0.0 ? '' : totalP.toString();
      contractInfo.contractFinalPriceC.text =
          totalP == 0.0 ? '' : totalP.toString();
      contractInfo.customerC.text = contractInfo.contractRname;
      contractInfo.storeC.text = contractInfo.contractSellerName;
      contractInfo.numC.text = contractInfo.contractNo;
    }
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    if (this.basicInfo != null) {
      data['basic_info'] = this.basicInfo.toJson();
    }
    if (this.sessionsInfo != null) {
      data['sessions_info'] = this.sessionsInfo.map((v) => v.toJson()).toList();
    }
    if (this.costInfo != null) {
      data['cost_info'] = this.costInfo.map((v) => v.toJson()).toList();
    }
    if (this.contractInfo != null) {
      data['contract_info'] = this.contractInfo.toJson();
    }
    data['invoice'] = this.invoice;
    return data;
  }
}

class BasicInfo {
  String ddate;
  String rname;
  String sex;
  String phone;
  String remark;
  Jiedan jiedan;
  Jiedan staff;
  String classify;
  List<Images> images;
  String warrantId; //担保人id
  List<Images> warrantImages; //担保图片
  String warrantDesc; //担保说明

  BasicInfo(
      {this.ddate,
      this.rname,
      this.sex,
      this.phone,
      this.remark,
      this.jiedan,
      this.staff,
      this.classify,
      this.images,
      this.warrantId,
      this.warrantImages,
      this.warrantDesc});

  BasicInfo.fromJson(Map<String, dynamic> json) {
    ddate = json['ddate'];
    rname = json['rname'];
    sex = json['sex'];
    phone = json['phone'];
    remark = json['remark'];
    jiedan =
        json['jiedan'] != null ? new Jiedan.fromJson(json['jiedan']) : null;
    staff = json['staff'] != null ? new Jiedan.fromJson(json['staff']) : null;
    classify = json['classify'];
    if (json['images'] != null) {
      images = <Images>[];
      if (json['images'] is List) {
        json['images'].forEach((v) {
          images.add(new Images.fromJson(v));
        });
      } else {
        convert.jsonDecode(json['images']).forEach((v) {
          images.add(new Images.fromJson(v));
        });
      }
    }
    warrantId = json['warrant_id'];

    if (json['warrant_images'] != null) {
      warrantImages = <Images>[];
      if (json['warrant_images'] is List) {
        json['warrant_images'].forEach((v) {
          warrantImages.add(new Images.fromJson(v));
        });
      } else {
        convert.jsonDecode(json['warrant_images']).forEach((v) {
          warrantImages.add(new Images.fromJson(v));
        });
      }
    }
    warrantDesc = json['warrant_desc'];
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    data['ddate'] = this.ddate;
    data['rname'] = this.rname;
    data['sex'] = this.sex;
    data['phone'] = this.phone;
    data['remark'] = this.remark;
    if (this.jiedan != null) {
      data['jiedan'] = this.jiedan.toJson();
    }
    if (this.staff != null) {
      data['staff'] = this.staff.toJson();
    }
    data['classify'] = this.classify;
    data['images'] = this.images;

    return data;
  }
}

class Jiedan {
  String nickName;
  String account;

  Jiedan({this.nickName, this.account});

  Jiedan.fromJson(Map<String, dynamic> json) {
    nickName = json['nick_name'];
    account = json['account'];
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    data['nick_name'] = this.nickName;
    data['account'] = this.account;
    return data;
  }
}

class SessionsInfo {
  String rdate;
  String tableInfo;
  List<SetmealDetail> setmeal;
  List<WineDetail> wine;
  List<OtherDetail> other;
  String remark;
  List<Images> images;
  dynamic tableNum;
  String servicetype;
  String serviceper;
  String serviceprice;
  String discounttype;
  String discountper;
  String discountprice;
  String totalprice;
  String id; //场次ID
  String rid; //宴会ID
  String qrdate; //开始时间
  String jedate; //结束时间
  String ddateInterval; //餐段(0不代餐,1早餐,2午餐,3晚餐)
  String reserveOrder; //第一场、第二场
  List<Tids> tids; // 桌位信息
  List<Setmeal> setmeals; // 套餐信息
  List<Wine> wines; // 酒水信息
  List<Other> others; // 酒水信息

  String get cdStr {
    switch (ddateInterval) {
      case '0':
        return '不带餐';
        break;
      case '1':
        return '早餐';
        break;
      case '2':
        return '午餐';
        break;
      case '3':
        return '晚餐';
        break;
      default:
    }
  }

  List<t.TableList> get tableList {
    List<t.TableList> tableList = [];
    tids.forEach((element) {
      t.TableList tmodel = t.TableList(
          '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '');
      tmodel.id = element.tid;
      tmodel.name = element.name;
      tableList.add(tmodel);
    });
    return tableList;
  }

  List<UploadImgModel> get feastRemarkImages {
    List<UploadImgModel> upload = [];
    images.forEach((element) {
      UploadImgModel model = UploadImgModel();
      model.process = 1;
      model.qiniuUrl = element.url;
      upload.add(model);
    });
    return upload;
  }

  SessionsInfo(
      {this.rdate,
      this.tableInfo,
      this.setmeal,
      this.wine,
      this.other,
      this.remark,
      this.images,
      this.tableNum,
      this.servicetype,
      this.serviceper,
      this.serviceprice,
      this.discounttype,
      this.discountper,
      this.discountprice,
      this.totalprice,
      this.id,
      this.rid,
      this.qrdate,
      this.jedate,
      this.ddateInterval,
      this.reserveOrder,
      this.tids,
      this.setmeals,
      this.wines,
      this.others});

  SessionsInfo.fromJson(Map<String, dynamic> json) {
    rdate = json['rdate'];
    tableInfo = json['table_info'];
    if (json['setmeal'] != null) {
      setmeal = <SetmealDetail>[];
      json['setmeal'].forEach((v) {
        setmeal.add(new SetmealDetail.fromJson(v));
      });
    }
    if (json['wine'] != null) {
      wine = <WineDetail>[];
      json['wine'].forEach((v) {
        wine.add(new WineDetail.fromJson(v));
      });
    }
    if (json['other'] != null) {
      other = <OtherDetail>[];
      json['other'].forEach((v) {
        other.add(new OtherDetail.fromJson(v));
      });
    }
    remark = json['remark'];

    if (json['images'] != null) {
      images = <Images>[];
      if (json['images'] is List) {
        json['images'].forEach((v) {
          images.add(new Images.fromJson(v));
        });
      } else {
        convert.jsonDecode(json['images']).forEach((v) {
          images.add(new Images.fromJson(v));
        });
      }
    }

    tableNum = json['table_num'];
    servicetype = json['service_type'];
    serviceper = json['service_per'];
    serviceprice = json['service_price'];
    discounttype = json['discount_type'];
    discountper = json['discount_per'];
    discountprice = json['discount_price'];
    totalprice = json['total_price'];

    //解析session新加字段,下午做
    id = json['id'];
    rid = json['rid'];
    qrdate = json['_rdate'];
    jedate = json['_edate'];
    ddateInterval = json['ddate_interval'];
    reserveOrder = json['reserve_order'];
    if (json['images'] != null) {
      images = <Images>[];

      convert.jsonDecode(json['images']).forEach((v) {
        images.add(new Images.fromJson(v));
      });
    }
    if (json['tableData'] != null) {
      tids = <Tids>[];
      convert.jsonDecode(json['tableData']).forEach((v) {
        tids.add(new Tids.fromJson(v));
      });
    }
    if (json['setmealData'] != null) {
      setmeals = <Setmeal>[];
      convert.jsonDecode(json['setmealData']).forEach((v) {
        setmeals.add(new Setmeal.fromJson(v));
      });
    }
    if (json['wineData'] != null) {
      wines = <Wine>[];
      convert.jsonDecode(json['wineData']).forEach((v) {
        wines.add(new Wine.fromJson(v));
      });
    }
    if (json['otherData'] != null) {
      others = <Other>[];
      convert.jsonDecode(json['otherData']).forEach((v) {
        others.add(new Other.fromJson(v));
      });
    }
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    data['rdate'] = this.rdate;
    data['table_info'] = this.tableInfo;
    if (this.setmeal != null) {
      data['setmeal'] = this.setmeal.map((v) => v.toJson()).toList();
    }
    if (this.wine != null) {
      data['wine'] = this.wine.map((v) => v.toJson()).toList();
    }
    if (this.other != null) {
      data['other'] = this.other.map((v) => v.toJson()).toList();
    }
    data['remark'] = this.remark;
    data['images'] = this.images;
    data['table_num'] = this.tableNum;
    data['service_type'] = this.servicetype;
    data['service_per'] = this.serviceper;
    data['service_price'] = this.serviceprice;
    data['discount_type'] = this.discounttype;
    data['discount_per'] = this.discountper;
    data['discount_price'] = this.discountprice;
    data['total_price'] = this.totalprice;
    data['id'] = this.id;
    data['rid'] = this.rid;
    data['_rdate'] = this.qrdate;
    data['_edate'] = this.jedate;
    data['ddate_interval'] = this.ddateInterval;
    data['reserve_order'] = this.reserveOrder;

    if (this.tids != null) {
      data['tableData'] = this.tids.map((v) => v.toJson()).toList();
    }
    if (this.setmeals != null) {
      data['setmealData'] = this.setmeal.map((v) => v.toJson()).toList();
    }
    if (this.wines != null) {
      data['wineData'] = this.wine.map((v) => v.toJson()).toList();
    }
    if (this.others != null) {
      data['otherData'] = this.other.map((v) => v.toJson()).toList();
    }
    return data;
  }
}

class SetmealDetail {
  String setmealId;
  String price;
  String finalPrice;
  String pnum;
  String min;
  String spare;
  List<Cooklist> cooklist;
  String mealName;

  SetmealDetail(
      {this.setmealId,
      this.price,
      this.finalPrice,
      this.pnum,
      this.min,
      this.spare,
      this.cooklist,
      this.mealName});

  SetmealDetail.fromJson(Map<String, dynamic> json) {
    setmealId = json['setmeal_id'];
    price = json['price'];
    finalPrice = json['final_price'];
    pnum = json['pnum'];
    min = json['min'];
    spare = json['spare'];
    // if (json['cooklist'] != null) {
    //   cooklist = <Cooklist>[];
    //   json['cooklist'].forEach((v) {
    //     cooklist.add(new Cooklist.fromJson(v));
    //   });
    // }

    if (json['cooklist'] != null && json['cooklist'].length > 0) {
      cooklist = <Cooklist>[];
      Map map = json['cooklist'];
      map.forEach((key, v) {
        v.forEach((v1) {
          cooklist.add(new Cooklist.fromJson(v1));
        });
      });
    }
    mealName = json['meal_name'];
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    data['setmeal_id'] = this.setmealId;
    data['price'] = this.price;
    data['final_price'] = this.finalPrice;
    data['pnum'] = this.pnum;
    data['min'] = this.min;
    data['spare'] = this.spare;
    if (this.cooklist != null) {
      data['cooklist'] = this.cooklist.map((v) => v.toJson()).toList();
    }
    data['meal_name'] = this.mealName;
    return data;
  }
}

// class Cooklist {
//   String cname;

//   Cooklist({this.cname});

//   Cooklist.fromJson(Map<String, dynamic> json) {
//     cname = json['cname'];
//   }

//   Map<String, dynamic> toJson() {
//     final Map<String, dynamic> data = new Map<String, dynamic>();
//     data['cname'] = this.cname;
//     return data;
//   }
// }

class WineDetail {
  String wineName;
  String wineNum;
  String spec;

  WineDetail({this.wineName, this.wineNum, this.spec});

  WineDetail.fromJson(Map<String, dynamic> json) {
    wineName = json['wine_name'];
    wineNum = json['wine_num'];
    spec = json['spec'];
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    data['wine_name'] = this.wineName;
    data['wine_num'] = this.wineNum;
    data['spec'] = this.spec;

    return data;
  }
}

class OtherDetail {
  String otherName;
  String otherNum;
  String spec;

  OtherDetail({this.otherName, this.otherNum, this.spec});

  OtherDetail.fromJson(Map<String, dynamic> json) {
    otherName = json['other_name'];
    otherNum = json['other_num'];
    spec = json['spec'];
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    data['other_name'] = this.otherName;
    data['other_num'] = this.otherNum;
    data['spec'] = this.spec;
    return data;
  }
}

class CostInfoModel {
  String title;
  List<CostInfoSunModel> data;
  bool service;
  bool discount;

  TextEditingController serviceC = TextEditingController();
  TextEditingController discountC = TextEditingController();
  String totalPriceSelf; //合计
  String sumPrice; //优惠和服务费之前的金额
  String servicetype;
  String serviceper;
  String serviceprice;
  String discounttype;
  String discountper;
  String discountprice;
  String totalprice; //接口获取到的值,在详情展示

  //详情用的服务费展示
  String get showService {
    double sum = double.parse(sumPrice); //原来总金额

    if (service) {
      //选中固定金额
      return serviceprice;
    } else {
      //选中百分比

      // 使除数为0
      double input = double.parse(serviceper);
      return '${sum * input / 100}';
    }
  }

  //详情用的合计展示(原价+服务费)
  String get showTotalWithService {
    double sum = double.parse(sumPrice); //原来总金额
    return '${sum + double.parse(showService)} 元';
  }

  //详情用的优惠金额展示
  String get showDiscount {
    double sum = double.parse(sumPrice); //原来总金额

    if (discount) {
      //选中固定金额
      return '-${discountprice} 元';
    } else {
      //选中百分比

      // 使除数为0
      double input = double.parse(discountper);
      return '-${sum * input / 100} 元';
    }
  }

  CostInfoModel({this.title, this.data});

  CostInfoModel.fromJson(List<dynamic> json) {
    data = [];
    double price = 0.0;
    json.forEach((value) {
      CostInfoSunModel sunModel = new CostInfoSunModel.fromJson(value);
      price += sunModel.price;
      data.add(sunModel);
    });
    sumPrice = price.toString();
    totalPriceSelf = sumPrice;
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    data['title'] = this.title;
    data['data'] = this.data;
    return data;
  }
}

class CostInfoSunModel {
  String cname;
  String unitPrice;
  String numStr;
  int price;
  String wineName;
  String otherName;

  CostInfoSunModel(
      {this.cname,
      this.unitPrice,
      this.numStr,
      this.price,
      this.wineName,
      this.otherName});

  CostInfoSunModel.fromJson(Map<String, dynamic> json) {
    cname = json['cname'];
    unitPrice = json['unit_price'];
    numStr = json['num'];
    price = json['price'];
    wineName = json['wine_name'];
    otherName = json['other_name'];
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    data['cname'] = this.cname;
    data['unit_price'] = this.unitPrice;
    data['num'] = this.numStr;
    data['price'] = this.price;
    data['wine_name'] = this.wineName;
    data['other_name'] = this.otherName;
    return data;
  }
}

class ContractInfo {
  String contractTotalPrice;
  String contractFinalPrice;
  String contractRname;
  String contractSellerName;
  String contractNo;
  List<Images> contractImages;
  TextEditingController contractFinalPriceC = TextEditingController();
  TextEditingController customerC = TextEditingController(); //客户签约人
  TextEditingController storeC = TextEditingController(); //店铺签约人
  TextEditingController numC = TextEditingController(); //合同编号

  ContractInfo(
      {this.contractTotalPrice,
      this.contractFinalPrice,
      this.contractRname,
      this.contractSellerName,
      this.contractNo,
      this.contractImages});

  ContractInfo.fromJson(Map<String, dynamic> json) {
    contractTotalPrice = json['contract_total_price'];
    contractFinalPrice = json['contract_final_price'];
    contractRname = json['contract_rname'];
    contractSellerName = json['contract_seller_name'];
    contractNo = json['contract_no'];

    if (json['contract_images'] != null) {
      contractImages = <Images>[];
      if (json['contract_images'] is List) {
        json['contract_images'].forEach((v) {
          contractImages.add(new Images.fromJson(v));
        });
      } else {
        convert.jsonDecode(json['contract_images']).forEach((v) {
          contractImages.add(new Images.fromJson(v));
        });
      }
    }
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    data['contract_total_price'] = this.contractTotalPrice;
    data['contract_final_price'] = this.contractFinalPrice;
    data['contract_rname'] = this.contractRname;
    data['contract_seller_name'] = this.contractSellerName;
    data['contract_no'] = this.contractNo;
    data['contract_images'] = this.contractImages;
    return data;
  }
}

// class Images {
//   String url;

//   Images({this.url});

//   Images.fromJson(Map<String, dynamic> json) {
//     url = json['url'];
//   }

//   Map<String, dynamic> toJson() {
//     final Map<String, dynamic> data = new Map<String, dynamic>();
//     data['url'] = this.url;
//     return data;
//   }
// }

class Invoice {
  String invoiceType; // "1 普通 2 专用",
  String price; //开票金额
  String unitName; //单位全称
  String numStr; //税号
  String address; //地址
  String phone; //电话
  String bank; //开户行
  String bankNum; //开户行账号
  String mail; //邮箱
  String addressee; //收件人
  String addresseePhone; //收件人电话
  String addresseeAddress; //收件人地址
  String code; //邮编
  List<Images> images;

  Invoice(
      {this.invoiceType,
      this.price,
      this.unitName,
      this.numStr,
      this.address,
      this.phone,
      this.bank,
      this.bankNum,
      this.mail,
      this.addressee,
      this.addresseePhone,
      this.addresseeAddress,
      this.code,
      this.images});

  Invoice.fromJson(Map<String, dynamic> json) {
    invoiceType = json['invoice_type'];
    price = json['price'];
    unitName = json['unit_name'];
    numStr = json['num'];
    address = json['address'];
    phone = json['phone'];
    bank = json['bank'];
    bankNum = json['bank_num'];
    mail = json['mail'];
    addressee = json['addressee'];
    addresseePhone = json['addressee_phone'];
    addresseeAddress = json['addressee_address'];
    code = json['code'];
    if (json['images'] != null) {
      images = <Images>[];
      if (json['images'] is List) {
        json['images'].forEach((v) {
          images.add(new Images.fromJson(v));
        });
      } else {
        convert.jsonDecode(json['images']).forEach((v) {
          images.add(new Images.fromJson(v));
        });
      }
    }
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    data['invoice_type'] = this.invoiceType;
    data['price'] = this.price;
    data['unit_name'] = this.unitName;
    data['num'] = this.numStr;
    data['address'] = this.address;
    data['phone'] = this.phone;
    data['bank'] = this.bank;
    data['bank_num'] = this.bankNum;
    data['mail'] = this.mail;
    data['addressee'] = this.addressee;
    data['addressee_phone'] = this.addresseePhone;
    data['addressee_address'] = this.addresseeAddress;
    data['code'] = this.code;
    data['images'] = this.images;
    return data;
  }
}