Commit b99bd5f66d0285b4dffce33e55dbc81647fd9e70

Authored by “gaiyaguang”
1 parent edea0c14

取消预订刷新页面

@@ -6,131 +6,155 @@ part 'notebook_detail.g.dart'; @@ -6,131 +6,155 @@ part 'notebook_detail.g.dart';
6 6
7 @JsonSerializable() 7 @JsonSerializable()
8 class NotebookDetail { 8 class NotebookDetail {
9 - NotebookDetail(); 9 + NotebookDetail();
10 10
11 - String id;  
12 - String tableinfo;  
13 - String pnum;  
14 - String rname;  
15 - String sex;  
16 - String phone;  
17 - String cusdem;  
18 - String cusman;//客户经理  
19 - String ddate;  
20 - String is_set_ddate;  
21 - String ddate_solt;  
22 - String status="0";//订单状态 0:待确认,1:已定座,2:确认到店,3:用餐完成,4:取消预订,5:安排包间,6拒绝订单  
23 - String action;  
24 - String type;//0 内部订单 1 在线预订  
25 - String note_name;  
26 - String channel;  
27 - String cdate;  
28 - List<Table> demands;//需求桌位  
29 - List<Table> tables;//预订桌位  
30 - Cancel cancel; 11 + String id;
  12 + String abolition;
  13 + String tableinfo;
  14 + String pnum;
  15 + String rname;
  16 + String sex;
  17 + String phone;
  18 + String cusdem;
  19 + String cusman; //客户经理
  20 + String ddate;
  21 + String is_set_ddate;
  22 + String ddate_solt;
  23 + String status = "0"; //订单状态 0:待确认,1:已定座,2:确认到店,3:用餐完成,4:取消预订,5:安排包间,6拒绝订单
  24 + String action;
  25 + String type; //0 内部订单 1 在线预订
  26 + String note_name;
  27 + String channel;
  28 + String cdate;
  29 + List<Table> demands; //需求桌位
  30 + List<Table> tables; //预订桌位
  31 + Cancel cancel;
31 32
32 - String get statuImgAssets{  
33 - switch(status){  
34 - case "0":  
35 - return "assets/status_undeal.png";  
36 - case "1":  
37 - case "5":  
38 - return "assets/statu_booked.png";  
39 - case "2":  
40 - return "assets/statu_reached.png";  
41 - case "3":  
42 - return "assets/statu_finished.png";  
43 - case "4":  
44 - return "assets/statu_canceled.png";  
45 - case "6":  
46 - return "assets/statu_refuse.png";  
47 - } 33 + String get statuImgAssets {
  34 + switch (status) {
  35 + case "0":
  36 + return "assets/status_undeal.png";
  37 + case "1":
  38 + case "5":
  39 + return "assets/statu_booked.png";
  40 + case "2":
  41 + return "assets/statu_reached.png";
  42 + case "3":
  43 + return "assets/statu_finished.png";
  44 + case "4":
  45 + return "assets/statu_canceled.png";
  46 + case "6":
  47 + return "assets/statu_refuse.png";
48 } 48 }
  49 + }
49 50
50 - String get ddateMd{  
51 - DateTime dateTime=DateTime.fromMillisecondsSinceEpoch(int.parse(ddate)*1000);  
52 - String md=Utils.addZeroNumber(dateTime.month)+"月"+Utils.addZeroNumber(dateTime.day)+"日";  
53 - switch (ddate_solt){  
54 - case "1":  
55 - md+=" 早餐";  
56 - break;  
57 - case "2":  
58 - md+=" 午餐";  
59 - break;  
60 - case "3":  
61 - md+=" 晚餐";  
62 - break;  
63 - }  
64 - return md; 51 + String get ddateMd {
  52 + DateTime dateTime =
  53 + DateTime.fromMillisecondsSinceEpoch(int.parse(ddate) * 1000);
  54 + String md = Utils.addZeroNumber(dateTime.month) +
  55 + "月" +
  56 + Utils.addZeroNumber(dateTime.day) +
  57 + "日";
  58 + switch (ddate_solt) {
  59 + case "1":
  60 + md += " 早餐";
  61 + break;
  62 + case "2":
  63 + md += " 午餐";
  64 + break;
  65 + case "3":
  66 + md += " 晚餐";
  67 + break;
65 } 68 }
  69 + return md;
  70 + }
66 71
67 - String get ddateHm{  
68 - if(type=="0"||(type=="1"&&is_set_ddate=="1")){  
69 - DateTime dateTime=DateTime.fromMillisecondsSinceEpoch(int.parse(ddate)*1000);  
70 - String Hm=Utils.addZeroNumber(dateTime.hour)+":"+Utils.addZeroNumber(dateTime.minute);  
71 - return Hm;  
72 - }else{  
73 - return "";  
74 - } 72 + String get ddateHm {
  73 + if (type == "0" || (type == "1" && is_set_ddate == "1")) {
  74 + DateTime dateTime =
  75 + DateTime.fromMillisecondsSinceEpoch(int.parse(ddate) * 1000);
  76 + String Hm = Utils.addZeroNumber(dateTime.hour) +
  77 + ":" +
  78 + Utils.addZeroNumber(dateTime.minute);
  79 + return Hm;
  80 + } else {
  81 + return "";
75 } 82 }
  83 + }
76 84
77 - String get ddateStr{  
78 - String ddateStr;  
79 - if (type=="1"&&is_set_ddate=="0"){//在线预订,没有设置到店时间  
80 - switch (ddate_solt){  
81 - case "1":  
82 - ddateStr="早餐";  
83 - break;  
84 - case "2":  
85 - ddateStr="午餐";  
86 - break;  
87 - case "3":  
88 - ddateStr="晚餐";  
89 - break;  
90 - default:  
91 - ddateStr="";  
92 - break;  
93 - }  
94 - }else{  
95 - DateTime dateTime=DateTime.fromMillisecondsSinceEpoch(int.parse(ddate)*1000);  
96 - ddateStr=Utils.addZeroNumber(dateTime.hour)+":"+Utils.addZeroNumber(dateTime.minute);  
97 - }  
98 - return ddateStr; 85 + String get ddateStr {
  86 + String ddateStr;
  87 + if (type == "1" && is_set_ddate == "0") {
  88 + //在线预订,没有设置到店时间
  89 + switch (ddate_solt) {
  90 + case "1":
  91 + ddateStr = "早餐";
  92 + break;
  93 + case "2":
  94 + ddateStr = "午餐";
  95 + break;
  96 + case "3":
  97 + ddateStr = "晚餐";
  98 + break;
  99 + default:
  100 + ddateStr = "";
  101 + break;
  102 + }
  103 + } else {
  104 + DateTime dateTime =
  105 + DateTime.fromMillisecondsSinceEpoch(int.parse(ddate) * 1000);
  106 + ddateStr = Utils.addZeroNumber(dateTime.hour) +
  107 + ":" +
  108 + Utils.addZeroNumber(dateTime.minute);
99 } 109 }
  110 + return ddateStr;
  111 + }
100 112
101 - String get rnameStr{  
102 - if(rname.isEmpty)return "";  
103 - switch(sex){  
104 - case "1"://先生  
105 - return rname+"先生";  
106 - case "2"://女士  
107 - return rname+"女士";  
108 - case "3"://公司  
109 - return rname+"公司";  
110 - } 113 + String get rnameStr {
  114 + if (rname.isEmpty) return "";
  115 + switch (sex) {
  116 + case "1": //先生
  117 + return rname + "先生";
  118 + case "2": //女士
  119 + return rname + "女士";
  120 + case "3": //公司
  121 + return rname + "公司";
111 } 122 }
  123 + }
112 124
113 - String get tableinfoStr{  
114 - return tables[0].name+ "\n"+(tables.length>=2?('等'+tables.length.toString()+'桌'):'');  
115 - } 125 + String get tableinfoStr {
  126 + return tables[0].name +
  127 + "\n" +
  128 + (tables.length >= 2 ? ('等' + tables.length.toString() + '桌') : '');
  129 + }
116 130
117 - factory NotebookDetail.fromJson(Map<String,dynamic> json) => _$NotebookDetailFromJson(json);  
118 - Map<String, dynamic> toJson() => _$NotebookDetailToJson(this); 131 + factory NotebookDetail.fromJson(Map<String, dynamic> json) =>
  132 + _$NotebookDetailFromJson(json);
  133 + Map<String, dynamic> toJson() => _$NotebookDetailToJson(this);
119 } 134 }
120 135
121 @JsonSerializable() 136 @JsonSerializable()
122 class Cancel { 137 class Cancel {
123 - Cancel(); 138 + Cancel();
124 139
125 - String uname;  
126 - String desc;  
127 - String cdate; 140 + String uname;
  141 + String desc;
  142 + String cdate;
128 143
129 - String get cdateStr{  
130 - DateTime dateTime=DateTime.fromMillisecondsSinceEpoch(int.parse(cdate)*1000);  
131 - return dateTime.year.toString()+"/"+Utils.addZeroNumber(dateTime.month)+"/"+Utils.addZeroNumber(dateTime.day)+" "+Utils.addZeroNumber(dateTime.hour)+":"+Utils.addZeroNumber(dateTime.minute);  
132 - } 144 + String get cdateStr {
  145 + DateTime dateTime =
  146 + DateTime.fromMillisecondsSinceEpoch(int.parse(cdate) * 1000);
  147 + return dateTime.year.toString() +
  148 + "/" +
  149 + Utils.addZeroNumber(dateTime.month) +
  150 + "/" +
  151 + Utils.addZeroNumber(dateTime.day) +
  152 + " " +
  153 + Utils.addZeroNumber(dateTime.hour) +
  154 + ":" +
  155 + Utils.addZeroNumber(dateTime.minute);
  156 + }
133 157
134 - factory Cancel.fromJson(Map<String,dynamic> json) => _$CancelFromJson(json);  
135 - Map<String, dynamic> toJson() => _$CancelToJson(this); 158 + factory Cancel.fromJson(Map<String, dynamic> json) => _$CancelFromJson(json);
  159 + Map<String, dynamic> toJson() => _$CancelToJson(this);
136 } 160 }
@@ -10,6 +10,7 @@ NotebookDetail _$NotebookDetailFromJson(Map<String, dynamic> json) { @@ -10,6 +10,7 @@ NotebookDetail _$NotebookDetailFromJson(Map<String, dynamic> json) {
10 return NotebookDetail() 10 return NotebookDetail()
11 ..id = json['id'] as String 11 ..id = json['id'] as String
12 ..tableinfo = json['tableinfo'] as String 12 ..tableinfo = json['tableinfo'] as String
  13 + ..abolition = json['abolition'] as String
13 ..pnum = json['pnum'] as String 14 ..pnum = json['pnum'] as String
14 ..rname = json['rname'] as String 15 ..rname = json['rname'] as String
15 ..sex = json['sex'] as String 16 ..sex = json['sex'] as String
@@ -42,6 +43,7 @@ Map<String, dynamic> _$NotebookDetailToJson(NotebookDetail instance) => @@ -42,6 +43,7 @@ Map<String, dynamic> _$NotebookDetailToJson(NotebookDetail instance) =>
42 <String, dynamic>{ 43 <String, dynamic>{
43 'id': instance.id, 44 'id': instance.id,
44 'tableinfo': instance.tableinfo, 45 'tableinfo': instance.tableinfo,
  46 + 'abolition':instance.abolition,
45 'pnum': instance.pnum, 47 'pnum': instance.pnum,
46 'rname': instance.rname, 48 'rname': instance.rname,
47 'sex': instance.sex, 49 'sex': instance.sex,
@@ -51,7 +51,7 @@ class NotebookDetailPageState extends State<NotebookDetailPage> { @@ -51,7 +51,7 @@ class NotebookDetailPageState extends State<NotebookDetailPage> {
51 Manager manager = Manager(); 51 Manager manager = Manager();
52 List cancelReasonList = []; 52 List cancelReasonList = [];
53 bool isShowTF = false; 53 bool isShowTF = false;
54 - int paddingBottom; 54 + // int paddingBottom;
55 int paddingTop = 138; 55 int paddingTop = 138;
56 FocusNode _cancelNode = FocusNode(); 56 FocusNode _cancelNode = FocusNode();
57 TextEditingController _cancelController = TextEditingController(); 57 TextEditingController _cancelController = TextEditingController();
@@ -102,7 +102,7 @@ class NotebookDetailPageState extends State<NotebookDetailPage> { @@ -102,7 +102,7 @@ class NotebookDetailPageState extends State<NotebookDetailPage> {
102 /// 初始化取消原因数据 102 /// 初始化取消原因数据
103 _initCancel() { 103 _initCancel() {
104 isShowTF = false; 104 isShowTF = false;
105 - paddingBottom = ScreenUtil.screenHeightDp.ceil() - 138 - 340; 105 + // paddingBottom = ScreenUtil.screenHeightDp.ceil() - 138 - 340;
106 cancelReasonList = [ 106 cancelReasonList = [
107 {'title': '顾客取消', 'select': false}, 107 {'title': '顾客取消', 'select': false},
108 {'title': '顾客行程有变', 'select': false}, 108 {'title': '顾客行程有变', 'select': false},
@@ -164,7 +164,7 @@ class NotebookDetailPageState extends State<NotebookDetailPage> { @@ -164,7 +164,7 @@ class NotebookDetailPageState extends State<NotebookDetailPage> {
164 164
165 ///取消预订弹框 165 ///取消预订弹框
166 _showCancelWidget(context) { 166 _showCancelWidget(context) {
167 - _scrollController=ScrollController(); 167 + _scrollController = ScrollController();
168 showGeneralDialog( 168 showGeneralDialog(
169 context: context, 169 context: context,
170 barrierDismissible: false, 170 barrierDismissible: false,
@@ -181,22 +181,22 @@ class NotebookDetailPageState extends State<NotebookDetailPage> { @@ -181,22 +181,22 @@ class NotebookDetailPageState extends State<NotebookDetailPage> {
181 // Navigator.of(context).pop(); 181 // Navigator.of(context).pop();
182 // }, 182 // },
183 child: Container( 183 child: Container(
184 - decoration: BoxDecoration(  
185 - color: Color.fromRGBO(00, 00, 00, 0.5),  
186 - ),  
187 - padding: EdgeInsets.fromLTRB(  
188 - ScreenUtil().setWidth(50),  
189 - ScreenUtil().setWidth(paddingTop * 2),  
190 - ScreenUtil().setWidth(50),  
191 - ScreenUtil().setWidth(0)),  
192 - child: Align( 184 + decoration: BoxDecoration(
  185 + color: Color.fromRGBO(00, 00, 00, 0.5),
  186 + ),
  187 + padding: EdgeInsets.fromLTRB(
  188 + ScreenUtil().setWidth(50),
  189 + ScreenUtil().setWidth(paddingTop * 2),
  190 + ScreenUtil().setWidth(50),
  191 + ScreenUtil().setWidth(0)),
  192 + child: Align(
193 alignment: Alignment.topCenter, 193 alignment: Alignment.topCenter,
194 child: Container( 194 child: Container(
195 padding: EdgeInsets.all(ScreenUtil().setWidth(40)), 195 padding: EdgeInsets.all(ScreenUtil().setWidth(40)),
196 decoration: BoxDecoration( 196 decoration: BoxDecoration(
197 color: Colors.white, 197 color: Colors.white,
198 borderRadius: 198 borderRadius:
199 - BorderRadius.circular(ScreenUtil().setWidth(10)), 199 + BorderRadius.circular(ScreenUtil().setWidth(10)),
200 ), 200 ),
201 child: Column( 201 child: Column(
202 mainAxisSize: MainAxisSize.min, 202 mainAxisSize: MainAxisSize.min,
@@ -245,20 +245,20 @@ class NotebookDetailPageState extends State<NotebookDetailPage> { @@ -245,20 +245,20 @@ class NotebookDetailPageState extends State<NotebookDetailPage> {
245 for (var item in cancelReasonList) { 245 for (var item in cancelReasonList) {
246 item['select'] = false; 246 item['select'] = false;
247 isShowTF = false; 247 isShowTF = false;
248 - paddingBottom =  
249 - ScreenUtil.screenHeightDp.ceil() -  
250 - 138 -  
251 - 340; 248 + // paddingBottom =
  249 + // ScreenUtil.screenHeightDp.ceil() -
  250 + // 138 -
  251 + // 340;
252 if (item['title'] == value['title']) { 252 if (item['title'] == value['title']) {
253 item['select'] = true; 253 item['select'] = true;
254 if (item['title'] == '其他原因') { 254 if (item['title'] == '其他原因') {
255 isShowTF = true; 255 isShowTF = true;
256 // paddingBottom = 130; 256 // paddingBottom = 130;
257 - paddingBottom =  
258 - ScreenUtil.screenHeightDp.ceil() -  
259 - 138 -  
260 - 340 -  
261 - 46; 257 + // paddingBottom =
  258 + // ScreenUtil.screenHeightDp.ceil() -
  259 + // 138 -
  260 + // 340 -
  261 + // 46;
262 } 262 }
263 } 263 }
264 } 264 }
@@ -275,7 +275,8 @@ class NotebookDetailPageState extends State<NotebookDetailPage> { @@ -275,7 +275,8 @@ class NotebookDetailPageState extends State<NotebookDetailPage> {
275 HEmptyView(30), 275 HEmptyView(30),
276 Text(value['title'], 276 Text(value['title'],
277 style: TextStyle( 277 style: TextStyle(
278 - fontSize: ScreenUtil().setSp(32), 278 + fontSize:
  279 + ScreenUtil().setSp(32),
279 fontWeight: FontWeight.normal, 280 fontWeight: FontWeight.normal,
280 decoration: TextDecoration.none, 281 decoration: TextDecoration.none,
281 color: MyColours.color_333333)) 282 color: MyColours.color_333333))
@@ -283,39 +284,42 @@ class NotebookDetailPageState extends State<NotebookDetailPage> { @@ -283,39 +284,42 @@ class NotebookDetailPageState extends State<NotebookDetailPage> {
283 ), 284 ),
284 value['title'] == '其他原因' && isShowTF 285 value['title'] == '其他原因' && isShowTF
285 ? Material( 286 ? Material(
286 - child: Container(  
287 - color: Colors.white,  
288 - padding: EdgeInsets.only(  
289 - left: ScreenUtil().setWidth(76)),  
290 - child: TextField(  
291 - maxLines: 1,  
292 - controller: _cancelController,  
293 - focusNode: _cancelNode,  
294 - textAlignVertical:  
295 - TextAlignVertical.bottom,  
296 - decoration: InputDecoration(  
297 - hintText: "请填写原因",  
298 - hintStyle: TextStyle(  
299 - color: MyColours.color_999999,  
300 - fontSize: ScreenUtil().setSp(30),  
301 - ),  
302 - enabledBorder: UnderlineInputBorder(  
303 - borderSide: BorderSide(  
304 - color:  
305 - MyColours.color_d8d8d8), 287 + child: Container(
  288 + color: Colors.white,
  289 + padding: EdgeInsets.only(
  290 + left:
  291 + ScreenUtil().setWidth(76)),
  292 + child: TextField(
  293 + maxLines: 1,
  294 + controller: _cancelController,
  295 + focusNode: _cancelNode,
  296 + textAlignVertical:
  297 + TextAlignVertical.bottom,
  298 + decoration: InputDecoration(
  299 + hintText: "请填写原因",
  300 + hintStyle: TextStyle(
  301 + color: MyColours.color_999999,
  302 + fontSize:
  303 + ScreenUtil().setSp(30),
  304 + ),
  305 + enabledBorder:
  306 + UnderlineInputBorder(
  307 + borderSide: BorderSide(
  308 + color: MyColours
  309 + .color_d8d8d8),
  310 + ),
  311 + // border: InputBorder.none,
306 ), 312 ),
307 - // border: InputBorder.none, 313 + onChanged: (_) {
  314 + setState(() {});
  315 + },
  316 + onEditingComplete: () {
  317 + print('fff');
  318 + _cancelNode.unfocus();
  319 + },
  320 + // keyboardType: TextInputType.number,
308 ), 321 ),
309 - onChanged: (_) {  
310 - setState(() {});  
311 - },  
312 - onEditingComplete: () {  
313 - print('fff');  
314 - _cancelNode.unfocus();  
315 - },  
316 - // keyboardType: TextInputType.number,  
317 - ),  
318 - )) 322 + ))
319 : Container(), 323 : Container(),
320 VEmptyView(40) 324 VEmptyView(40)
321 ]), 325 ]),
@@ -349,6 +353,7 @@ class NotebookDetailPageState extends State<NotebookDetailPage> { @@ -349,6 +353,7 @@ class NotebookDetailPageState extends State<NotebookDetailPage> {
349 Navigator.of(context).pop(); 353 Navigator.of(context).pop();
350 Loading.showLoading(context); 354 Loading.showLoading(context);
351 setReserveStatus('4', desc: desc); 355 setReserveStatus('4', desc: desc);
  356 + bus.emit("refresh_book_list");
352 }, 357 },
353 text: '确认', 358 text: '确认',
354 height: ScreenUtil().setWidth(80), 359 height: ScreenUtil().setWidth(80),
@@ -359,7 +364,7 @@ class NotebookDetailPageState extends State<NotebookDetailPage> { @@ -359,7 +364,7 @@ class NotebookDetailPageState extends State<NotebookDetailPage> {
359 ], 364 ],
360 ), 365 ),
361 )), 366 )),
362 - ), 367 + ),
363 ); 368 );
364 }); 369 });
365 }); 370 });
@@ -490,8 +495,6 @@ class NotebookDetailPageState extends State<NotebookDetailPage> { @@ -490,8 +495,6 @@ class NotebookDetailPageState extends State<NotebookDetailPage> {
490 RowMultiText("客户姓名", detailEntity.rnameStr), 495 RowMultiText("客户姓名", detailEntity.rnameStr),
491 RowMultiText( 496 RowMultiText(
492 "客户电话", detailEntity.phone ?? ""), 497 "客户电话", detailEntity.phone ?? ""),
493 - RowMultiText(  
494 - "备注信息", detailEntity.cusdem ?? ""),  
495 MyDivider(double.infinity, 498 MyDivider(double.infinity,
496 ScreenUtil().setHeight(1)), 499 ScreenUtil().setHeight(1)),
497 Container( 500 Container(
@@ -522,7 +525,7 @@ class NotebookDetailPageState extends State<NotebookDetailPage> { @@ -522,7 +525,7 @@ class NotebookDetailPageState extends State<NotebookDetailPage> {
522 list.add(manager.roleUserName); 525 list.add(manager.roleUserName);
523 } 526 }
524 DialogUtil.showSelectCusmanDialog( 527 DialogUtil.showSelectCusmanDialog(
525 - context, list,(value){ 528 + context, list, (value) {
526 if (value != null) { 529 if (value != null) {
527 setState(() { 530 setState(() {
528 cusmanText = 531 cusmanText =
@@ -531,9 +534,7 @@ class NotebookDetailPageState extends State<NotebookDetailPage> { @@ -531,9 +534,7 @@ class NotebookDetailPageState extends State<NotebookDetailPage> {
531 }); 534 });
532 _setCurrManager(); 535 _setCurrManager();
533 } 536 }
534 - })  
535 - .then((value) {  
536 - }); 537 + }).then((value) {});
537 }, 538 },
538 child: Text( 539 child: Text(
539 cusmanText, 540 cusmanText,
@@ -550,8 +551,11 @@ class NotebookDetailPageState extends State<NotebookDetailPage> { @@ -550,8 +551,11 @@ class NotebookDetailPageState extends State<NotebookDetailPage> {
550 ], 551 ],
551 ), 552 ),
552 ), 553 ),
553 - RowMultiText(  
554 - "记录人", detailEntity.note_name ?? ""), 554 + Offstage(
  555 + offstage: detailEntity.note_name == '',
  556 + child: RowMultiText(
  557 + "记录人", detailEntity.note_name ?? ""),
  558 + ),
555 Offstage( 559 Offstage(
556 offstage: (detailEntity.status == "4" && 560 offstage: (detailEntity.status == "4" &&
557 detailEntity.cancel != null) 561 detailEntity.cancel != null)
@@ -568,8 +572,12 @@ class NotebookDetailPageState extends State<NotebookDetailPage> { @@ -568,8 +572,12 @@ class NotebookDetailPageState extends State<NotebookDetailPage> {
568 "取消时间", 572 "取消时间",
569 detailEntity.cancel?.cdateStr ?? 573 detailEntity.cancel?.cdateStr ??
570 ""), 574 ""),
571 - RowMultiText("操作人",  
572 - detailEntity.cancel?.uname ?? ""), 575 + RowMultiText(
  576 + "操作人",
  577 + detailEntity.abolition == '2'
  578 + ? '顾客在线取消'
  579 + : detailEntity.cancel?.uname ??
  580 + ""),
573 ], 581 ],
574 ), 582 ),
575 ), 583 ),
@@ -7,11 +7,10 @@ import 'package:one_key/widgets/MyDivider.dart'; @@ -7,11 +7,10 @@ import 'package:one_key/widgets/MyDivider.dart';
7 import 'package:one_key/widgets/v_empty_view.dart'; 7 import 'package:one_key/widgets/v_empty_view.dart';
8 8
9 class NoteBookItem extends StatefulWidget { 9 class NoteBookItem extends StatefulWidget {
10 -  
11 final num index; 10 final num index;
12 final Notebook notebook; 11 final Notebook notebook;
13 12
14 - NoteBookItem(this.notebook,this.index); 13 + NoteBookItem(this.notebook, this.index);
15 14
16 @override 15 @override
17 State<StatefulWidget> createState() { 16 State<StatefulWidget> createState() {
@@ -20,31 +19,41 @@ class NoteBookItem extends StatefulWidget { @@ -20,31 +19,41 @@ class NoteBookItem extends StatefulWidget {
20 } 19 }
21 } 20 }
22 21
23 -class NotebookItemState extends State<NoteBookItem>{  
24 -  
25 -  
26 - _onOperateClick(){  
27 - if(widget.notebook.operationText=="通知客户"){  
28 - NavigatorUtil.goInvicationPage(context, widget.notebook.id,widget.notebook.tableinfoStr,widget.notebook.ddate,widget.notebook.ddateStr); 22 +class NotebookItemState extends State<NoteBookItem> {
  23 + _onOperateClick() {
  24 + if (widget.notebook.operationText == "通知客户") {
  25 + NavigatorUtil.goInvicationPage(
  26 + context,
  27 + widget.notebook.id,
  28 + widget.notebook.tableinfoStr,
  29 + widget.notebook.ddate,
  30 + widget.notebook.ddateStr);
29 } 31 }
30 } 32 }
31 33
32 @override 34 @override
33 Widget build(BuildContext context) { 35 Widget build(BuildContext context) {
34 // TODO: implement build 36 // TODO: implement build
35 - Notebook notebook=widget.notebook; 37 + Notebook notebook = widget.notebook;
36 38
37 - Color textColor=(notebook.status=="3"||notebook.status=="4"||notebook.status=="6")?MyColours.color_bfbfbf:MyColours.color_353535; 39 + Color textColor = (notebook.status == "3" ||
  40 + notebook.status == "4" ||
  41 + notebook.status == "6")
  42 + ? MyColours.color_bfbfbf
  43 + : MyColours.color_353535;
38 44
39 return Container( 45 return Container(
40 width: double.infinity, 46 width: double.infinity,
41 height: ScreenUtil().setHeight(110), 47 height: ScreenUtil().setHeight(110),
42 - color: (widget.index % 2 == 0) ? MyColours.color_f7fdfd : MyColours.color_ffffff, 48 + color: (widget.index % 2 == 0)
  49 + ? MyColours.color_f7fdfd
  50 + : MyColours.color_ffffff,
43 child: Row( 51 child: Row(
44 children: <Widget>[ 52 children: <Widget>[
45 GestureDetector( 53 GestureDetector(
46 - onTap: (){  
47 - NavigatorUtil.goNotebookDetailPage(context,notebook.id); 54 + behavior: HitTestBehavior.translucent,
  55 + onTap: () {
  56 + NavigatorUtil.goNotebookDetailPage(context, notebook.id);
48 }, 57 },
49 child: Row( 58 child: Row(
50 children: <Widget>[ 59 children: <Widget>[
@@ -54,8 +63,7 @@ class NotebookItemState extends State<NoteBookItem>{ @@ -54,8 +63,7 @@ class NotebookItemState extends State<NoteBookItem>{
54 child: Text( 63 child: Text(
55 notebook.tableinfoStr, 64 notebook.tableinfoStr,
56 style: TextStyle( 65 style: TextStyle(
57 - color: textColor,  
58 - fontSize: ScreenUtil().setSp(28)), 66 + color: textColor, fontSize: ScreenUtil().setSp(28)),
59 ), 67 ),
60 ), 68 ),
61 MyDivider( 69 MyDivider(
@@ -69,9 +77,17 @@ class NotebookItemState extends State<NoteBookItem>{ @@ -69,9 +77,17 @@ class NotebookItemState extends State<NoteBookItem>{
69 child: Column( 77 child: Column(
70 mainAxisSize: MainAxisSize.min, 78 mainAxisSize: MainAxisSize.min,
71 children: <Widget>[ 79 children: <Widget>[
72 - Text(notebook.rnameStr,style: TextStyle(color: textColor,fontSize: ScreenUtil().setSp(28)),), 80 + Text(
  81 + notebook.rnameStr,
  82 + style: TextStyle(
  83 + color: textColor, fontSize: ScreenUtil().setSp(28)),
  84 + ),
73 VEmptyView(10), 85 VEmptyView(10),
74 - Text(notebook.phoneStr,style: TextStyle(color: textColor,fontSize: ScreenUtil().setSp(22)),) 86 + Text(
  87 + notebook.phoneStr,
  88 + style: TextStyle(
  89 + color: textColor, fontSize: ScreenUtil().setSp(22)),
  90 + )
75 ], 91 ],
76 ), 92 ),
77 ), 93 ),
@@ -86,8 +102,7 @@ class NotebookItemState extends State<NoteBookItem>{ @@ -86,8 +102,7 @@ class NotebookItemState extends State<NoteBookItem>{
86 child: Text( 102 child: Text(
87 notebook.ddateStr, 103 notebook.ddateStr,
88 style: TextStyle( 104 style: TextStyle(
89 - color: textColor,  
90 - fontSize: ScreenUtil().setSp(28)), 105 + color: textColor, fontSize: ScreenUtil().setSp(28)),
91 ), 106 ),
92 ), 107 ),
93 ], 108 ],
@@ -106,7 +121,11 @@ class NotebookItemState extends State<NoteBookItem>{ @@ -106,7 +121,11 @@ class NotebookItemState extends State<NoteBookItem>{
106 child: Text( 121 child: Text(
107 notebook.operationText, 122 notebook.operationText,
108 style: TextStyle( 123 style: TextStyle(
109 - color: (notebook.status=="3"||notebook.status=="4"||notebook.status=="6")?MyColours.color_bfbfbf:MyColours.color_2bb5b7, 124 + color: (notebook.status == "3" ||
  125 + notebook.status == "4" ||
  126 + notebook.status == "6")
  127 + ? MyColours.color_bfbfbf
  128 + : MyColours.color_2bb5b7,
110 fontSize: ScreenUtil().setSp(28)), 129 fontSize: ScreenUtil().setSp(28)),
111 ), 130 ),
112 ), 131 ),
@@ -115,5 +134,4 @@ class NotebookItemState extends State<NoteBookItem>{ @@ -115,5 +134,4 @@ class NotebookItemState extends State<NoteBookItem>{
115 ), 134 ),
116 ); 135 );
117 } 136 }
118 -  
119 } 137 }
@@ -8,6 +8,7 @@ import 'package:one_key/provider/update_model.dart'; @@ -8,6 +8,7 @@ import 'package:one_key/provider/update_model.dart';
8 import 'package:one_key/provider/user_model.dart'; 8 import 'package:one_key/provider/user_model.dart';
9 import 'package:one_key/res/colors.dart'; 9 import 'package:one_key/res/colors.dart';
10 import 'package:one_key/utils/dialog_util.dart'; 10 import 'package:one_key/utils/dialog_util.dart';
  11 +import 'package:one_key/utils/event_bus.dart';
11 import 'package:one_key/utils/log_util.dart'; 12 import 'package:one_key/utils/log_util.dart';
12 import 'package:one_key/utils/utils.dart'; 13 import 'package:one_key/utils/utils.dart';
13 import 'package:one_key/widgets/MyDivider.dart'; 14 import 'package:one_key/widgets/MyDivider.dart';
@@ -47,9 +48,17 @@ class NoteBookPageState extends State<NoteBookPage> { @@ -47,9 +48,17 @@ class NoteBookPageState extends State<NoteBookPage> {
47 WidgetsBinding.instance.addPostFrameCallback((_) { 48 WidgetsBinding.instance.addPostFrameCallback((_) {
48 _getReserveList(); 49 _getReserveList();
49 _reserveCountDay(); 50 _reserveCountDay();
  51 + bus.on("refresh_book_list", (args) {
  52 + _getReserveList();
  53 + });
50 }); 54 });
51 } 55 }
52 56
  57 + @override
  58 + void dispose() {
  59 + bus.off("refresh_book_list");
  60 + }
  61 +
53 //初始化时间 62 //初始化时间
54 _initTime() { 63 _initTime() {
55 dateTime = DateTime.now(); 64 dateTime = DateTime.now();
@@ -39,7 +39,7 @@ class NotebookDetailModel extends ChangeNotifier { @@ -39,7 +39,7 @@ class NotebookDetailModel extends ChangeNotifier {
39 .catchError((error) { 39 .catchError((error) {
40 print(error.toString()); 40 print(error.toString());
41 }); 41 });
42 - if (baseResp.code == Constant.status_success) { 42 + if (baseResp?.code == Constant.status_success) {
43 return (baseResp.data["manager"] as List) 43 return (baseResp.data["manager"] as List)
44 .map((value) => Manager.fromJson(value as Map<String, dynamic>)) 44 .map((value) => Manager.fromJson(value as Map<String, dynamic>))
45 .toList(); 45 .toList();