Commit 8423d9b0e16ba8ad0e0b52170cd96f8cf4a9a854

Authored by wdn127929
1 parent 56d95d22

浏览图片、更多桌位查看

@@ -25,6 +25,7 @@ import 'package:one_key/utils/event_bus.dart'; @@ -25,6 +25,7 @@ import 'package:one_key/utils/event_bus.dart';
25 import 'package:one_key/utils/misc.dart'; 25 import 'package:one_key/utils/misc.dart';
26 import 'package:one_key/route/navigator_util.dart'; 26 import 'package:one_key/route/navigator_util.dart';
27 import 'package:one_key/utils/utils.dart'; 27 import 'package:one_key/utils/utils.dart';
  28 +import 'package:one_key/widgets/MyDivider.dart';
28 import 'package:one_key/widgets/h_empty_view.dart'; 29 import 'package:one_key/widgets/h_empty_view.dart';
29 import 'package:one_key/widgets/input_done_view.dart'; 30 import 'package:one_key/widgets/input_done_view.dart';
30 import 'package:one_key/widgets/page_exception.dart'; 31 import 'package:one_key/widgets/page_exception.dart';
@@ -57,7 +58,8 @@ class InvicationPage extends StatefulWidget { @@ -57,7 +58,8 @@ class InvicationPage extends StatefulWidget {
57 } 58 }
58 } 59 }
59 60
60 -class InvicationPageState extends State<InvicationPage> { 61 +class InvicationPageState extends State<InvicationPage>
  62 + with WidgetsBindingObserver {
61 User user; 63 User user;
62 DateTime dateTime; 64 DateTime dateTime;
63 String dateTimeStr = ""; 65 String dateTimeStr = "";
@@ -84,7 +86,7 @@ class InvicationPageState extends State<InvicationPage> { @@ -84,7 +86,7 @@ class InvicationPageState extends State<InvicationPage> {
84 int couponSelectIndex = 0; 86 int couponSelectIndex = 0;
85 NotebookDetail detailEntity; 87 NotebookDetail detailEntity;
86 88
87 - String tableInfo; //桌位信息 89 + List<Map<String, String>> tableInfo = []; //桌位信息
88 String ddate; 90 String ddate;
89 String ddateStr; 91 String ddateStr;
90 String phoneWidget; 92 String phoneWidget;
@@ -103,10 +105,12 @@ class InvicationPageState extends State<InvicationPage> { @@ -103,10 +105,12 @@ class InvicationPageState extends State<InvicationPage> {
103 String oldSex; 105 String oldSex;
104 bool needBack = false; 106 bool needBack = false;
105 bool needBlack = false; 107 bool needBlack = false;
  108 + bool needHistory = false;
106 String youhui = '选择优惠'; 109 String youhui = '选择优惠';
107 @override 110 @override
108 void initState() { 111 void initState() {
109 super.initState(); 112 super.initState();
  113 + WidgetsBinding.instance.addObserver(this);
110 114
111 personNumList = Utils.getPersonNumList(); 115 personNumList = Utils.getPersonNumList();
112 116
@@ -114,7 +118,7 @@ class InvicationPageState extends State<InvicationPage> { @@ -114,7 +118,7 @@ class InvicationPageState extends State<InvicationPage> {
114 if (_nameNode.hasFocus) { 118 if (_nameNode.hasFocus) {
115 showOverlay(context); 119 showOverlay(context);
116 } else { 120 } else {
117 - if (!needBack && !needBlack) { 121 + if (!needBack && !needBlack && !needHistory && !_phoneNode.hasFocus) {
118 _showConfirmWidget(); 122 _showConfirmWidget();
119 } 123 }
120 removeOverlay(); 124 removeOverlay();
@@ -125,7 +129,7 @@ class InvicationPageState extends State<InvicationPage> { @@ -125,7 +129,7 @@ class InvicationPageState extends State<InvicationPage> {
125 if (_phoneNode.hasFocus) { 129 if (_phoneNode.hasFocus) {
126 showOverlay(context); 130 showOverlay(context);
127 } else { 131 } else {
128 - if (!needBack && !needBlack) { 132 + if (!needBack && !needBlack && !needHistory && !_nameNode.hasFocus) {
129 _showConfirmWidget(); 133 _showConfirmWidget();
130 } 134 }
131 135
@@ -137,8 +141,9 @@ class InvicationPageState extends State<InvicationPage> { @@ -137,8 +141,9 @@ class InvicationPageState extends State<InvicationPage> {
137 couponProvider.sendSMS = false; 141 couponProvider.sendSMS = false;
138 await _couponNetworkData(isShowLoading: false); 142 await _couponNetworkData(isShowLoading: false);
139 await _getCustomerActivityBaseinfo(); 143 await _getCustomerActivityBaseinfo();
140 - await _getTablesPhoto(); 144 +
141 await _getReserveDetail(showCicle: false); 145 await _getReserveDetail(showCicle: false);
  146 + await _getTablesPhoto();
142 }); 147 });
143 bus.on("refresh_coupon_invitation", (args) { 148 bus.on("refresh_coupon_invitation", (args) {
144 _couponNetworkData(isShowLoading: false); 149 _couponNetworkData(isShowLoading: false);
@@ -157,11 +162,23 @@ class InvicationPageState extends State<InvicationPage> { @@ -157,11 +162,23 @@ class InvicationPageState extends State<InvicationPage> {
157 couponProvider.clearSelect(); 162 couponProvider.clearSelect();
158 bus.off("refresh_coupon_invitation"); 163 bus.off("refresh_coupon_invitation");
159 bus.off("refresh_invitaion_info"); 164 bus.off("refresh_invitaion_info");
  165 + WidgetsBinding.instance.removeObserver(this); //销毁观察者
160 166
161 super.dispose(); 167 super.dispose();
162 } 168 }
163 169
164 - _showConfirmWidget({needBack = false, needSex = false}) { 170 + @override
  171 + void didChangeMetrics() {
  172 + super.didChangeMetrics();
  173 + print(MediaQuery.of(context).viewInsets.bottom);
  174 +
  175 + if (MediaQuery.of(context).viewInsets.bottom > 0) {
  176 + removeOverlay();
  177 + }
  178 + }
  179 +
  180 + _showConfirmWidget(
  181 + {needBack = false, needSex = false, needHistory = false, int index}) {
165 FocusScope.of(context).requestFocus(FocusNode()); //点击空白处隐藏键盘 182 FocusScope.of(context).requestFocus(FocusNode()); //点击空白处隐藏键盘
166 String phone = ''; 183 String phone = '';
167 String name = ''; 184 String name = '';
@@ -172,14 +189,16 @@ class InvicationPageState extends State<InvicationPage> { @@ -172,14 +189,16 @@ class InvicationPageState extends State<InvicationPage> {
172 if (nameStr != null && nameStr.trim().length > 0) { 189 if (nameStr != null && nameStr.trim().length > 0) {
173 name = nameStr; 190 name = nameStr;
174 } 191 }
175 - if (oldName != name || oldPhone != phone || needSex) { 192 + if (oldName != name || oldPhone != phone || needSex || needHistory) {
176 DialogUtil.cupertinoAlertDialog(context, 193 DialogUtil.cupertinoAlertDialog(context,
177 title: "客户信息", 194 title: "客户信息",
178 content: "客户信息已修改,是否确定修改", 195 content: "客户信息已修改,是否确定修改",
179 lTitle: "取消", 196 lTitle: "取消",
180 rTitle: "确定修改", lCallback: () { 197 rTitle: "确定修改", lCallback: () {
181 print("取消"); 198 print("取消");
  199 + showPhoneHistory = false;
182 if (needBack) { 200 if (needBack) {
  201 + needBack = false;
183 Navigator.of(context).pop(); 202 Navigator.of(context).pop();
184 } else { 203 } else {
185 if (needSex) { 204 if (needSex) {
@@ -192,10 +211,17 @@ class InvicationPageState extends State<InvicationPage> { @@ -192,10 +211,17 @@ class InvicationPageState extends State<InvicationPage> {
192 } 211 }
193 } 212 }
194 } 213 }
  214 + needSex = false;
  215 + }
  216 + if (needHistory) {
  217 + needHistory = false;
  218 + }
  219 +
  220 + if (needBlack) {
  221 + needBlack = false;
195 } 222 }
196 if (_baseIndoProvider.phoneController.text.trim().length > 0) { 223 if (_baseIndoProvider.phoneController.text.trim().length > 0) {
197 _baseIndoProvider.phoneController.text = oldPhone; 224 _baseIndoProvider.phoneController.text = oldPhone;
198 - showPhoneHistory = false;  
199 } 225 }
200 if (nameStr != null && nameStr.trim().length > 0) { 226 if (nameStr != null && nameStr.trim().length > 0) {
201 nameStr = oldName; 227 nameStr = oldName;
@@ -210,13 +236,41 @@ class InvicationPageState extends State<InvicationPage> { @@ -210,13 +236,41 @@ class InvicationPageState extends State<InvicationPage> {
210 setState(() {}); 236 setState(() {});
211 } 237 }
212 }, rCallback: () { 238 }, rCallback: () {
  239 + showPhoneHistory = false;
213 if (needBack) { 240 if (needBack) {
  241 + needBack = false;
214 Navigator.of(context).pop(); 242 Navigator.of(context).pop();
215 } 243 }
  244 + if (needSex) {
  245 + needSex = false;
  246 + }
  247 + if (needHistory) {
  248 + setState(() {
  249 + showPhoneHistory = false;
  250 + _baseIndoProvider.phoneController.text =
  251 + _baseIndoProvider.userHistorys[index].phone != null
  252 + ? _baseIndoProvider.userHistorys[index].phone
  253 + : '';
  254 + // _homeEnterModel.nameController.text =
  255 + // _homeEnterModel
  256 + // .userHistorys[index].rname +
  257 + // _nameSuffix();
  258 + _addNameSuffix(
  259 + _baseIndoProvider.userHistorys[index].rname, _nameSuffix());
  260 + nameStr = _baseIndoProvider.userHistorys[index].rname;
  261 + _phoneNode.unfocus();
  262 + _baseIndoProvider.userHistorys.clear();
  263 + });
  264 + needHistory = false;
  265 + }
  266 + if (needBlack) {
  267 + needBlack = false;
  268 + }
216 _updateReserve(); 269 _updateReserve();
217 }); 270 });
218 } else { 271 } else {
219 if (needBack) { 272 if (needBack) {
  273 + needBack = false;
220 Navigator.of(context).pop(); 274 Navigator.of(context).pop();
221 } 275 }
222 } 276 }
@@ -505,6 +559,10 @@ class InvicationPageState extends State<InvicationPage> { @@ -505,6 +559,10 @@ class InvicationPageState extends State<InvicationPage> {
505 _nameStr += '${detailEntity.tables[i].name},'; 559 _nameStr += '${detailEntity.tables[i].name},';
506 _tid += '${detailEntity.tables[i].id},'; 560 _tid += '${detailEntity.tables[i].id},';
507 regionName += '${detailEntity.tables[i].rname},'; 561 regionName += '${detailEntity.tables[i].rname},';
  562 + tableInfo.add({
  563 + 'name': detailEntity.tables[i].name,
  564 + 'tid': detailEntity.tables[i].id
  565 + });
508 } 566 }
509 if (_tid.endsWith(',')) { 567 if (_tid.endsWith(',')) {
510 _tid = _tid.substring(0, _tid.length - 1); 568 _tid = _tid.substring(0, _tid.length - 1);
@@ -517,7 +575,8 @@ class InvicationPageState extends State<InvicationPage> { @@ -517,7 +575,8 @@ class InvicationPageState extends State<InvicationPage> {
517 } 575 }
518 576
519 tid = _tid; 577 tid = _tid;
520 - tableInfo = _nameStr; 578 + // tableInfo = _nameStr;
  579 +
521 ddate = detailEntity.ddate; 580 ddate = detailEntity.ddate;
522 ddateStr = detailEntity.ddateStr; 581 ddateStr = detailEntity.ddateStr;
523 phoneWidget = detailEntity.phone; 582 phoneWidget = detailEntity.phone;
@@ -766,26 +825,27 @@ class InvicationPageState extends State<InvicationPage> { @@ -766,26 +825,27 @@ class InvicationPageState extends State<InvicationPage> {
766 825
767 ///浏览照片 826 ///浏览照片
768 /// 827 ///
769 - void onTapDown(BuildContext context, TapDownDetails details, GlobalKey key) { 828 + void onTapDown(BuildContext context, TapDownDetails details, GlobalKey key,
  829 + String tableid) {
770 final RenderBox box = context.findRenderObject(); 830 final RenderBox box = context.findRenderObject();
771 final Offset localOffset = box.globalToLocal(details.globalPosition); 831 final Offset localOffset = box.globalToLocal(details.globalPosition);
772 final RenderBox containerBox = key.currentContext.findRenderObject(); 832 final RenderBox containerBox = key.currentContext.findRenderObject();
773 final Offset containerOffset = containerBox.localToGlobal(localOffset); 833 final Offset containerOffset = containerBox.localToGlobal(localOffset);
774 final onTap = containerBox.paintBounds.contains(containerOffset); 834 final onTap = containerBox.paintBounds.contains(containerOffset);
775 if (onTap) { 835 if (onTap) {
776 - _seePhoto(); 836 + _seePhoto(tableid);
777 } 837 }
778 } 838 }
779 839
780 - _seePhoto() { 840 + _seePhoto(tableid) {
781 // List<String> temp = []; 841 // List<String> temp = [];
782 - if (_baseIndoProvider.photoList.length > 0) { 842 + if (_baseIndoProvider.photoList[tableid].length > 0) {
783 // for (int i = 0; i < _baseIndoProvider.photoList.length; i++) { 843 // for (int i = 0; i < _baseIndoProvider.photoList.length; i++) {
784 // temp.add(_baseIndoProvider.photoList[i].image); 844 // temp.add(_baseIndoProvider.photoList[i].image);
785 // } 845 // }
786 846
787 ///没有上传完成的不可以点击 847 ///没有上传完成的不可以点击
788 - _showPhotoView(context, 0, _baseIndoProvider.photoList); 848 + _showPhotoView(context, 0, _baseIndoProvider.photoList[tableid]);
789 } 849 }
790 } 850 }
791 851
@@ -967,38 +1027,181 @@ class InvicationPageState extends State<InvicationPage> { @@ -967,38 +1027,181 @@ class InvicationPageState extends State<InvicationPage> {
967 ); 1027 );
968 } 1028 }
969 1029
  1030 + _tableListWidget(CustomCallBack callback) {
  1031 + // List<Map<String, String>> temp = []; //桌位信息
  1032 + // temp.addAll(tableInfo);
  1033 + // temp.removeAt(0);
  1034 + // temp.removeAt(0);
  1035 + List<Widget> lists = tableInfo.map((item) {
  1036 + final GlobalKey key = new GlobalKey();
  1037 + return GestureDetector(
  1038 + onTapDown: (TapDownDetails details) => onTapDown(
  1039 + context,
  1040 + details,
  1041 + key,
  1042 + item['tid'],
  1043 + ),
  1044 + child: Container(
  1045 + child: Stack(
  1046 + alignment: Alignment.bottomCenter,
  1047 + overflow: Overflow.visible,
  1048 + children: [
  1049 + Container(
  1050 + margin: EdgeInsets.only(bottom: ScreenUtil().setWidth(18)),
  1051 + constraints:
  1052 + BoxConstraints(minWidth: ScreenUtil().setWidth(160)),
  1053 + padding: EdgeInsets.fromLTRB(
  1054 + ScreenUtil().setWidth(20),
  1055 + ScreenUtil().setWidth(20),
  1056 + ScreenUtil().setWidth(20),
  1057 + ScreenUtil().setWidth(18 * 2)),
  1058 + decoration: BoxDecoration(
  1059 + borderRadius: BorderRadius.all(
  1060 + Radius.circular(ScreenUtil().setWidth(13 * 2))),
  1061 + border: Border.all(
  1062 + color: MyColours.color_199095,
  1063 + width: ScreenUtil().setWidth(4))),
  1064 + child: Text(
  1065 + item['name'],
  1066 + textAlign: TextAlign.center,
  1067 + style: TextStyle(
  1068 + // letterSpacing: ScreenUtil()
  1069 + // .setWidth(2.13 * 2),
  1070 + color: MyColours.color_333333,
  1071 + fontWeight: FontWeight.bold,
  1072 + fontSize: ScreenUtil().setSp(32)),
  1073 + ),
  1074 + ),
  1075 + Positioned(
  1076 + key: key,
  1077 + bottom: 0,
  1078 + child: RoundButton(
  1079 + onPressed: () {
  1080 + _seePhoto(item['tid']);
  1081 + },
  1082 + text: '浏览照片',
  1083 + width: ScreenUtil().setWidth(60 * 2),
  1084 + height: ScreenUtil().setWidth(18 * 2),
  1085 + fontSize: 22,
  1086 + textColor: _baseIndoProvider.photoList.isNotEmpty &&
  1087 + _baseIndoProvider.photoList[item['tid']].length > 0
  1088 + ? MyColours.color_ffffff
  1089 + : MyColours.color_ffffff,
  1090 + isBold: false,
  1091 + gradientStart: _baseIndoProvider.photoList.isNotEmpty &&
  1092 + _baseIndoProvider.photoList[item['tid']].length > 0
  1093 + ? MyColours.color_199095
  1094 + : Color.fromRGBO(154, 154, 154, 1),
  1095 + gradientEnd: _baseIndoProvider.photoList.isNotEmpty &&
  1096 + _baseIndoProvider.photoList[item['tid']].length > 0
  1097 + ? MyColours.color_199095
  1098 + : Color.fromRGBO(154, 154, 154, 1),
  1099 + ))
  1100 + ],
  1101 + )));
  1102 + }).toList();
  1103 + return lists;
  1104 + }
  1105 +
  1106 + Future _openTablesDialog(BuildContext context, {CustomCallBack onTap}) async {
  1107 + final action = await showDialog(
  1108 + context: context,
  1109 + barrierDismissible: true,
  1110 + builder: (BuildContext context) {
  1111 + return Center(
  1112 + child: Container(
  1113 + height: ScreenUtil().setWidth(500),
  1114 + width: ScreenUtil.screenWidthDp - ScreenUtil().setWidth(80),
  1115 + decoration: BoxDecoration(
  1116 + borderRadius: BorderRadius.circular(ScreenUtil().setWidth(10))),
  1117 + child: Card(
  1118 + shape: RoundedRectangleBorder(
  1119 + borderRadius: BorderRadius.all(
  1120 + Radius.circular(ScreenUtil().setWidth(10)))), //设置圆角
  1121 + child: Column(children: [
  1122 + Expanded(
  1123 + child: ListView(
  1124 + padding: EdgeInsets.symmetric(
  1125 + horizontal: ScreenUtil().setWidth(40),
  1126 + vertical: ScreenUtil().setWidth(40)),
  1127 + shrinkWrap: true,
  1128 + children: [
  1129 + Wrap(
  1130 + crossAxisAlignment: WrapCrossAlignment.center,
  1131 + runAlignment: WrapAlignment.spaceAround,
  1132 + alignment: WrapAlignment.center,
  1133 + children: _tableListWidget((v) {}),
  1134 + spacing: ScreenUtil().setWidth(20),
  1135 + runSpacing: ScreenUtil().setWidth(20),
  1136 + // alignment: WrapAlignment.start,
  1137 + // runAlignment: WrapAlignment.end,
  1138 + ),
  1139 + ],
  1140 + )),
  1141 + MyDivider(double.infinity, ScreenUtil().setWidth(2)),
  1142 + InkWell(
  1143 + onTap: () {
  1144 + Navigator.pop(context);
  1145 + },
  1146 + child: Container(
  1147 + width: double.infinity,
  1148 + alignment: Alignment.center,
  1149 + padding: EdgeInsets.symmetric(
  1150 + vertical: ScreenUtil().setWidth(40)),
  1151 + child: Text('确定',
  1152 + style: TextStyle(
  1153 + color: Color.fromRGBO(42, 96, 244, 1),
  1154 + fontSize: ScreenUtil().setSp(30))),
  1155 + ),
  1156 + )
  1157 + ])),
  1158 + ),
  1159 + );
  1160 + },
  1161 + );
  1162 + }
  1163 +
970 //构建常用备注 1164 //构建常用备注
971 List<Widget> _buildAlwayItems() { 1165 List<Widget> _buildAlwayItems() {
972 - List<String> tableInfoList = tableInfo.split(","); 1166 + // List<String> tableInfoList = tableInfo.split(",");
973 // 1167 //
974 List<Widget> tables = []; 1168 List<Widget> tables = [];
975 - for (int i = 0; i < tableInfoList.length; i++) { 1169 + for (int i = 0; i < tableInfo.length; i++) {
976 if (i == 2) { 1170 if (i == 2) {
977 - tables.add(Container(  
978 - padding: EdgeInsets.only(  
979 - left: ScreenUtil().setWidth(10),  
980 - right: ScreenUtil().setWidth(10),  
981 - top: ScreenUtil().setWidth(10)),  
982 - decoration: BoxDecoration(  
983 - color: MyColours.color_ffffff,  
984 - // border: Border.all(  
985 - // color: MyColours.color_E0E0E0,  
986 - // width: ScreenUtil().setWidth(2)),  
987 - borderRadius: BorderRadius.circular(ScreenUtil().setWidth(10))),  
988 - child: Text(  
989 - '等${tableInfoList.length}个桌位',  
990 - style: TextStyle(  
991 - fontSize: ScreenUtil().setSp(26),  
992 - color: MyColours.color_199095,  
993 - ),  
994 - ))); 1171 + tables.add(InkWell(
  1172 + onTap: () {
  1173 + _openTablesDialog(context);
  1174 + },
  1175 + child: Container(
  1176 + padding: EdgeInsets.only(
  1177 + left: ScreenUtil().setWidth(10),
  1178 + right: ScreenUtil().setWidth(10),
  1179 + top: ScreenUtil().setWidth(10)),
  1180 + decoration: BoxDecoration(
  1181 + color: MyColours.color_ffffff,
  1182 + // border: Border.all(
  1183 + // color: MyColours.color_E0E0E0,
  1184 + // width: ScreenUtil().setWidth(2)),
  1185 + borderRadius:
  1186 + BorderRadius.circular(ScreenUtil().setWidth(10))),
  1187 + child: Text(
  1188 + '等${tableInfo.length}个桌位',
  1189 + style: TextStyle(
  1190 + fontSize: ScreenUtil().setSp(26),
  1191 + color: MyColours.color_199095,
  1192 + ),
  1193 + ))));
995 return tables; 1194 return tables;
996 } else { 1195 } else {
997 final GlobalKey key = new GlobalKey(); 1196 final GlobalKey key = new GlobalKey();
998 tables.add( 1197 tables.add(
999 GestureDetector( 1198 GestureDetector(
1000 - onTapDown: (TapDownDetails details) =>  
1001 - onTapDown(context, details, key), 1199 + onTapDown: (TapDownDetails details) => onTapDown(
  1200 + context,
  1201 + details,
  1202 + key,
  1203 + tableInfo[i]['tid'],
  1204 + ),
1002 child: Container( 1205 child: Container(
1003 child: Stack( 1206 child: Stack(
1004 alignment: Alignment.bottomCenter, 1207 alignment: Alignment.bottomCenter,
@@ -1020,7 +1223,7 @@ class InvicationPageState extends State<InvicationPage> { @@ -1020,7 +1223,7 @@ class InvicationPageState extends State<InvicationPage> {
1020 color: MyColours.color_199095, 1223 color: MyColours.color_199095,
1021 width: ScreenUtil().setWidth(4))), 1224 width: ScreenUtil().setWidth(4))),
1022 child: Text( 1225 child: Text(
1023 - tableInfoList[i], 1226 + tableInfo[i]['name'],
1024 textAlign: TextAlign.center, 1227 textAlign: TextAlign.center,
1025 style: TextStyle( 1228 style: TextStyle(
1026 // letterSpacing: ScreenUtil() 1229 // letterSpacing: ScreenUtil()
@@ -1035,20 +1238,29 @@ class InvicationPageState extends State<InvicationPage> { @@ -1035,20 +1238,29 @@ class InvicationPageState extends State<InvicationPage> {
1035 bottom: 0, 1238 bottom: 0,
1036 child: RoundButton( 1239 child: RoundButton(
1037 onPressed: () { 1240 onPressed: () {
1038 - _seePhoto(); 1241 + _seePhoto(tableInfo[i]['tid']);
1039 }, 1242 },
1040 text: '浏览照片', 1243 text: '浏览照片',
1041 width: ScreenUtil().setWidth(60 * 2), 1244 width: ScreenUtil().setWidth(60 * 2),
1042 height: ScreenUtil().setWidth(18 * 2), 1245 height: ScreenUtil().setWidth(18 * 2),
1043 fontSize: 22, 1246 fontSize: 22,
1044 - textColor: _baseIndoProvider.photoList.length > 0 1247 + textColor: _baseIndoProvider.photoList.isNotEmpty &&
  1248 + _baseIndoProvider
  1249 + .photoList[tableInfo[i]['tid']].length >
  1250 + 0
1045 ? MyColours.color_ffffff 1251 ? MyColours.color_ffffff
1046 : MyColours.color_ffffff, 1252 : MyColours.color_ffffff,
1047 isBold: false, 1253 isBold: false,
1048 - gradientStart: _baseIndoProvider.photoList.length > 0 1254 + gradientStart: _baseIndoProvider.photoList.isNotEmpty &&
  1255 + _baseIndoProvider
  1256 + .photoList[tableInfo[i]['tid']].length >
  1257 + 0
1049 ? MyColours.color_199095 1258 ? MyColours.color_199095
1050 : Color.fromRGBO(154, 154, 154, 1), 1259 : Color.fromRGBO(154, 154, 154, 1),
1051 - gradientEnd: _baseIndoProvider.photoList.length > 0 1260 + gradientEnd: _baseIndoProvider.photoList.isNotEmpty &&
  1261 + _baseIndoProvider
  1262 + .photoList[tableInfo[i]['tid']].length >
  1263 + 0
1052 ? MyColours.color_199095 1264 ? MyColours.color_199095
1053 : Color.fromRGBO(154, 154, 154, 1), 1265 : Color.fromRGBO(154, 154, 154, 1),
1054 )) 1266 ))
@@ -1503,33 +1715,10 @@ class InvicationPageState extends State<InvicationPage> { @@ -1503,33 +1715,10 @@ class InvicationPageState extends State<InvicationPage> {
1503 itemBuilder: (context, index) { 1715 itemBuilder: (context, index) {
1504 return GestureDetector( 1716 return GestureDetector(
1505 onTap: () { 1717 onTap: () {
1506 - setState(() {  
1507 - showPhoneHistory = false;  
1508 - _baseIndoProvider  
1509 - .phoneController  
1510 - .text = _baseIndoProvider  
1511 - .userHistorys[index]  
1512 - .phone !=  
1513 - null  
1514 - ? _baseIndoProvider  
1515 - .userHistorys[index]  
1516 - .phone  
1517 - : '';  
1518 - // _homeEnterModel.nameController.text =  
1519 - // _homeEnterModel  
1520 - // .userHistorys[index].rname +  
1521 - // _nameSuffix();  
1522 - _addNameSuffix(  
1523 - _baseIndoProvider  
1524 - .userHistorys[index]  
1525 - .rname,  
1526 - _nameSuffix());  
1527 - nameStr = _baseIndoProvider  
1528 - .userHistorys[index].rname;  
1529 - _phoneNode.unfocus();  
1530 - _baseIndoProvider.userHistorys  
1531 - .clear();  
1532 - }); 1718 + needHistory = true;
  1719 + _showConfirmWidget(
  1720 + needHistory: true,
  1721 + index: index);
1533 }, 1722 },
1534 child: Container( 1723 child: Container(
1535 width: double.infinity, 1724 width: double.infinity,
@@ -2009,14 +2198,14 @@ class InvicationPageState extends State<InvicationPage> { @@ -2009,14 +2198,14 @@ class InvicationPageState extends State<InvicationPage> {
2009 // } 2198 // }
2010 Utils.showToast('请输入客户手机号'); 2199 Utils.showToast('请输入客户手机号');
2011 } else if (!Utils.phoneRegExp(reserverPhone)) { 2200 } else if (!Utils.phoneRegExp(reserverPhone)) {
2012 - Utils.showToast('手机号错误,请修改正确'); 2201 + Utils.showToast('手机号格式错误,请修改正确');
2013 //跳转到录入联系人页面 2202 //跳转到录入联系人页面
2014 - String temp = await NavigatorUtil.goEditReserverPage(  
2015 - context, widget.rid, name, sex,  
2016 - needBtn: true);  
2017 - if (temp != null) {  
2018 - reserverPhone = temp;  
2019 - } 2203 + // String temp = await NavigatorUtil.goEditReserverPage(
  2204 + // context, widget.rid, name, sex,
  2205 + // needBtn: true);
  2206 + // if (temp != null) {
  2207 + // reserverPhone = temp;
  2208 + // }
2020 } else { 2209 } else {
2021 if (!couponProvider.sendSMS) { 2210 if (!couponProvider.sendSMS) {
2022 /* 2211 /*
@@ -2131,88 +2320,90 @@ class InvicationPageState extends State<InvicationPage> { @@ -2131,88 +2320,90 @@ class InvicationPageState extends State<InvicationPage> {
2131 needBlack = true; 2320 needBlack = true;
2132 _showConfirmWidget(); 2321 _showConfirmWidget();
2133 }, 2322 },
2134 - child: Column(  
2135 - children: [  
2136 - Container(  
2137 - width: double.infinity,  
2138 - // color: backgroundColor,  
2139 - padding: EdgeInsets.symmetric(  
2140 - vertical: ScreenUtil().setHeight(30)),  
2141 - child: Stack(  
2142 - alignment: Alignment.center,  
2143 - children: <Widget>[  
2144 - Positioned(  
2145 - left: 0,  
2146 - child: GestureDetector(  
2147 - onTap: () {  
2148 - needBack = true;  
2149 - _showConfirmWidget(needBack: true);  
2150 - },  
2151 - behavior: HitTestBehavior.opaque,  
2152 - child: Padding(  
2153 - padding: EdgeInsets.symmetric(  
2154 - horizontal: ScreenUtil().setWidth(40),  
2155 - vertical: ScreenUtil().setHeight(15)),  
2156 - child: Image.asset(  
2157 - "assets/icon_back.png",  
2158 - width: ScreenUtil().setWidth(20),  
2159 - height: ScreenUtil().setHeight(31), 2323 + child: Container(
  2324 + color: MyColours.color_ffffff,
  2325 + child: Column(
  2326 + children: [
  2327 + Container(
  2328 + width: double.infinity,
  2329 + // color: backgroundColor,
  2330 + padding: EdgeInsets.symmetric(
  2331 + vertical: ScreenUtil().setHeight(30)),
  2332 + child: Stack(
  2333 + alignment: Alignment.center,
  2334 + children: <Widget>[
  2335 + Positioned(
  2336 + left: 0,
  2337 + child: GestureDetector(
  2338 + onTap: () {
  2339 + needBack = true;
  2340 + _showConfirmWidget(needBack: true);
  2341 + },
  2342 + behavior: HitTestBehavior.opaque,
  2343 + child: Padding(
  2344 + padding: EdgeInsets.symmetric(
  2345 + horizontal: ScreenUtil().setWidth(40),
  2346 + vertical: ScreenUtil().setHeight(15)),
  2347 + child: Image.asset(
  2348 + "assets/icon_back.png",
  2349 + width: ScreenUtil().setWidth(20),
  2350 + height: ScreenUtil().setHeight(31),
  2351 + ),
  2352 + ),
2160 ), 2353 ),
2161 ), 2354 ),
2162 - ),  
2163 - ),  
2164 - Center(  
2165 - child: Image.asset(  
2166 - "assets/yd_logo.png",  
2167 - width: ScreenUtil().setWidth(103 * 2),  
2168 - // height: ScreenUtil().setHeight(21 * 2),  
2169 - ))  
2170 - ],  
2171 - )),  
2172 - Expanded(child:  
2173 - Consumer<BaseIndoProvider>(builder: (context, model, _) {  
2174 - if (model.pageState != PageState.Success) {  
2175 - return ExceptionPage(  
2176 - pageState: model.pageState,  
2177 - callback: () async {  
2178 - model.pageState = PageState.Loading;  
2179 - await _couponNetworkData(isShowLoading: false);  
2180 - await _getCustomerActivityBaseinfo();  
2181 - await _getTablesPhoto();  
2182 - await _getReserveDetail(showCicle: false);  
2183 - model.notifyListeners();  
2184 - },  
2185 - emptyMsg: "稍后加载",  
2186 - emptyImg: "empty_search",  
2187 - showMsg: "加载中,请稍后...",  
2188 - );  
2189 - } else {  
2190 - return Container(  
2191 - padding: EdgeInsets.symmetric(  
2192 - horizontal: ScreenUtil().setWidth(40)),  
2193 - child: Column(  
2194 - children: [  
2195 - Expanded(  
2196 - child: SingleChildScrollView(  
2197 - child: Column( 2355 + Center(
  2356 + child: Image.asset(
  2357 + "assets/yd_logo.png",
  2358 + width: ScreenUtil().setWidth(103 * 2),
  2359 + // height: ScreenUtil().setHeight(21 * 2),
  2360 + ))
  2361 + ],
  2362 + )),
  2363 + Expanded(child: Consumer<BaseIndoProvider>(
  2364 + builder: (context, model, _) {
  2365 + if (model.pageState != PageState.Success) {
  2366 + return ExceptionPage(
  2367 + pageState: model.pageState,
  2368 + callback: () async {
  2369 + model.pageState = PageState.Loading;
  2370 + await _couponNetworkData(isShowLoading: false);
  2371 + await _getCustomerActivityBaseinfo();
  2372 + await _getTablesPhoto();
  2373 + await _getReserveDetail(showCicle: false);
  2374 + model.notifyListeners();
  2375 + },
  2376 + emptyMsg: "稍后加载",
  2377 + emptyImg: "empty_search",
  2378 + showMsg: "加载中,请稍后...",
  2379 + );
  2380 + } else {
  2381 + return Container(
  2382 + padding: EdgeInsets.symmetric(
  2383 + horizontal: ScreenUtil().setWidth(40)),
  2384 + child: Column(
2198 children: [ 2385 children: [
2199 - VEmptyView(40),  
2200 - _managerWidget(),  
2201 - VEmptyView(50),  
2202 - _orderInfoWidget(),  
2203 - VEmptyView(30),  
2204 - _couponWidget(),  
2205 - VEmptyView(20), 2386 + Expanded(
  2387 + child: SingleChildScrollView(
  2388 + child: Column(
  2389 + children: [
  2390 + VEmptyView(40),
  2391 + _managerWidget(),
  2392 + VEmptyView(50),
  2393 + _orderInfoWidget(),
  2394 + VEmptyView(30),
  2395 + _couponWidget(),
  2396 + VEmptyView(20),
  2397 + ],
  2398 + ))),
  2399 + _btnWidget(),
2206 ], 2400 ],
2207 - ))),  
2208 - _btnWidget(),  
2209 - ],  
2210 - ),  
2211 - );  
2212 - }  
2213 - })),  
2214 - ],  
2215 - ), 2401 + ),
  2402 + );
  2403 + }
  2404 + })),
  2405 + ],
  2406 + )),
2216 2407
2217 // body: Stack( 2408 // body: Stack(
2218 // children: [ 2409 // children: [
@@ -15,7 +15,7 @@ import 'package:provider/provider.dart'; @@ -15,7 +15,7 @@ import 'package:provider/provider.dart';
15 15
16 class BaseIndoProvider with ChangeNotifier { 16 class BaseIndoProvider with ChangeNotifier {
17 BaseInfoSunModel baseInfoSunModel; //客户经理基础信息 17 BaseInfoSunModel baseInfoSunModel; //客户经理基础信息
18 - List<String> photoList = []; //商家图片信息 18 + Map<String, List<String>> photoList = {}; //商家图片信息
19 19
20 PageState pageState = PageState.Loading; 20 PageState pageState = PageState.Loading;
21 21
@@ -185,9 +185,24 @@ class BaseIndoProvider with ChangeNotifier { @@ -185,9 +185,24 @@ class BaseIndoProvider with ChangeNotifier {
185 } else { 185 } else {
186 List<TablePhotoSunModel> tablePhotoList = 186 List<TablePhotoSunModel> tablePhotoList =
187 TablePhotoModel.fromJson(baseResp.responseData).data; 187 TablePhotoModel.fromJson(baseResp.responseData).data;
188 - for (int i = 0; i < tablePhotoList.length; i++) {  
189 - photoList.add(tablePhotoList[i].url); 188 + String tid = params['tableids'];
  189 + List<String> tids = tid.split(',');
  190 + Map<String, List<String>> photos = {};
  191 + for (String tid in tids) {
  192 + photos[tid] = [];
190 } 193 }
  194 + for (String tid in tids) {
  195 + for (TablePhotoSunModel item in tablePhotoList) {
  196 + if (tid == item.tableid) {
  197 + List<String> list = photos.putIfAbsent(tid, () => []);
  198 + list.add(item.url);
  199 + photos[tid] = list;
  200 + }
  201 + }
  202 + }
  203 + print(photos);
  204 + photoList = photos;
  205 + // photoList.add(tablePhotoList[i].url);
191 notifyListeners(); 206 notifyListeners();
192 } 207 }
193 } else { 208 } else {
@@ -457,15 +457,17 @@ class CouponProvider with ChangeNotifier { @@ -457,15 +457,17 @@ class CouponProvider with ChangeNotifier {
457 } else { 457 } else {
458 List<CouponSunModel> coupon = 458 List<CouponSunModel> coupon =
459 CouponModel.fromJson(baseResp.responseData).data; 459 CouponModel.fromJson(baseResp.responseData).data;
  460 + hasModify = false;
460 for (int i = 0; i < couponListSelect.length; i++) { 461 for (int i = 0; i < couponListSelect.length; i++) {
461 // coupons.add(couponListSelect[i].id); 462 // coupons.add(couponListSelect[i].id);
462 463
463 // couponsShow.add(couponTemp[i].id); 464 // couponsShow.add(couponTemp[i].id);
464 if (coupon[0].id == couponListSelect[i].id) { 465 if (coupon[0].id == couponListSelect[i].id) {
465 index = i; 466 index = i;
  467 + hasModify = true;
466 } 468 }
467 } 469 }
468 - hasModify = true; 470 +
469 notifyListeners(); 471 notifyListeners();
470 } 472 }
471 } else { 473 } else {