Commit 70e5b34af7027e59e3058d7d9a667ed19373a2cb

Authored by wdn127929
1 parent 258d67e1

签约费用

  1 +import 'package:common_utils/common_utils.dart';
  2 +
  3 +import '../utils/utils.dart';
  4 +
  5 +class GetBanquetByTimeModel {
  6 + int ret;
  7 + List<GetBanquetByTimeSunModel> data;
  8 + String msg;
  9 +
  10 + GetBanquetByTimeModel({this.ret, this.data, this.msg});
  11 +
  12 + GetBanquetByTimeModel.fromJson(Map<String, dynamic> json) {
  13 + ret = json['ret'];
  14 + if (json['data'] != null) {
  15 + data = <GetBanquetByTimeSunModel>[];
  16 + json['data'].forEach((v) {
  17 + data.add(new GetBanquetByTimeSunModel.fromJson(v));
  18 + });
  19 + }
  20 + msg = json['msg'];
  21 + }
  22 +
  23 + Map<String, dynamic> toJson() {
  24 + final Map<String, dynamic> data = new Map<String, dynamic>();
  25 + data['ret'] = this.ret;
  26 + if (this.data != null) {
  27 + data['data'] = this.data.map((v) => v.toJson()).toList();
  28 + }
  29 + data['msg'] = this.msg;
  30 + return data;
  31 + }
  32 +}
  33 +
  34 +class GetBanquetByTimeSunModel {
  35 + String id;
  36 + String rname;
  37 + String sex;
  38 + String phone;
  39 + String staffId;
  40 + String ddate;
  41 + String classifyId;
  42 + String className;
  43 + String nickName;
  44 + String account;
  45 + List<SessionByTime> list;
  46 +
  47 + String get ddateStr {
  48 + DateTime dateTime =
  49 + DateTime.fromMillisecondsSinceEpoch(int.parse(ddate) * 1000);
  50 + return '${dateTime.month}月${dateTime.day}日';
  51 + }
  52 +
  53 + GetBanquetByTimeSunModel(
  54 + {this.id,
  55 + this.rname,
  56 + this.sex,
  57 + this.phone,
  58 + this.staffId,
  59 + this.ddate,
  60 + this.classifyId,
  61 + this.className,
  62 + this.nickName,
  63 + this.account,
  64 + this.list});
  65 +
  66 + GetBanquetByTimeSunModel.fromJson(Map<String, dynamic> json) {
  67 + id = json['id'];
  68 + rname = json['rname'];
  69 + sex = json['sex'];
  70 + phone = json['phone'];
  71 + staffId = json['staff_id'];
  72 + ddate = json['ddate'];
  73 + classifyId = json['classify_id'];
  74 + className = json['class_name'];
  75 + nickName = json['nick_name'];
  76 + account = json['account'];
  77 + if (json['list'] != null) {
  78 + list = <SessionByTime>[];
  79 + json['list'].forEach((v) {
  80 + list.add(new SessionByTime.fromJson(v));
  81 + });
  82 + }
  83 + }
  84 +
  85 + Map<String, dynamic> toJson() {
  86 + final Map<String, dynamic> data = new Map<String, dynamic>();
  87 + data['id'] = this.id;
  88 + data['rname'] = this.rname;
  89 + data['sex'] = this.sex;
  90 + data['phone'] = this.phone;
  91 + data['staff_id'] = this.staffId;
  92 + data['ddate'] = this.ddate;
  93 + data['classify_id'] = this.classifyId;
  94 + data['class_name'] = this.className;
  95 + data['nick_name'] = this.nickName;
  96 + data['account'] = this.account;
  97 + if (this.list != null) {
  98 + data['list'] = this.list.map((v) => v.toJson()).toList();
  99 + }
  100 + return data;
  101 + }
  102 +}
  103 +
  104 +class SessionByTime {
  105 + String reserveOrder;
  106 + String ddateInterval;
  107 + String rdate;
  108 + String edate;
  109 + String tids;
  110 + List<String> tableName;
  111 + String get ddateStr {
  112 + if (rdate.length > 11) {
  113 + return '';
  114 + }
  115 + if (ddateInterval == '0') {
  116 + //不带餐
  117 +
  118 + DateTime dateS =
  119 + DateTime.fromMillisecondsSinceEpoch(int.parse(rdate) * 1000);
  120 + DateTime dateE =
  121 + DateTime.fromMillisecondsSinceEpoch(int.parse(edate) * 1000);
  122 + String ymd = DateUtil.formatDate(dateS, format: DateFormats.y_mo_d);
  123 + String start = '${Utils.addZeroNumber(dateS.hour)}:${Utils.addZeroNumber(dateS.minute)}';
  124 + String end = '${Utils.addZeroNumber(dateE.hour)}:${Utils.addZeroNumber(dateE.minute)}';
  125 +
  126 + return ymd + ' ' + start + '-' + end;
  127 + } else {
  128 + DateTime dateS =
  129 + DateTime.fromMillisecondsSinceEpoch(int.parse(rdate) * 1000);
  130 + // DateTime dateE =
  131 + // DateTime.fromMillisecondsSinceEpoch(int.parse(temp[1]) * 1000);
  132 + String ymd = DateUtil.formatDate(dateS, format: DateFormats.y_mo_d);
  133 + if (ddateInterval == '1') {
  134 + return ymd + ' ' + '早餐';
  135 + } else if (ddateInterval == '2') {
  136 + return ymd + ' ' + '午餐';
  137 + } else if (ddateInterval == '3') {
  138 + return ymd + ' ' + '晚餐';
  139 + }
  140 + }
  141 +
  142 + return '';
  143 + }
  144 +
  145 + SessionByTime(
  146 + {this.reserveOrder,
  147 + this.ddateInterval,
  148 + this.rdate,
  149 + this.edate,
  150 + this.tids,
  151 + this.tableName});
  152 +
  153 + SessionByTime.fromJson(Map<String, dynamic> json) {
  154 + reserveOrder = json['reserve_order'];
  155 + ddateInterval = json['ddate_interval'];
  156 + rdate = json['rdate'];
  157 + edate = json['edate'];
  158 + tids = json['tids'];
  159 + tableName = json['table_name'].cast<String>();
  160 + }
  161 +
  162 + Map<String, dynamic> toJson() {
  163 + final Map<String, dynamic> data = new Map<String, dynamic>();
  164 + data['reserve_order'] = this.reserveOrder;
  165 + data['ddate_interval'] = this.ddateInterval;
  166 + data['rdate'] = this.rdate;
  167 + data['edate'] = this.edate;
  168 + data['tids'] = this.tids;
  169 + data['table_name'] = this.tableName;
  170 + return data;
  171 + }
  172 +}
@@ -311,6 +311,9 @@ class HttpUrl { @@ -311,6 +311,9 @@ class HttpUrl {
311 "?service=App.Banquet.SetInvoice"; //设置、修改、删除发票 311 "?service=App.Banquet.SetInvoice"; //设置、修改、删除发票
312 static const String del_banquet_info = 312 static const String del_banquet_info =
313 "?service=App.Banquet.DelBanquetInfo"; //删除场次 313 "?service=App.Banquet.DelBanquetInfo"; //删除场次
314 - 314 + static const String get_banquet_by_time =
  315 + "?service=App.Banquet.GetBanquetByTime"; //根据时间范围获取宴会订单
  316 + static const String set_banquet_info_price =
  317 + "?service=App.Banquet.SetBanquetInfoPrice"; //设置宴会场次费用
315 318
316 } 319 }
@@ -84,6 +84,9 @@ class _FeastCreatePageState extends State<FeastCreatePage> { @@ -84,6 +84,9 @@ class _FeastCreatePageState extends State<FeastCreatePage> {
84 UserModel userModel; 84 UserModel userModel;
85 Map<String, List<CookByIdSetmeal>> dataMenu = {}; 85 Map<String, List<CookByIdSetmeal>> dataMenu = {};
86 Map<String, String> invoice; //发票 86 Map<String, String> invoice; //发票
  87 + String morning;
  88 + String noon;
  89 + String night;
87 90
88 @override 91 @override
89 void initState() { 92 void initState() {
@@ -155,12 +158,10 @@ class _FeastCreatePageState extends State<FeastCreatePage> { @@ -155,12 +158,10 @@ class _FeastCreatePageState extends State<FeastCreatePage> {
155 dsoltList.add(dsoltModel('0', '不带餐')); 158 dsoltList.add(dsoltModel('0', '不带餐'));
156 UserModel userModel = Provider.of<UserModel>(context, listen: false); 159 UserModel userModel = Provider.of<UserModel>(context, listen: false);
157 160
158 - String morning = 161 + morning =
159 userModel.user.morning.isEmpty ? "00:00-00:00" : userModel.user.morning; 162 userModel.user.morning.isEmpty ? "00:00-00:00" : userModel.user.morning;
160 - String noon =  
161 - userModel.user.noon.isEmpty ? "00:00-00:00" : userModel.user.noon;  
162 - String night =  
163 - userModel.user.night.isEmpty ? "00:00-00:00" : userModel.user.night; 163 + noon = userModel.user.noon.isEmpty ? "00:00-00:00" : userModel.user.noon;
  164 + night = userModel.user.night.isEmpty ? "00:00-00:00" : userModel.user.night;
164 if (morning != "00:00-00:00") { 165 if (morning != "00:00-00:00") {
165 dsoltList.add(dsoltModel('1', '早餐')); 166 dsoltList.add(dsoltModel('1', '早餐'));
166 } 167 }
@@ -893,7 +894,7 @@ class _FeastCreatePageState extends State<FeastCreatePage> { @@ -893,7 +894,7 @@ class _FeastCreatePageState extends State<FeastCreatePage> {
893 } 894 }
894 895
895 //获取一天开始-结束时间字符串 896 //获取一天开始-结束时间字符串
896 - String _getRdate(DateTime date) { 897 + String _getRdate(SetXuanTaiModel model, DateTime date) {
897 String keys = ''; 898 String keys = '';
898 899
899 String ymd = DateUtil.formatDate(date, format: DateFormats.y_mo_d); 900 String ymd = DateUtil.formatDate(date, format: DateFormats.y_mo_d);
@@ -903,9 +904,9 @@ class _FeastCreatePageState extends State<FeastCreatePage> { @@ -903,9 +904,9 @@ class _FeastCreatePageState extends State<FeastCreatePage> {
903 double startDay; 904 double startDay;
904 //一天结束时间 905 //一天结束时间
905 double endDay; 906 double endDay;
906 - if (xuantaiData[xuantaiSelIndex].qsDateShow != '暂未选择') {  
907 - timeStrStart = ymd + ' ' + xuantaiData[xuantaiSelIndex].startDate + ':00';  
908 - timeStrEnd = ymd + ' ' + xuantaiData[xuantaiSelIndex].endDate + ':00'; 907 + if (model.qsDateShow != '暂未选择') {
  908 + timeStrStart = ymd + ' ' + model.startDate + ':00';
  909 + timeStrEnd = ymd + ' ' + model.endDate + ':00';
909 } else { 910 } else {
910 timeStrStart = date.year.toString() + 911 timeStrStart = date.year.toString() +
911 "-" + 912 "-" +
@@ -925,6 +926,63 @@ class _FeastCreatePageState extends State<FeastCreatePage> { @@ -925,6 +926,63 @@ class _FeastCreatePageState extends State<FeastCreatePage> {
925 return startDay.floor().toString() + "-" + endDay.floor().toString(); 926 return startDay.floor().toString() + "-" + endDay.floor().toString();
926 } 927 }
927 928
  929 + //获取一天开始-结束时间字符串
  930 + String _getEdate(SetXuanTaiModel element, DateTime date) {
  931 + String keys = '';
  932 +
  933 + String ymd = DateUtil.formatDate(date, format: DateFormats.y_mo_d);
  934 + String timeStrStart = '';
  935 + String timeStrEnd = '';
  936 + //一天开始时间
  937 + double startDay;
  938 + //一天结束时间
  939 + double endDay;
  940 + if (xuantaiData[xuantaiSelIndex].qsDateShow != '暂未选择') {
  941 + timeStrStart = ymd + ' ' + xuantaiData[xuantaiSelIndex].startDate + ':00';
  942 + timeStrEnd = ymd + ' ' + xuantaiData[xuantaiSelIndex].endDate + ':00';
  943 + startDay = (DateTime.parse(timeStrStart).millisecondsSinceEpoch) / 1000;
  944 + endDay = (DateTime.parse(timeStrEnd).millisecondsSinceEpoch) / 1000;
  945 + return startDay.floor().toString() + "-" + endDay.floor().toString();
  946 + } else {
  947 + return null;
  948 + }
  949 + // if (element.cdShow == '不带餐') {
  950 + // timeStrStart = ymd + ' ' + xuantaiData[xuantaiSelIndex].startDate + ':00';
  951 + // timeStrEnd = ymd + ' ' + xuantaiData[xuantaiSelIndex].endDate + ':00';
  952 + // } else {
  953 + // List temp = [];
  954 + // if (element.cdShow == '早餐') {
  955 + // temp = morning.split('-');
  956 + // } else if (element.cdShow == '午餐') {
  957 + // temp = noon.split('-');
  958 + // } else if (element.cdShow == '晚餐') {
  959 + // temp = night.split('-');
  960 + // }
  961 +
  962 + // if (temp.length == 2) {
  963 + // timeStrStart = ymd + ' ' + temp[0] + ':00';
  964 + // timeStrEnd = ymd + ' ' + temp[1] + ':00';
  965 + // } else {
  966 + // timeStrStart = date.year.toString() +
  967 + // "-" +
  968 + // Utils.addZeroNumber(date.month) +
  969 + // "-" +
  970 + // Utils.addZeroNumber(date.day) +
  971 + // " 00:00:00";
  972 + // timeStrEnd = date.year.toString() +
  973 + // "-" +
  974 + // Utils.addZeroNumber(date.month) +
  975 + // "-" +
  976 + // Utils.addZeroNumber(date.day) +
  977 + // " 23:59:59";
  978 + // }
  979 + // }
  980 +
  981 + startDay = (DateTime.parse(timeStrStart).millisecondsSinceEpoch) / 1000;
  982 + endDay = (DateTime.parse(timeStrEnd).millisecondsSinceEpoch) / 1000;
  983 + return startDay.floor().toString() + "-" + endDay.floor().toString();
  984 + }
  985 +
928 /// 选台保存接口 986 /// 选台保存接口
929 Future<bool> xtSave() async { 987 Future<bool> xtSave() async {
930 //判断非空选项,并弹窗提醒用户填写信息 988 //判断非空选项,并弹窗提醒用户填写信息
@@ -940,6 +998,10 @@ class _FeastCreatePageState extends State<FeastCreatePage> { @@ -940,6 +998,10 @@ class _FeastCreatePageState extends State<FeastCreatePage> {
940 Utils.showToast('请选择${reserveOrder}餐段'); 998 Utils.showToast('请选择${reserveOrder}餐段');
941 return false; 999 return false;
942 } 1000 }
  1001 + if (element.cdShow == '不带餐' && element.qsDateShow == '暂未选择') {
  1002 + Utils.showToast('请选择${reserveOrder}起始时间');
  1003 + return false;
  1004 + }
943 if (element.tids.length == 0) { 1005 if (element.tids.length == 0) {
944 Utils.showToast('请选择${reserveOrder}桌位'); 1006 Utils.showToast('请选择${reserveOrder}桌位');
945 return false; 1007 return false;
@@ -965,7 +1027,8 @@ class _FeastCreatePageState extends State<FeastCreatePage> { @@ -965,7 +1027,8 @@ class _FeastCreatePageState extends State<FeastCreatePage> {
965 } 1027 }
966 map['reserve_order'] = element.reserveOrder; 1028 map['reserve_order'] = element.reserveOrder;
967 map['ddate_interval'] = element.cdCode; 1029 map['ddate_interval'] = element.cdCode;
968 - map['rdate'] = _getRdate(element.dateTimext); 1030 + map['rdate'] = _getRdate(element, element.dateTimext);
  1031 + // map['edate'] = _getEdate(element, element.dateTimext);
969 List tids = []; 1032 List tids = [];
970 for (Tids item in element.tids) { 1033 for (Tids item in element.tids) {
971 Map mapTids = {'tid': item.tid, 'num': item.numStr}; 1034 Map mapTids = {'tid': item.tid, 'num': item.numStr};
@@ -1319,7 +1382,9 @@ class _FeastCreatePageState extends State<FeastCreatePage> { @@ -1319,7 +1382,9 @@ class _FeastCreatePageState extends State<FeastCreatePage> {
1319 }), 1382 }),
1320 _selectWidget( 1383 _selectWidget(
1321 '起始时间', xuantaiData[xuantaiSelIndex].qsDateShow, 1384 '起始时间', xuantaiData[xuantaiSelIndex].qsDateShow,
1322 - need: false, onTap: () { 1385 + need: xuantaiData[xuantaiSelIndex].cdShow == '不带餐'
  1386 + ? true
  1387 + : false, onTap: () {
1323 FocusScope.of(context).requestFocus(FocusNode()); //隐藏键盘 1388 FocusScope.of(context).requestFocus(FocusNode()); //隐藏键盘
1324 1389
1325 SetTimeWidget.init.showFeastTimeSelector( 1390 SetTimeWidget.init.showFeastTimeSelector(
@@ -1479,6 +1544,10 @@ class _FeastCreatePageState extends State<FeastCreatePage> { @@ -1479,6 +1544,10 @@ class _FeastCreatePageState extends State<FeastCreatePage> {
1479 int.parse(item 1544 int.parse(item
1480 .tableNumC.text); 1545 .tableNumC.text);
1481 } 1546 }
  1547 + xuantaiData[xuantaiSelIndex]
  1548 + .tids[index]
  1549 + .numStr = value;
  1550 +
1482 setState(() {}); 1551 setState(() {});
1483 }, 1552 },
1484 onEditingComplete: () { 1553 onEditingComplete: () {
@@ -1517,13 +1586,19 @@ class _FeastCreatePageState extends State<FeastCreatePage> { @@ -1517,13 +1586,19 @@ class _FeastCreatePageState extends State<FeastCreatePage> {
1517 .color_E6000000, 1586 .color_E6000000,
1518 rTitle: "删除", 1587 rTitle: "删除",
1519 rCallback: () { 1588 rCallback: () {
1520 - xuantaiData[xuantaiSelIndex]  
1521 - .tableSum -=  
1522 - int.parse(xuantaiData[ 1589 + if (xuantaiData[
1523 xuantaiSelIndex] 1590 xuantaiSelIndex]
1524 - .tids[index]  
1525 - .tableNumC  
1526 - .text); 1591 + .tableSum >
  1592 + 0) {
  1593 + xuantaiData[xuantaiSelIndex]
  1594 + .tableSum -=
  1595 + int.parse(xuantaiData[
  1596 + xuantaiSelIndex]
  1597 + .tids[index]
  1598 + .tableNumC
  1599 + .text);
  1600 + }
  1601 +
1527 xuantaiData[xuantaiSelIndex] 1602 xuantaiData[xuantaiSelIndex]
1528 .tids 1603 .tids
1529 .removeAt(index); 1604 .removeAt(index);
@@ -2628,7 +2703,7 @@ class _FeastCreatePageState extends State<FeastCreatePage> { @@ -2628,7 +2703,7 @@ class _FeastCreatePageState extends State<FeastCreatePage> {
2628 children: [ 2703 children: [
2629 Container( 2704 Container(
2630 width: w(80), 2705 width: w(80),
2631 - child: Text('套餐安排', 2706 + child: Text('套餐安排:',
2632 style: TextStyle( 2707 style: TextStyle(
2633 color: MyColours.color_999999, 2708 color: MyColours.color_999999,
2634 fontSize: font(12))), 2709 fontSize: font(12))),
@@ -3998,6 +4073,45 @@ class _FeastCreatePageState extends State<FeastCreatePage> { @@ -3998,6 +4073,45 @@ class _FeastCreatePageState extends State<FeastCreatePage> {
3998 ]); 4073 ]);
3999 } 4074 }
4000 4075
  4076 + ///设置宴会场次费用
  4077 + Future<bool> _setBanquetInfoPrice() async {
  4078 + ///组装请求数据
  4079 + List dataRequest = []; //请求数据
  4080 + feastModel.banquetDetail.costInfo.forEach((element) {
  4081 + Map map = {};
  4082 + map['rid'] = feastModel.rid;
  4083 + feastModel.sessionsSunModelList.forEach((value) {
  4084 + if (element.title.contains(value.reserveOrder)) {
  4085 + map['info_id'] = value.id; //场次id
  4086 + }
  4087 + });
  4088 +
  4089 + map['service_type'] = element.service ? '1' : '2';
  4090 + if (element.service) {
  4091 + map['service_price'] = element.serviceC.text;
  4092 + } else {
  4093 + map['service_per'] = element.serviceC.text;
  4094 + }
  4095 + map['discount_type'] = element.discount ? '1' : '2';
  4096 + if (element.discount) {
  4097 + map['discount_price'] = element.discountC.text;
  4098 + } else {
  4099 + map['discount_per'] = element.discountC.text;
  4100 + }
  4101 + map['total_price'] = element.totalPrice;
  4102 + dataRequest.add(map);
  4103 + });
  4104 +
  4105 + Map<String, String> pramas = {'data': json.encode(dataRequest)};
  4106 + bool success = await feastModel.setBanquetInfoPrice(context, pramas);
  4107 +
  4108 + if (success) {
  4109 + return true;
  4110 + } else {
  4111 + return false;
  4112 + }
  4113 + }
  4114 +
4001 ///设置合同信息 4115 ///设置合同信息
4002 Future<bool> _setBanquetContract() async { 4116 Future<bool> _setBanquetContract() async {
4003 List imageQiniuUrlList = []; //接口图片数据list 4117 List imageQiniuUrlList = []; //接口图片数据list
@@ -4064,22 +4178,24 @@ class _FeastCreatePageState extends State<FeastCreatePage> { @@ -4064,22 +4178,24 @@ class _FeastCreatePageState extends State<FeastCreatePage> {
4064 } 4178 }
4065 4179
4066 _setData() async { 4180 _setData() async {
4067 - await Future.wait<bool>([_setBanquetContract(), _setInvoice()])  
4068 - .then((results) {  
4069 - print(results[0]);  
4070 - if (results[0] && results[1]) {  
4071 - //成功  
4072 - Utils.showToast('保存成功');  
4073 - } else {  
4074 - if (!results[0]) {  
4075 - // Utils.showToast('');  
4076 - } else {  
4077 - // Utils.showToast('');  
4078 - }  
4079 - }  
4080 - }).catchError((e) {  
4081 - print(e);  
4082 - }); 4181 + _setBanquetInfoPrice();
  4182 + // await Future.wait<bool>(
  4183 + // [_setBanquetContract(), _setInvoice(), _setBanquetInfoPrice()])
  4184 + // .then((results) {
  4185 + // print(results[0]);
  4186 + // if (results[0] && results[1] && results[2]) {
  4187 + // //成功
  4188 + // Utils.showToast('保存成功');
  4189 + // } else {
  4190 + // if (!results[0]) {
  4191 + // // Utils.showToast('');
  4192 + // } else {
  4193 + // // Utils.showToast('');
  4194 + // }
  4195 + // }
  4196 + // }).catchError((e) {
  4197 + // print(e);
  4198 + // });
4083 } 4199 }
4084 4200
4085 Widget taocanTextType(String per1, String title, String per) { 4201 Widget taocanTextType(String per1, String title, String per) {
  1 +import 'package:cached_network_image/cached_network_image.dart';
  2 +import 'package:flutter/material.dart';
  3 +import 'package:flutter_screenutil/flutter_screenutil.dart';
  4 +import 'package:provider/provider.dart';
  5 +
  6 +import '../../constant/state.dart';
  7 +import '../../models/get_banquet_by_id_new_model.dart';
  8 +import '../../provider/feast_model.dart';
  9 +import '../../res/colors.dart';
  10 +import '../../route/navigator_util.dart';
  11 +import '../../utils/ConvertNumberToChineseMoneyWords.dart';
  12 +import '../../utils/screen_util.dart';
  13 +import '../../utils/utils.dart';
  14 +import '../../widgets/h_empty_view.dart';
  15 +import '../../widgets/page_exception.dart';
  16 +import '../../widgets/round_button.dart';
  17 +import '../../widgets/system_app_bar.dart';
  18 +import '../../widgets/v_empty_view.dart';
  19 +
  20 +class FeastDetailPage extends StatefulWidget {
  21 + final String rid;
  22 + FeastDetailPage({Key key, this.rid}) : super(key: key);
  23 +
  24 + @override
  25 + _FeastDetailPageState createState() => _FeastDetailPageState();
  26 +}
  27 +
  28 +class _FeastDetailPageState extends State<FeastDetailPage> {
  29 + FeastModel feastModel;
  30 + ScrollController _scrollController = ScrollController();
  31 +
  32 + @override
  33 + void initState() {
  34 + // TODO: implement initState
  35 + super.initState();
  36 + Utils.changeStatusColor(color: MyColours.color_438E93);
  37 +
  38 + WidgetsBinding.instance.addPostFrameCallback((_) {
  39 + _getBanquetById();
  40 + });
  41 + }
  42 +
  43 + ///获取宴会详情
  44 + _getBanquetById() async {
  45 + Map<String, String> pramas = {'rid': widget.rid}; //
  46 + bool success = await feastModel.getBanquetById(context, pramas);
  47 + if (success) {
  48 + // _uploadImageProvider.feastRemarkContractImageList = [];
  49 + // feastModel.banquetDetail.contractInfo.contractImages.forEach((element) {
  50 + // UploadImgModel uploadImgModel = UploadImgModel();
  51 + // uploadImgModel.process = 1;
  52 + // uploadImgModel.qiniuUrl = element.url;
  53 + // _uploadImageProvider.feastRemarkContractImageList.add(uploadImgModel);
  54 + // });
  55 + // setState(() {});
  56 + }
  57 + }
  58 +
  59 + Widget baseInfoItem(String title, String content) {
  60 + return Padding(
  61 + padding: EdgeInsets.symmetric(vertical: h(6)),
  62 + child: Row(
  63 + children: [
  64 + Container(
  65 + width: w(80),
  66 + child: Text(title,
  67 + style: TextStyle(
  68 + color: MyColours.color_999999, fontSize: font(12))),
  69 + ),
  70 + Expanded(
  71 + child: Text(content,
  72 + style: TextStyle(
  73 + color: MyColours.color_515151, fontSize: font(12))))
  74 + ],
  75 + ));
  76 + }
  77 +
  78 + //生成日期文本
  79 + createDateText(BuildContext context, DateTime day) {
  80 + // if (Utils.isOneDay(day, dateTime)) return; //日期没变
  81 + String ymd = "${day.year}-" +
  82 + Utils.addZeroNumber(day.month) +
  83 + "-" +
  84 + Utils.addZeroNumber(day.day);
  85 + ymd += " (周${Utils.formatWeekDayNum(day.weekday)} ";
  86 + ymd += Utils.lunarCalendarHolidays(day);
  87 + ymd += ')';
  88 + return ymd;
  89 + }
  90 +
  91 +//基本信息板块
  92 + Widget baseInfoWidget() {
  93 + return Container(
  94 + decoration: BoxDecoration(
  95 + borderRadius: BorderRadius.circular(r(6)),
  96 + border: Border.all(width: w(1), color: MyColours.color_438E93)),
  97 + child: Column(
  98 + children: [
  99 + Container(
  100 + width: double.infinity,
  101 + // height: h(31),
  102 + padding: EdgeInsets.symmetric(horizontal: w(12), vertical: h(6)),
  103 + decoration: BoxDecoration(
  104 + color: MyColours.color_438E93,
  105 + borderRadius: BorderRadius.only(
  106 + topLeft: Radius.circular(r(5)),
  107 + topRight: Radius.circular(r(5)))),
  108 + child: Text(
  109 + '基本信息',
  110 + style:
  111 + TextStyle(color: MyColours.color_F6F6F6, fontSize: font(14)),
  112 + ),
  113 + ),
  114 + Padding(
  115 + padding: EdgeInsets.only(
  116 + left: w(12), right: w(12), top: w(8), bottom: w(11)),
  117 + child: Column(
  118 + children: [
  119 + baseInfoItem(
  120 + '宴会日期:',
  121 + createDateText(
  122 + context,
  123 + DateTime.fromMillisecondsSinceEpoch(int.parse(
  124 + feastModel.banquetDetail.basicInfo.ddate) *
  125 + 1000))),
  126 + baseInfoItem(
  127 + '宴会类型:', feastModel.banquetDetail.basicInfo.classify),
  128 + baseInfoItem('预订人:',
  129 + '${feastModel.banquetDetail.basicInfo.rname} ${feastModel.banquetDetail.basicInfo.sex}'),
  130 + baseInfoItem('场次数量:',
  131 + '共 ${feastModel.banquetDetail.sessionsInfo.length} 场'),
  132 + baseInfoItem('电话:', feastModel.banquetDetail.basicInfo.phone),
  133 + baseInfoItem(
  134 + '服务经理:',
  135 + feastModel.banquetDetail.basicInfo.jiedan.nickName ??
  136 + feastModel.banquetDetail.basicInfo.jiedan.account),
  137 + baseInfoItem(
  138 + '备注:', feastModel.banquetDetail.basicInfo.remark ?? '无'),
  139 + ],
  140 + ))
  141 + ],
  142 + ),
  143 + );
  144 + }
  145 +
  146 + ///三组 左---中----右
  147 + Widget sessionsItem(String title, SessionsInfo sessionsInfo) {
  148 + return Padding(
  149 + padding: EdgeInsets.symmetric(vertical: h(6)),
  150 + child: Row(
  151 + crossAxisAlignment: CrossAxisAlignment.start,
  152 + children: [
  153 + Container(
  154 + width: w(80),
  155 + child: Text(title,
  156 + style: TextStyle(
  157 + color: MyColours.color_999999, fontSize: font(12))),
  158 + ),
  159 + Expanded(
  160 + child: ListView.builder(
  161 + itemCount: title == '酒水安排:'
  162 + ? sessionsInfo.wine.length
  163 + : sessionsInfo.other.length,
  164 + shrinkWrap: true,
  165 + controller: _scrollController,
  166 + itemBuilder: (BuildContext context, int index) {
  167 + String name = title == '酒水安排:'
  168 + ? sessionsInfo.wine[index].wineName
  169 + : sessionsInfo.other[index].otherName;
  170 + String numStr = title == '酒水安排:'
  171 + ? sessionsInfo.wine[index].wineNum
  172 + : sessionsInfo.other[index].otherNum;
  173 + String spec = title == '酒水安排:'
  174 + ? sessionsInfo.wine[index].spec
  175 + : sessionsInfo.other[index].spec;
  176 + return Container(
  177 + padding: EdgeInsets.only(bottom: w(8)),
  178 + margin: EdgeInsets.only(bottom: w(12)),
  179 + // decoration: BoxDecoration(
  180 + // border: Border(
  181 + // bottom: BorderSide(
  182 + // width: w(1),
  183 + // color: MyColours.color_DBDBDB))),
  184 + child: Row(
  185 + children: [
  186 + Expanded(
  187 + child: Text(name,
  188 + style: TextStyle(
  189 + color: MyColours.color_515151,
  190 + fontSize: font(12)))),
  191 + Text('${numStr} ${spec}',
  192 + style: TextStyle(
  193 + color: MyColours.color_515151,
  194 + fontSize: font(12)))
  195 + ],
  196 + ));
  197 + })),
  198 + ],
  199 + ));
  200 + }
  201 +
  202 + ///第一场 。第二场。。。。
  203 + Widget sessionsWidget(String title, SessionsInfo sessionsInfo) {
  204 + // int tableNum = 0;
  205 + // List<String> temp = sessionsInfo.tableInfo.split('、');
  206 + // temp.forEach((element) {
  207 + // int start = element.indexOf('(');
  208 + // int end = element.length - 2;
  209 + // String numstr = element.substring(start + 1, end);
  210 + // tableNum += int.parse(numstr);
  211 + // });
  212 + return Container(
  213 + margin: EdgeInsets.only(bottom: h(26)),
  214 + decoration: BoxDecoration(
  215 + borderRadius: BorderRadius.circular(r(6)),
  216 + border: Border.all(width: w(1), color: MyColours.color_438E93)),
  217 + child: Column(
  218 + children: [
  219 + Container(
  220 + width: double.infinity,
  221 + // height: h(31),
  222 + padding: EdgeInsets.symmetric(horizontal: w(12), vertical: h(6)),
  223 + decoration: BoxDecoration(
  224 + color: MyColours.color_438E93,
  225 + borderRadius: BorderRadius.only(
  226 + topLeft: Radius.circular(r(5)),
  227 + topRight: Radius.circular(r(5)))),
  228 + child: Text(
  229 + title,
  230 + style:
  231 + TextStyle(color: MyColours.color_F6F6F6, fontSize: font(14)),
  232 + ),
  233 + ),
  234 + Padding(
  235 + padding: EdgeInsets.only(
  236 + left: w(12), right: w(12), top: w(8), bottom: w(11)),
  237 + child: Column(
  238 + children: [
  239 + baseInfoItem('场次时间:', sessionsInfo.rdate),
  240 + baseInfoItem('桌位数量:', '共 ${sessionsInfo.tableNum ?? 0} 桌'),
  241 + baseInfoItem('桌位信息:', sessionsInfo.tableInfo),
  242 + Padding(
  243 + padding: EdgeInsets.symmetric(vertical: h(6)),
  244 + child: Row(
  245 + crossAxisAlignment: CrossAxisAlignment.start,
  246 + children: [
  247 + Container(
  248 + width: w(80),
  249 + child: Text('套餐安排:',
  250 + style: TextStyle(
  251 + color: MyColours.color_999999,
  252 + fontSize: font(12))),
  253 + ),
  254 + Expanded(
  255 + child: ListView.builder(
  256 + itemCount: sessionsInfo.setmeal.length,
  257 + shrinkWrap: true,
  258 + controller: _scrollController,
  259 + itemBuilder:
  260 + (BuildContext context, int index) {
  261 + SetmealDetail setmealDetail =
  262 + sessionsInfo.setmeal[index];
  263 + return Container(
  264 + padding: EdgeInsets.only(bottom: w(8)),
  265 + margin: EdgeInsets.only(bottom: w(12)),
  266 + decoration: BoxDecoration(
  267 + border: Border(
  268 + bottom: BorderSide(
  269 + width: w(1),
  270 + color: MyColours
  271 + .color_DBDBDB))),
  272 + child: Column(
  273 + children: [
  274 + Row(
  275 + children: [
  276 + Text(setmealDetail.mealName,
  277 + style: TextStyle(
  278 + color: MyColours
  279 + .color_515151,
  280 + fontSize: font(12))),
  281 + Spacer(),
  282 + RoundButton(
  283 + text: '查看菜单',
  284 + radius: r(7),
  285 + width: w(48),
  286 + height: h(18),
  287 + fontSize: 20,
  288 + textColor:
  289 + MyColours.color_F6F6F6,
  290 + isBold: false,
  291 + gradientStart:
  292 + MyColours.color_438E93,
  293 + gradientEnd:
  294 + MyColours.color_438E93,
  295 + onPressed: () {
  296 + // String tableData = '';
  297 + // if (data.pnumC.text
  298 + // .trim()
  299 + // .length >
  300 + // 0) {
  301 + // tableData +=
  302 + // '${data.pnumC.text}人/桌';
  303 + // }
  304 + // if (data.minC.text
  305 + // .trim()
  306 + // .length >
  307 + // 0) {
  308 + // tableData +=
  309 + // ' 保证 ${data.minC.text} 桌';
  310 + // }
  311 + // if (data.spareC.text
  312 + // .trim()
  313 + // .length >
  314 + // 0) {
  315 + // tableData +=
  316 + // ' 备用 ${data.spareC.text} 桌';
  317 + // }
  318 +
  319 + // if (data.dataMenu != null &&
  320 + // data.dataMenu.length >
  321 + // 0) {
  322 + // await NavigatorUtil
  323 + // .goFeastMenuShowPage(
  324 + // context,
  325 + // data.setmealId,
  326 + // data.name,
  327 + // widget.dateData,
  328 + // tableData,
  329 + // justSelData: {
  330 + // 'object':
  331 + // data.dataMenu
  332 + // });
  333 + // } else {
  334 + // await NavigatorUtil
  335 + // .goFeastMenuShowPage(
  336 + // context,
  337 + // data.setmealId,
  338 + // data.name,
  339 + // widget.dateData,
  340 + // tableData);
  341 + // }
  342 +
  343 + NavigatorUtil
  344 + .goFeastMenuQYShowPage(
  345 + context,
  346 + object: {
  347 + 'object':
  348 + setmealDetail
  349 + .cooklist
  350 + });
  351 + },
  352 + ),
  353 + ],
  354 + ),
  355 + VEmptyView(16),
  356 + Row(
  357 + children: [
  358 + Text(
  359 + '${setmealDetail.pnum} 人/桌',
  360 + style: TextStyle(
  361 + color: MyColours
  362 + .color_999999,
  363 + fontSize: font(12))),
  364 + HEmptyView(24),
  365 + Text(
  366 + '保证 ${setmealDetail.min} 桌',
  367 + style: TextStyle(
  368 + color: MyColours
  369 + .color_999999,
  370 + fontSize: font(12))),
  371 + HEmptyView(24),
  372 + Text(
  373 + '备用 ${setmealDetail.spare} 桌',
  374 + style: TextStyle(
  375 + color: MyColours
  376 + .color_999999,
  377 + fontSize: font(12))),
  378 + ],
  379 + )
  380 + ],
  381 + ));
  382 + }))
  383 + ],
  384 + )),
  385 + sessionsItem('酒水安排:', sessionsInfo),
  386 + sessionsItem('其他配置:', sessionsInfo),
  387 + remarkItem('备注:', sessionsInfo)
  388 + ],
  389 + ))
  390 + ],
  391 + ),
  392 + );
  393 + }
  394 +
  395 + ///备注----照片
  396 + Widget remarkItem(String title, SessionsInfo sessionsInfo) {
  397 + return Padding(
  398 + padding: EdgeInsets.symmetric(vertical: h(6)),
  399 + child: Row(
  400 + crossAxisAlignment: CrossAxisAlignment.start,
  401 + children: [
  402 + Container(
  403 + width: w(80),
  404 + child: Text(title,
  405 + style: TextStyle(
  406 + color: MyColours.color_999999, fontSize: font(12))),
  407 + ),
  408 + Expanded(
  409 + child: Column(
  410 + crossAxisAlignment: CrossAxisAlignment.start,
  411 + children: [
  412 + sessionsInfo.remark == null || sessionsInfo.remark == ''
  413 + ? SizedBox()
  414 + : Text(sessionsInfo.remark,
  415 + style: TextStyle(
  416 + color: MyColours.color_515151, fontSize: font(12))),
  417 + sessionsInfo.remark == null || sessionsInfo.remark == ''
  418 + ? SizedBox()
  419 + : VEmptyView(16),
  420 + _getGridImg(sessionsInfo.images.map((e) {
  421 + return e.url;
  422 + }).toList())
  423 + ],
  424 + )),
  425 + ],
  426 + ));
  427 + }
  428 +
  429 + /// 九宫格
  430 + Widget _getGridImg(List<String> data) {
  431 + return GridView.builder(
  432 + controller: _scrollController,
  433 + // padding: EdgeInsets.only(top: ScreenUtil().getAdapterSize(10)),
  434 + shrinkWrap: true,
  435 + itemCount: data.length,
  436 +
  437 + //SliverGridDelegateWithFixedCrossAxisCount 构建一个横轴固定数量Widget
  438 + gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
  439 + //横轴元素个数
  440 + crossAxisCount: 4,
  441 + //纵轴间距
  442 + mainAxisSpacing: ScreenUtil().setWidth(52),
  443 + //横轴间距
  444 + crossAxisSpacing: ScreenUtil().setWidth(60),
  445 + //子组件宽高长度比例
  446 + childAspectRatio: 1.0),
  447 + itemBuilder: (BuildContext context, int index) {
  448 + return InkWell(
  449 + onTap: () {
  450 + // _showPhotoView(
  451 + // context, index, widget.model.imageQiniuUrlList);
  452 + },
  453 + child: Stack(
  454 + // alignment: Alignment.topRight,
  455 + children: [
  456 + ClipRRect(
  457 + borderRadius: BorderRadius.circular(r(5)),
  458 + child: CachedNetworkImage(
  459 + imageUrl: data[index],
  460 + // imageUrl:
  461 + // 'https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fimg.jj20.com%2Fup%2Fallimg%2F4k%2Fs%2F02%2F2109242332225H9-0-lp.jpg&refer=http%3A%2F%2Fimg.jj20.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=auto?sec=1662806063&t=d576b5247e04ce721c266f098625f145',
  462 + fit: BoxFit.cover,
  463 + width: ScreenUtil().setWidth(38 * 2),
  464 + height: ScreenUtil().setWidth(38 * 2),
  465 + ),
  466 + ),
  467 + // Positioned(
  468 + // top: 0,
  469 + // right: 0,
  470 + // child: GestureDetector(
  471 + // child: Image.asset(
  472 + // Utils.getImgPath("f_delete"),
  473 + // width: ScreenUtil().setWidth(24),
  474 + // height: ScreenUtil().setWidth(24),
  475 + // ),
  476 + // onTap: () {
  477 + // //已经传到服务器,弹提醒窗口,是否删除
  478 + // //修改之前有内容,则弹框
  479 + // DialogUtil.cupertinoAlertDialog(context,
  480 + // title: "确认删除",
  481 + // content: "是否确定删除该照片,删除操作不可逆转,请谨慎操作",
  482 + // lCallback: () {
  483 + // print("取消");
  484 + // }, rCallback: () {
  485 + // print("确定");
  486 + // // widget.deleteCallback(index);
  487 + // });
  488 + // }
  489 + // // else {
  490 + // // //点击删除按钮
  491 + // // setState(() {
  492 + // // temp.removeWhere((element) =>
  493 + // // element == temp[index]);
  494 + // // widget.model.imageQiniuUrlList
  495 + // // .removeWhere((element) =>
  496 + // // element ==
  497 + // // widget.model
  498 + // // .imageQiniuUrlList[index]);
  499 + // // });
  500 + // // }
  501 + // // },
  502 + // )),
  503 + ],
  504 + ),
  505 + );
  506 + });
  507 + }
  508 +
  509 + ///费用详情
  510 + Widget costWidget() {
  511 + return Container(
  512 + margin: EdgeInsets.only(bottom: h(26)),
  513 + decoration: BoxDecoration(
  514 + borderRadius: BorderRadius.circular(r(6)),
  515 + border: Border.all(width: w(1), color: MyColours.color_438E93)),
  516 + child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [
  517 + Container(
  518 + width: double.infinity,
  519 + // height: h(31),
  520 + padding: EdgeInsets.symmetric(horizontal: w(12), vertical: h(6)),
  521 + decoration: BoxDecoration(
  522 + color: MyColours.color_438E93,
  523 + borderRadius: BorderRadius.only(
  524 + topLeft: Radius.circular(r(5)),
  525 + topRight: Radius.circular(r(5)))),
  526 + child: Text(
  527 + '费用详情',
  528 + style:
  529 + TextStyle(color: MyColours.color_F6F6F6, fontSize: font(14)),
  530 + ),
  531 + ),
  532 + VEmptyView(34),
  533 + ListView.builder(
  534 + itemCount: feastModel.banquetDetail.costInfo.length,
  535 + shrinkWrap: true,
  536 + controller: _scrollController,
  537 + itemBuilder: (BuildContext context, int index) {
  538 + CostInfoModel costInfoModel =
  539 + feastModel.banquetDetail.costInfo[index];
  540 + return Padding(
  541 + padding: EdgeInsets.only(
  542 + left: w(12), right: w(12), bottom: w(27)),
  543 + child: Column(
  544 + crossAxisAlignment: CrossAxisAlignment.start,
  545 + children: [
  546 + Text(
  547 + '${costInfoModel.title}:',
  548 + style: TextStyle(
  549 + color: MyColours.color_999999,
  550 + fontSize: font(12)),
  551 + ),
  552 + VEmptyView(8),
  553 + costItem('名称', '单价', '数量', '金额', isTitle: true),
  554 + ListView.builder(
  555 + itemCount: costInfoModel.data.length,
  556 + shrinkWrap: true,
  557 + controller: _scrollController,
  558 + itemBuilder: (BuildContext context, int index) {
  559 + CostInfoSunModel costInfoSunModel =
  560 + costInfoModel.data[index];
  561 + String name = '';
  562 + if (costInfoSunModel.cname != null) {
  563 + name = costInfoSunModel.cname;
  564 + }
  565 + if (costInfoSunModel.otherName != null) {
  566 + name = costInfoSunModel.otherName;
  567 + }
  568 + if (costInfoSunModel.wineName != null) {
  569 + name = costInfoSunModel.wineName;
  570 + }
  571 + return costItem(
  572 + name,
  573 + costInfoSunModel.unitPrice,
  574 + costInfoSunModel.numStr,
  575 + costInfoSunModel.price.toString(),
  576 + );
  577 + }),
  578 + //服务费
  579 + Container(
  580 + height: h(32),
  581 + margin: EdgeInsets.only(bottom: h(8)),
  582 + decoration: BoxDecoration(
  583 + border: Border(
  584 + bottom: BorderSide(
  585 + width: w(1),
  586 + color: MyColours.color_DBDBDB))),
  587 + child: Row(
  588 + children: [
  589 + Container(
  590 + width: w(80),
  591 + child: Text(
  592 + '服务费:',
  593 + style: TextStyle(
  594 + color: MyColours.color_515151,
  595 + fontSize: font(12)),
  596 + ),
  597 + ),
  598 + InkWell(
  599 + onTap: () {
  600 + if (costInfoModel.service) {
  601 + return;
  602 + }
  603 + setState(() {
  604 + costInfoModel.service =
  605 + !costInfoModel.service;
  606 + });
  607 + if (costInfoModel.serviceC.text != '') {
  608 + // _calculatePrice(
  609 + // costInfoModel,
  610 + // );
  611 + }
  612 + },
  613 + child: Row(
  614 + children: [
  615 + Image.asset(
  616 + Utils.getImgPath(costInfoModel.service
  617 + ? 'f_radio_sel'
  618 + : 'f_radio_un'),
  619 + width: w(20),
  620 + ),
  621 + HEmptyView(8),
  622 + Text(
  623 + '固定金额',
  624 + style: TextStyle(
  625 + color: MyColours.color_515151,
  626 + fontSize: font(12)),
  627 + ),
  628 + ],
  629 + ),
  630 + ),
  631 + HEmptyView(16),
  632 + InkWell(
  633 + onTap: () {
  634 + if (!costInfoModel.service) {
  635 + return;
  636 + }
  637 + setState(() {
  638 + costInfoModel.service =
  639 + !costInfoModel.service;
  640 + });
  641 + if (costInfoModel.serviceC.text != '') {
  642 + // _calculatePrice(
  643 + // costInfoModel,
  644 + // );
  645 + }
  646 + },
  647 + child: Row(
  648 + children: [
  649 + Image.asset(
  650 + Utils.getImgPath(!costInfoModel.service
  651 + ? 'f_radio_sel'
  652 + : 'f_radio_un'),
  653 + width: w(20),
  654 + ),
  655 + HEmptyView(8),
  656 + Container(
  657 + width: w(40),
  658 + child: Text(
  659 + '百分比',
  660 + style: TextStyle(
  661 + color: MyColours.color_515151,
  662 + fontSize: font(12)),
  663 + )),
  664 + ],
  665 + ),
  666 + ),
  667 + HEmptyView(12),
  668 + Expanded(
  669 + child: Container(
  670 + height: h(17),
  671 + decoration: BoxDecoration(
  672 + border: Border(
  673 + bottom: BorderSide(
  674 + width: w(1),
  675 + color:
  676 + MyColours.color_DBDBDB))),
  677 + child: TextField(
  678 + maxLines: 1,
  679 +
  680 + //输入文本的样式
  681 + style: TextStyle(
  682 + fontSize: ScreenUtil().setSp(24),
  683 + color: MyColours.color_515151),
  684 + controller: costInfoModel.serviceC,
  685 + // focusNode: node,
  686 + // textAlignVertical: TextAlignVertical.top,
  687 + decoration: InputDecoration(
  688 + hintText: '请输入',
  689 + hintStyle: TextStyle(
  690 + color: true
  691 + ? MyColours.color_999999
  692 + : MyColours.color_515151,
  693 + fontSize: ScreenUtil().setSp(24),
  694 + ),
  695 + // contentPadding:
  696 + // EdgeInsets.only(bottom: ScreenUtil().setWidth(17)),
  697 + // border: InputBorder.none,
  698 + contentPadding: EdgeInsets.zero,
  699 + border: OutlineInputBorder(
  700 + borderSide: BorderSide.none),
  701 + ),
  702 + onChanged: (value) {
  703 + print('ggg');
  704 +
  705 + // _calculatePrice(
  706 + // costInfoModel,
  707 + // );
  708 +
  709 + // nameStr = value;
  710 + },
  711 + onEditingComplete: () {
  712 + // print('fff');
  713 + // node.unfocus();
  714 + // _homeEnterModel.nameController.text =
  715 + // nameStr + _nameSuffix();
  716 + // _addNameSuffix(nameStr, sexStr);
  717 + },
  718 + keyboardType: TextInputType
  719 + .numberWithOptions())),
  720 + ),
  721 + HEmptyView(4),
  722 + Text(
  723 + costInfoModel.service ? '元' : '%',
  724 + style: TextStyle(
  725 + color: MyColours.color_000000,
  726 + fontSize: font(12)),
  727 + ),
  728 + ],
  729 + )),
  730 + //优惠金额
  731 + Container(
  732 + height: h(32),
  733 + margin: EdgeInsets.only(bottom: h(8)),
  734 + decoration: BoxDecoration(
  735 + border: Border(
  736 + bottom: BorderSide(
  737 + width: w(1),
  738 + color: MyColours.color_DBDBDB))),
  739 + child: Row(
  740 + children: [
  741 + Container(
  742 + width: w(80),
  743 + child: Text(
  744 + '优惠金额:',
  745 + style: TextStyle(
  746 + color: MyColours.color_E34D59,
  747 + fontSize: font(12)),
  748 + ),
  749 + ),
  750 + InkWell(
  751 + onTap: () {
  752 + if (costInfoModel.discount) {
  753 + return;
  754 + }
  755 + setState(() {
  756 + costInfoModel.discount =
  757 + !costInfoModel.discount;
  758 + });
  759 + if (costInfoModel.discountC.text != '') {
  760 + // _calculatePrice(
  761 + // costInfoModel,
  762 + // );
  763 + }
  764 + },
  765 + child: Row(children: [
  766 + Image.asset(
  767 + Utils.getImgPath(costInfoModel.discount
  768 + ? 'f_radio_sel'
  769 + : 'f_radio_un'),
  770 + width: w(20),
  771 + ),
  772 + HEmptyView(8),
  773 + Text(
  774 + '固定金额',
  775 + style: TextStyle(
  776 + color: MyColours.color_515151,
  777 + fontSize: font(12)),
  778 + ),
  779 + ])),
  780 + HEmptyView(16),
  781 + InkWell(
  782 + onTap: () {
  783 + if (!costInfoModel.discount) {
  784 + return;
  785 + }
  786 + setState(() {
  787 + costInfoModel.discount =
  788 + !costInfoModel.discount;
  789 + });
  790 + if (costInfoModel.discountC.text != '') {
  791 + // _calculatePrice(
  792 + // costInfoModel,
  793 + // );
  794 + }
  795 + },
  796 + child: Row(children: [
  797 + Image.asset(
  798 + Utils.getImgPath(!costInfoModel.discount
  799 + ? 'f_radio_sel'
  800 + : 'f_radio_un'),
  801 + width: w(20),
  802 + ),
  803 + HEmptyView(8),
  804 + Container(
  805 + width: w(40),
  806 + child: Text(
  807 + '折扣',
  808 + style: TextStyle(
  809 + color: MyColours.color_515151,
  810 + fontSize: font(12)),
  811 + ))
  812 + ])),
  813 + HEmptyView(12),
  814 + Expanded(
  815 + child: Container(
  816 + height: h(17),
  817 + decoration: BoxDecoration(
  818 + border: Border(
  819 + bottom: BorderSide(
  820 + width: w(1),
  821 + color:
  822 + MyColours.color_DBDBDB))),
  823 + child: TextField(
  824 + maxLines: 1,
  825 +
  826 + //输入文本的样式
  827 + style: TextStyle(
  828 + fontSize: ScreenUtil().setSp(24),
  829 + color: MyColours.color_515151),
  830 + controller: costInfoModel.discountC,
  831 + // focusNode: node,
  832 + // textAlignVertical: TextAlignVertical.top,
  833 + decoration: InputDecoration(
  834 + hintText: '请输入',
  835 + hintStyle: TextStyle(
  836 + color: true
  837 + ? MyColours.color_999999
  838 + : MyColours.color_E34D59,
  839 + fontSize: ScreenUtil().setSp(24),
  840 + ),
  841 + // contentPadding:
  842 + // EdgeInsets.only(bottom: ScreenUtil().setWidth(17)),
  843 + // border: InputBorder.none,
  844 + contentPadding: EdgeInsets.zero,
  845 + border: OutlineInputBorder(
  846 + borderSide: BorderSide.none),
  847 + ),
  848 + onChanged: (value) {
  849 + print('ggg');
  850 +
  851 + // _calculatePrice(
  852 + // costInfoModel,
  853 + // );
  854 +
  855 + // nameStr = value;
  856 + },
  857 + onEditingComplete: () {
  858 + // print('fff');
  859 + // node.unfocus();
  860 + // _homeEnterModel.nameController.text =
  861 + // nameStr + _nameSuffix();
  862 + // _addNameSuffix(nameStr, sexStr);
  863 + },
  864 + keyboardType: TextInputType
  865 + .numberWithOptions())),
  866 + ),
  867 + HEmptyView(4),
  868 + Text(
  869 + costInfoModel.discount ? '元' : '%',
  870 + style: TextStyle(
  871 + color: MyColours.color_000000,
  872 + fontSize: font(12)),
  873 + ),
  874 + ],
  875 + )),
  876 + //合计
  877 + Container(
  878 + height: h(24),
  879 + decoration: BoxDecoration(
  880 + border: Border(
  881 + bottom: BorderSide(
  882 + width: w(1),
  883 + color: MyColours.color_DBDBDB))),
  884 + child: Row(children: [
  885 + Text(
  886 + '合计',
  887 + style: TextStyle(
  888 + color: MyColours.color_515151,
  889 + fontWeight: FontWeight.bold,
  890 + fontSize: font(14)),
  891 + ),
  892 + Spacer(),
  893 + Text(
  894 + '${costInfoModel.totalPrice} 元',
  895 + style: TextStyle(
  896 + color: MyColours.color_515151,
  897 + fontWeight: FontWeight.bold,
  898 + fontSize: font(14)),
  899 + ),
  900 + HEmptyView(48)
  901 + ]))
  902 + ],
  903 + ));
  904 + }),
  905 + ]));
  906 + }
  907 +
  908 + Widget _callButton(
  909 + {GestureTapCallback onPress,
  910 + content,
  911 + hasLeftBorder = true,
  912 + Color textColor = MyColours.color_438E93,
  913 + isSelect = false}) {
  914 + return InkWell(
  915 + onTap: onPress,
  916 + child: Container(
  917 + height: h(48),
  918 + decoration: BoxDecoration(
  919 + color: isSelect ? MyColours.color_438E93 : MyColours.color_ffffff,
  920 + border: Border(
  921 + bottom: BorderSide(
  922 + color: MyColours.color_438E93,
  923 + width: ScreenUtil().setWidth(2)),
  924 + top: BorderSide(
  925 + color: MyColours.color_438E93,
  926 + width: ScreenUtil().setWidth(2)),
  927 + left: hasLeftBorder
  928 + ? BorderSide(
  929 + color: MyColours.color_438E93,
  930 + width: ScreenUtil().setWidth(2))
  931 + : BorderSide.none,
  932 + right: BorderSide(
  933 + color: MyColours.color_438E93,
  934 + width: ScreenUtil().setWidth(2)))),
  935 + child: Align(
  936 + alignment: Alignment.center,
  937 + child: Text(
  938 + content,
  939 + style: TextStyle(
  940 + color: isSelect ? MyColours.color_F6F6F6 : textColor,
  941 + fontSize: ScreenUtil().setSp(36)),
  942 + ),
  943 + ),
  944 + ),
  945 + );
  946 + }
  947 +
  948 + ///费用item
  949 + Widget costItem(
  950 + String name,
  951 + String unitprice,
  952 + String amount,
  953 + String money, {
  954 + bool isTitle = false,
  955 + }) {
  956 + Color color = isTitle ? MyColours.color_438E93 : MyColours.color_515151;
  957 + return Container(
  958 + height: h(25),
  959 + margin: EdgeInsets.only(bottom: isTitle ? 0 : h(8)),
  960 + decoration: !isTitle
  961 + ? BoxDecoration(
  962 + border: Border(
  963 + bottom:
  964 + BorderSide(width: w(1), color: MyColours.color_DBDBDB)))
  965 + : BoxDecoration(),
  966 + child: Row(
  967 + children: [
  968 + Expanded(
  969 + child: Text(
  970 + name,
  971 + style: TextStyle(color: color, fontSize: font(12)),
  972 + ),
  973 + ),
  974 + Container(
  975 + width: w(62),
  976 + child: Text(
  977 + unitprice,
  978 + style: TextStyle(color: color, fontSize: font(12)),
  979 + ),
  980 + ),
  981 + Container(
  982 + width: w(62),
  983 + child: Text(
  984 + amount,
  985 + style: TextStyle(color: color, fontSize: font(12)),
  986 + ),
  987 + ),
  988 + Container(
  989 + width: w(62),
  990 + child: Text(
  991 + money,
  992 + style: TextStyle(color: color, fontSize: font(12)),
  993 + ),
  994 + )
  995 + ],
  996 + ));
  997 + }
  998 +
  999 + /// 发票
  1000 + Widget invoiceWidget() {
  1001 + return Container(
  1002 + margin: EdgeInsets.only(bottom: h(26)),
  1003 + decoration: BoxDecoration(
  1004 + borderRadius: BorderRadius.circular(r(6)),
  1005 + border: Border.all(width: w(1), color: MyColours.color_438E93)),
  1006 + child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [
  1007 + Container(
  1008 + width: double.infinity,
  1009 + // height: h(31),
  1010 + padding: EdgeInsets.symmetric(horizontal: w(12), vertical: h(6)),
  1011 + decoration: BoxDecoration(
  1012 + color: MyColours.color_438E93,
  1013 + borderRadius: BorderRadius.only(
  1014 + topLeft: Radius.circular(r(5)),
  1015 + topRight: Radius.circular(r(5)))),
  1016 + child: Text(
  1017 + '发票',
  1018 + style:
  1019 + TextStyle(color: MyColours.color_F6F6F6, fontSize: font(14)),
  1020 + ),
  1021 + ),
  1022 + VEmptyView(16),
  1023 + Padding(
  1024 + padding: EdgeInsets.only(
  1025 + left: w(12), right: w(12), top: w(11), bottom: w(35)),
  1026 + child: Column(
  1027 + children: [
  1028 + feastModel.banquetDetail.invoice == null ||
  1029 + feastModel.banquetDetail.invoice.unitName == null
  1030 + ? SizedBox()
  1031 + : Container(
  1032 + // margin: EdgeInsets.only(top: w(31)),
  1033 + padding: EdgeInsets.only(
  1034 + top: w(8),
  1035 + bottom: w(8),
  1036 + ),
  1037 + decoration: BoxDecoration(
  1038 + border: Border(
  1039 + bottom: BorderSide(
  1040 + width: w(1),
  1041 + color: MyColours.color_DBDBDB))),
  1042 + child: Row(
  1043 + mainAxisAlignment: MainAxisAlignment.spaceBetween,
  1044 + children: [
  1045 + Column(
  1046 + crossAxisAlignment: CrossAxisAlignment.start,
  1047 + children: [
  1048 + Text(
  1049 + feastModel.banquetDetail.invoice.unitName,
  1050 + style: TextStyle(
  1051 + fontWeight: FontWeight.bold,
  1052 + color: MyColours.color_515151,
  1053 + fontSize: ScreenUtil().setSp(32)),
  1054 + ),
  1055 + VEmptyView(16),
  1056 + Text(
  1057 + feastModel.banquetDetail.invoice
  1058 + .invoiceType ==
  1059 + '1'
  1060 + ? '增值税普通发票'
  1061 + : '增值税专用发票',
  1062 + style: TextStyle(
  1063 + color: MyColours.color_999999,
  1064 + fontSize: ScreenUtil().setSp(24)),
  1065 + ),
  1066 + ],
  1067 + ),
  1068 + // InkWell(
  1069 + // onTap: () {
  1070 + // //弹框确认是否删除
  1071 + // DialogUtil.cupertinoAlertDialog(context,
  1072 + // title: "",
  1073 + // content: "是否确定删除?",
  1074 + // isBoldContent: true,
  1075 + // contentColor: MyColours.color_E6000000,
  1076 + // rTitle: "删除", rCallback: () {
  1077 + // feastModel.banquetDetail.invoice = null;
  1078 + // setState(() {});
  1079 + // });
  1080 + // },
  1081 + // child: Image.asset(
  1082 + // Utils.getImgPath('f_delete_red'),
  1083 + // width: w(20))),
  1084 + ],
  1085 + ),
  1086 + ),
  1087 + // VEmptyView(48),
  1088 + // Consumer<UploadImageProvider>(builder: (context, model, _) {
  1089 + // return ImgPickerFWidget(
  1090 + // model: model,
  1091 + // scrollController: _scrollController,
  1092 + // uploadType: UploadType.FeastRemarkInvoiceType,
  1093 + // bgColor: MyColours.color_DBDBDB,
  1094 + // size: 64,
  1095 + // crossAxisCount: 4,
  1096 + // maxImageNumber: 8,
  1097 + // mainAxisSpacing: 72,
  1098 + // crossAxisSpacing: 56,
  1099 + // );
  1100 + // }),
  1101 + ],
  1102 + ),
  1103 + )
  1104 + ]));
  1105 + }
  1106 +
  1107 + ///签约
  1108 + Widget qyWidget() {
  1109 + return Column(children: <Widget>[
  1110 + Expanded(child: Consumer<FeastModel>(builder: (context, model, _) {
  1111 + if (model.pageStateBanquet != PageState.Success) {
  1112 + return ExceptionPage(
  1113 + pageState: model.pageStateDeposit,
  1114 + callback: () {
  1115 + _getBanquetById();
  1116 + },
  1117 + emptyMsg: "暂时没有宴会详情哦",
  1118 + emptyImg: "empty_search",
  1119 + showMsg: "加载中,请稍后...",
  1120 + );
  1121 + } else {
  1122 + return Column(
  1123 + children: [
  1124 + Expanded(
  1125 + child: Padding(
  1126 + padding: EdgeInsets.symmetric(horizontal: w(12)),
  1127 + child: SingleChildScrollView(
  1128 + controller: _scrollController,
  1129 + child: Column(children: [
  1130 + VEmptyView(32),
  1131 + baseInfoWidget(), //基本信息
  1132 + VEmptyView(52),
  1133 + //场次
  1134 + ListView.builder(
  1135 + itemCount:
  1136 + feastModel.banquetDetail.sessionsInfo.length,
  1137 + shrinkWrap: true,
  1138 + controller: _scrollController,
  1139 + itemBuilder: (BuildContext context, int index) {
  1140 + SessionsInfo sessionsInfo = feastModel
  1141 + .banquetDetail.sessionsInfo[index];
  1142 + String numStr =
  1143 + ConvertNumberToChineseMoneyWords.toChinese(
  1144 + index);
  1145 + return sessionsWidget(
  1146 + '第${numStr}场', sessionsInfo);
  1147 + }),
  1148 + //费用详情
  1149 + costWidget(),
  1150 + //合同
  1151 + // contractWidget(),
  1152 +
  1153 + invoiceWidget()
  1154 + ]))),
  1155 + ),
  1156 + Row(
  1157 + children: [
  1158 + Expanded(
  1159 + child: _callButton(
  1160 + onPress: () {},
  1161 + content: '丢单',
  1162 + hasLeftBorder: true,
  1163 + textColor: MyColours.color_E34D59,
  1164 + isSelect: false)),
  1165 + Expanded(
  1166 + child: _callButton(
  1167 + onPress: () async {
  1168 + // selectMenu = '签约';
  1169 + // menuSet.add('定金');
  1170 + // menuSet.add('签约');
  1171 + // setState(() {});
  1172 + // for (UploadImgModel item in _uploadImageProvider
  1173 + // .feastRemarkContractImageList) {
  1174 + // if (item.process < 1) {
  1175 + // Utils.showToast('正在上传图片,请稍等');
  1176 + // return false;
  1177 + // }
  1178 + // }
  1179 + // for (UploadImgModel item in _uploadImageProvider
  1180 + // .feastRemarkInvoiceImageList) {
  1181 + // if (item.process < 1) {
  1182 + // Utils.showToast('正在上传图片,请稍等');
  1183 + // return false;
  1184 + // }
  1185 + // }
  1186 + // _setData();
  1187 + },
  1188 + content: '编辑宴会',
  1189 + hasLeftBorder: true,
  1190 + isSelect: true))
  1191 + ],
  1192 + )
  1193 + ],
  1194 + );
  1195 + }
  1196 + }))
  1197 + ]);
  1198 + }
  1199 +
  1200 + @override
  1201 + Widget build(BuildContext context) {
  1202 + feastModel = Provider.of<FeastModel>(context, listen: true);
  1203 +
  1204 + return Scaffold(
  1205 + backgroundColor: MyColours.color_ffffff,
  1206 + appBar: SystemAppBar(
  1207 + '宴会详情',
  1208 + needWhite: true,
  1209 + bgColor: MyColours.color_438E93,
  1210 + titleColor: MyColours.color_F6F6F6,
  1211 + onTap: () {
  1212 + Navigator.pop(context);
  1213 + },
  1214 + ),
  1215 + body: qyWidget());
  1216 + }
  1217 +}
@@ -2,10 +2,17 @@ import 'package:flutter/gestures.dart'; @@ -2,10 +2,17 @@ import 'package:flutter/gestures.dart';
2 import 'package:flutter/material.dart'; 2 import 'package:flutter/material.dart';
3 import 'package:flutter_screenutil/flutter_screenutil.dart'; 3 import 'package:flutter_screenutil/flutter_screenutil.dart';
4 import 'package:one_key/res/colors.dart'; 4 import 'package:one_key/res/colors.dart';
  5 +import 'package:one_key/utils/utils.dart';
  6 +import 'package:one_key/widgets/round_button.dart';
5 import 'package:one_key/widgets/v_empty_view.dart'; 7 import 'package:one_key/widgets/v_empty_view.dart';
6 8
  9 +import '../../models/GetBanquetByTimeModel.dart';
  10 +import '../../utils/screen_util.dart';
  11 +
7 class FeastItem extends StatefulWidget { 12 class FeastItem extends StatefulWidget {
8 - FeastItem({Key key}) : super(key: key); 13 + final ScrollController controller;
  14 + final GetBanquetByTimeSunModel sunModel;
  15 + FeastItem(this.controller, this.sunModel, {Key key}) : super(key: key);
9 16
10 @override 17 @override
11 _FeastItemState createState() => _FeastItemState(); 18 _FeastItemState createState() => _FeastItemState();
@@ -15,40 +22,16 @@ class _FeastItemState extends State<FeastItem> { @@ -15,40 +22,16 @@ class _FeastItemState extends State<FeastItem> {
15 List<Widget> taocanWidget(List data) { 22 List<Widget> taocanWidget(List data) {
16 List<Widget> list = []; 23 List<Widget> list = [];
17 data.forEach((element) { 24 data.forEach((element) {
18 - list.add(  
19 - RichText(  
20 - textScaleFactor: 1,  
21 - overflow: TextOverflow.ellipsis,  
22 - // textDirection: TextDirection.ltr,  
23 - // textAlign: TextAlign.left,  
24 -  
25 - text: TextSpan(  
26 - children: [  
27 - TextSpan(  
28 - text: "1299套餐:",  
29 - style: TextStyle(  
30 - color: MyColours.color_000000,  
31 - fontSize: ScreenUtil().setSp(28)),  
32 - recognizer: TapGestureRecognizer()..onTap = () {}),  
33 - TextSpan(  
34 - text: "已调菜",  
35 - style: TextStyle(  
36 - color: MyColours.color_438E93,  
37 - fontSize: ScreenUtil().setSp(28)),  
38 - //点击事件  
39 - recognizer: TapGestureRecognizer()  
40 - ..onTap = () {  
41 - print("点击了安全协议");  
42 - }),  
43 - TextSpan(  
44 - text: "保证30桌、备2桌",  
45 - style: TextStyle(  
46 - color: MyColours.color_000000,  
47 - fontSize: ScreenUtil().setSp(28)),  
48 - recognizer: TapGestureRecognizer()..onTap = () {}),  
49 - ],  
50 - )),  
51 - ); 25 + list.add(Container(
  26 + padding: EdgeInsets.symmetric(horizontal: w(4), vertical: h(4)),
  27 + decoration: BoxDecoration(
  28 + color: MyColours.color_438E93,
  29 + borderRadius: BorderRadius.circular(w(5))),
  30 + child: Text(
  31 + element,
  32 + style: TextStyle(fontSize: font(14), color: MyColours.color_F6F6F6),
  33 + ),
  34 + ));
52 }); 35 });
53 return list; 36 return list;
54 } 37 }
@@ -84,14 +67,14 @@ class _FeastItemState extends State<FeastItem> { @@ -84,14 +67,14 @@ class _FeastItemState extends State<FeastItem> {
84 mainAxisAlignment: MainAxisAlignment.spaceBetween, 67 mainAxisAlignment: MainAxisAlignment.spaceBetween,
85 children: [ 68 children: [
86 Text( 69 Text(
87 - '8月1日 午餐 14:00-16:00', 70 + widget.sunModel.ddateStr,
88 style: TextStyle( 71 style: TextStyle(
89 fontWeight: FontWeight.bold, 72 fontWeight: FontWeight.bold,
90 color: MyColours.color_F6F6F6, 73 color: MyColours.color_F6F6F6,
91 fontSize: ScreenUtil().setSp(40)), 74 fontSize: ScreenUtil().setSp(40)),
92 ), 75 ),
93 Text( 76 Text(
94 - '婚宴', 77 + widget.sunModel.className,
95 style: TextStyle( 78 style: TextStyle(
96 fontWeight: FontWeight.bold, 79 fontWeight: FontWeight.bold,
97 color: MyColours.color_F6F6F6, 80 color: MyColours.color_F6F6F6,
@@ -112,37 +95,63 @@ class _FeastItemState extends State<FeastItem> { @@ -112,37 +95,63 @@ class _FeastItemState extends State<FeastItem> {
112 ), 95 ),
113 child: Column( 96 child: Column(
114 crossAxisAlignment: CrossAxisAlignment.start, 97 crossAxisAlignment: CrossAxisAlignment.start,
  98 + mainAxisAlignment: MainAxisAlignment.start,
115 children: [ 99 children: [
116 - Text(  
117 - '桌位:凤凰厅、包间1、包间2',  
118 - style: TextStyle(  
119 - color: MyColours.color_000000,  
120 - fontSize: ScreenUtil().setSp(28)),  
121 - ),  
122 - VEmptyView(8),  
123 - Column(  
124 - children: taocanWidget(['ff', 'ff', 'ff', 'ff']),  
125 - ),  
126 - VEmptyView(36),  
127 Row( 100 Row(
128 - mainAxisAlignment: MainAxisAlignment.spaceBetween,  
129 - children: [  
130 - Text(  
131 - '方先生 订32桌 备2桌',  
132 - style: TextStyle(  
133 - fontWeight: FontWeight.bold,  
134 - color: MyColours.color_000000,  
135 - fontSize: ScreenUtil().setSp(28)),  
136 - ),  
137 - Text(  
138 - '负责人:刘经理',  
139 - style: TextStyle(  
140 - fontWeight: FontWeight.bold,  
141 - color: MyColours.color_000000,  
142 - fontSize: ScreenUtil().setSp(28)),  
143 - ),  
144 - ],  
145 - ) 101 + mainAxisAlignment: MainAxisAlignment.spaceBetween,
  102 + children: [
  103 + Text(
  104 + '${widget.sunModel.rname} ${Utils.starPhone(widget.sunModel.phone)}',
  105 + style: TextStyle(
  106 + color: MyColours.color_515151,
  107 + fontSize: ScreenUtil().setSp(28)),
  108 + ),
  109 + Text(
  110 + '跟单经理:${widget.sunModel.nickName}',
  111 + style: TextStyle(
  112 + color: MyColours.color_515151,
  113 + fontSize: ScreenUtil().setSp(28)),
  114 + )
  115 + ]),
  116 + VEmptyView(16),
  117 + ListView.builder(
  118 + shrinkWrap: true,
  119 + controller: widget.controller,
  120 + padding: EdgeInsets.zero,
  121 + // padding: EdgeInsets.symmetric(
  122 + // horizontal: ScreenUtil().setWidth(24)),
  123 + itemBuilder: (context, index) {
  124 + SessionByTime sessionByTime = widget.sunModel.list[index];
  125 + return Column(
  126 + crossAxisAlignment: CrossAxisAlignment.start,
  127 + children: [
  128 + Row(
  129 + children: [
  130 + Text(
  131 + sessionByTime.reserveOrder,
  132 + style: TextStyle(
  133 + color: MyColours.color_000000,
  134 + fontWeight: FontWeight.bold,
  135 + fontSize: ScreenUtil().setSp(30)),
  136 + ),
  137 + Text(
  138 + ' ${sessionByTime.ddateStr}',
  139 + style: TextStyle(
  140 + color: MyColours.color_000000,
  141 + fontSize: ScreenUtil().setSp(30)),
  142 + )
  143 + ],
  144 + ),
  145 + VEmptyView(20),
  146 + Wrap(
  147 + spacing: ScreenUtil().setWidth(14),
  148 + runSpacing: ScreenUtil().setWidth(20),
  149 + children: taocanWidget(sessionByTime.tableName),
  150 + ),
  151 + VEmptyView(26)
  152 + ]);
  153 + },
  154 + itemCount: widget.sunModel.list.length),
146 ], 155 ],
147 ), 156 ),
148 ) 157 )
@@ -2,6 +2,7 @@ import 'dart:io'; @@ -2,6 +2,7 @@ import 'dart:io';
2 2
3 import 'package:flutter/material.dart'; 3 import 'package:flutter/material.dart';
4 import 'package:flutter_screenutil/flutter_screenutil.dart'; 4 import 'package:flutter_screenutil/flutter_screenutil.dart';
  5 +import 'package:one_key/models/GetBanquetByTimeModel.dart';
5 import 'package:one_key/pages/feast/feast_item.dart'; 6 import 'package:one_key/pages/feast/feast_item.dart';
6 import 'package:one_key/provider/feast_model.dart'; 7 import 'package:one_key/provider/feast_model.dart';
7 import 'package:one_key/route/navigator_util.dart'; 8 import 'package:one_key/route/navigator_util.dart';
@@ -11,6 +12,7 @@ import 'package:one_key/widgets/v_empty_view.dart'; @@ -11,6 +12,7 @@ import 'package:one_key/widgets/v_empty_view.dart';
11 import 'package:provider/provider.dart'; 12 import 'package:provider/provider.dart';
12 13
13 import '../../constant/state.dart'; 14 import '../../constant/state.dart';
  15 +import '../../provider/user_model.dart';
14 import '../../res/colors.dart'; 16 import '../../res/colors.dart';
15 17
16 import '../../widgets/page_exception.dart'; 18 import '../../widgets/page_exception.dart';
@@ -23,6 +25,45 @@ class FeastPage extends StatefulWidget { @@ -23,6 +25,45 @@ class FeastPage extends StatefulWidget {
23 } 25 }
24 26
25 class _FeastPageState extends State<FeastPage> { 27 class _FeastPageState extends State<FeastPage> {
  28 + ScrollController controller = ScrollController();
  29 + FeastModel feastModel;
  30 +
  31 + @override
  32 + void initState() {
  33 + super.initState();
  34 + WidgetsBinding.instance.addPostFrameCallback((_) {
  35 + _getBanquetByTime();
  36 + // scrollController.jumpTo(scrollController.position.minScrollExtent);
  37 + });
  38 + }
  39 +
  40 + ///获取宴会详情
  41 + _getBanquetByTime() async {
  42 + DateTime now = DateTime.now();
  43 + DateTime new7 = now.add(Duration(days: 7));
  44 + String timeStrStart = now.year.toString() +
  45 + "-" +
  46 + Utils.addZeroNumber(now.month) +
  47 + "-" +
  48 + Utils.addZeroNumber(now.day) +
  49 + " 00:00:00";
  50 + String timeStrEnd = new7.year.toString() +
  51 + "-" +
  52 + Utils.addZeroNumber(new7.month) +
  53 + "-" +
  54 + Utils.addZeroNumber(new7.day) +
  55 + " 23:59:59";
  56 + double startDay =
  57 + (DateTime.parse(timeStrStart).millisecondsSinceEpoch) / 1000;
  58 + double endDay = (DateTime.parse(timeStrEnd).millisecondsSinceEpoch) / 1000;
  59 + Map<String, String> pramas = {
  60 + 'sid': Provider.of<UserModel>(context, listen: false).user.sellerid,
  61 + 'rdate': startDay.floor().toString(),
  62 + 'edate': endDay.floor().toString()
  63 + }; //
  64 + bool success = await feastModel.getBanquetByTime(context, pramas);
  65 + }
  66 +
26 Widget upAndDown(String image, String title, {GestureTapCallback onTap}) { 67 Widget upAndDown(String image, String title, {GestureTapCallback onTap}) {
27 return InkWell( 68 return InkWell(
28 onTap: onTap, 69 onTap: onTap,
@@ -43,6 +84,7 @@ class _FeastPageState extends State<FeastPage> { @@ -43,6 +84,7 @@ class _FeastPageState extends State<FeastPage> {
43 84
44 @override 85 @override
45 Widget build(BuildContext context) { 86 Widget build(BuildContext context) {
  87 + feastModel = Provider.of<FeastModel>(context, listen: true);
46 return Scaffold( 88 return Scaffold(
47 backgroundColor: MyColours.color_ffffff, 89 backgroundColor: MyColours.color_ffffff,
48 // appBar: SystemAppBar(''), 90 // appBar: SystemAppBar(''),
@@ -84,7 +126,7 @@ class _FeastPageState extends State<FeastPage> { @@ -84,7 +126,7 @@ class _FeastPageState extends State<FeastPage> {
84 ), 126 ),
85 ) 127 )
86 ]), 128 ]),
87 - upAndDown('y_money', '定金管理',onTap: (){ 129 + upAndDown('y_money', '定金管理', onTap: () {
88 NavigatorUtil.goFeastDepositDataPage(context); 130 NavigatorUtil.goFeastDepositDataPage(context);
89 }) 131 })
90 ], 132 ],
@@ -93,7 +135,7 @@ class _FeastPageState extends State<FeastPage> { @@ -93,7 +135,7 @@ class _FeastPageState extends State<FeastPage> {
93 Padding( 135 Padding(
94 padding: EdgeInsets.only(left: ScreenUtil().setWidth(48)), 136 padding: EdgeInsets.only(left: ScreenUtil().setWidth(48)),
95 child: Text( 137 child: Text(
96 - '30天内宴会', 138 + '7天内宴会',
97 style: TextStyle( 139 style: TextStyle(
98 color: MyColours.color_000000, 140 color: MyColours.color_000000,
99 fontSize: ScreenUtil().setSp(28)), 141 fontSize: ScreenUtil().setSp(28)),
@@ -114,12 +156,19 @@ class _FeastPageState extends State<FeastPage> { @@ -114,12 +156,19 @@ class _FeastPageState extends State<FeastPage> {
114 ); 156 );
115 } else { 157 } else {
116 return ListView.builder( 158 return ListView.builder(
  159 + controller: controller,
117 padding: EdgeInsets.symmetric( 160 padding: EdgeInsets.symmetric(
118 horizontal: ScreenUtil().setWidth(24)), 161 horizontal: ScreenUtil().setWidth(24)),
119 itemBuilder: (context, index) { 162 itemBuilder: (context, index) {
120 - return FeastItem(); 163 + GetBanquetByTimeSunModel sunModel =
  164 + feastModel.banquetHome[index];
  165 + return InkWell(
  166 + onTap: () {
  167 + NavigatorUtil.goFeastDetailPage(context, sunModel.id);
  168 + },
  169 + child: FeastItem(controller, sunModel));
121 }, 170 },
122 - itemCount: 100, 171 + itemCount: feastModel.banquetHome.length,
123 ); 172 );
124 } 173 }
125 })) 174 }))
@@ -7,6 +7,7 @@ import 'package:provider/provider.dart'; @@ -7,6 +7,7 @@ import 'package:provider/provider.dart';
7 7
8 import '../constant/constant.dart'; 8 import '../constant/constant.dart';
9 import '../constant/error.dart'; 9 import '../constant/error.dart';
  10 +import '../models/GetBanquetByTimeModel.dart';
10 import '../models/classify_model.dart'; 11 import '../models/classify_model.dart';
11 import '../models/filter_btn_model.dart'; 12 import '../models/filter_btn_model.dart';
12 import '../models/get_banquet_by_id_new_model.dart'; 13 import '../models/get_banquet_by_id_new_model.dart';
@@ -29,7 +30,7 @@ import '../utils/utils.dart'; @@ -29,7 +30,7 @@ import '../utils/utils.dart';
29 import 'dart:convert' as convert; 30 import 'dart:convert' as convert;
30 31
31 class FeastModel extends ChangeNotifier { 32 class FeastModel extends ChangeNotifier {
32 - PageState pageState = PageState.Success; 33 + PageState pageState = PageState.Loading; //宴会首页
33 34
34 List<FilterBtnModel> sellerManageList = []; //经理数据 ---- 商家编辑页面 35 List<FilterBtnModel> sellerManageList = []; //经理数据 ---- 商家编辑页面
35 36
@@ -76,6 +77,63 @@ class FeastModel extends ChangeNotifier { @@ -76,6 +77,63 @@ class FeastModel extends ChangeNotifier {
76 PageState pageStateBanquet = PageState.Loading; //宴会详情 77 PageState pageStateBanquet = PageState.Loading; //宴会详情
77 GetBanquetByIdNewSunModel banquetDetail; //宴会详情信息 78 GetBanquetByIdNewSunModel banquetDetail; //宴会详情信息
78 79
  80 + List<GetBanquetByTimeSunModel> banquetHome; //宴会首页数据
  81 +
  82 + /**
  83 + * 宴会首页
  84 + */
  85 +
  86 + //根据时间范围获取宴会订单
  87 + Future<dynamic> getBanquetByTime(
  88 + BuildContext context, Map<String, String> params,
  89 + {isShowLoading = true}) async {
  90 + BaseResp<dynamic> baseResp = await DioUtil()
  91 + .request<dynamic>(context, Method.get, HttpUrl.get_banquet_by_time,
  92 + data: params, showLoading: isShowLoading)
  93 + .catchError((error) {
  94 + print(error.toString());
  95 + if (error is MyError) {
  96 + switch (error.type) {
  97 + case 1:
  98 + pageState = PageState.ConnectivityError;
  99 + break;
  100 + case 2:
  101 + pageState = PageState.ConnectivityTimeOut;
  102 + break;
  103 + default:
  104 + pageState = PageState.ConnectivityError;
  105 + break;
  106 + }
  107 + }
  108 + notifyListeners();
  109 + return false;
  110 + });
  111 + if (baseResp.code == Constant.status_success) {
  112 + banquetHome = GetBanquetByTimeModel.fromJson(baseResp.responseData).data;
  113 +
  114 + // if (baseResp.data == 1) {
  115 + // rid = baseResp.data['id'];
  116 + if (banquetHome.length == 0) {
  117 + pageState = PageState.Empty;
  118 + } else {
  119 + pageState = PageState.Success;
  120 + }
  121 +
  122 + notifyListeners();
  123 + return true;
  124 + // } else {
  125 + // return false;
  126 + // }
  127 + } else {
  128 + if (baseResp != null) {
  129 + Utils.showToast(baseResp.msg ?? "");
  130 + }
  131 + pageState = PageState.ConnectivityError;
  132 + notifyListeners();
  133 + return false;
  134 + }
  135 + }
  136 +
79 /*** 137 /***
80 * 138 *
81 * 新建宴会 139 * 新建宴会
@@ -399,7 +457,34 @@ class FeastModel extends ChangeNotifier { @@ -399,7 +457,34 @@ class FeastModel extends ChangeNotifier {
399 } 457 }
400 } 458 }
401 459
402 - ///设置合同信息 460 + ///设置宴会场次费用
  461 + Future<dynamic> setBanquetInfoPrice(
  462 + BuildContext context, Map<String, String> params,
  463 + {isShowLoading = true}) async {
  464 + BaseResp<dynamic> baseResp = await DioUtil()
  465 + .request<dynamic>(context, Method.get, HttpUrl.set_banquet_info_price,
  466 + data: params, showLoading: isShowLoading)
  467 + .catchError((error) {
  468 + print(error.toString());
  469 + if (error is MyError) {}
  470 + return false;
  471 + });
  472 + if (baseResp.code == Constant.status_success) {
  473 + // if (baseResp.data == 1) {
  474 + // rid = baseResp.data['id'];
  475 + return true;
  476 + // } else {
  477 + // return false;
  478 + // }
  479 + } else {
  480 + if (baseResp != null) {
  481 + Utils.showToast(baseResp.msg ?? "");
  482 + }
  483 + return false;
  484 + }
  485 + }
  486 +
  487 + ///设置发票信息
403 Future<dynamic> setInvoice(BuildContext context, Map<String, String> params, 488 Future<dynamic> setInvoice(BuildContext context, Map<String, String> params,
404 {isShowLoading = true}) async { 489 {isShowLoading = true}) async {
405 BaseResp<dynamic> baseResp = await DioUtil() 490 BaseResp<dynamic> baseResp = await DioUtil()
@@ -1062,7 +1062,6 @@ class NavigatorUtil { @@ -1062,7 +1062,6 @@ class NavigatorUtil {
1062 1062
1063 ///宴会--签约--菜单信息 1063 ///宴会--签约--菜单信息
1064 static Future<dynamic> goFeastMenuQYShowPage(BuildContext context, 1064 static Future<dynamic> goFeastMenuQYShowPage(BuildContext context,
1065 -  
1066 {replace = false, bool onlyShow = false, Map object}) { 1065 {replace = false, bool onlyShow = false, Map object}) {
1067 if (object == null) { 1066 if (object == null) {
1068 return _navigateTo(context, "${Routes.feast_qy_menu_show_page}", 1067 return _navigateTo(context, "${Routes.feast_qy_menu_show_page}",
@@ -1072,4 +1071,14 @@ class NavigatorUtil { @@ -1072,4 +1071,14 @@ class NavigatorUtil {
1072 "${Routes.feast_qy_menu_show_page}?object=${FluroConvertUtils.object2string(object)}", 1071 "${Routes.feast_qy_menu_show_page}?object=${FluroConvertUtils.object2string(object)}",
1073 replace: replace); 1072 replace: replace);
1074 } 1073 }
  1074 +
  1075 + ///宴会--详情
  1076 + static Future<dynamic> goFeastDetailPage(
  1077 + BuildContext context,
  1078 + String rid, {
  1079 + replace = false,
  1080 + }) {
  1081 + return _navigateTo(context, "${Routes.feast_detail_page}?rid=$rid",
  1082 + replace: replace);
  1083 + }
1075 } 1084 }
@@ -155,6 +155,7 @@ import '../pages/feast/feast_board.dart'; @@ -155,6 +155,7 @@ import '../pages/feast/feast_board.dart';
155 import '../pages/feast/feast_create_page.dart'; 155 import '../pages/feast/feast_create_page.dart';
156 import '../pages/feast/feast_deposit_data_page.dart'; 156 import '../pages/feast/feast_deposit_data_page.dart';
157 import '../pages/feast/feast_deposit_page.dart'; 157 import '../pages/feast/feast_deposit_page.dart';
  158 +import '../pages/feast/feast_detail_page.dart';
158 import '../pages/feast/feast_followup_page.dart'; 159 import '../pages/feast/feast_followup_page.dart';
159 import '../pages/feast/feast_invoice_page.dart'; 160 import '../pages/feast/feast_invoice_page.dart';
160 import '../pages/feast/feast_menu_page.dart'; 161 import '../pages/feast/feast_menu_page.dart';
@@ -1734,3 +1735,16 @@ var feastQYMenuPageHandle = new Handler( @@ -1734,3 +1735,16 @@ var feastQYMenuPageHandle = new Handler(
1734 cookListData: cook, 1735 cookListData: cook,
1735 )); 1736 ));
1736 }); 1737 });
  1738 +
  1739 +///宴会----详情
  1740 +var feastDetailPageHandle = new Handler(
  1741 + handlerFunc: (BuildContext context, Map<dynamic, List<Object>> params) {
  1742 +
  1743 + String rid = params["rid"].first;
  1744 +
  1745 + return ChangeNotifierProvider<FeastModel>(
  1746 + create: (_) => FeastModel(),
  1747 + child: FeastDetailPage(
  1748 + rid: rid,
  1749 + ));
  1750 +});
@@ -153,6 +153,7 @@ class Routes { @@ -153,6 +153,7 @@ class Routes {
153 "/feast_menu_show_page"; //宴会-----新建宴会---菜单信息 153 "/feast_menu_show_page"; //宴会-----新建宴会---菜单信息
154 static String feast_qy_menu_show_page = 154 static String feast_qy_menu_show_page =
155 "/feast_qy_menu_show_page"; //宴会-----新建宴会---签约菜单信息 155 "/feast_qy_menu_show_page"; //宴会-----新建宴会---签约菜单信息
  156 + static String feast_detail_page = "/feast_detail_page"; //宴会-----详情
156 157
157 static void configureRoutes(FluroRouter router) { 158 static void configureRoutes(FluroRouter router) {
158 router.notFoundHandler = new Handler( 159 router.notFoundHandler = new Handler(
@@ -306,7 +307,8 @@ class Routes { @@ -306,7 +307,8 @@ class Routes {
306 router.define(feast_select_table_page, handler: feastSelectTablePageHandle); 307 router.define(feast_select_table_page, handler: feastSelectTablePageHandle);
307 router.define(feast_menu_show_page, handler: feastMenuShowPageHandle); 308 router.define(feast_menu_show_page, handler: feastMenuShowPageHandle);
308 309
309 - router.define(feast_qy_menu_show_page, handler: feastQYMenuPageHandle);  
310 - 310 + router.define(feast_qy_menu_show_page, handler: feastQYMenuPageHandle);
  311 +
  312 + router.define(feast_detail_page, handler: feastDetailPageHandle);
311 } 313 }
312 } 314 }
@@ -869,7 +869,10 @@ class Utils { @@ -869,7 +869,10 @@ class Utils {
869 }; 869 };
870 } 870 }
871 871
872 - static String starPhone(phone) { 872 + static String starPhone(String phone) {
  873 + if (phone.length < 5) {
  874 + return phone;
  875 + }
873 return phone.replaceFirst(new RegExp(r'\d{4}'), '****', 3); 876 return phone.replaceFirst(new RegExp(r'\d{4}'), '****', 3);
874 } 877 }
875 878