Showing
22 changed files
with
1379 additions
and
904 deletions
lib/models/new_unmessage_model.dart
0 → 100644
| 1 | +import 'package:json_annotation/json_annotation.dart'; | ||
| 2 | +import 'package:one_key/utils/utils.dart'; | ||
| 3 | + | ||
| 4 | +part 'new_unmessage_model.g.dart'; | ||
| 5 | + | ||
| 6 | +@JsonSerializable() | ||
| 7 | +class NewUnmessageModel extends Object { | ||
| 8 | + @JsonKey(name: 'ret') | ||
| 9 | + int ret; | ||
| 10 | + | ||
| 11 | + @JsonKey(name: 'data') | ||
| 12 | + NewUnmessageSunModel data; | ||
| 13 | + | ||
| 14 | + @JsonKey(name: 'msg') | ||
| 15 | + String msg; | ||
| 16 | + | ||
| 17 | + NewUnmessageModel( | ||
| 18 | + this.ret, | ||
| 19 | + this.data, | ||
| 20 | + this.msg, | ||
| 21 | + ); | ||
| 22 | + | ||
| 23 | + factory NewUnmessageModel.fromJson(Map<String, dynamic> srcJson) => | ||
| 24 | + _$NewUnmessageModelFromJson(srcJson); | ||
| 25 | + | ||
| 26 | + Map<String, dynamic> toJson() => _$NewUnmessageModelToJson(this); | ||
| 27 | +} | ||
| 28 | + | ||
| 29 | +@JsonSerializable() | ||
| 30 | +class NewUnmessageSunModel extends Object { | ||
| 31 | + @JsonKey(name: 'count') | ||
| 32 | + int count; | ||
| 33 | + | ||
| 34 | + @JsonKey(name: 'list') | ||
| 35 | + List<NewUnmessage> list; | ||
| 36 | + | ||
| 37 | + NewUnmessageSunModel( | ||
| 38 | + this.count, | ||
| 39 | + this.list, | ||
| 40 | + ); | ||
| 41 | + | ||
| 42 | + factory NewUnmessageSunModel.fromJson(Map<String, dynamic> srcJson) => | ||
| 43 | + _$NewUnmessageSunModelFromJson(srcJson); | ||
| 44 | + | ||
| 45 | + Map<String, dynamic> toJson() => _$NewUnmessageSunModelToJson(this); | ||
| 46 | +} | ||
| 47 | + | ||
| 48 | +@JsonSerializable() | ||
| 49 | +class NewUnmessage extends Object { | ||
| 50 | + @JsonKey(name: 'id') | ||
| 51 | + String id; | ||
| 52 | + | ||
| 53 | + @JsonKey(name: 'uid') | ||
| 54 | + String uid; | ||
| 55 | + | ||
| 56 | + @JsonKey(name: 'message_type') | ||
| 57 | + String message_type; | ||
| 58 | + | ||
| 59 | + @JsonKey(name: 'handle_time') | ||
| 60 | + String handle_time; | ||
| 61 | + | ||
| 62 | + @JsonKey(name: 'read_time') | ||
| 63 | + String read_time; | ||
| 64 | + | ||
| 65 | + @JsonKey(name: 'is_read') | ||
| 66 | + String is_read; | ||
| 67 | + | ||
| 68 | + @JsonKey(name: 'is_handle') | ||
| 69 | + String is_handle; | ||
| 70 | + | ||
| 71 | + @JsonKey(name: 'ddate') | ||
| 72 | + dynamic ddate; | ||
| 73 | + | ||
| 74 | + @JsonKey(name: 'rname') | ||
| 75 | + String rname; | ||
| 76 | + | ||
| 77 | + @JsonKey(name: 'sex') | ||
| 78 | + dynamic sex; | ||
| 79 | + | ||
| 80 | + @JsonKey(name: 'cdate') | ||
| 81 | + dynamic cdate; | ||
| 82 | + | ||
| 83 | + @JsonKey(name: 'rid') | ||
| 84 | + dynamic rid; | ||
| 85 | + | ||
| 86 | + @JsonKey(name: 'room_demand') | ||
| 87 | + dynamic room_demand; | ||
| 88 | + | ||
| 89 | + @JsonKey(name: 'ddate_solt') | ||
| 90 | + dynamic ddate_solt; | ||
| 91 | + | ||
| 92 | + @JsonKey(name: 'ddate_long') | ||
| 93 | + dynamic ddate_long; | ||
| 94 | + | ||
| 95 | + @JsonKey(name: 'cancel_name') | ||
| 96 | + String cancelName; | ||
| 97 | + | ||
| 98 | + @JsonKey(name: 'status') | ||
| 99 | + dynamic status; | ||
| 100 | + | ||
| 101 | + @JsonKey(name: 'room_info') | ||
| 102 | + dynamic room_info; | ||
| 103 | + | ||
| 104 | + NewUnmessage( | ||
| 105 | + this.id, | ||
| 106 | + this.uid, | ||
| 107 | + this.message_type, | ||
| 108 | + this.handle_time, | ||
| 109 | + this.read_time, | ||
| 110 | + this.is_read, | ||
| 111 | + this.is_handle, | ||
| 112 | + this.ddate, | ||
| 113 | + this.rname, | ||
| 114 | + this.sex, | ||
| 115 | + this.cdate, | ||
| 116 | + this.rid, | ||
| 117 | + this.room_demand, | ||
| 118 | + this.ddate_solt, | ||
| 119 | + this.ddate_long, | ||
| 120 | + this.cancelName, | ||
| 121 | + this.status, | ||
| 122 | + this.room_info, | ||
| 123 | + ); | ||
| 124 | + | ||
| 125 | + String get rnameStr { | ||
| 126 | + if (rname == null || rname == '') return ""; | ||
| 127 | + switch (sex.toString()) { | ||
| 128 | + case "1": //先生 | ||
| 129 | + case "男": | ||
| 130 | + case "先生": | ||
| 131 | + return rname + "先生"; | ||
| 132 | + case "2": //女士 | ||
| 133 | + case "女": | ||
| 134 | + case "女士": | ||
| 135 | + return rname + "女士"; | ||
| 136 | + case "3": //公司 | ||
| 137 | + case "公司": | ||
| 138 | + return rname + "公司"; | ||
| 139 | + } | ||
| 140 | + } | ||
| 141 | + | ||
| 142 | + ///年月日 餐段 | ||
| 143 | + String get ddateStr { | ||
| 144 | + String ymd = ""; | ||
| 145 | + if (ddate_long != null) { | ||
| 146 | + DateTime dateTime = DateTime.fromMillisecondsSinceEpoch( | ||
| 147 | + int.parse(ddate_long.toString()) * 1000); | ||
| 148 | + ymd = dateTime.year.toString() + | ||
| 149 | + "-" + | ||
| 150 | + Utils.addZeroNumber(dateTime.month) + | ||
| 151 | + "-" + | ||
| 152 | + Utils.addZeroNumber(dateTime.day); | ||
| 153 | + } else { | ||
| 154 | + ymd = ddate.substring(0, 10); | ||
| 155 | + } | ||
| 156 | + switch (ddate_solt) { | ||
| 157 | + case "1": //早餐 | ||
| 158 | + return ymd + " 早餐"; | ||
| 159 | + case "2": //午餐 | ||
| 160 | + return ymd + " 午餐"; | ||
| 161 | + case "3": //晚餐 | ||
| 162 | + return ymd + " 晚餐"; | ||
| 163 | + default: | ||
| 164 | + return ymd; | ||
| 165 | + } | ||
| 166 | + } | ||
| 167 | + | ||
| 168 | + String get cdateStr { | ||
| 169 | + String temp_date = '${cdate}'; | ||
| 170 | + switch (message_type) { | ||
| 171 | + case "1": //提前点餐 | ||
| 172 | + case "2": //内部预订 | ||
| 173 | + if (is_read == "0") { | ||
| 174 | + //未读 下单时间 | ||
| 175 | + temp_date = cdate; | ||
| 176 | + } else { | ||
| 177 | + temp_date = read_time; //已读 查看时间 | ||
| 178 | + } | ||
| 179 | + break; | ||
| 180 | + case "10": //在线预订 | ||
| 181 | + case "11": //在线预订 | ||
| 182 | + if (is_handle == "0") { | ||
| 183 | + //未处理 下单时间 | ||
| 184 | + temp_date = '${cdate}'; | ||
| 185 | + } else { | ||
| 186 | + temp_date = handle_time; //已处理 处理时间 | ||
| 187 | + } | ||
| 188 | + break; | ||
| 189 | + } | ||
| 190 | + DateTime dateTime = DateTime.fromMillisecondsSinceEpoch( | ||
| 191 | + int.parse(temp_date.toString()) * 1000); | ||
| 192 | + if ((DateTime.now().difference(dateTime)).inMilliseconds < 60000) { | ||
| 193 | + return "刚刚"; | ||
| 194 | + } else { | ||
| 195 | + return dateTime.year.toString() + | ||
| 196 | + "-" + | ||
| 197 | + Utils.addZeroNumber(dateTime.month) + | ||
| 198 | + "-" + | ||
| 199 | + Utils.addZeroNumber(dateTime.day) + | ||
| 200 | + " " + | ||
| 201 | + Utils.addZeroNumber(dateTime.hour) + | ||
| 202 | + ":" + | ||
| 203 | + Utils.addZeroNumber(dateTime.minute); | ||
| 204 | + } | ||
| 205 | + } | ||
| 206 | + | ||
| 207 | + factory NewUnmessage.fromJson(Map<String, dynamic> srcJson) => | ||
| 208 | + _$NewUnmessageFromJson(srcJson); | ||
| 209 | + | ||
| 210 | + Map<String, dynamic> toJson() => _$NewUnmessageToJson(this); | ||
| 211 | +} |
lib/models/new_unmessage_model.g.dart
0 → 100644
| 1 | +// GENERATED CODE - DO NOT MODIFY BY HAND | ||
| 2 | + | ||
| 3 | +part of 'new_unmessage_model.dart'; | ||
| 4 | + | ||
| 5 | +// ************************************************************************** | ||
| 6 | +// JsonSerializableGenerator | ||
| 7 | +// ************************************************************************** | ||
| 8 | + | ||
| 9 | +NewUnmessageModel _$NewUnmessageModelFromJson(Map<String, dynamic> json) { | ||
| 10 | + return NewUnmessageModel( | ||
| 11 | + json['ret'] as int, | ||
| 12 | + json['data'] == null | ||
| 13 | + ? null | ||
| 14 | + : NewUnmessageSunModel.fromJson(json['data'] as Map<String, dynamic>), | ||
| 15 | + json['msg'] as String, | ||
| 16 | + ); | ||
| 17 | +} | ||
| 18 | + | ||
| 19 | +Map<String, dynamic> _$NewUnmessageModelToJson(NewUnmessageModel instance) => | ||
| 20 | + <String, dynamic>{ | ||
| 21 | + 'ret': instance.ret, | ||
| 22 | + 'data': instance.data, | ||
| 23 | + 'msg': instance.msg, | ||
| 24 | + }; | ||
| 25 | + | ||
| 26 | +NewUnmessageSunModel _$NewUnmessageSunModelFromJson(Map<String, dynamic> json) { | ||
| 27 | + return NewUnmessageSunModel( | ||
| 28 | + json['count'] as int, | ||
| 29 | + (json['list'] as List) | ||
| 30 | + ?.map((e) => | ||
| 31 | + e == null ? null : NewUnmessage.fromJson(e as Map<String, dynamic>)) | ||
| 32 | + ?.toList(), | ||
| 33 | + ); | ||
| 34 | +} | ||
| 35 | + | ||
| 36 | +Map<String, dynamic> _$NewUnmessageSunModelToJson( | ||
| 37 | + NewUnmessageSunModel instance) => | ||
| 38 | + <String, dynamic>{ | ||
| 39 | + 'count': instance.count, | ||
| 40 | + 'list': instance.list, | ||
| 41 | + }; | ||
| 42 | + | ||
| 43 | +NewUnmessage _$NewUnmessageFromJson(Map<String, dynamic> json) { | ||
| 44 | + return NewUnmessage( | ||
| 45 | + json['id'] as String, | ||
| 46 | + json['uid'] as String, | ||
| 47 | + json['message_type'] as String, | ||
| 48 | + json['handle_time'] as String, | ||
| 49 | + json['read_time'] as String, | ||
| 50 | + json['is_read'] as String, | ||
| 51 | + json['is_handle'] as String, | ||
| 52 | + json['ddate'] as dynamic, | ||
| 53 | + json['rname'] as String, | ||
| 54 | + json['sex'] as dynamic, | ||
| 55 | + json['cdate'] as dynamic, | ||
| 56 | + json['rid'] as dynamic, | ||
| 57 | + json['room_demand'] as dynamic, | ||
| 58 | + json['ddate_solt'] as dynamic, | ||
| 59 | + json['ddate_long'] as dynamic, | ||
| 60 | + json['cancel_name'] as dynamic, | ||
| 61 | + json['status'] as dynamic, | ||
| 62 | + json['room_info'] as dynamic, | ||
| 63 | + ); | ||
| 64 | +} | ||
| 65 | + | ||
| 66 | +Map<String, dynamic> _$NewUnmessageToJson(NewUnmessage instance) => | ||
| 67 | + <String, dynamic>{ | ||
| 68 | + 'id': instance.id, | ||
| 69 | + 'uid': instance.uid, | ||
| 70 | + 'message_type': instance.message_type, | ||
| 71 | + 'handle_time': instance.handle_time, | ||
| 72 | + 'read_time': instance.read_time, | ||
| 73 | + 'is_read': instance.is_read, | ||
| 74 | + 'is_handle': instance.is_handle, | ||
| 75 | + 'ddate': instance.ddate, | ||
| 76 | + 'rname': instance.rname, | ||
| 77 | + 'sex': instance.sex, | ||
| 78 | + 'cdate': instance.cdate, | ||
| 79 | + 'rid': instance.rid, | ||
| 80 | + 'room_demand': instance.room_demand, | ||
| 81 | + 'ddate_solt': instance.ddate_solt, | ||
| 82 | + 'ddate_long': instance.ddate_long, | ||
| 83 | + 'cancel_name': instance.cancelName, | ||
| 84 | + 'status': instance.status, | ||
| 85 | + 'room_info': instance.room_info, | ||
| 86 | + }; |
| @@ -18,6 +18,7 @@ class Table { | @@ -18,6 +18,7 @@ class Table { | ||
| 18 | String enable; //0禁用 1启用 | 18 | String enable; //0禁用 1启用 |
| 19 | String spell; //1拼桌 | 19 | String spell; //1拼桌 |
| 20 | String rname; //关联区域名称 | 20 | String rname; //关联区域名称 |
| 21 | + dynamic isExitsClass; //表示这个桌子已经关联到包间分类了 null是没有 | ||
| 21 | String max; //最多可做人数 | 22 | String max; //最多可做人数 |
| 22 | String low; //最低消费 | 23 | String low; //最低消费 |
| 23 | String sign; //标签 桌位状态 0:待确认,1:已定座,2:确认到店,3:用餐完成,4:取消预订,5:安排包间,6拒绝订单 | 24 | String sign; //标签 桌位状态 0:待确认,1:已定座,2:确认到店,3:用餐完成,4:取消预订,5:安排包间,6拒绝订单 |
| @@ -103,6 +104,6 @@ class Table { | @@ -103,6 +104,6 @@ class Table { | ||
| 103 | 104 | ||
| 104 | @override | 105 | @override |
| 105 | String toString() { | 106 | String toString() { |
| 106 | - return 'Table{id: $id,isPhoto:$isPhoto rid: $rid, tid: $tid, name: $name, table_pnum: $table_pnum, most_pnum: $most_pnum, order_o: $order_o, status: $status, tablestatus: $tablestatus, enable: $enable, spell: $spell, rname: $rname, max: $max, low: $low}'; | 107 | + return 'Table{id: $id,isPhoto:$isPhoto rid: $rid, tid: $tid, name: $name, table_pnum: $table_pnum, most_pnum: $most_pnum, order_o: $order_o, status: $status, tablestatus: $tablestatus, enable: $enable, spell: $spell, rname: $rname, isExitsClass:$isExitsClass,max: $max, low: $low}'; |
| 107 | } | 108 | } |
| 108 | } | 109 | } |
| @@ -21,6 +21,7 @@ Table _$TableFromJson(Map<String, dynamic> json) { | @@ -21,6 +21,7 @@ Table _$TableFromJson(Map<String, dynamic> json) { | ||
| 21 | ..enable = json['enable'] as String | 21 | ..enable = json['enable'] as String |
| 22 | ..spell = json['spell'] as String | 22 | ..spell = json['spell'] as String |
| 23 | ..rname = json['rname'] as String | 23 | ..rname = json['rname'] as String |
| 24 | + ..isExitsClass = json['IsExitsClass'] as dynamic | ||
| 24 | ..max = json['max'] as String | 25 | ..max = json['max'] as String |
| 25 | ..low = json['low'] as String | 26 | ..low = json['low'] as String |
| 26 | ..sign = json['sign'] as String | 27 | ..sign = json['sign'] as String |
| @@ -43,6 +44,7 @@ Map<String, dynamic> _$TableToJson(Table instance) => <String, dynamic>{ | @@ -43,6 +44,7 @@ Map<String, dynamic> _$TableToJson(Table instance) => <String, dynamic>{ | ||
| 43 | 'enable': instance.enable, | 44 | 'enable': instance.enable, |
| 44 | 'spell': instance.spell, | 45 | 'spell': instance.spell, |
| 45 | 'rname': instance.rname, | 46 | 'rname': instance.rname, |
| 47 | + 'isExitsClass': instance.isExitsClass, | ||
| 46 | 'max': instance.max, | 48 | 'max': instance.max, |
| 47 | 'low': instance.low, | 49 | 'low': instance.low, |
| 48 | 'sign': instance.sign, | 50 | 'sign': instance.sign, |
| @@ -236,5 +236,9 @@ class HttpUrl { | @@ -236,5 +236,9 @@ class HttpUrl { | ||
| 236 | "?service=App.Tables.BatchSetTable"; // 批量修改桌位信息 | 236 | "?service=App.Tables.BatchSetTable"; // 批量修改桌位信息 |
| 237 | static const String push_msg_set_message_status = | 237 | static const String push_msg_set_message_status = |
| 238 | "?service=App.PushMsg.SetMessage"; //设置消息状态 | 238 | "?service=App.PushMsg.SetMessage"; //设置消息状态 |
| 239 | + static const String new_get_untreated_msg_list = | ||
| 240 | + "?service=Android.Reserve.NewGetUntreatedMsgList"; //根据不同得消息类型获取对应得消息列表 | ||
| 241 | + static const String new_get_message_list = | ||
| 242 | + "?service=Android.Reserve.NewGetMessageList"; //根据不同得消息类型获取对应得消息列表 | ||
| 239 | 243 | ||
| 240 | } | 244 | } |
| @@ -6,6 +6,7 @@ import 'package:flutter/cupertino.dart'; | @@ -6,6 +6,7 @@ import 'package:flutter/cupertino.dart'; | ||
| 6 | import 'package:flutter/material.dart'; | 6 | import 'package:flutter/material.dart'; |
| 7 | import 'package:flutter_app_update/azhon_app_update.dart'; | 7 | import 'package:flutter_app_update/azhon_app_update.dart'; |
| 8 | import 'package:flutter_screenutil/flutter_screenutil.dart'; | 8 | import 'package:flutter_screenutil/flutter_screenutil.dart'; |
| 9 | +import 'package:one_key/models/new_unmessage_model.dart'; | ||
| 9 | import 'package:one_key/models/pull_marketing_by_uid_model.dart'; | 10 | import 'package:one_key/models/pull_marketing_by_uid_model.dart'; |
| 10 | 11 | ||
| 11 | import 'package:one_key/pages/message/message_page.dart'; | 12 | import 'package:one_key/pages/message/message_page.dart'; |
| @@ -497,18 +498,20 @@ class HomePageState extends State<HomePage> with WidgetsBindingObserver { | @@ -497,18 +498,20 @@ class HomePageState extends State<HomePage> with WidgetsBindingObserver { | ||
| 497 | 498 | ||
| 498 | // 消息类型ID 1/2/10 提前点餐/新订单(预定)消息/在线预订 | 499 | // 消息类型ID 1/2/10 提前点餐/新订单(预定)消息/在线预订 |
| 499 | //获取未处理在线预订消息 | 500 | //获取未处理在线预订消息 |
| 500 | - getUntreatedMessage(String typeId, VoidCallback callback) { | 501 | + getUntreatedMessage(VoidCallback callback) async { |
| 501 | UserModel userModel = Provider.of<UserModel>(context, listen: false); | 502 | UserModel userModel = Provider.of<UserModel>(context, listen: false); |
| 502 | Map<String, String> params = { | 503 | Map<String, String> params = { |
| 503 | "sid": userModel.user.sellerid, | 504 | "sid": userModel.user.sellerid, |
| 504 | - "type_id": typeId, | ||
| 505 | - "status": "0", //未处理 | 505 | + // "type_id": "10", //1提前点餐2内部预订10在线预订 |
| 506 | + // "status": '0', | ||
| 507 | + | ||
| 506 | "offset": "0", | 508 | "offset": "0", |
| 507 | "limit": "100", | 509 | "limit": "100", |
| 508 | }; | 510 | }; |
| 511 | + | ||
| 509 | MessageDialogModel messageModel = | 512 | MessageDialogModel messageModel = |
| 510 | Provider.of<MessageDialogModel>(context, listen: false); | 513 | Provider.of<MessageDialogModel>(context, listen: false); |
| 511 | - messageModel.getUntreatedMsg(context, params, callback); | 514 | + await messageModel.getUntreatedMsg(context, params, callback); |
| 512 | } | 515 | } |
| 513 | 516 | ||
| 514 | @override | 517 | @override |
| @@ -544,25 +547,36 @@ class HomePageState extends State<HomePage> with WidgetsBindingObserver { | @@ -544,25 +547,36 @@ class HomePageState extends State<HomePage> with WidgetsBindingObserver { | ||
| 544 | MessageDialogModel messageModel = | 547 | MessageDialogModel messageModel = |
| 545 | Provider.of<MessageDialogModel>(context, listen: false); | 548 | Provider.of<MessageDialogModel>(context, listen: false); |
| 546 | messageModel.messages = []; | 549 | messageModel.messages = []; |
| 547 | - getUntreatedMessage('1', () { | ||
| 548 | - getUntreatedMessage('10', () { | ||
| 549 | - if (messageModel.messages.isNotEmpty) { | ||
| 550 | - //底部弹出布局 | ||
| 551 | - if (!messageModel.showMessageDialog) { | ||
| 552 | - DialogUtil.showMessageDialog(context); | ||
| 553 | - } else { | ||
| 554 | - messageModel.notifyListeners(); | ||
| 555 | - } | ||
| 556 | - //播放声音 | ||
| 557 | - if (messageModel.messages.length > 1) { | ||
| 558 | - messageModel.play("-1"); | ||
| 559 | - } else { | ||
| 560 | - for (Message message in messageModel.messages) { | ||
| 561 | - messageModel.play(message.message_type); | 550 | + |
| 551 | + getUntreatedMessage(() { | ||
| 552 | + if (messageModel.messages.isNotEmpty) { | ||
| 553 | + //底部弹出布局 | ||
| 554 | + if (!messageModel.showMessageDialog) { | ||
| 555 | + messageModel.messages.removeWhere((message) { | ||
| 556 | + if (messageModel.messagesCancelOnlyOneShow.contains(message.id)) { | ||
| 557 | + return true; | ||
| 562 | } | 558 | } |
| 559 | + return false; | ||
| 560 | + }); | ||
| 561 | + | ||
| 562 | + DialogUtil.showMessageDialog(context); | ||
| 563 | + for (NewUnmessage item in messageModel.messages) { | ||
| 564 | + if (item.message_type == '11') { | ||
| 565 | + messageModel.messagesCancelOnlyOneShow.add(item.id); | ||
| 566 | + } | ||
| 567 | + } | ||
| 568 | + } else { | ||
| 569 | + messageModel.notifyListeners(); | ||
| 570 | + } | ||
| 571 | + //播放声音 | ||
| 572 | + if (messageModel.messages.length > 1) { | ||
| 573 | + messageModel.play("-1"); | ||
| 574 | + } else { | ||
| 575 | + for (NewUnmessage message in messageModel.messages) { | ||
| 576 | + messageModel.play(message.message_type); | ||
| 563 | } | 577 | } |
| 564 | } | 578 | } |
| 565 | - }); | 579 | + } |
| 566 | }); | 580 | }); |
| 567 | } | 581 | } |
| 568 | 582 | ||
| @@ -570,10 +584,7 @@ class HomePageState extends State<HomePage> with WidgetsBindingObserver { | @@ -570,10 +584,7 @@ class HomePageState extends State<HomePage> with WidgetsBindingObserver { | ||
| 570 | bool _getUnMsgNumUI() { | 584 | bool _getUnMsgNumUI() { |
| 571 | MessageModel messageModel = | 585 | MessageModel messageModel = |
| 572 | Provider.of<MessageModel>(context, listen: true); | 586 | Provider.of<MessageModel>(context, listen: true); |
| 573 | - if (messageModel.onlineTotal + | ||
| 574 | - messageModel.orderTotal + | ||
| 575 | - messageModel.checkTotal > | ||
| 576 | - 0) { | 587 | + if (messageModel.allUnNum > 0) { |
| 577 | return true; | 588 | return true; |
| 578 | } | 589 | } |
| 579 | return false; | 590 | return false; |
| @@ -582,10 +593,17 @@ class HomePageState extends State<HomePage> with WidgetsBindingObserver { | @@ -582,10 +593,17 @@ class HomePageState extends State<HomePage> with WidgetsBindingObserver { | ||
| 582 | //三种分类各自的未读消息数目 | 593 | //三种分类各自的未读消息数目 |
| 583 | _getUnMsgNum() async { | 594 | _getUnMsgNum() async { |
| 584 | UserModel userModel = Provider.of<UserModel>(context, listen: false); | 595 | UserModel userModel = Provider.of<UserModel>(context, listen: false); |
| 585 | - Map<String, String> params = {"sid": userModel.user.sellerid}; | ||
| 586 | MessageModel messageModel = | 596 | MessageModel messageModel = |
| 587 | Provider.of<MessageModel>(context, listen: false); | 597 | Provider.of<MessageModel>(context, listen: false); |
| 588 | - await messageModel.getUnMsgNum(context, params); | 598 | + Map<String, String> params = { |
| 599 | + "sid": userModel.user.sellerid, | ||
| 600 | + // "type_id": "10", //1提前点餐2内部预订10在线预订 | ||
| 601 | + // "status": '0', | ||
| 602 | + "offset": '0', | ||
| 603 | + "limit": "20", | ||
| 604 | + }; | ||
| 605 | + await messageModel.getNewGetUntreatedMsgList(context, params, | ||
| 606 | + showLoading: false); | ||
| 589 | setState(() {}); | 607 | setState(() {}); |
| 590 | } | 608 | } |
| 591 | 609 |
| @@ -2,6 +2,7 @@ import 'package:common_utils/common_utils.dart'; | @@ -2,6 +2,7 @@ import 'package:common_utils/common_utils.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/models/message.dart'; | 4 | import 'package:one_key/models/message.dart'; |
| 5 | +import 'package:one_key/models/new_unmessage_model.dart'; | ||
| 5 | import 'package:one_key/pages/detail/handle_online_page.dart'; | 6 | import 'package:one_key/pages/detail/handle_online_page.dart'; |
| 6 | import 'package:one_key/pages/home/home_page.dart'; | 7 | import 'package:one_key/pages/home/home_page.dart'; |
| 7 | import 'package:one_key/provider/message_dialog_model.dart'; | 8 | import 'package:one_key/provider/message_dialog_model.dart'; |
| @@ -18,7 +19,7 @@ import 'package:provider/provider.dart'; | @@ -18,7 +19,7 @@ import 'package:provider/provider.dart'; | ||
| 18 | import '../../app.dart'; | 19 | import '../../app.dart'; |
| 19 | 20 | ||
| 20 | class MessageDialogItemF extends StatelessWidget { | 21 | class MessageDialogItemF extends StatelessWidget { |
| 21 | - final Message message; | 22 | + final NewUnmessage message; |
| 22 | final bool isTreated; | 23 | final bool isTreated; |
| 23 | MessageDialogItemF(this.message, {this.isTreated = false}); | 24 | MessageDialogItemF(this.message, {this.isTreated = false}); |
| 24 | 25 |
| 1 | import 'package:flutter/material.dart'; | 1 | import 'package:flutter/material.dart'; |
| 2 | import 'package:flutter_screenutil/flutter_screenutil.dart'; | 2 | import 'package:flutter_screenutil/flutter_screenutil.dart'; |
| 3 | import 'package:one_key/models/message.dart'; | 3 | import 'package:one_key/models/message.dart'; |
| 4 | +import 'package:one_key/models/new_unmessage_model.dart'; | ||
| 4 | import 'package:one_key/provider/message_dialog_model.dart'; | 5 | import 'package:one_key/provider/message_dialog_model.dart'; |
| 5 | import 'package:one_key/provider/user_model.dart'; | 6 | import 'package:one_key/provider/user_model.dart'; |
| 6 | import 'package:one_key/res/colors.dart'; | 7 | import 'package:one_key/res/colors.dart'; |
| @@ -13,7 +14,7 @@ import 'package:one_key/widgets/v_empty_view.dart'; | @@ -13,7 +14,7 @@ import 'package:one_key/widgets/v_empty_view.dart'; | ||
| 13 | import 'package:provider/provider.dart'; | 14 | import 'package:provider/provider.dart'; |
| 14 | 15 | ||
| 15 | class MessageItemF extends StatelessWidget { | 16 | class MessageItemF extends StatelessWidget { |
| 16 | - final Message message; | 17 | + final NewUnmessage message; |
| 17 | final bool isTreated; | 18 | final bool isTreated; |
| 18 | MessageItemF(this.message, {this.isTreated = false}); | 19 | MessageItemF(this.message, {this.isTreated = false}); |
| 19 | 20 | ||
| @@ -317,20 +318,23 @@ class MessageItemF extends StatelessWidget { | @@ -317,20 +318,23 @@ class MessageItemF extends StatelessWidget { | ||
| 317 | fontSize: ScreenUtil().setSp(24)), | 318 | fontSize: ScreenUtil().setSp(24)), |
| 318 | ), | 319 | ), |
| 319 | VEmptyView(8), | 320 | VEmptyView(8), |
| 320 | - Container( | ||
| 321 | - padding: EdgeInsets.symmetric( | ||
| 322 | - horizontal: ScreenUtil().setWidth(16), | ||
| 323 | - vertical: ScreenUtil().setWidth(6)), | ||
| 324 | - decoration: BoxDecoration( | ||
| 325 | - color: bgcolor, | ||
| 326 | - borderRadius: BorderRadius.circular(8)), | ||
| 327 | - child: Text( | ||
| 328 | - '${message.message_type == '1' ? message.room_info : message.room_demand}', | ||
| 329 | - style: TextStyle( | ||
| 330 | - color: MyColours.color_ffffff, | ||
| 331 | - fontSize: ScreenUtil().setSp(20)), | ||
| 332 | - ), | ||
| 333 | - ) | 321 | + message.room_demand == '' || |
| 322 | + message.room_demand == null | ||
| 323 | + ? SizedBox() | ||
| 324 | + : Container( | ||
| 325 | + padding: EdgeInsets.symmetric( | ||
| 326 | + horizontal: ScreenUtil().setWidth(16), | ||
| 327 | + vertical: ScreenUtil().setWidth(6)), | ||
| 328 | + decoration: BoxDecoration( | ||
| 329 | + color: bgcolor, | ||
| 330 | + borderRadius: BorderRadius.circular(8)), | ||
| 331 | + child: Text( | ||
| 332 | + '${message.room_demand}', | ||
| 333 | + style: TextStyle( | ||
| 334 | + color: MyColours.color_ffffff, | ||
| 335 | + fontSize: ScreenUtil().setSp(20)), | ||
| 336 | + ), | ||
| 337 | + ) | ||
| 334 | ], | 338 | ], |
| 335 | )) | 339 | )) |
| 336 | : SizedBox(), | 340 | : SizedBox(), |
| @@ -346,7 +350,8 @@ class MessageItemF extends StatelessWidget { | @@ -346,7 +350,8 @@ class MessageItemF extends StatelessWidget { | ||
| 346 | ), | 350 | ), |
| 347 | VEmptyView(8), | 351 | VEmptyView(8), |
| 348 | message.message_type == "1" | 352 | message.message_type == "1" |
| 349 | - ? message.room_info == '' | 353 | + ? message.room_info == '' || |
| 354 | + message.room_info == null | ||
| 350 | ? SizedBox() | 355 | ? SizedBox() |
| 351 | : Container( | 356 | : Container( |
| 352 | padding: EdgeInsets.symmetric( | 357 | padding: EdgeInsets.symmetric( |
| @@ -358,13 +363,14 @@ class MessageItemF extends StatelessWidget { | @@ -358,13 +363,14 @@ class MessageItemF extends StatelessWidget { | ||
| 358 | borderRadius: | 363 | borderRadius: |
| 359 | BorderRadius.circular(8)), | 364 | BorderRadius.circular(8)), |
| 360 | child: Text( | 365 | child: Text( |
| 361 | - '${message.room_info == ''}', | 366 | + '${message.room_info}', |
| 362 | style: TextStyle( | 367 | style: TextStyle( |
| 363 | color: MyColours.color_ffffff, | 368 | color: MyColours.color_ffffff, |
| 364 | fontSize: ScreenUtil().setSp(20)), | 369 | fontSize: ScreenUtil().setSp(20)), |
| 365 | ), | 370 | ), |
| 366 | ) | 371 | ) |
| 367 | - : message.room_demand == '' | 372 | + : message.room_demand == '' || |
| 373 | + message.room_demand == null | ||
| 368 | ? SizedBox() | 374 | ? SizedBox() |
| 369 | : Container( | 375 | : Container( |
| 370 | padding: EdgeInsets.symmetric( | 376 | padding: EdgeInsets.symmetric( |
| @@ -385,7 +391,7 @@ class MessageItemF extends StatelessWidget { | @@ -385,7 +391,7 @@ class MessageItemF extends StatelessWidget { | ||
| 385 | message.message_type == "1" | 391 | message.message_type == "1" |
| 386 | ? SizedBox() | 392 | ? SizedBox() |
| 387 | : Text( | 393 | : Text( |
| 388 | - true ? '取消操作人:顾客在线取消' : '取消操作人:方硕', | 394 | + '取消操作人:${message.cancelName}', |
| 389 | style: TextStyle( | 395 | style: TextStyle( |
| 390 | color: isTreated | 396 | color: isTreated |
| 391 | ? MyColours.color_BFC4D4 | 397 | ? MyColours.color_BFC4D4 |
| 1 | -import 'package:flutter/material.dart'; | ||
| 2 | -import 'package:flutter_easyrefresh/easy_refresh.dart'; | ||
| 3 | -import 'package:flutter_screenutil/flutter_screenutil.dart'; | ||
| 4 | -import 'package:one_key/constant/state.dart'; | ||
| 5 | -import 'package:one_key/pages/message/messsage_item.dart'; | ||
| 6 | -import 'package:one_key/provider/message_dialog_model.dart'; | ||
| 7 | -import 'package:one_key/provider/message_model.dart'; | ||
| 8 | -import 'package:one_key/provider/user_model.dart'; | ||
| 9 | -import 'package:one_key/res/colors.dart'; | ||
| 10 | -import 'package:one_key/widgets/page_error.dart'; | ||
| 11 | -import 'package:one_key/widgets/page_exception.dart'; | ||
| 12 | -import 'package:provider/provider.dart'; | ||
| 13 | -import 'package:one_key/utils/event_bus.dart'; | 1 | +// import 'package:flutter/material.dart'; |
| 2 | +// import 'package:flutter_easyrefresh/easy_refresh.dart'; | ||
| 3 | +// import 'package:flutter_screenutil/flutter_screenutil.dart'; | ||
| 4 | +// import 'package:one_key/constant/state.dart'; | ||
| 5 | +// import 'package:one_key/pages/message/messsage_item.dart'; | ||
| 6 | +// import 'package:one_key/provider/message_dialog_model.dart'; | ||
| 7 | +// import 'package:one_key/provider/message_model.dart'; | ||
| 8 | +// import 'package:one_key/provider/user_model.dart'; | ||
| 9 | +// import 'package:one_key/res/colors.dart'; | ||
| 10 | +// import 'package:one_key/widgets/page_error.dart'; | ||
| 11 | +// import 'package:one_key/widgets/page_exception.dart'; | ||
| 12 | +// import 'package:provider/provider.dart'; | ||
| 13 | +// import 'package:one_key/utils/event_bus.dart'; | ||
| 14 | 14 | ||
| 15 | -/** | ||
| 16 | - * 在线买单消息 | ||
| 17 | - */ | ||
| 18 | -class MessageOnlineCheckPage extends StatefulWidget { | ||
| 19 | - @override | ||
| 20 | - State<StatefulWidget> createState() { | ||
| 21 | - // TODO: implement createState | ||
| 22 | - return new MessageOnlineCheckPageState(); | ||
| 23 | - } | ||
| 24 | -} | 15 | +// /** |
| 16 | +// * 在线买单消息 | ||
| 17 | +// */ | ||
| 18 | +// class MessageOnlineCheckPage extends StatefulWidget { | ||
| 19 | +// @override | ||
| 20 | +// State<StatefulWidget> createState() { | ||
| 21 | +// // TODO: implement createState | ||
| 22 | +// return new MessageOnlineCheckPageState(); | ||
| 23 | +// } | ||
| 24 | +// } | ||
| 25 | 25 | ||
| 26 | -class MessageOnlineCheckPageState extends State<MessageOnlineCheckPage> { | ||
| 27 | - EasyRefreshController _controller; | 26 | +// class MessageOnlineCheckPageState extends State<MessageOnlineCheckPage> { |
| 27 | +// EasyRefreshController _controller; | ||
| 28 | 28 | ||
| 29 | - Color selectedColor = MyColours.color_199095; | ||
| 30 | - Color unSelectedColor = MyColours.color_999999; | 29 | +// Color selectedColor = MyColours.color_199095; |
| 30 | +// Color unSelectedColor = MyColours.color_999999; | ||
| 31 | 31 | ||
| 32 | - int selectedIndex = 0; | 32 | +// int selectedIndex = 0; |
| 33 | 33 | ||
| 34 | - int offset = 0; | ||
| 35 | - MessageModel messageModel; | ||
| 36 | - UserModel userModel; | ||
| 37 | - MessageDialogModel messageDialogModel; | 34 | +// int offset = 0; |
| 35 | +// MessageModel messageModel; | ||
| 36 | +// UserModel userModel; | ||
| 37 | +// MessageDialogModel messageDialogModel; | ||
| 38 | 38 | ||
| 39 | - @override | ||
| 40 | - void initState() { | ||
| 41 | - // TODO: implement initState | ||
| 42 | - super.initState(); | ||
| 43 | - //移除在线买单消息 | ||
| 44 | - // bus.on("remove_untreated_message_check", (args) { | ||
| 45 | - // messageModel.removeUntreatedMessageByMid(args.toString()); | ||
| 46 | - // messageDialogModel.removeMessage(args.toString()); | ||
| 47 | - // }); | ||
| 48 | - _controller = EasyRefreshController(); | ||
| 49 | - WidgetsBinding.instance.addPostFrameCallback((_) { | ||
| 50 | - // getMessage(); | ||
| 51 | - // setState(() { | ||
| 52 | - // messageModel.pageState = PageState.Loading; | ||
| 53 | - // }); | ||
| 54 | - messageModel.pageState = PageState.Loading; | ||
| 55 | - messageModel.notifyListeners(); | ||
| 56 | - }); | ||
| 57 | - } | 39 | +// @override |
| 40 | +// void initState() { | ||
| 41 | +// // TODO: implement initState | ||
| 42 | +// super.initState(); | ||
| 43 | +// //移除在线买单消息 | ||
| 44 | +// // bus.on("remove_untreated_message_check", (args) { | ||
| 45 | +// // messageModel.removeUntreatedMessageByMid(args.toString()); | ||
| 46 | +// // messageDialogModel.removeMessage(args.toString()); | ||
| 47 | +// // }); | ||
| 48 | +// _controller = EasyRefreshController(); | ||
| 49 | +// WidgetsBinding.instance.addPostFrameCallback((_) { | ||
| 50 | +// // getMessage(); | ||
| 51 | +// // setState(() { | ||
| 52 | +// // messageModel.pageState = PageState.Loading; | ||
| 53 | +// // }); | ||
| 54 | +// messageModel.pageState = PageState.Loading; | ||
| 55 | +// messageModel.notifyListeners(); | ||
| 56 | +// }); | ||
| 57 | +// } | ||
| 58 | 58 | ||
| 59 | - @override | ||
| 60 | - void dispose() { | ||
| 61 | - // TODO: implement dispose | ||
| 62 | - super.dispose(); | ||
| 63 | - // bus.off("remove_untreated_message_check"); | ||
| 64 | - } | 59 | +// @override |
| 60 | +// void dispose() { | ||
| 61 | +// // TODO: implement dispose | ||
| 62 | +// super.dispose(); | ||
| 63 | +// // bus.off("remove_untreated_message_check"); | ||
| 64 | +// } | ||
| 65 | 65 | ||
| 66 | - //三种分类各自的未读消息数目 | ||
| 67 | - _getUnMsgNum() async { | ||
| 68 | - Map<String, String> params = {"sid": userModel.user.sellerid}; | ||
| 69 | - await messageModel.getUnMsgNum(context, params); | ||
| 70 | - } | 66 | +// //三种分类各自的未读消息数目 |
| 67 | +// _getUnMsgNum() async { | ||
| 68 | +// Map<String, String> params = {"sid": userModel.user.sellerid}; | ||
| 69 | +// await messageModel.getUnMsgNum(context, params); | ||
| 70 | +// } | ||
| 71 | 71 | ||
| 72 | - //获取在线预订消息status 0未处理 1已处理 | ||
| 73 | - getMessage({bool showLoading = true}) async { | ||
| 74 | - Map<String, String> params = { | ||
| 75 | - "sid": userModel.user.sellerid, | ||
| 76 | - "type_id": "12", //1提前点餐 2内部预订 10在线预订 12在线买单 | ||
| 77 | - "status": selectedIndex.toString(), | ||
| 78 | - "offset": offset.toString(), | ||
| 79 | - "limit": "20", | ||
| 80 | - }; | 72 | +// //获取在线预订消息status 0未处理 1已处理 |
| 73 | +// getMessage({bool showLoading = true}) async { | ||
| 74 | +// Map<String, String> params = { | ||
| 75 | +// "sid": userModel.user.sellerid, | ||
| 76 | +// "type_id": "12", //1提前点餐 2内部预订 10在线预订 12在线买单 | ||
| 77 | +// "status": selectedIndex.toString(), | ||
| 78 | +// "offset": offset.toString(), | ||
| 79 | +// "limit": "20", | ||
| 80 | +// }; | ||
| 81 | 81 | ||
| 82 | - await messageModel.getMessages(context, params, showLoading: showLoading); | ||
| 83 | - _getUnMsgNum(); | ||
| 84 | - } | 82 | +// await messageModel.getMessages(context, params, showLoading: showLoading); |
| 83 | +// _getUnMsgNum(); | ||
| 84 | +// } | ||
| 85 | 85 | ||
| 86 | - @override | ||
| 87 | - Widget build(BuildContext context) { | ||
| 88 | - messageModel = Provider.of<MessageModel>(context, listen: true); | ||
| 89 | - userModel = Provider.of<UserModel>(context, listen: false); | ||
| 90 | - messageDialogModel = | ||
| 91 | - Provider.of<MessageDialogModel>(context, listen: false); | ||
| 92 | - return Container( | ||
| 93 | - color: MyColours.color_f5f5f5, | ||
| 94 | - child: Column( | ||
| 95 | - children: [ | ||
| 96 | - Container( | ||
| 97 | - width: double.infinity, | ||
| 98 | - height: ScreenUtil().setWidth(84), | ||
| 99 | - color: MyColours.color_ffffff, | ||
| 100 | - child: Row( | ||
| 101 | - children: [ | ||
| 102 | - Expanded( | ||
| 103 | - child: GestureDetector( | ||
| 104 | - behavior: HitTestBehavior.opaque, | ||
| 105 | - onTap: () { | ||
| 106 | - if (selectedIndex == 0) return; | ||
| 107 | - setState(() { | ||
| 108 | - selectedIndex = 0; | ||
| 109 | - messageModel.messages = []; | ||
| 110 | - }); | ||
| 111 | - getMessage(showLoading: true); | ||
| 112 | - }, | ||
| 113 | - child: Center( | ||
| 114 | - child: Text( | ||
| 115 | - "未处理", | ||
| 116 | - style: TextStyle( | ||
| 117 | - color: selectedIndex == 0 | ||
| 118 | - ? selectedColor | ||
| 119 | - : unSelectedColor, | ||
| 120 | - fontSize: ScreenUtil().setSp(30)), | ||
| 121 | - ), | ||
| 122 | - ))), | ||
| 123 | - Expanded( | ||
| 124 | - child: GestureDetector( | ||
| 125 | - behavior: HitTestBehavior.opaque, | ||
| 126 | - onTap: () { | ||
| 127 | - if (selectedIndex == 1) return; | ||
| 128 | - setState(() { | ||
| 129 | - selectedIndex = 1; | ||
| 130 | - messageModel.messages = []; | ||
| 131 | - }); | ||
| 132 | - getMessage(showLoading: true); | ||
| 133 | - }, | ||
| 134 | - child: Center( | ||
| 135 | - child: Text( | ||
| 136 | - "已处理", | ||
| 137 | - style: TextStyle( | ||
| 138 | - color: selectedIndex == 1 | ||
| 139 | - ? selectedColor | ||
| 140 | - : unSelectedColor, | ||
| 141 | - fontSize: ScreenUtil().setSp(30)), | ||
| 142 | - ), | ||
| 143 | - ))) | ||
| 144 | - ], | ||
| 145 | - ), | ||
| 146 | - ), | ||
| 147 | - Expanded( | ||
| 148 | - child: Consumer<MessageModel>( | ||
| 149 | - builder: (context, model, _) { | ||
| 150 | - if (model.pageState != PageState.Success) { | ||
| 151 | - return ExceptionPage( | ||
| 152 | - pageState: model.pageState, | ||
| 153 | - callback: () { | ||
| 154 | - offset = 0; | ||
| 155 | - getMessage(showLoading: true); | ||
| 156 | - }, | ||
| 157 | - emptyMsg: | ||
| 158 | - "暂时没有${selectedIndex == 0 ? '未处理' : '已处理'}的在线买单消息哦", | ||
| 159 | - emptyImg: "empty_search", | ||
| 160 | - showMsg: "加载中,请稍后...", | ||
| 161 | - ); | ||
| 162 | - } else { | ||
| 163 | - return EasyRefresh.custom( | ||
| 164 | - controller: _controller, | ||
| 165 | - slivers: [ | ||
| 166 | - SliverList( | ||
| 167 | - delegate: SliverChildBuilderDelegate( | ||
| 168 | - (BuildContext context, int index) { | ||
| 169 | - return MessageItem( | ||
| 170 | - model.messages[index], | ||
| 171 | - isTreated: selectedIndex == 1, | ||
| 172 | - ); | ||
| 173 | - }, childCount: model.messages.length), | ||
| 174 | - ) | ||
| 175 | - ], | ||
| 176 | - onRefresh: () async { | ||
| 177 | - offset = 0; | ||
| 178 | - getMessage(showLoading: false); | ||
| 179 | - }, | ||
| 180 | - onLoad: () async { | ||
| 181 | - offset++; | ||
| 182 | - getMessage(showLoading: false); | ||
| 183 | - }, | ||
| 184 | - ); | ||
| 185 | - } | ||
| 186 | - }, | ||
| 187 | - ), | ||
| 188 | - ) | ||
| 189 | - ], | ||
| 190 | - ), | ||
| 191 | - ); | ||
| 192 | - } | ||
| 193 | -} | 86 | +// @override |
| 87 | +// Widget build(BuildContext context) { | ||
| 88 | +// messageModel = Provider.of<MessageModel>(context, listen: true); | ||
| 89 | +// userModel = Provider.of<UserModel>(context, listen: false); | ||
| 90 | +// messageDialogModel = | ||
| 91 | +// Provider.of<MessageDialogModel>(context, listen: false); | ||
| 92 | +// return Container( | ||
| 93 | +// color: MyColours.color_f5f5f5, | ||
| 94 | +// child: Column( | ||
| 95 | +// children: [ | ||
| 96 | +// Container( | ||
| 97 | +// width: double.infinity, | ||
| 98 | +// height: ScreenUtil().setWidth(84), | ||
| 99 | +// color: MyColours.color_ffffff, | ||
| 100 | +// child: Row( | ||
| 101 | +// children: [ | ||
| 102 | +// Expanded( | ||
| 103 | +// child: GestureDetector( | ||
| 104 | +// behavior: HitTestBehavior.opaque, | ||
| 105 | +// onTap: () { | ||
| 106 | +// if (selectedIndex == 0) return; | ||
| 107 | +// setState(() { | ||
| 108 | +// selectedIndex = 0; | ||
| 109 | +// messageModel.messages = []; | ||
| 110 | +// }); | ||
| 111 | +// getMessage(showLoading: true); | ||
| 112 | +// }, | ||
| 113 | +// child: Center( | ||
| 114 | +// child: Text( | ||
| 115 | +// "未处理", | ||
| 116 | +// style: TextStyle( | ||
| 117 | +// color: selectedIndex == 0 | ||
| 118 | +// ? selectedColor | ||
| 119 | +// : unSelectedColor, | ||
| 120 | +// fontSize: ScreenUtil().setSp(30)), | ||
| 121 | +// ), | ||
| 122 | +// ))), | ||
| 123 | +// Expanded( | ||
| 124 | +// child: GestureDetector( | ||
| 125 | +// behavior: HitTestBehavior.opaque, | ||
| 126 | +// onTap: () { | ||
| 127 | +// if (selectedIndex == 1) return; | ||
| 128 | +// setState(() { | ||
| 129 | +// selectedIndex = 1; | ||
| 130 | +// messageModel.messages = []; | ||
| 131 | +// }); | ||
| 132 | +// getMessage(showLoading: true); | ||
| 133 | +// }, | ||
| 134 | +// child: Center( | ||
| 135 | +// child: Text( | ||
| 136 | +// "已处理", | ||
| 137 | +// style: TextStyle( | ||
| 138 | +// color: selectedIndex == 1 | ||
| 139 | +// ? selectedColor | ||
| 140 | +// : unSelectedColor, | ||
| 141 | +// fontSize: ScreenUtil().setSp(30)), | ||
| 142 | +// ), | ||
| 143 | +// ))) | ||
| 144 | +// ], | ||
| 145 | +// ), | ||
| 146 | +// ), | ||
| 147 | +// Expanded( | ||
| 148 | +// child: Consumer<MessageModel>( | ||
| 149 | +// builder: (context, model, _) { | ||
| 150 | +// if (model.pageState != PageState.Success) { | ||
| 151 | +// return ExceptionPage( | ||
| 152 | +// pageState: model.pageState, | ||
| 153 | +// callback: () { | ||
| 154 | +// offset = 0; | ||
| 155 | +// getMessage(showLoading: true); | ||
| 156 | +// }, | ||
| 157 | +// emptyMsg: | ||
| 158 | +// "暂时没有${selectedIndex == 0 ? '未处理' : '已处理'}的在线买单消息哦", | ||
| 159 | +// emptyImg: "empty_search", | ||
| 160 | +// showMsg: "加载中,请稍后...", | ||
| 161 | +// ); | ||
| 162 | +// } else { | ||
| 163 | +// return EasyRefresh.custom( | ||
| 164 | +// controller: _controller, | ||
| 165 | +// slivers: [ | ||
| 166 | +// SliverList( | ||
| 167 | +// delegate: SliverChildBuilderDelegate( | ||
| 168 | +// (BuildContext context, int index) { | ||
| 169 | +// return MessageItem( | ||
| 170 | +// model.messages[index], | ||
| 171 | +// isTreated: selectedIndex == 1, | ||
| 172 | +// ); | ||
| 173 | +// }, childCount: model.messages.length), | ||
| 174 | +// ) | ||
| 175 | +// ], | ||
| 176 | +// onRefresh: () async { | ||
| 177 | +// offset = 0; | ||
| 178 | +// getMessage(showLoading: false); | ||
| 179 | +// }, | ||
| 180 | +// onLoad: () async { | ||
| 181 | +// offset++; | ||
| 182 | +// getMessage(showLoading: false); | ||
| 183 | +// }, | ||
| 184 | +// ); | ||
| 185 | +// } | ||
| 186 | +// }, | ||
| 187 | +// ), | ||
| 188 | +// ) | ||
| 189 | +// ], | ||
| 190 | +// ), | ||
| 191 | +// ); | ||
| 192 | +// } | ||
| 193 | +// } |
| 1 | -import 'package:flutter/material.dart'; | ||
| 2 | -import 'package:flutter_easyrefresh/easy_refresh.dart'; | ||
| 3 | -import 'package:flutter_screenutil/flutter_screenutil.dart'; | ||
| 4 | -import 'package:one_key/constant/state.dart'; | ||
| 5 | -import 'package:one_key/pages/message/messsage_item.dart'; | ||
| 6 | -import 'package:one_key/provider/message_dialog_model.dart'; | ||
| 7 | -import 'package:one_key/provider/message_model.dart'; | ||
| 8 | -import 'package:one_key/provider/user_model.dart'; | ||
| 9 | -import 'package:one_key/res/colors.dart'; | ||
| 10 | -import 'package:one_key/widgets/page_error.dart'; | ||
| 11 | -import 'package:one_key/widgets/page_exception.dart'; | ||
| 12 | -import 'package:provider/provider.dart'; | ||
| 13 | -import 'package:one_key/utils/event_bus.dart'; | 1 | +// import 'package:flutter/material.dart'; |
| 2 | +// import 'package:flutter_easyrefresh/easy_refresh.dart'; | ||
| 3 | +// import 'package:flutter_screenutil/flutter_screenutil.dart'; | ||
| 4 | +// import 'package:one_key/constant/state.dart'; | ||
| 5 | +// import 'package:one_key/pages/message/messsage_item.dart'; | ||
| 6 | +// import 'package:one_key/provider/message_dialog_model.dart'; | ||
| 7 | +// import 'package:one_key/provider/message_model.dart'; | ||
| 8 | +// import 'package:one_key/provider/user_model.dart'; | ||
| 9 | +// import 'package:one_key/res/colors.dart'; | ||
| 10 | +// import 'package:one_key/widgets/page_error.dart'; | ||
| 11 | +// import 'package:one_key/widgets/page_exception.dart'; | ||
| 12 | +// import 'package:provider/provider.dart'; | ||
| 13 | +// import 'package:one_key/utils/event_bus.dart'; | ||
| 14 | 14 | ||
| 15 | -/** | ||
| 16 | - * 在线预订消息 | ||
| 17 | - */ | ||
| 18 | -class MessageOnlinePage extends StatefulWidget { | ||
| 19 | - @override | ||
| 20 | - State<StatefulWidget> createState() { | ||
| 21 | - // TODO: implement createState | ||
| 22 | - return new MessageOnlinePageState(); | ||
| 23 | - } | ||
| 24 | -} | 15 | +// /** |
| 16 | +// * 在线预订消息 | ||
| 17 | +// */ | ||
| 18 | +// class MessageOnlinePage extends StatefulWidget { | ||
| 19 | +// @override | ||
| 20 | +// State<StatefulWidget> createState() { | ||
| 21 | +// // TODO: implement createState | ||
| 22 | +// return new MessageOnlinePageState(); | ||
| 23 | +// } | ||
| 24 | +// } | ||
| 25 | 25 | ||
| 26 | -class MessageOnlinePageState extends State<MessageOnlinePage> { | ||
| 27 | - EasyRefreshController _controller; | 26 | +// class MessageOnlinePageState extends State<MessageOnlinePage> { |
| 27 | +// EasyRefreshController _controller; | ||
| 28 | 28 | ||
| 29 | - Color selectedColor = MyColours.color_199095; | ||
| 30 | - Color unSelectedColor = MyColours.color_999999; | 29 | +// Color selectedColor = MyColours.color_199095; |
| 30 | +// Color unSelectedColor = MyColours.color_999999; | ||
| 31 | 31 | ||
| 32 | - int selectedIndex = 0; | 32 | +// int selectedIndex = 0; |
| 33 | 33 | ||
| 34 | - int offset = 0; | ||
| 35 | - MessageModel messageModel; | ||
| 36 | - UserModel userModel; | ||
| 37 | - MessageDialogModel messageDialogModel; | 34 | +// int offset = 0; |
| 35 | +// MessageModel messageModel; | ||
| 36 | +// UserModel userModel; | ||
| 37 | +// MessageDialogModel messageDialogModel; | ||
| 38 | 38 | ||
| 39 | - @override | ||
| 40 | - void initState() { | ||
| 41 | - // TODO: implement initState | ||
| 42 | - super.initState(); | ||
| 43 | - // //移除在线预订消息 | ||
| 44 | - // bus.on("remove_untreated_message", (args) { | ||
| 45 | - // messageModel.removeUntreatedMessageByMid(args.toString()); | ||
| 46 | - // messageDialogModel.removeMessage(args.toString()); | ||
| 47 | - // }); | ||
| 48 | - _controller = EasyRefreshController(); | ||
| 49 | - // messageModel.pageState = PageState.Loading; | ||
| 50 | - WidgetsBinding.instance.addPostFrameCallback((_) { | ||
| 51 | - // getMessage(); | ||
| 52 | - // setState(() { | ||
| 53 | - // messageModel.pageState = PageState.Loading; | ||
| 54 | - // }); | ||
| 55 | - messageModel.pageState = PageState.Loading; | ||
| 56 | - messageModel.notifyListeners(); | ||
| 57 | - }); | ||
| 58 | - } | 39 | +// @override |
| 40 | +// void initState() { | ||
| 41 | +// // TODO: implement initState | ||
| 42 | +// super.initState(); | ||
| 43 | +// // //移除在线预订消息 | ||
| 44 | +// // bus.on("remove_untreated_message", (args) { | ||
| 45 | +// // messageModel.removeUntreatedMessageByMid(args.toString()); | ||
| 46 | +// // messageDialogModel.removeMessage(args.toString()); | ||
| 47 | +// // }); | ||
| 48 | +// _controller = EasyRefreshController(); | ||
| 49 | +// // messageModel.pageState = PageState.Loading; | ||
| 50 | +// WidgetsBinding.instance.addPostFrameCallback((_) { | ||
| 51 | +// // getMessage(); | ||
| 52 | +// // setState(() { | ||
| 53 | +// // messageModel.pageState = PageState.Loading; | ||
| 54 | +// // }); | ||
| 55 | +// messageModel.pageState = PageState.Loading; | ||
| 56 | +// messageModel.notifyListeners(); | ||
| 57 | +// }); | ||
| 58 | +// } | ||
| 59 | 59 | ||
| 60 | - @override | ||
| 61 | - void dispose() { | ||
| 62 | - // TODO: implement dispose | ||
| 63 | - super.dispose(); | ||
| 64 | - // bus.off("remove_untreated_message"); | ||
| 65 | - } | 60 | +// @override |
| 61 | +// void dispose() { | ||
| 62 | +// // TODO: implement dispose | ||
| 63 | +// super.dispose(); | ||
| 64 | +// // bus.off("remove_untreated_message"); | ||
| 65 | +// } | ||
| 66 | 66 | ||
| 67 | - //三种分类各自的未读消息数目 | ||
| 68 | - _getUnMsgNum() async { | ||
| 69 | - Map<String, String> params = {"sid": userModel.user.sellerid}; | ||
| 70 | - await messageModel.getUnMsgNum(context, params); | ||
| 71 | - } | 67 | +// //三种分类各自的未读消息数目 |
| 68 | +// _getUnMsgNum() async { | ||
| 69 | +// Map<String, String> params = {"sid": userModel.user.sellerid}; | ||
| 70 | +// await messageModel.getUnMsgNum(context, params); | ||
| 71 | +// } | ||
| 72 | 72 | ||
| 73 | - //获取在线预订消息status 0未处理 1已处理 | ||
| 74 | - getMessage({bool showLoading = true}) async { | ||
| 75 | - Map<String, String> params = { | ||
| 76 | - "sid": userModel.user.sellerid, | ||
| 77 | - "type_id": "10", //1提前点餐2内部预订10在线预订 | ||
| 78 | - "status": selectedIndex.toString(), | ||
| 79 | - "offset": offset.toString(), | ||
| 80 | - "limit": "20", | ||
| 81 | - }; | 73 | +// //获取在线预订消息status 0未处理 1已处理 |
| 74 | +// getMessage({bool showLoading = true}) async { | ||
| 75 | +// Map<String, String> params = { | ||
| 76 | +// "sid": userModel.user.sellerid, | ||
| 77 | +// "type_id": "10", //1提前点餐2内部预订10在线预订 | ||
| 78 | +// "status": selectedIndex.toString(), | ||
| 79 | +// "offset": offset.toString(), | ||
| 80 | +// "limit": "20", | ||
| 81 | +// }; | ||
| 82 | 82 | ||
| 83 | - await messageModel.getMessages(context, params, showLoading: showLoading); | ||
| 84 | - _getUnMsgNum(); | ||
| 85 | - } | 83 | +// await messageModel.getMessages(context, params, showLoading: showLoading); |
| 84 | +// _getUnMsgNum(); | ||
| 85 | +// } | ||
| 86 | 86 | ||
| 87 | - @override | ||
| 88 | - Widget build(BuildContext context) { | ||
| 89 | - messageModel = Provider.of<MessageModel>(context, listen: true); | ||
| 90 | - userModel = Provider.of<UserModel>(context, listen: false); | ||
| 91 | - messageDialogModel = | ||
| 92 | - Provider.of<MessageDialogModel>(context, listen: false); | ||
| 93 | - return Container( | ||
| 94 | - color: MyColours.color_f5f5f5, | ||
| 95 | - child: Column( | ||
| 96 | - children: [ | ||
| 97 | - Container( | ||
| 98 | - width: double.infinity, | ||
| 99 | - height: ScreenUtil().setWidth(84), | ||
| 100 | - color: MyColours.color_ffffff, | ||
| 101 | - child: Row( | ||
| 102 | - children: [ | ||
| 103 | - Expanded( | ||
| 104 | - child: GestureDetector( | ||
| 105 | - behavior: HitTestBehavior.opaque, | ||
| 106 | - onTap: () { | ||
| 107 | - if (selectedIndex == 0) return; | ||
| 108 | - setState(() { | ||
| 109 | - selectedIndex = 0; | ||
| 110 | - messageModel.messages = []; | ||
| 111 | - }); | ||
| 112 | - getMessage(showLoading: true); | ||
| 113 | - }, | ||
| 114 | - child: Center( | ||
| 115 | - child: Text( | ||
| 116 | - "未处理", | ||
| 117 | - style: TextStyle( | ||
| 118 | - color: selectedIndex == 0 | ||
| 119 | - ? selectedColor | ||
| 120 | - : unSelectedColor, | ||
| 121 | - fontSize: ScreenUtil().setSp(30)), | ||
| 122 | - ), | ||
| 123 | - ))), | ||
| 124 | - Expanded( | ||
| 125 | - child: GestureDetector( | ||
| 126 | - behavior: HitTestBehavior.opaque, | ||
| 127 | - onTap: () { | ||
| 128 | - if (selectedIndex == 1) return; | ||
| 129 | - setState(() { | ||
| 130 | - selectedIndex = 1; | ||
| 131 | - messageModel.messages = []; | ||
| 132 | - }); | ||
| 133 | - getMessage(showLoading: true); | ||
| 134 | - }, | ||
| 135 | - child: Center( | ||
| 136 | - child: Text( | ||
| 137 | - "已处理", | ||
| 138 | - style: TextStyle( | ||
| 139 | - color: selectedIndex == 1 | ||
| 140 | - ? selectedColor | ||
| 141 | - : unSelectedColor, | ||
| 142 | - fontSize: ScreenUtil().setSp(30)), | ||
| 143 | - ), | ||
| 144 | - ))) | ||
| 145 | - ], | ||
| 146 | - ), | ||
| 147 | - ), | ||
| 148 | - Expanded( | ||
| 149 | - child: Consumer<MessageModel>( | ||
| 150 | - builder: (context, model, _) { | ||
| 151 | - if (model.pageState != PageState.Success) { | ||
| 152 | - return ExceptionPage( | ||
| 153 | - pageState: model.pageState, | ||
| 154 | - callback: () { | ||
| 155 | - offset = 0; | ||
| 156 | - getMessage(showLoading: true); | ||
| 157 | - }, | ||
| 158 | - emptyMsg: | ||
| 159 | - "暂时没有${selectedIndex == 0 ? '未处理' : '已处理'}的在线预订消息哦", | ||
| 160 | - emptyImg: "empty_search", | ||
| 161 | - showMsg: "加载中,请稍后...", | ||
| 162 | - ); | ||
| 163 | - } else { | ||
| 164 | - return EasyRefresh.custom( | ||
| 165 | - controller: _controller, | ||
| 166 | - slivers: [ | ||
| 167 | - SliverList( | ||
| 168 | - delegate: SliverChildBuilderDelegate( | ||
| 169 | - (BuildContext context, int index) { | ||
| 170 | - return MessageItem( | ||
| 171 | - model.messages[index], | ||
| 172 | - isTreated: selectedIndex == 1, | ||
| 173 | - ); | ||
| 174 | - }, childCount: model.messages.length), | ||
| 175 | - ) | ||
| 176 | - ], | ||
| 177 | - onRefresh: () async { | ||
| 178 | - offset = 0; | ||
| 179 | - getMessage(showLoading: false); | ||
| 180 | - }, | ||
| 181 | - onLoad: () async { | ||
| 182 | - offset++; | ||
| 183 | - getMessage(showLoading: false); | ||
| 184 | - }, | ||
| 185 | - ); | ||
| 186 | - } | ||
| 187 | - }, | ||
| 188 | - ), | ||
| 189 | - ) | ||
| 190 | - ], | ||
| 191 | - ), | ||
| 192 | - ); | ||
| 193 | - } | ||
| 194 | -} | 87 | +// @override |
| 88 | +// Widget build(BuildContext context) { | ||
| 89 | +// messageModel = Provider.of<MessageModel>(context, listen: true); | ||
| 90 | +// userModel = Provider.of<UserModel>(context, listen: false); | ||
| 91 | +// messageDialogModel = | ||
| 92 | +// Provider.of<MessageDialogModel>(context, listen: false); | ||
| 93 | +// return Container( | ||
| 94 | +// color: MyColours.color_f5f5f5, | ||
| 95 | +// child: Column( | ||
| 96 | +// children: [ | ||
| 97 | +// Container( | ||
| 98 | +// width: double.infinity, | ||
| 99 | +// height: ScreenUtil().setWidth(84), | ||
| 100 | +// color: MyColours.color_ffffff, | ||
| 101 | +// child: Row( | ||
| 102 | +// children: [ | ||
| 103 | +// Expanded( | ||
| 104 | +// child: GestureDetector( | ||
| 105 | +// behavior: HitTestBehavior.opaque, | ||
| 106 | +// onTap: () { | ||
| 107 | +// if (selectedIndex == 0) return; | ||
| 108 | +// setState(() { | ||
| 109 | +// selectedIndex = 0; | ||
| 110 | +// messageModel.messages = []; | ||
| 111 | +// }); | ||
| 112 | +// getMessage(showLoading: true); | ||
| 113 | +// }, | ||
| 114 | +// child: Center( | ||
| 115 | +// child: Text( | ||
| 116 | +// "未处理", | ||
| 117 | +// style: TextStyle( | ||
| 118 | +// color: selectedIndex == 0 | ||
| 119 | +// ? selectedColor | ||
| 120 | +// : unSelectedColor, | ||
| 121 | +// fontSize: ScreenUtil().setSp(30)), | ||
| 122 | +// ), | ||
| 123 | +// ))), | ||
| 124 | +// Expanded( | ||
| 125 | +// child: GestureDetector( | ||
| 126 | +// behavior: HitTestBehavior.opaque, | ||
| 127 | +// onTap: () { | ||
| 128 | +// if (selectedIndex == 1) return; | ||
| 129 | +// setState(() { | ||
| 130 | +// selectedIndex = 1; | ||
| 131 | +// messageModel.messages = []; | ||
| 132 | +// }); | ||
| 133 | +// getMessage(showLoading: true); | ||
| 134 | +// }, | ||
| 135 | +// child: Center( | ||
| 136 | +// child: Text( | ||
| 137 | +// "已处理", | ||
| 138 | +// style: TextStyle( | ||
| 139 | +// color: selectedIndex == 1 | ||
| 140 | +// ? selectedColor | ||
| 141 | +// : unSelectedColor, | ||
| 142 | +// fontSize: ScreenUtil().setSp(30)), | ||
| 143 | +// ), | ||
| 144 | +// ))) | ||
| 145 | +// ], | ||
| 146 | +// ), | ||
| 147 | +// ), | ||
| 148 | +// Expanded( | ||
| 149 | +// child: Consumer<MessageModel>( | ||
| 150 | +// builder: (context, model, _) { | ||
| 151 | +// if (model.pageState != PageState.Success) { | ||
| 152 | +// return ExceptionPage( | ||
| 153 | +// pageState: model.pageState, | ||
| 154 | +// callback: () { | ||
| 155 | +// offset = 0; | ||
| 156 | +// getMessage(showLoading: true); | ||
| 157 | +// }, | ||
| 158 | +// emptyMsg: | ||
| 159 | +// "暂时没有${selectedIndex == 0 ? '未处理' : '已处理'}的在线预订消息哦", | ||
| 160 | +// emptyImg: "empty_search", | ||
| 161 | +// showMsg: "加载中,请稍后...", | ||
| 162 | +// ); | ||
| 163 | +// } else { | ||
| 164 | +// return EasyRefresh.custom( | ||
| 165 | +// controller: _controller, | ||
| 166 | +// slivers: [ | ||
| 167 | +// SliverList( | ||
| 168 | +// delegate: SliverChildBuilderDelegate( | ||
| 169 | +// (BuildContext context, int index) { | ||
| 170 | +// return MessageItem( | ||
| 171 | +// model.messages[index], | ||
| 172 | +// isTreated: selectedIndex == 1, | ||
| 173 | +// ); | ||
| 174 | +// }, childCount: model.messages.length), | ||
| 175 | +// ) | ||
| 176 | +// ], | ||
| 177 | +// onRefresh: () async { | ||
| 178 | +// offset = 0; | ||
| 179 | +// getMessage(showLoading: false); | ||
| 180 | +// }, | ||
| 181 | +// onLoad: () async { | ||
| 182 | +// offset++; | ||
| 183 | +// getMessage(showLoading: false); | ||
| 184 | +// }, | ||
| 185 | +// ); | ||
| 186 | +// } | ||
| 187 | +// }, | ||
| 188 | +// ), | ||
| 189 | +// ) | ||
| 190 | +// ], | ||
| 191 | +// ), | ||
| 192 | +// ); | ||
| 193 | +// } | ||
| 194 | +// } |
| 1 | -import 'package:common_utils/common_utils.dart'; | ||
| 2 | -import 'package:flutter/material.dart'; | ||
| 3 | -import 'package:flutter_easyrefresh/easy_refresh.dart'; | ||
| 4 | -import 'package:flutter_screenutil/screenutil.dart'; | ||
| 5 | -import 'package:one_key/constant/state.dart'; | ||
| 6 | -import 'package:one_key/pages/message/messsage_item.dart'; | ||
| 7 | -import 'package:one_key/provider/message_dialog_model.dart'; | ||
| 8 | -import 'package:one_key/provider/message_model.dart'; | ||
| 9 | -import 'package:one_key/provider/user_model.dart'; | ||
| 10 | -import 'package:one_key/res/colors.dart'; | ||
| 11 | -import 'package:one_key/utils/event_bus.dart'; | ||
| 12 | -import 'package:one_key/widgets/page_error.dart'; | ||
| 13 | -import 'package:one_key/widgets/page_exception.dart'; | ||
| 14 | -import 'package:provider/provider.dart'; | 1 | +// import 'package:common_utils/common_utils.dart'; |
| 2 | +// import 'package:flutter/material.dart'; | ||
| 3 | +// import 'package:flutter_easyrefresh/easy_refresh.dart'; | ||
| 4 | +// import 'package:flutter_screenutil/screenutil.dart'; | ||
| 5 | +// import 'package:one_key/constant/state.dart'; | ||
| 6 | +// import 'package:one_key/pages/message/messsage_item.dart'; | ||
| 7 | +// import 'package:one_key/provider/message_dialog_model.dart'; | ||
| 8 | +// import 'package:one_key/provider/message_model.dart'; | ||
| 9 | +// import 'package:one_key/provider/user_model.dart'; | ||
| 10 | +// import 'package:one_key/res/colors.dart'; | ||
| 11 | +// import 'package:one_key/utils/event_bus.dart'; | ||
| 12 | +// import 'package:one_key/widgets/page_error.dart'; | ||
| 13 | +// import 'package:one_key/widgets/page_exception.dart'; | ||
| 14 | +// import 'package:provider/provider.dart'; | ||
| 15 | 15 | ||
| 16 | -/** | ||
| 17 | - * 提前点餐消息 | ||
| 18 | - */ | ||
| 19 | -class MessageOrderPage extends StatefulWidget { | ||
| 20 | - @override | ||
| 21 | - State<StatefulWidget> createState() { | ||
| 22 | - // TODO: implement createState | ||
| 23 | - return new MessageOrderPageState(); | ||
| 24 | - } | ||
| 25 | -} | 16 | +// /** |
| 17 | +// * 提前点餐消息 | ||
| 18 | +// */ | ||
| 19 | +// class MessageOrderPage extends StatefulWidget { | ||
| 20 | +// @override | ||
| 21 | +// State<StatefulWidget> createState() { | ||
| 22 | +// // TODO: implement createState | ||
| 23 | +// return new MessageOrderPageState(); | ||
| 24 | +// } | ||
| 25 | +// } | ||
| 26 | 26 | ||
| 27 | -class MessageOrderPageState extends State<MessageOrderPage> { | ||
| 28 | - EasyRefreshController _controller; | 27 | +// class MessageOrderPageState extends State<MessageOrderPage> { |
| 28 | +// EasyRefreshController _controller; | ||
| 29 | 29 | ||
| 30 | - Color selectedColor = MyColours.color_199095; | ||
| 31 | - Color unSelectedColor = MyColours.color_999999; | 30 | +// Color selectedColor = MyColours.color_199095; |
| 31 | +// Color unSelectedColor = MyColours.color_999999; | ||
| 32 | 32 | ||
| 33 | - int selectedIndex = 0; | 33 | +// int selectedIndex = 0; |
| 34 | 34 | ||
| 35 | - int offset = 0; //当前页数 | 35 | +// int offset = 0; //当前页数 |
| 36 | 36 | ||
| 37 | - MessageModel messageModel; | ||
| 38 | - UserModel userModel; | ||
| 39 | - MessageDialogModel messageDialogModel; | 37 | +// MessageModel messageModel; |
| 38 | +// UserModel userModel; | ||
| 39 | +// MessageDialogModel messageDialogModel; | ||
| 40 | 40 | ||
| 41 | - @override | ||
| 42 | - void initState() { | ||
| 43 | - // TODO: implement initState | ||
| 44 | - super.initState(); | ||
| 45 | - _controller = EasyRefreshController(); | ||
| 46 | - // messageModel.pageState = PageState.Loading; | ||
| 47 | - WidgetsBinding.instance.addPostFrameCallback((_) { | ||
| 48 | - // getMessages(); | ||
| 49 | - // setState(() { | ||
| 50 | - // messageModel.pageState = PageState.Loading; | ||
| 51 | - // }); | ||
| 52 | - messageModel.pageState = PageState.Loading; | ||
| 53 | - messageModel.notifyListeners(); | ||
| 54 | - }); | ||
| 55 | - //从列表数据本地移除提前点餐消息 | ||
| 56 | - // bus.on("remove_untreated_message_order", (args) { | ||
| 57 | - // messageModel.removeUntreatedMessageByMid(args.toString()); | ||
| 58 | - // messageDialogModel.removeMessage(args.toString()); | ||
| 59 | - // }); | ||
| 60 | - } | 41 | +// @override |
| 42 | +// void initState() { | ||
| 43 | +// // TODO: implement initState | ||
| 44 | +// super.initState(); | ||
| 45 | +// _controller = EasyRefreshController(); | ||
| 46 | +// // messageModel.pageState = PageState.Loading; | ||
| 47 | +// WidgetsBinding.instance.addPostFrameCallback((_) { | ||
| 48 | +// // getMessages(); | ||
| 49 | +// // setState(() { | ||
| 50 | +// // messageModel.pageState = PageState.Loading; | ||
| 51 | +// // }); | ||
| 52 | +// messageModel.pageState = PageState.Loading; | ||
| 53 | +// messageModel.notifyListeners(); | ||
| 54 | +// }); | ||
| 55 | +// //从列表数据本地移除提前点餐消息 | ||
| 56 | +// // bus.on("remove_untreated_message_order", (args) { | ||
| 57 | +// // messageModel.removeUntreatedMessageByMid(args.toString()); | ||
| 58 | +// // messageDialogModel.removeMessage(args.toString()); | ||
| 59 | +// // }); | ||
| 60 | +// } | ||
| 61 | 61 | ||
| 62 | - @override | ||
| 63 | - void dispose() { | ||
| 64 | - super.dispose(); | ||
| 65 | - // bus.off("remove_untreated_message_order"); | ||
| 66 | - } | 62 | +// @override |
| 63 | +// void dispose() { | ||
| 64 | +// super.dispose(); | ||
| 65 | +// // bus.off("remove_untreated_message_order"); | ||
| 66 | +// } | ||
| 67 | 67 | ||
| 68 | - //三种分类各自的未读消息数目 | ||
| 69 | - _getUnMsgNum() async { | ||
| 70 | - Map<String, String> params = {"sid": userModel.user.sellerid}; | ||
| 71 | - await messageModel.getUnMsgNum(context, params); | ||
| 72 | - } | 68 | +// //三种分类各自的未读消息数目 |
| 69 | +// _getUnMsgNum() async { | ||
| 70 | +// Map<String, String> params = {"sid": userModel.user.sellerid}; | ||
| 71 | +// await messageModel.getUnMsgNum(context, params); | ||
| 72 | +// } | ||
| 73 | 73 | ||
| 74 | - //获取消息 | ||
| 75 | - getMessages({bool showLoading = true}) async { | ||
| 76 | - Map<String, String> params = { | ||
| 77 | - "sid": userModel.user.sellerid, | ||
| 78 | - "type_id": "1", //1提前点餐2内部预订10在线预订 | ||
| 79 | - "status": selectedIndex.toString(), | ||
| 80 | - "offset": offset.toString(), | ||
| 81 | - "limit": "20", | ||
| 82 | - }; | ||
| 83 | - await messageModel.getMessages(context, params, showLoading: showLoading); | ||
| 84 | - _getUnMsgNum(); | ||
| 85 | - } | 74 | +// //获取消息 |
| 75 | +// getMessages({bool showLoading = true}) async { | ||
| 76 | +// Map<String, String> params = { | ||
| 77 | +// "sid": userModel.user.sellerid, | ||
| 78 | +// "type_id": "1", //1提前点餐2内部预订10在线预订 | ||
| 79 | +// "status": selectedIndex.toString(), | ||
| 80 | +// "offset": offset.toString(), | ||
| 81 | +// "limit": "20", | ||
| 82 | +// }; | ||
| 83 | +// await messageModel.getMessages(context, params, showLoading: showLoading); | ||
| 84 | +// _getUnMsgNum(); | ||
| 85 | +// } | ||
| 86 | 86 | ||
| 87 | - @override | ||
| 88 | - Widget build(BuildContext context) { | ||
| 89 | - // TODO: implement build | ||
| 90 | - messageModel = Provider.of<MessageModel>(context, listen: true); | ||
| 91 | - userModel = Provider.of<UserModel>(context, listen: false); | ||
| 92 | - messageDialogModel = | ||
| 93 | - Provider.of<MessageDialogModel>(context, listen: false); | ||
| 94 | - return Container( | ||
| 95 | - color: MyColours.color_f5f5f5, | ||
| 96 | - child: Column( | ||
| 97 | - children: [ | ||
| 98 | - Container( | ||
| 99 | - width: double.infinity, | ||
| 100 | - height: ScreenUtil().setWidth(84), | ||
| 101 | - color: MyColours.color_ffffff, | ||
| 102 | - child: Row( | ||
| 103 | - children: [ | ||
| 104 | - Expanded( | ||
| 105 | - child: GestureDetector( | ||
| 106 | - behavior: HitTestBehavior.opaque, | ||
| 107 | - onTap: () { | ||
| 108 | - if (selectedIndex == 0) return; | ||
| 109 | - setState(() { | ||
| 110 | - selectedIndex = 0; | ||
| 111 | - messageModel.messages = []; | ||
| 112 | - }); | ||
| 113 | - getMessages(); | ||
| 114 | - }, | ||
| 115 | - child: Center( | ||
| 116 | - child: Text( | ||
| 117 | - "未处理", | ||
| 118 | - style: TextStyle( | ||
| 119 | - color: selectedIndex == 0 | ||
| 120 | - ? selectedColor | ||
| 121 | - : unSelectedColor, | ||
| 122 | - fontSize: ScreenUtil().setSp(30)), | ||
| 123 | - ), | ||
| 124 | - ))), | ||
| 125 | - Expanded( | ||
| 126 | - child: GestureDetector( | ||
| 127 | - behavior: HitTestBehavior.opaque, | ||
| 128 | - onTap: () { | ||
| 129 | - if (selectedIndex == 1) return; | ||
| 130 | - setState(() { | ||
| 131 | - selectedIndex = 1; | ||
| 132 | - messageModel.messages = []; | ||
| 133 | - }); | ||
| 134 | - getMessages(); | ||
| 135 | - }, | ||
| 136 | - child: Center( | ||
| 137 | - child: Text( | ||
| 138 | - "已处理", | ||
| 139 | - style: TextStyle( | ||
| 140 | - color: selectedIndex == 1 | ||
| 141 | - ? selectedColor | ||
| 142 | - : unSelectedColor, | ||
| 143 | - fontSize: ScreenUtil().setSp(30)), | ||
| 144 | - ), | ||
| 145 | - ))) | ||
| 146 | - ], | ||
| 147 | - ), | ||
| 148 | - ), | ||
| 149 | - Expanded( | ||
| 150 | - child: Consumer<MessageModel>( | ||
| 151 | - builder: (context, model, _) { | ||
| 152 | - if (model.pageState != PageState.Success) { | ||
| 153 | - return ExceptionPage( | ||
| 154 | - pageState: model.pageState, | ||
| 155 | - callback: () { | ||
| 156 | - offset = 0; | ||
| 157 | - getMessages(); | ||
| 158 | - }, | ||
| 159 | - emptyMsg: | ||
| 160 | - "暂时没有${selectedIndex == 0 ? '未处理' : '已处理'}的提前点餐消息哦", | ||
| 161 | - emptyImg: "empty_search", | ||
| 162 | - showMsg: "加载中,请稍后...", | ||
| 163 | - ); | ||
| 164 | - } else { | ||
| 165 | - return EasyRefresh.custom( | ||
| 166 | - controller: _controller, | ||
| 167 | - slivers: [ | ||
| 168 | - SliverList( | ||
| 169 | - delegate: SliverChildBuilderDelegate( | ||
| 170 | - (BuildContext context, int index) { | ||
| 171 | - return MessageItem(model.messages[index], | ||
| 172 | - isTreated: selectedIndex == 1); | ||
| 173 | - }, childCount: model.messages.length), | ||
| 174 | - ) | ||
| 175 | - ], | ||
| 176 | - onRefresh: () async { | ||
| 177 | - offset = 0; | ||
| 178 | - getMessages(showLoading: false); | ||
| 179 | - }, | ||
| 180 | - onLoad: () async { | ||
| 181 | - offset++; | ||
| 182 | - getMessages(showLoading: false); | ||
| 183 | - }, | ||
| 184 | - ); | ||
| 185 | - } | ||
| 186 | - }, | ||
| 187 | - ), | ||
| 188 | - ) | ||
| 189 | - ], | ||
| 190 | - ), | ||
| 191 | - ); | ||
| 192 | - } | ||
| 193 | -} | 87 | +// @override |
| 88 | +// Widget build(BuildContext context) { | ||
| 89 | +// // TODO: implement build | ||
| 90 | +// messageModel = Provider.of<MessageModel>(context, listen: true); | ||
| 91 | +// userModel = Provider.of<UserModel>(context, listen: false); | ||
| 92 | +// messageDialogModel = | ||
| 93 | +// Provider.of<MessageDialogModel>(context, listen: false); | ||
| 94 | +// return Container( | ||
| 95 | +// color: MyColours.color_f5f5f5, | ||
| 96 | +// child: Column( | ||
| 97 | +// children: [ | ||
| 98 | +// Container( | ||
| 99 | +// width: double.infinity, | ||
| 100 | +// height: ScreenUtil().setWidth(84), | ||
| 101 | +// color: MyColours.color_ffffff, | ||
| 102 | +// child: Row( | ||
| 103 | +// children: [ | ||
| 104 | +// Expanded( | ||
| 105 | +// child: GestureDetector( | ||
| 106 | +// behavior: HitTestBehavior.opaque, | ||
| 107 | +// onTap: () { | ||
| 108 | +// if (selectedIndex == 0) return; | ||
| 109 | +// setState(() { | ||
| 110 | +// selectedIndex = 0; | ||
| 111 | +// messageModel.messages = []; | ||
| 112 | +// }); | ||
| 113 | +// getMessages(); | ||
| 114 | +// }, | ||
| 115 | +// child: Center( | ||
| 116 | +// child: Text( | ||
| 117 | +// "未处理", | ||
| 118 | +// style: TextStyle( | ||
| 119 | +// color: selectedIndex == 0 | ||
| 120 | +// ? selectedColor | ||
| 121 | +// : unSelectedColor, | ||
| 122 | +// fontSize: ScreenUtil().setSp(30)), | ||
| 123 | +// ), | ||
| 124 | +// ))), | ||
| 125 | +// Expanded( | ||
| 126 | +// child: GestureDetector( | ||
| 127 | +// behavior: HitTestBehavior.opaque, | ||
| 128 | +// onTap: () { | ||
| 129 | +// if (selectedIndex == 1) return; | ||
| 130 | +// setState(() { | ||
| 131 | +// selectedIndex = 1; | ||
| 132 | +// messageModel.messages = []; | ||
| 133 | +// }); | ||
| 134 | +// getMessages(); | ||
| 135 | +// }, | ||
| 136 | +// child: Center( | ||
| 137 | +// child: Text( | ||
| 138 | +// "已处理", | ||
| 139 | +// style: TextStyle( | ||
| 140 | +// color: selectedIndex == 1 | ||
| 141 | +// ? selectedColor | ||
| 142 | +// : unSelectedColor, | ||
| 143 | +// fontSize: ScreenUtil().setSp(30)), | ||
| 144 | +// ), | ||
| 145 | +// ))) | ||
| 146 | +// ], | ||
| 147 | +// ), | ||
| 148 | +// ), | ||
| 149 | +// Expanded( | ||
| 150 | +// child: Consumer<MessageModel>( | ||
| 151 | +// builder: (context, model, _) { | ||
| 152 | +// if (model.pageState != PageState.Success) { | ||
| 153 | +// return ExceptionPage( | ||
| 154 | +// pageState: model.pageState, | ||
| 155 | +// callback: () { | ||
| 156 | +// offset = 0; | ||
| 157 | +// getMessages(); | ||
| 158 | +// }, | ||
| 159 | +// emptyMsg: | ||
| 160 | +// "暂时没有${selectedIndex == 0 ? '未处理' : '已处理'}的提前点餐消息哦", | ||
| 161 | +// emptyImg: "empty_search", | ||
| 162 | +// showMsg: "加载中,请稍后...", | ||
| 163 | +// ); | ||
| 164 | +// } else { | ||
| 165 | +// return EasyRefresh.custom( | ||
| 166 | +// controller: _controller, | ||
| 167 | +// slivers: [ | ||
| 168 | +// SliverList( | ||
| 169 | +// delegate: SliverChildBuilderDelegate( | ||
| 170 | +// (BuildContext context, int index) { | ||
| 171 | +// return MessageItem(model.messages[index], | ||
| 172 | +// isTreated: selectedIndex == 1); | ||
| 173 | +// }, childCount: model.messages.length), | ||
| 174 | +// ) | ||
| 175 | +// ], | ||
| 176 | +// onRefresh: () async { | ||
| 177 | +// offset = 0; | ||
| 178 | +// getMessages(showLoading: false); | ||
| 179 | +// }, | ||
| 180 | +// onLoad: () async { | ||
| 181 | +// offset++; | ||
| 182 | +// getMessages(showLoading: false); | ||
| 183 | +// }, | ||
| 184 | +// ); | ||
| 185 | +// } | ||
| 186 | +// }, | ||
| 187 | +// ), | ||
| 188 | +// ) | ||
| 189 | +// ], | ||
| 190 | +// ), | ||
| 191 | +// ); | ||
| 192 | +// } | ||
| 193 | +// } |
| @@ -68,8 +68,16 @@ class MessagePageState extends State<MessagePage> | @@ -68,8 +68,16 @@ class MessagePageState extends State<MessagePage> | ||
| 68 | //三种分类各自的未读消息数目 | 68 | //三种分类各自的未读消息数目 |
| 69 | _getUnMsgNum() async { | 69 | _getUnMsgNum() async { |
| 70 | if (mounted) { | 70 | if (mounted) { |
| 71 | - Map<String, String> params = {"sid": userModel.user.sellerid}; | ||
| 72 | - await messageModel.getUnMsgNum(context, params); | 71 | + Map<String, String> params = { |
| 72 | + "sid": userModel.user.sellerid, | ||
| 73 | + // "type_id": "10", //1提前点餐2内部预订10在线预订 | ||
| 74 | + // "status": '0', | ||
| 75 | + "offset": '0', | ||
| 76 | + "limit": "20", | ||
| 77 | + }; | ||
| 78 | + | ||
| 79 | + await messageModel.getNewGetUntreatedMsgList(context, params, | ||
| 80 | + showLoading: false); | ||
| 73 | } | 81 | } |
| 74 | } | 82 | } |
| 75 | 83 | ||
| @@ -176,26 +184,24 @@ class MessagePageState extends State<MessagePage> | @@ -176,26 +184,24 @@ class MessagePageState extends State<MessagePage> | ||
| 176 | ? ScreenUtil().setSp(32) | 184 | ? ScreenUtil().setSp(32) |
| 177 | : ScreenUtil().setSp(24), | 185 | : ScreenUtil().setSp(24), |
| 178 | )), | 186 | )), |
| 179 | - Offstage( | ||
| 180 | - offstage: false, | ||
| 181 | - child: Container( | ||
| 182 | - width: ScreenUtil().setWidth(36), | ||
| 183 | - height: ScreenUtil().setWidth(36), | ||
| 184 | - margin: EdgeInsets.only( | ||
| 185 | - left: ScreenUtil().setWidth(20)), | ||
| 186 | - decoration: BoxDecoration( | ||
| 187 | - borderRadius: BorderRadius.circular( | ||
| 188 | - ScreenUtil().setWidth(36)), | ||
| 189 | - color: true | ||
| 190 | - ? MyColours.color_E34D59 | ||
| 191 | - : MyColours.color_ffffff), | ||
| 192 | - alignment: Alignment.center, | ||
| 193 | - child: Text("5", | ||
| 194 | - style: TextStyle( | ||
| 195 | - color: MyColours.color_ffffff, | ||
| 196 | - fontSize: ScreenUtil().setSp(28), | ||
| 197 | - )), | ||
| 198 | - )), | 187 | + messageModel.allUnNum > 0 |
| 188 | + ? Container( | ||
| 189 | + width: ScreenUtil().setWidth(36), | ||
| 190 | + height: ScreenUtil().setWidth(36), | ||
| 191 | + margin: EdgeInsets.only( | ||
| 192 | + left: ScreenUtil().setWidth(20)), | ||
| 193 | + decoration: BoxDecoration( | ||
| 194 | + borderRadius: BorderRadius.circular( | ||
| 195 | + ScreenUtil().setWidth(36)), | ||
| 196 | + color: MyColours.color_E34D59), | ||
| 197 | + alignment: Alignment.center, | ||
| 198 | + child: Text("${messageModel.allUnNum}", | ||
| 199 | + style: TextStyle( | ||
| 200 | + color: MyColours.color_ffffff, | ||
| 201 | + fontSize: ScreenUtil().setSp(28), | ||
| 202 | + )), | ||
| 203 | + ) | ||
| 204 | + : SizedBox(), | ||
| 199 | ], | 205 | ], |
| 200 | ), | 206 | ), |
| 201 | ), | 207 | ), |
| @@ -97,11 +97,13 @@ class MessageTreatedPageState extends State<MessageTreatedPage> { | @@ -97,11 +97,13 @@ class MessageTreatedPageState extends State<MessageTreatedPage> { | ||
| 97 | getMessage(String typeid, {bool showLoading = true}) async { | 97 | getMessage(String typeid, {bool showLoading = true}) async { |
| 98 | Map<String, String> params = { | 98 | Map<String, String> params = { |
| 99 | "sid": userModel.user.sellerid, | 99 | "sid": userModel.user.sellerid, |
| 100 | - "type_id": typeid, //1提前点餐2内部预订10在线预订店/内消息传15 | ||
| 101 | "status": '1', | 100 | "status": '1', |
| 102 | "offset": offset.toString(), | 101 | "offset": offset.toString(), |
| 103 | "limit": "20", | 102 | "limit": "20", |
| 104 | }; | 103 | }; |
| 104 | + if (typeid != '') { | ||
| 105 | + params['type_id'] = typeid; //1提前点餐/2内部预订/10在线预订/店内消息传15 | ||
| 106 | + } | ||
| 105 | 107 | ||
| 106 | await messageModel.getMessages(context, params, showLoading: showLoading); | 108 | await messageModel.getMessages(context, params, showLoading: showLoading); |
| 107 | _getUnMsgNum(); | 109 | _getUnMsgNum(); |
| @@ -145,6 +147,7 @@ class MessageTreatedPageState extends State<MessageTreatedPage> { | @@ -145,6 +147,7 @@ class MessageTreatedPageState extends State<MessageTreatedPage> { | ||
| 145 | // 1提前点餐/2内部预订/10在线预订/15店内消息传/12在线买单 | 147 | // 1提前点餐/2内部预订/10在线预订/15店内消息传/12在线买单 |
| 146 | 148 | ||
| 147 | if (index == 0) { | 149 | if (index == 0) { |
| 150 | + typeid = ''; | ||
| 148 | } else if (index == 1) { | 151 | } else if (index == 1) { |
| 149 | //店内消息 | 152 | //店内消息 |
| 150 | typeid = '15'; | 153 | typeid = '15'; |
| @@ -3,6 +3,7 @@ import 'package:flutter_easyrefresh/easy_refresh.dart'; | @@ -3,6 +3,7 @@ import 'package:flutter_easyrefresh/easy_refresh.dart'; | ||
| 3 | import 'package:flutter_screenutil/flutter_screenutil.dart'; | 3 | import 'package:flutter_screenutil/flutter_screenutil.dart'; |
| 4 | import 'package:one_key/constant/state.dart'; | 4 | import 'package:one_key/constant/state.dart'; |
| 5 | import 'package:one_key/models/message.dart'; | 5 | import 'package:one_key/models/message.dart'; |
| 6 | +import 'package:one_key/models/new_unmessage_model.dart'; | ||
| 6 | import 'package:one_key/pages/message/message_item_f.dart'; | 7 | import 'package:one_key/pages/message/message_item_f.dart'; |
| 7 | import 'package:one_key/pages/message/messsage_item.dart'; | 8 | import 'package:one_key/pages/message/messsage_item.dart'; |
| 8 | import 'package:one_key/provider/message_dialog_model.dart'; | 9 | import 'package:one_key/provider/message_dialog_model.dart'; |
| @@ -66,30 +67,30 @@ class MessageUntreatedPageState extends State<MessageUntreatedPage> { | @@ -66,30 +67,30 @@ class MessageUntreatedPageState extends State<MessageUntreatedPage> { | ||
| 66 | // bus.off("remove_untreated_message"); | 67 | // bus.off("remove_untreated_message"); |
| 67 | } | 68 | } |
| 68 | 69 | ||
| 69 | - //三种分类各自的未读消息数目 | ||
| 70 | - _getUnMsgNum() async { | ||
| 71 | - Map<String, String> params = {"sid": userModel.user.sellerid}; | ||
| 72 | - await messageModel.getUnMsgNum(context, params); | ||
| 73 | - } | 70 | + // //三种分类各自的未读消息数目 |
| 71 | + // _getUnMsgNum() async { | ||
| 72 | + // Map<String, String> params = {"sid": userModel.user.sellerid}; | ||
| 73 | + // await messageModel.getUnMsgNum(context, params); | ||
| 74 | + // } | ||
| 74 | 75 | ||
| 75 | //获取在线预订消息status 0未处理 1已处理 | 76 | //获取在线预订消息status 0未处理 1已处理 |
| 76 | getMessage({bool showLoading = true}) async { | 77 | getMessage({bool showLoading = true}) async { |
| 77 | Map<String, String> params = { | 78 | Map<String, String> params = { |
| 78 | "sid": userModel.user.sellerid, | 79 | "sid": userModel.user.sellerid, |
| 79 | - "type_id": "10", //1提前点餐2内部预订10在线预订 | ||
| 80 | - "status": '0', | 80 | + // "type_id": "10", //1提前点餐2内部预订10在线预订 |
| 81 | + // "status": '0', | ||
| 81 | "offset": offset.toString(), | 82 | "offset": offset.toString(), |
| 82 | - "limit": "20", | 83 | + "limit": "1000", |
| 83 | }; | 84 | }; |
| 84 | 85 | ||
| 85 | - await messageModel.getMessages(context, params, showLoading: showLoading); | 86 | + await messageModel.getNewGetUntreatedMsgList(context, params, showLoading: showLoading); |
| 86 | _cancelMessage(); | 87 | _cancelMessage(); |
| 87 | - _getUnMsgNum(); | 88 | + // _getUnMsgNum(); |
| 88 | } | 89 | } |
| 89 | 90 | ||
| 90 | _cancelMessage() async { | 91 | _cancelMessage() async { |
| 91 | String messageids = ''; //超过24小时 | 92 | String messageids = ''; //超过24小时 |
| 92 | - for (Message item in messageModel.messages) { | 93 | + for (NewUnmessage item in messageModel.messages) { |
| 93 | if (item.message_type == '11') { | 94 | if (item.message_type == '11') { |
| 94 | DateTime cdate = DateTime.fromMillisecondsSinceEpoch( | 95 | DateTime cdate = DateTime.fromMillisecondsSinceEpoch( |
| 95 | int.parse(item.cdate.toString()) * 1000); | 96 | int.parse(item.cdate.toString()) * 1000); |
| @@ -145,7 +146,7 @@ class MessageUntreatedPageState extends State<MessageUntreatedPage> { | @@ -145,7 +146,7 @@ class MessageUntreatedPageState extends State<MessageUntreatedPage> { | ||
| 145 | SliverList( | 146 | SliverList( |
| 146 | delegate: SliverChildBuilderDelegate( | 147 | delegate: SliverChildBuilderDelegate( |
| 147 | (BuildContext context, int index) { | 148 | (BuildContext context, int index) { |
| 148 | - Message message = model.messages[index]; | 149 | + NewUnmessage message = model.messages[index]; |
| 149 | if (message.message_type == "10") { | 150 | if (message.message_type == "10") { |
| 150 | // titleText = "在线预订"; | 151 | // titleText = "在线预订"; |
| 151 | 152 |
| @@ -43,6 +43,7 @@ class _RoomTypeCreatePageState extends State<RoomTypeCreatePage> { | @@ -43,6 +43,7 @@ class _RoomTypeCreatePageState extends State<RoomTypeCreatePage> { | ||
| 43 | StoreDetailModel detailModel; | 43 | StoreDetailModel detailModel; |
| 44 | int selectIndex = 0; | 44 | int selectIndex = 0; |
| 45 | String selectNum = '0'; | 45 | String selectNum = '0'; |
| 46 | + String tableListStr = ''; | ||
| 46 | 47 | ||
| 47 | @override | 48 | @override |
| 48 | void initState() { | 49 | void initState() { |
| @@ -70,8 +71,9 @@ class _RoomTypeCreatePageState extends State<RoomTypeCreatePage> { | @@ -70,8 +71,9 @@ class _RoomTypeCreatePageState extends State<RoomTypeCreatePage> { | ||
| 70 | 71 | ||
| 71 | sunModel.status == '1' ? swichState = true : swichState = false; | 72 | sunModel.status == '1' ? swichState = true : swichState = false; |
| 72 | tableListSel = sunModel.tableid != null ? sunModel.tableid : ''; | 73 | tableListSel = sunModel.tableid != null ? sunModel.tableid : ''; |
| 73 | - selectNum = sunModel.surplus; | 74 | + selectNum = sunModel.surplus ?? '0'; |
| 74 | List<String> numList = []; | 75 | List<String> numList = []; |
| 76 | + tableListStr = tableListSel; | ||
| 75 | for (int i = 0; i < tableListSel.split(',').length; i++) { | 77 | for (int i = 0; i < tableListSel.split(',').length; i++) { |
| 76 | numList.add('$i'); | 78 | numList.add('$i'); |
| 77 | } | 79 | } |
| @@ -102,7 +104,10 @@ class _RoomTypeCreatePageState extends State<RoomTypeCreatePage> { | @@ -102,7 +104,10 @@ class _RoomTypeCreatePageState extends State<RoomTypeCreatePage> { | ||
| 102 | if (widget.tableClassId != 'null') { | 104 | if (widget.tableClassId != 'null') { |
| 103 | params['id'] = widget.tableClassId; | 105 | params['id'] = widget.tableClassId; |
| 104 | } | 106 | } |
| 105 | - if (tableListSel.split(',').length > 0) { | 107 | + UserModel userModel = Provider.of<UserModel>(context, listen: false); |
| 108 | + if ((userModel.user.role_name == '管理员' || | ||
| 109 | + userModel.user.role_name == '店长') && | ||
| 110 | + tableListSel.split(',').length > 0) { | ||
| 106 | params['surplus'] = selectNum; | 111 | params['surplus'] = selectNum; |
| 107 | } | 112 | } |
| 108 | 113 | ||
| @@ -252,6 +257,7 @@ class _RoomTypeCreatePageState extends State<RoomTypeCreatePage> { | @@ -252,6 +257,7 @@ class _RoomTypeCreatePageState extends State<RoomTypeCreatePage> { | ||
| 252 | @override | 257 | @override |
| 253 | Widget build(BuildContext context) { | 258 | Widget build(BuildContext context) { |
| 254 | detailModel = Provider.of<StoreDetailModel>(context, listen: true); | 259 | detailModel = Provider.of<StoreDetailModel>(context, listen: true); |
| 260 | + UserModel userModel = Provider.of<UserModel>(context, listen: false); | ||
| 255 | return Material( | 261 | return Material( |
| 256 | child: InkWell( | 262 | child: InkWell( |
| 257 | onTap: () { | 263 | onTap: () { |
| @@ -424,6 +430,7 @@ class _RoomTypeCreatePageState extends State<RoomTypeCreatePage> { | @@ -424,6 +430,7 @@ class _RoomTypeCreatePageState extends State<RoomTypeCreatePage> { | ||
| 424 | canChoose: true, | 430 | canChoose: true, |
| 425 | fromPage: 'room_manage', | 431 | fromPage: 'room_manage', |
| 426 | object: tableListSel, | 432 | object: tableListSel, |
| 433 | + oldobject:tableListStr | ||
| 427 | ); | 434 | ); |
| 428 | if (temp != null) { | 435 | if (temp != null) { |
| 429 | print(temp['tid']); | 436 | print(temp['tid']); |
| @@ -444,81 +451,96 @@ class _RoomTypeCreatePageState extends State<RoomTypeCreatePage> { | @@ -444,81 +451,96 @@ class _RoomTypeCreatePageState extends State<RoomTypeCreatePage> { | ||
| 444 | right: ScreenUtil().setWidth(40)), | 451 | right: ScreenUtil().setWidth(40)), |
| 445 | ), | 452 | ), |
| 446 | VEmptyView(10), | 453 | VEmptyView(10), |
| 447 | - tableListSel.split(',').length == 0 | ||
| 448 | - ? SizedBox() | ||
| 449 | - : Padding( | ||
| 450 | - padding: EdgeInsets.symmetric( | ||
| 451 | - horizontal: ScreenUtil().setWidth(40), | ||
| 452 | - vertical: ScreenUtil().setWidth(40), | ||
| 453 | - ), | ||
| 454 | - child: _select('核实通知', '当剩余 $selectNum 间时', | ||
| 455 | - textColor: MyColours.color_000000, | ||
| 456 | - ontap: () async { | ||
| 457 | - List<String> numList = []; | ||
| 458 | - for (int i = 0; | ||
| 459 | - i < tableListSel.split(',').length; | ||
| 460 | - i++) { | ||
| 461 | - numList.add('$i'); | ||
| 462 | - } | ||
| 463 | - DialogUtil.showSelectCusmanDialog( | ||
| 464 | - context, numList, (value) async { | ||
| 465 | - if (value != null) { | ||
| 466 | - selectIndex = value.first; | ||
| 467 | - selectNum = numList[value.first]; | ||
| 468 | - setState(() {}); | 454 | + userModel.user.role_name == '管理员' || |
| 455 | + userModel.user.role_name == '店长' | ||
| 456 | + ? tableListSel.split(',').length == 0 | ||
| 457 | + ? SizedBox() | ||
| 458 | + : Padding( | ||
| 459 | + padding: EdgeInsets.symmetric( | ||
| 460 | + horizontal: ScreenUtil().setWidth(40), | ||
| 461 | + vertical: ScreenUtil().setWidth(40), | ||
| 462 | + ), | ||
| 463 | + child: _select( | ||
| 464 | + '核实通知', '当剩余 $selectNum 间时', | ||
| 465 | + textColor: MyColours.color_000000, | ||
| 466 | + ontap: () async { | ||
| 467 | + List<String> numList = []; | ||
| 468 | + for (int i = 0; | ||
| 469 | + i < | ||
| 470 | + tableListSel | ||
| 471 | + .split(',') | ||
| 472 | + .length; | ||
| 473 | + i++) { | ||
| 474 | + numList.add('$i'); | ||
| 475 | + } | ||
| 476 | + DialogUtil.showSelectCusmanDialog( | ||
| 477 | + context, numList, | ||
| 478 | + (value) async { | ||
| 479 | + if (value != null) { | ||
| 480 | + selectIndex = value.first; | ||
| 481 | + selectNum = numList[value.first]; | ||
| 482 | + setState(() {}); | ||
| 469 | 483 | ||
| 470 | - // bool sucess = | ||
| 471 | - // await detailModel.upReserveInfo( | ||
| 472 | - // context, widget.rid, | ||
| 473 | - // actualPum: | ||
| 474 | - // detailModel.selectNum); | 484 | + // bool sucess = |
| 485 | + // await detailModel.upReserveInfo( | ||
| 486 | + // context, widget.rid, | ||
| 487 | + // actualPum: | ||
| 488 | + // detailModel.selectNum); | ||
| 475 | 489 | ||
| 476 | - // if (sucess) { | ||
| 477 | - // EventBus().emit( | ||
| 478 | - // "refresh_tablemanager"); //刷新桌位 | ||
| 479 | - // await _getReserveDetail( | ||
| 480 | - // showCicle: false); | ||
| 481 | - // } | ||
| 482 | - } | ||
| 483 | - }, | ||
| 484 | - selecteds: selectIndex == null | ||
| 485 | - ? [] | ||
| 486 | - : [selectIndex]) | ||
| 487 | - .then((value) {}); | ||
| 488 | - })), | ||
| 489 | - tableListSel.split(',').length == 0 | ||
| 490 | - ? SizedBox() | ||
| 491 | - : Padding( | ||
| 492 | - padding: EdgeInsets.symmetric( | ||
| 493 | - horizontal: ScreenUtil().setWidth(38)), | ||
| 494 | - child: Row( | ||
| 495 | - crossAxisAlignment: | ||
| 496 | - CrossAxisAlignment.start, | ||
| 497 | - children: [ | ||
| 498 | - Image.asset( | ||
| 499 | - Utils.getImgPath('error-circle'), | ||
| 500 | - width: ScreenUtil().setWidth(40)), | ||
| 501 | - HEmptyView(20), | ||
| 502 | - Flexible( | ||
| 503 | - child: Transform.translate( | ||
| 504 | - offset: Offset( | ||
| 505 | - 0, | ||
| 506 | - 0.3 / | ||
| 507 | - 2), //1为 StrutStyle 的 leading的值 | ||
| 508 | - child: Text( | ||
| 509 | - '给员工发送核实通知,核实顾客是否如约到店,如不能,及时释放包间', | ||
| 510 | - style: TextStyle( | ||
| 511 | - color: MyColours.color_438E93, | ||
| 512 | - fontSize: ScreenUtil().setSp(24), | ||
| 513 | - ), | ||
| 514 | - strutStyle: StrutStyle( | ||
| 515 | - forceStrutHeight: true, | ||
| 516 | - height: 1, | ||
| 517 | - leading: 0.3), | ||
| 518 | - ), | 490 | + // if (sucess) { |
| 491 | + // EventBus().emit( | ||
| 492 | + // "refresh_tablemanager"); //刷新桌位 | ||
| 493 | + // await _getReserveDetail( | ||
| 494 | + // showCicle: false); | ||
| 495 | + // } | ||
| 496 | + } | ||
| 497 | + }, | ||
| 498 | + selecteds: selectIndex == null | ||
| 499 | + ? [] | ||
| 500 | + : [selectIndex]) | ||
| 501 | + .then((value) {}); | ||
| 502 | + })) | ||
| 503 | + : SizedBox(), | ||
| 504 | + userModel.user.role_name == '管理员' || | ||
| 505 | + userModel.user.role_name == '店长' | ||
| 506 | + ? tableListSel.split(',').length == 0 | ||
| 507 | + ? SizedBox() | ||
| 508 | + : Padding( | ||
| 509 | + padding: EdgeInsets.symmetric( | ||
| 510 | + horizontal: | ||
| 511 | + ScreenUtil().setWidth(38)), | ||
| 512 | + child: Row( | ||
| 513 | + crossAxisAlignment: | ||
| 514 | + CrossAxisAlignment.start, | ||
| 515 | + children: [ | ||
| 516 | + Image.asset( | ||
| 517 | + Utils.getImgPath( | ||
| 518 | + 'error-circle'), | ||
| 519 | + width: | ||
| 520 | + ScreenUtil().setWidth(40)), | ||
| 521 | + HEmptyView(20), | ||
| 522 | + Flexible( | ||
| 523 | + child: Transform.translate( | ||
| 524 | + offset: Offset( | ||
| 525 | + 0, | ||
| 526 | + 0.3 / | ||
| 527 | + 2), //1为 StrutStyle 的 leading的值 | ||
| 528 | + child: Text( | ||
| 529 | + '给员工发送核实通知,核实顾客是否如约到店,如不能,及时释放包间', | ||
| 530 | + style: TextStyle( | ||
| 531 | + color: MyColours.color_438E93, | ||
| 532 | + fontSize: | ||
| 533 | + ScreenUtil().setSp(24), | ||
| 534 | + ), | ||
| 535 | + strutStyle: StrutStyle( | ||
| 536 | + forceStrutHeight: true, | ||
| 537 | + height: 1, | ||
| 538 | + leading: 0.3), | ||
| 539 | + ), | ||
| 540 | + )) | ||
| 541 | + ], | ||
| 519 | )) | 542 | )) |
| 520 | - ], | ||
| 521 | - )) | 543 | + : SizedBox() |
| 522 | ], | 544 | ], |
| 523 | )), | 545 | )), |
| 524 | ), | 546 | ), |
| @@ -34,8 +34,14 @@ class RoomTypeSelectTablePage extends StatefulWidget { | @@ -34,8 +34,14 @@ class RoomTypeSelectTablePage extends StatefulWidget { | ||
| 34 | final String fromPage; | 34 | final String fromPage; |
| 35 | final String tid; | 35 | final String tid; |
| 36 | 36 | ||
| 37 | + final List<String> oldobjectList; | ||
| 38 | + | ||
| 37 | RoomTypeSelectTablePage(this.rid, this.dateTime, this.ddate_slot, | 39 | RoomTypeSelectTablePage(this.rid, this.dateTime, this.ddate_slot, |
| 38 | - {this.canChoose = false, this.tableList, this.fromPage, this.tid}); | 40 | + {this.canChoose = false, |
| 41 | + this.tableList, | ||
| 42 | + this.fromPage, | ||
| 43 | + this.tid, | ||
| 44 | + this.oldobjectList}); | ||
| 39 | 45 | ||
| 40 | @override | 46 | @override |
| 41 | State<StatefulWidget> createState() { | 47 | State<StatefulWidget> createState() { |
| @@ -61,6 +67,8 @@ class RoomTypeSelectTablePageState extends State<RoomTypeSelectTablePage> { | @@ -61,6 +67,8 @@ class RoomTypeSelectTablePageState extends State<RoomTypeSelectTablePage> { | ||
| 61 | 67 | ||
| 62 | int selectNum = 0; | 68 | int selectNum = 0; |
| 63 | 69 | ||
| 70 | + List<t.Table> selectTablesTemp = []; //选择的桌位 包间管理桌子 | ||
| 71 | + | ||
| 64 | @override | 72 | @override |
| 65 | void initState() { | 73 | void initState() { |
| 66 | // TODO: implement initState | 74 | // TODO: implement initState |
| @@ -88,6 +96,7 @@ class RoomTypeSelectTablePageState extends State<RoomTypeSelectTablePage> { | @@ -88,6 +96,7 @@ class RoomTypeSelectTablePageState extends State<RoomTypeSelectTablePage> { | ||
| 88 | if (item.id == tid) { | 96 | if (item.id == tid) { |
| 89 | item.selected = true; | 97 | item.selected = true; |
| 90 | selectNum++; | 98 | selectNum++; |
| 99 | + | ||
| 91 | // if (!tableList.contains(item)) { | 100 | // if (!tableList.contains(item)) { |
| 92 | // tableList.add(item); | 101 | // tableList.add(item); |
| 93 | // } | 102 | // } |
| @@ -295,31 +304,33 @@ class RoomTypeSelectTablePageState extends State<RoomTypeSelectTablePage> { | @@ -295,31 +304,33 @@ class RoomTypeSelectTablePageState extends State<RoomTypeSelectTablePage> { | ||
| 295 | childAspectRatio: 8 / 9), | 304 | childAspectRatio: 8 / 9), |
| 296 | itemBuilder: (context, index) { | 305 | itemBuilder: (context, index) { |
| 297 | return TableItem( | 306 | return TableItem( |
| 298 | - areaTableMap[currentArea][index], | ||
| 299 | - need: false, | ||
| 300 | - onSelected: (t.Table table) { | ||
| 301 | - if ((table as t.Table).selected) { | ||
| 302 | - selectTables.add(table); | 307 | + areaTableMap[currentArea][index], |
| 308 | + need: false, | ||
| 309 | + onSelected: (t.Table table) { | ||
| 310 | + if ((table as t.Table).selected) { | ||
| 311 | + selectTables.add(table); | ||
| 303 | 312 | ||
| 304 | - selectNum++; | 313 | + selectNum++; |
| 305 | 314 | ||
| 306 | - widget.tableList | ||
| 307 | - .add(tableToTableList(table).id); | ||
| 308 | - } else { | ||
| 309 | - widget.tableList | ||
| 310 | - .removeWhere((t) => t == table.id); | 315 | + widget.tableList |
| 316 | + .add(tableToTableList(table).id); | ||
| 317 | + } else { | ||
| 318 | + widget.tableList.removeWhere( | ||
| 319 | + (t) => t == table.id); | ||
| 311 | 320 | ||
| 312 | - selectNum--; | 321 | + selectNum--; |
| 313 | 322 | ||
| 314 | - selectTables.removeWhere( | ||
| 315 | - (t) => t.id == table.id); | ||
| 316 | - } | ||
| 317 | - setState(() {}); | ||
| 318 | - }, | ||
| 319 | - canSelected: true, | ||
| 320 | - fromPage: widget.fromPage, | ||
| 321 | - tableMap: tableMap, | ||
| 322 | - rid: widget.rid); | 323 | + selectTables.removeWhere( |
| 324 | + (t) => t.id == table.id); | ||
| 325 | + } | ||
| 326 | + setState(() {}); | ||
| 327 | + }, | ||
| 328 | + canSelected: true, | ||
| 329 | + fromPage: widget.fromPage, | ||
| 330 | + tableMap: tableMap, | ||
| 331 | + rid: widget.rid, | ||
| 332 | + oldOjectList: widget.oldobjectList, | ||
| 333 | + ); | ||
| 323 | }, | 334 | }, |
| 324 | itemCount: currentArea == null | 335 | itemCount: currentArea == null |
| 325 | ? 0 | 336 | ? 0 |
| @@ -365,7 +365,7 @@ class _OnlineCheckDetailPageState extends State<OnlineCheckDetailPage> { | @@ -365,7 +365,7 @@ class _OnlineCheckDetailPageState extends State<OnlineCheckDetailPage> { | ||
| 365 | Offstage( | 365 | Offstage( |
| 366 | offstage: arrowStatus, | 366 | offstage: arrowStatus, |
| 367 | child: Column( | 367 | child: Column( |
| 368 | - crossAxisAlignment: CrossAxisAlignment.start, | 368 | + crossAxisAlignment: CrossAxisAlignment.end, |
| 369 | children: [ | 369 | children: [ |
| 370 | tableNameSunList2.length > 0 | 370 | tableNameSunList2.length > 0 |
| 371 | ? Padding( | 371 | ? Padding( |
| @@ -1026,128 +1026,153 @@ class _OnlineCheckDetailPageState extends State<OnlineCheckDetailPage> { | @@ -1026,128 +1026,153 @@ class _OnlineCheckDetailPageState extends State<OnlineCheckDetailPage> { | ||
| 1026 | ), | 1026 | ), |
| 1027 | ), | 1027 | ), |
| 1028 | VEmptyView(20), | 1028 | VEmptyView(20), |
| 1029 | - Container( | ||
| 1030 | - width: double.infinity, | ||
| 1031 | - decoration: BoxDecoration( | ||
| 1032 | - color: Colors.white, | ||
| 1033 | - // borderRadius: | ||
| 1034 | - // BorderRadius.circular(10) | ||
| 1035 | - ), | ||
| 1036 | - child: Column( | ||
| 1037 | - crossAxisAlignment: CrossAxisAlignment.start, | ||
| 1038 | - children: <Widget>[ | ||
| 1039 | - _onlineCheckEditProvider | ||
| 1040 | - .orderInfoSunModel.billList.length > | ||
| 1041 | - 0 | ||
| 1042 | - ? Container( | ||
| 1043 | - height: ScreenUtil().setWidth(53 * 2), | ||
| 1044 | - width: double.infinity, | ||
| 1045 | - decoration: BoxDecoration( | ||
| 1046 | - color: MyColours.color_ffffff, | ||
| 1047 | - // borderRadius: | ||
| 1048 | - // BorderRadius.only( | ||
| 1049 | - // topLeft: | ||
| 1050 | - // Radius.circular( | ||
| 1051 | - // 10), | ||
| 1052 | - // topRight: | ||
| 1053 | - // Radius.circular( | ||
| 1054 | - // 10)), | ||
| 1055 | - ), | ||
| 1056 | - child: Padding( | ||
| 1057 | - padding: EdgeInsets.fromLTRB( | ||
| 1058 | - ScreenUtil().setWidth(32), | ||
| 1059 | - ScreenUtil().setWidth(24), | ||
| 1060 | - ScreenUtil().setWidth(20), | ||
| 1061 | - ScreenUtil().setWidth(24)), | ||
| 1062 | - child: Text( | ||
| 1063 | - '上传图片', | ||
| 1064 | - style: TextStyle( | ||
| 1065 | - fontSize: ScreenUtil().setSp(32), | ||
| 1066 | - color: MyColours.color_000000, | ||
| 1067 | - fontWeight: FontWeight.bold), | 1029 | + _onlineCheckEditProvider.orderInfoSunModel != null && |
| 1030 | + _onlineCheckEditProvider | ||
| 1031 | + .orderInfoSunModel?.billList.length > | ||
| 1032 | + 0 | ||
| 1033 | + ? Container( | ||
| 1034 | + width: double.infinity, | ||
| 1035 | + decoration: BoxDecoration( | ||
| 1036 | + color: Colors.white, | ||
| 1037 | + // borderRadius: | ||
| 1038 | + // BorderRadius.circular(10) | ||
| 1039 | + ), | ||
| 1040 | + child: Column( | ||
| 1041 | + crossAxisAlignment: CrossAxisAlignment.start, | ||
| 1042 | + children: <Widget>[ | ||
| 1043 | + Container( | ||
| 1044 | + height: ScreenUtil().setWidth(53 * 2), | ||
| 1045 | + width: double.infinity, | ||
| 1046 | + decoration: BoxDecoration( | ||
| 1047 | + color: MyColours.color_ffffff, | ||
| 1048 | + // borderRadius: | ||
| 1049 | + // BorderRadius.only( | ||
| 1050 | + // topLeft: | ||
| 1051 | + // Radius.circular( | ||
| 1052 | + // 10), | ||
| 1053 | + // topRight: | ||
| 1054 | + // Radius.circular( | ||
| 1055 | + // 10)), | ||
| 1068 | ), | 1056 | ), |
| 1069 | - )) | ||
| 1070 | - : SizedBox(), | ||
| 1071 | - _onlineCheckEditProvider.orderInfoSunModel != null | ||
| 1072 | - ? Padding( | ||
| 1073 | - padding: EdgeInsets.fromLTRB( | ||
| 1074 | - ScreenUtil().setWidth(32), | ||
| 1075 | - ScreenUtil().setWidth(0), | ||
| 1076 | - ScreenUtil().setWidth(20), | ||
| 1077 | - ScreenUtil().setWidth(24)), | ||
| 1078 | - child: Consumer<UploadImageProvider>( | ||
| 1079 | - builder: (context, model, _) { | ||
| 1080 | - List<String> temp = []; | ||
| 1081 | - for (int i = 0; | ||
| 1082 | - i < | ||
| 1083 | - _onlineCheckEditProvider | 1057 | + child: Padding( |
| 1058 | + padding: EdgeInsets.fromLTRB( | ||
| 1059 | + ScreenUtil().setWidth(32), | ||
| 1060 | + ScreenUtil().setWidth(24), | ||
| 1061 | + ScreenUtil().setWidth(20), | ||
| 1062 | + ScreenUtil().setWidth(24)), | ||
| 1063 | + child: Text( | ||
| 1064 | + '上传图片', | ||
| 1065 | + style: TextStyle( | ||
| 1066 | + fontSize: ScreenUtil().setSp(32), | ||
| 1067 | + color: MyColours.color_000000, | ||
| 1068 | + fontWeight: FontWeight.bold), | ||
| 1069 | + ), | ||
| 1070 | + )), | ||
| 1071 | + _onlineCheckEditProvider.orderInfoSunModel != | ||
| 1072 | + null | ||
| 1073 | + ? Padding( | ||
| 1074 | + padding: EdgeInsets.fromLTRB( | ||
| 1075 | + ScreenUtil().setWidth(32), | ||
| 1076 | + ScreenUtil().setWidth(0), | ||
| 1077 | + ScreenUtil().setWidth(20), | ||
| 1078 | + ScreenUtil().setWidth(24)), | ||
| 1079 | + child: Consumer<UploadImageProvider>( | ||
| 1080 | + builder: (context, model, _) { | ||
| 1081 | + List<String> temp = []; | ||
| 1082 | + for (int i = 0; | ||
| 1083 | + i < | ||
| 1084 | + _onlineCheckEditProvider | ||
| 1085 | + .orderInfoSunModel | ||
| 1086 | + .billList | ||
| 1087 | + .length; | ||
| 1088 | + i++) { | ||
| 1089 | + temp.add(_onlineCheckEditProvider | ||
| 1084 | .orderInfoSunModel | 1090 | .orderInfoSunModel |
| 1085 | - .billList | ||
| 1086 | - .length; | ||
| 1087 | - i++) { | ||
| 1088 | - temp.add(_onlineCheckEditProvider | ||
| 1089 | - .orderInfoSunModel.billList[i]); | ||
| 1090 | - } | 1091 | + .billList[i]); |
| 1092 | + } | ||
| 1091 | 1093 | ||
| 1092 | - return temp.length > 0 | ||
| 1093 | - ? GridView.builder( | ||
| 1094 | - // controller: widget.scrollController, | ||
| 1095 | - // padding: EdgeInsets.only(top: ScreenUtil().getAdapterSize(10)), | ||
| 1096 | - shrinkWrap: true, | ||
| 1097 | - itemCount: temp.length, | 1094 | + return temp.length > 0 |
| 1095 | + ? GridView.builder( | ||
| 1096 | + // controller: widget.scrollController, | ||
| 1097 | + // padding: EdgeInsets.only(top: ScreenUtil().getAdapterSize(10)), | ||
| 1098 | + shrinkWrap: true, | ||
| 1099 | + itemCount: temp.length, | ||
| 1098 | 1100 | ||
| 1099 | - //SliverGridDelegateWithFixedCrossAxisCount 构建一个横轴固定数量Widget | ||
| 1100 | - gridDelegate: | ||
| 1101 | - SliverGridDelegateWithFixedCrossAxisCount( | ||
| 1102 | - //横轴元素个数 | ||
| 1103 | - crossAxisCount: 3, | ||
| 1104 | - //纵轴间距 | ||
| 1105 | - mainAxisSpacing: | ||
| 1106 | - ScreenUtil() | ||
| 1107 | - .setWidth(40), | ||
| 1108 | - //横轴间距 | ||
| 1109 | - crossAxisSpacing: | ||
| 1110 | - ScreenUtil() | ||
| 1111 | - .setWidth(36), | ||
| 1112 | - //子组件宽高长度比例 | ||
| 1113 | - childAspectRatio: 1.0), | ||
| 1114 | - itemBuilder: | ||
| 1115 | - (BuildContext context, | ||
| 1116 | - int index) { | ||
| 1117 | - return InkWell( | ||
| 1118 | - onTap: () { | ||
| 1119 | - _showPhotoView( | ||
| 1120 | - context, | ||
| 1121 | - 0, | ||
| 1122 | - temp, | ||
| 1123 | - ); | ||
| 1124 | - }, | ||
| 1125 | - child: CachedNetworkImage( | ||
| 1126 | - imageUrl: temp[index], | ||
| 1127 | - fit: BoxFit.cover, | ||
| 1128 | - width: ScreenUtil() | ||
| 1129 | - .setWidth(80 * 2), | ||
| 1130 | - height: ScreenUtil() | ||
| 1131 | - .setWidth(80 * 2), | ||
| 1132 | - )); | ||
| 1133 | - }) | ||
| 1134 | - : SizedBox(); | ||
| 1135 | - })) | ||
| 1136 | - : SizedBox(), | ||
| 1137 | - VEmptyView(36), | ||
| 1138 | - _invoiceInfoWidget(), | ||
| 1139 | - VEmptyView(36), | ||
| 1140 | - // Offstage( | ||
| 1141 | - // offstage: _onlineCheckEditProvider.orderInfoSunModel != | ||
| 1142 | - // null | ||
| 1143 | - // ? _onlineCheckEditProvider.orderInfoSunModel.status == | ||
| 1144 | - // '2' | ||
| 1145 | - // : true, | ||
| 1146 | - // child: _orderInfoWidget(), | ||
| 1147 | - // ) | ||
| 1148 | - ], | ||
| 1149 | - ), | ||
| 1150 | - ) | 1101 | + //SliverGridDelegateWithFixedCrossAxisCount 构建一个横轴固定数量Widget |
| 1102 | + gridDelegate: | ||
| 1103 | + SliverGridDelegateWithFixedCrossAxisCount( | ||
| 1104 | + //横轴元素个数 | ||
| 1105 | + crossAxisCount: 3, | ||
| 1106 | + //纵轴间距 | ||
| 1107 | + mainAxisSpacing: | ||
| 1108 | + ScreenUtil() | ||
| 1109 | + .setWidth( | ||
| 1110 | + 40), | ||
| 1111 | + //横轴间距 | ||
| 1112 | + crossAxisSpacing: | ||
| 1113 | + ScreenUtil() | ||
| 1114 | + .setWidth( | ||
| 1115 | + 36), | ||
| 1116 | + //子组件宽高长度比例 | ||
| 1117 | + childAspectRatio: | ||
| 1118 | + 1.0), | ||
| 1119 | + itemBuilder: | ||
| 1120 | + (BuildContext context, | ||
| 1121 | + int index) { | ||
| 1122 | + return InkWell( | ||
| 1123 | + onTap: () { | ||
| 1124 | + _showPhotoView( | ||
| 1125 | + context, | ||
| 1126 | + 0, | ||
| 1127 | + temp, | ||
| 1128 | + ); | ||
| 1129 | + }, | ||
| 1130 | + child: | ||
| 1131 | + CachedNetworkImage( | ||
| 1132 | + imageUrl: | ||
| 1133 | + temp[index], | ||
| 1134 | + fit: BoxFit.cover, | ||
| 1135 | + width: ScreenUtil() | ||
| 1136 | + .setWidth( | ||
| 1137 | + 80 * 2), | ||
| 1138 | + height: ScreenUtil() | ||
| 1139 | + .setWidth( | ||
| 1140 | + 80 * 2), | ||
| 1141 | + )); | ||
| 1142 | + }) | ||
| 1143 | + : SizedBox(); | ||
| 1144 | + })) | ||
| 1145 | + : SizedBox(), | ||
| 1146 | + | ||
| 1147 | + // Offstage( | ||
| 1148 | + // offstage: _onlineCheckEditProvider.orderInfoSunModel != | ||
| 1149 | + // null | ||
| 1150 | + // ? _onlineCheckEditProvider.orderInfoSunModel.status == | ||
| 1151 | + // '2' | ||
| 1152 | + // : true, | ||
| 1153 | + // child: _orderInfoWidget(), | ||
| 1154 | + // ) | ||
| 1155 | + ], | ||
| 1156 | + ), | ||
| 1157 | + ) | ||
| 1158 | + : SizedBox(), | ||
| 1159 | + VEmptyView(36), | ||
| 1160 | + _onlineCheckEditProvider.orderInfoSunModel != null && | ||
| 1161 | + _onlineCheckEditProvider | ||
| 1162 | + .orderInfoSunModel?.invoice == | ||
| 1163 | + null | ||
| 1164 | + ? Container( | ||
| 1165 | + width: double.infinity, | ||
| 1166 | + padding: EdgeInsets.symmetric( | ||
| 1167 | + horizontal: ScreenUtil().setWidth(60), | ||
| 1168 | + vertical: ScreenUtil().setWidth(20)), | ||
| 1169 | + decoration: BoxDecoration( | ||
| 1170 | + color: Colors.white, | ||
| 1171 | + ), | ||
| 1172 | + child: _customInfoItemWidget('发票抬头', '无', | ||
| 1173 | + fontsize: 20)) | ||
| 1174 | + : _invoiceInfoWidget(), | ||
| 1175 | + VEmptyView(36), | ||
| 1151 | ]))), | 1176 | ]))), |
| 1152 | onWillPop: () async { | 1177 | onWillPop: () async { |
| 1153 | if (widget.fromNotify) { | 1178 | if (widget.fromNotify) { |
| @@ -2,6 +2,7 @@ import 'package:common_utils/common_utils.dart'; | @@ -2,6 +2,7 @@ import 'package:common_utils/common_utils.dart'; | ||
| 2 | import 'package:flutter/material.dart'; | 2 | import 'package:flutter/material.dart'; |
| 3 | import 'package:one_key/constant/constant.dart'; | 3 | import 'package:one_key/constant/constant.dart'; |
| 4 | import 'package:one_key/models/message.dart'; | 4 | import 'package:one_key/models/message.dart'; |
| 5 | +import 'package:one_key/models/new_unmessage_model.dart'; | ||
| 5 | import 'package:one_key/net/base_resp.dart'; | 6 | import 'package:one_key/net/base_resp.dart'; |
| 6 | import 'package:one_key/net/dio_util.dart'; | 7 | import 'package:one_key/net/dio_util.dart'; |
| 7 | import 'package:one_key/net/http_url.dart'; | 8 | import 'package:one_key/net/http_url.dart'; |
| @@ -16,9 +17,10 @@ class MessageDialogModel extends ChangeNotifier { | @@ -16,9 +17,10 @@ class MessageDialogModel extends ChangeNotifier { | ||
| 16 | 17 | ||
| 17 | bool showMessageDialog = false; | 18 | bool showMessageDialog = false; |
| 18 | 19 | ||
| 19 | - List<Message> messages = []; //所有消息用于展示 | ||
| 20 | - List<Message> unMessagesOnline = []; //未读在线预定 | ||
| 21 | - List<Message> unMessagesOrder = []; //未读提前点餐 | 20 | + List<NewUnmessage> messages = []; //所有消息用于展示 |
| 21 | + // List<Message> unMessagesOnline = []; //未读在线预定 | ||
| 22 | + // List<Message> unMessagesOrder = []; //未读提前点餐 | ||
| 23 | + List<String> messagesCancelOnlyOneShow = []; //取消预订只展示一次 | ||
| 22 | 24 | ||
| 23 | void init() { | 25 | void init() { |
| 24 | _player.load("tts_online.mp3"); | 26 | _player.load("tts_online.mp3"); |
| @@ -55,7 +57,7 @@ class MessageDialogModel extends ChangeNotifier { | @@ -55,7 +57,7 @@ class MessageDialogModel extends ChangeNotifier { | ||
| 55 | } | 57 | } |
| 56 | 58 | ||
| 57 | //添加一条信息 | 59 | //添加一条信息 |
| 58 | - addMessage(BuildContext context, Message message) { | 60 | + addMessage(BuildContext context, NewUnmessage message) { |
| 59 | LogUtil.v(message.toString()); | 61 | LogUtil.v(message.toString()); |
| 60 | play(message.message_type); | 62 | play(message.message_type); |
| 61 | messages.add(message); | 63 | messages.add(message); |
| @@ -75,16 +77,18 @@ class MessageDialogModel extends ChangeNotifier { | @@ -75,16 +77,18 @@ class MessageDialogModel extends ChangeNotifier { | ||
| 75 | //获取未处理在线预订消息 | 77 | //获取未处理在线预订消息 |
| 76 | getUntreatedMsg(BuildContext context, Map<String, String> params, | 78 | getUntreatedMsg(BuildContext context, Map<String, String> params, |
| 77 | VoidCallback callback) async { | 79 | VoidCallback callback) async { |
| 78 | - BaseResp<List> baseResp = await DioUtil() | ||
| 79 | - .request<List>(context, Method.get, HttpUrl.get_message_list, | ||
| 80 | - showLoading: false, data: params) | 80 | + BaseResp<dynamic> baseResp = await DioUtil() |
| 81 | + .request<dynamic>( | ||
| 82 | + context, Method.get, HttpUrl.new_get_untreated_msg_list, | ||
| 83 | + data: params, showLoading: false) | ||
| 81 | .catchError((error) { | 84 | .catchError((error) { |
| 82 | print(error.toString()); | 85 | print(error.toString()); |
| 83 | }); | 86 | }); |
| 84 | - List<Message> messagesTemp = []; | 87 | + |
| 88 | + List<NewUnmessage> messagesTemp = []; | ||
| 85 | if (baseResp != null && baseResp.code == Constant.status_success) { | 89 | if (baseResp != null && baseResp.code == Constant.status_success) { |
| 86 | - messagesTemp = baseResp.data.map<Message>((value) { | ||
| 87 | - return Message.fromJson(value); | 90 | + messagesTemp = baseResp.data['list'].map<NewUnmessage>((value) { |
| 91 | + return NewUnmessage.fromJson(value); | ||
| 88 | }).toList(); | 92 | }).toList(); |
| 89 | messagesTemp.removeWhere((message) { | 93 | messagesTemp.removeWhere((message) { |
| 90 | if (message.message_type.toString() == "10") { | 94 | if (message.message_type.toString() == "10") { |
| @@ -96,13 +100,8 @@ class MessageDialogModel extends ChangeNotifier { | @@ -96,13 +100,8 @@ class MessageDialogModel extends ChangeNotifier { | ||
| 96 | } | 100 | } |
| 97 | return false; | 101 | return false; |
| 98 | }); | 102 | }); |
| 99 | - if (params["type_id"] == '10') { | ||
| 100 | - unMessagesOnline = messagesTemp; | ||
| 101 | - messages.addAll(unMessagesOnline); | ||
| 102 | - } else if (params["type_id"] == '1') { | ||
| 103 | - unMessagesOrder = messagesTemp; | ||
| 104 | - messages = unMessagesOrder; | ||
| 105 | - } | 103 | + |
| 104 | + messages = messagesTemp; | ||
| 106 | // messages.addAll(messagesTemp); | 105 | // messages.addAll(messagesTemp); |
| 107 | 106 | ||
| 108 | callback(); | 107 | callback(); |
| @@ -3,13 +3,14 @@ import 'package:one_key/constant/constant.dart'; | @@ -3,13 +3,14 @@ import 'package:one_key/constant/constant.dart'; | ||
| 3 | import 'package:one_key/constant/error.dart'; | 3 | import 'package:one_key/constant/error.dart'; |
| 4 | import 'package:one_key/constant/state.dart'; | 4 | import 'package:one_key/constant/state.dart'; |
| 5 | import 'package:one_key/models/message.dart'; | 5 | import 'package:one_key/models/message.dart'; |
| 6 | +import 'package:one_key/models/new_unmessage_model.dart'; | ||
| 6 | import 'package:one_key/net/base_resp.dart'; | 7 | import 'package:one_key/net/base_resp.dart'; |
| 7 | import 'package:one_key/net/dio_util.dart'; | 8 | import 'package:one_key/net/dio_util.dart'; |
| 8 | import 'package:one_key/net/http_url.dart'; | 9 | import 'package:one_key/net/http_url.dart'; |
| 9 | import 'package:one_key/utils/utils.dart'; | 10 | import 'package:one_key/utils/utils.dart'; |
| 10 | 11 | ||
| 11 | class MessageModel extends ChangeNotifier { | 12 | class MessageModel extends ChangeNotifier { |
| 12 | - List<Message> messages = []; //消息 | 13 | + List<NewUnmessage> messages = []; //消息 |
| 13 | PageState pageStateUn = PageState.Loading; //未处理 | 14 | PageState pageStateUn = PageState.Loading; //未处理 |
| 14 | PageState pageState = PageState.Loading; //已处理 | 15 | PageState pageState = PageState.Loading; //已处理 |
| 15 | // 未处理消息总数 | 16 | // 未处理消息总数 |
| @@ -18,28 +19,90 @@ class MessageModel extends ChangeNotifier { | @@ -18,28 +19,90 @@ class MessageModel extends ChangeNotifier { | ||
| 18 | int orderTotal = 0; //提前点餐 | 19 | int orderTotal = 0; //提前点餐 |
| 19 | int checkTotal = 0; //在线买单 | 20 | int checkTotal = 0; //在线买单 |
| 20 | 21 | ||
| 22 | + int allUnNum = 0; //全部未读 | ||
| 23 | + | ||
| 21 | initData() { | 24 | initData() { |
| 22 | messages = []; //消息 | 25 | messages = []; //消息 |
| 23 | pageStateUn = PageState.Loading; //未处理 | 26 | pageStateUn = PageState.Loading; //未处理 |
| 24 | pageState = PageState.Loading; //已处理 | 27 | pageState = PageState.Loading; //已处理 |
| 25 | } | 28 | } |
| 26 | 29 | ||
| 27 | - //获取消息 | 30 | + //获取已处理消息 |
| 28 | getMessages(BuildContext context, Map<String, String> params, | 31 | getMessages(BuildContext context, Map<String, String> params, |
| 29 | {showLoading = true}) async { | 32 | {showLoading = true}) async { |
| 30 | if (showLoading) { | 33 | if (showLoading) { |
| 31 | - if (params['status'] == '0') { | ||
| 32 | - //未处理 | ||
| 33 | - pageStateUn = PageState.Loading; | 34 | + pageState = PageState.Loading; |
| 35 | + messages = []; | ||
| 36 | + notifyListeners(); | ||
| 37 | + } | ||
| 38 | + BaseResp<List> baseResp = await DioUtil() | ||
| 39 | + .request<List>(context, Method.get, HttpUrl.new_get_message_list, | ||
| 40 | + data: params, showLoading: false) | ||
| 41 | + .catchError((error) { | ||
| 42 | + print(error.toString()); | ||
| 43 | + if (error is MyError) { | ||
| 44 | + switch (error.type) { | ||
| 45 | + case 1: | ||
| 46 | + pageState = PageState.ConnectivityError; | ||
| 47 | + break; | ||
| 48 | + case 2: | ||
| 49 | + pageState = PageState.ConnectivityTimeOut; | ||
| 50 | + break; | ||
| 51 | + default: | ||
| 52 | + pageState = PageState.ConnectivityError; | ||
| 53 | + break; | ||
| 54 | + } | ||
| 55 | + } | ||
| 56 | + notifyListeners(); | ||
| 57 | + }); | ||
| 58 | + if (baseResp != null && baseResp.code == Constant.status_success) { | ||
| 59 | + if (params['offset'] == "0") { | ||
| 60 | + messages = baseResp.data.map<NewUnmessage>((value) { | ||
| 61 | + return NewUnmessage.fromJson(value); | ||
| 62 | + }).toList(); | ||
| 63 | + } else { | ||
| 64 | + messages.addAll(baseResp.data.map<NewUnmessage>((value) { | ||
| 65 | + return NewUnmessage.fromJson(value); | ||
| 66 | + }).toList()); | ||
| 67 | + } | ||
| 68 | + | ||
| 69 | + // if (params["type_id"] == "10") { | ||
| 70 | + // //在线预订 | ||
| 71 | + // messages.removeWhere((message) { | ||
| 72 | + // if (message.message_type.toString() == "10") { | ||
| 73 | + // //在线预订 | ||
| 74 | + // if (message.status == "4") { | ||
| 75 | + // //已取消 | ||
| 76 | + // return true; | ||
| 77 | + // } | ||
| 78 | + // return false; | ||
| 79 | + // } else if (message.message_type.toString() == "11") { | ||
| 80 | + // //取消在线预订 | ||
| 81 | + // return false; | ||
| 82 | + // } | ||
| 83 | + // return true; | ||
| 84 | + // }); | ||
| 85 | + // } | ||
| 86 | + if (messages.isEmpty) { | ||
| 87 | + pageState = PageState.Empty; | ||
| 34 | } else { | 88 | } else { |
| 35 | - pageState = PageState.Loading; | 89 | + pageState = PageState.Success; |
| 36 | } | 90 | } |
| 91 | + notifyListeners(); | ||
| 92 | + } | ||
| 93 | + } | ||
| 37 | 94 | ||
| 95 | + //获取未处理消息和数目 | ||
| 96 | + getNewGetUntreatedMsgList(BuildContext context, Map<String, String> params, | ||
| 97 | + {showLoading = true}) async { | ||
| 98 | + if (showLoading) { | ||
| 99 | + pageStateUn = PageState.Loading; | ||
| 38 | messages = []; | 100 | messages = []; |
| 39 | notifyListeners(); | 101 | notifyListeners(); |
| 40 | } | 102 | } |
| 41 | - BaseResp<List> baseResp = await DioUtil() | ||
| 42 | - .request<List>(context, Method.get, HttpUrl.get_message_list, | 103 | + BaseResp<dynamic> baseResp = await DioUtil() |
| 104 | + .request<dynamic>( | ||
| 105 | + context, Method.get, HttpUrl.new_get_untreated_msg_list, | ||
| 43 | data: params, showLoading: false) | 106 | data: params, showLoading: false) |
| 44 | .catchError((error) { | 107 | .catchError((error) { |
| 45 | print(error.toString()); | 108 | print(error.toString()); |
| @@ -47,32 +110,28 @@ class MessageModel extends ChangeNotifier { | @@ -47,32 +110,28 @@ class MessageModel extends ChangeNotifier { | ||
| 47 | if (error is MyError) { | 110 | if (error is MyError) { |
| 48 | switch (error.type) { | 111 | switch (error.type) { |
| 49 | case 1: | 112 | case 1: |
| 50 | - pageStateTemp = PageState.ConnectivityError; | 113 | + pageStateUn = PageState.ConnectivityError; |
| 51 | break; | 114 | break; |
| 52 | case 2: | 115 | case 2: |
| 53 | - pageStateTemp = PageState.ConnectivityTimeOut; | 116 | + pageStateUn = PageState.ConnectivityTimeOut; |
| 54 | break; | 117 | break; |
| 55 | default: | 118 | default: |
| 56 | - pageStateTemp = PageState.ConnectivityError; | 119 | + pageStateUn = PageState.ConnectivityError; |
| 57 | break; | 120 | break; |
| 58 | } | 121 | } |
| 59 | } | 122 | } |
| 60 | - if (params['status'] == '0') { | ||
| 61 | - //未处理 | ||
| 62 | - pageStateUn = pageStateTemp; | ||
| 63 | - } else { | ||
| 64 | - pageState = pageStateTemp; | ||
| 65 | - } | 123 | + |
| 66 | notifyListeners(); | 124 | notifyListeners(); |
| 67 | }); | 125 | }); |
| 68 | if (baseResp != null && baseResp.code == Constant.status_success) { | 126 | if (baseResp != null && baseResp.code == Constant.status_success) { |
| 127 | + allUnNum = baseResp.data['count']; | ||
| 69 | if (params['offset'] == "0") { | 128 | if (params['offset'] == "0") { |
| 70 | - messages = baseResp.data.map<Message>((value) { | ||
| 71 | - return Message.fromJson(value); | 129 | + messages = baseResp.data['list'].map<NewUnmessage>((value) { |
| 130 | + return NewUnmessage.fromJson(value); | ||
| 72 | }).toList(); | 131 | }).toList(); |
| 73 | } else { | 132 | } else { |
| 74 | - messages.addAll(baseResp.data.map<Message>((value) { | ||
| 75 | - return Message.fromJson(value); | 133 | + messages.addAll(baseResp.data['list'].map<NewUnmessage>((value) { |
| 134 | + return NewUnmessage.fromJson(value); | ||
| 76 | }).toList()); | 135 | }).toList()); |
| 77 | } | 136 | } |
| 78 | 137 | ||
| @@ -90,19 +149,11 @@ class MessageModel extends ChangeNotifier { | @@ -90,19 +149,11 @@ class MessageModel extends ChangeNotifier { | ||
| 90 | // }); | 149 | // }); |
| 91 | // } | 150 | // } |
| 92 | if (messages.isEmpty) { | 151 | if (messages.isEmpty) { |
| 93 | - if (params['status'] == '0') { | ||
| 94 | - //未处理 | ||
| 95 | - pageStateUn = PageState.Empty; | ||
| 96 | - } else { | ||
| 97 | - pageState = PageState.Empty; | ||
| 98 | - } | 152 | + //未处理 |
| 153 | + pageStateUn = PageState.Empty; | ||
| 99 | } else { | 154 | } else { |
| 100 | - if (params['status'] == '0') { | ||
| 101 | - //未处理 | ||
| 102 | - pageStateUn = PageState.Success; | ||
| 103 | - } else { | ||
| 104 | - pageState = PageState.Success; | ||
| 105 | - } | 155 | + //未处理 |
| 156 | + pageStateUn = PageState.Success; | ||
| 106 | } | 157 | } |
| 107 | notifyListeners(); | 158 | notifyListeners(); |
| 108 | } | 159 | } |
| @@ -466,11 +466,12 @@ class NavigatorUtil { | @@ -466,11 +466,12 @@ class NavigatorUtil { | ||
| 466 | BuildContext context, String rid, int dateTime, String ddate_slot, | 466 | BuildContext context, String rid, int dateTime, String ddate_slot, |
| 467 | {bool canChoose = false, | 467 | {bool canChoose = false, |
| 468 | String object, | 468 | String object, |
| 469 | + String oldobject, | ||
| 469 | String fromPage = 'change', | 470 | String fromPage = 'change', |
| 470 | String tid = ''}) { | 471 | String tid = ''}) { |
| 471 | if (object != null) { | 472 | if (object != null) { |
| 472 | return _navigateTo(context, | 473 | return _navigateTo(context, |
| 473 | - "${Routes.room_type_select_table_page}?rid=$rid&tid=$tid&dateTime=$dateTime&fromPage=$fromPage&ddate_slot=$ddate_slot&canChoose=$canChoose&object=${object}"); | 474 | + "${Routes.room_type_select_table_page}?rid=$rid&tid=$tid&dateTime=$dateTime&fromPage=$fromPage&ddate_slot=$ddate_slot&canChoose=$canChoose&object=${object}&oldobject=${oldobject}"); |
| 474 | } | 475 | } |
| 475 | // object = {'object': [], "tid": ''}; | 476 | // object = {'object': [], "tid": ''}; |
| 476 | return _navigateTo(context, | 477 | return _navigateTo(context, |
| @@ -792,6 +792,8 @@ var roomTypeSelectTablePageHandler = new Handler( | @@ -792,6 +792,8 @@ var roomTypeSelectTablePageHandler = new Handler( | ||
| 792 | bool canChoose = params["canChoose"].first == "true" ? true : false; | 792 | bool canChoose = params["canChoose"].first == "true" ? true : false; |
| 793 | String temp = params["object"].first; | 793 | String temp = params["object"].first; |
| 794 | List<String> tidSelList = temp.length > 0 ? temp.split(',') : []; | 794 | List<String> tidSelList = temp.length > 0 ? temp.split(',') : []; |
| 795 | + String oldobject = params["oldobject"].first; | ||
| 796 | + List<String> oldobjectList = oldobject.length > 0 ? oldobject.split(',') : []; | ||
| 795 | 797 | ||
| 796 | // return SelectTablePage(rid, dateTime, ddate_slot,canChoose: canChoose); | 798 | // return SelectTablePage(rid, dateTime, ddate_slot,canChoose: canChoose); |
| 797 | return ChangeNotifierProvider<ChooseTableModel>( | 799 | return ChangeNotifierProvider<ChooseTableModel>( |
| @@ -800,7 +802,8 @@ var roomTypeSelectTablePageHandler = new Handler( | @@ -800,7 +802,8 @@ var roomTypeSelectTablePageHandler = new Handler( | ||
| 800 | canChoose: canChoose, | 802 | canChoose: canChoose, |
| 801 | tableList: tidSelList, | 803 | tableList: tidSelList, |
| 802 | fromPage: fromPage, | 804 | fromPage: fromPage, |
| 803 | - tid: tid)); | 805 | + tid: tid, |
| 806 | + oldobjectList:oldobjectList)); | ||
| 804 | }); | 807 | }); |
| 805 | 808 | ||
| 806 | ///菜单管理页面 | 809 | ///菜单管理页面 |
| 1 | import 'package:flutter/material.dart'; | 1 | import 'package:flutter/material.dart'; |
| 2 | import 'package:flutter_screenutil/flutter_screenutil.dart'; | 2 | import 'package:flutter_screenutil/flutter_screenutil.dart'; |
| 3 | import 'package:one_key/models/notebook.dart'; | 3 | import 'package:one_key/models/notebook.dart'; |
| 4 | +import 'package:one_key/models/reserve_detail_model.dart'; | ||
| 4 | import 'package:one_key/res/colors.dart'; | 5 | import 'package:one_key/res/colors.dart'; |
| 5 | 6 | ||
| 6 | import 'package:one_key/models/table.dart' as t; | 7 | import 'package:one_key/models/table.dart' as t; |
| @@ -16,6 +17,7 @@ class TableItem extends StatefulWidget { | @@ -16,6 +17,7 @@ class TableItem extends StatefulWidget { | ||
| 16 | 17 | ||
| 17 | final int height; //高度 | 18 | final int height; //高度 |
| 18 | final bool need; | 19 | final bool need; |
| 20 | + final List<String> oldOjectList; | ||
| 19 | 21 | ||
| 20 | TableItem(this.table, | 22 | TableItem(this.table, |
| 21 | {this.onSelected, | 23 | {this.onSelected, |
| @@ -24,7 +26,8 @@ class TableItem extends StatefulWidget { | @@ -24,7 +26,8 @@ class TableItem extends StatefulWidget { | ||
| 24 | this.fromPage = 'new', | 26 | this.fromPage = 'new', |
| 25 | this.rid, | 27 | this.rid, |
| 26 | this.tableMap, | 28 | this.tableMap, |
| 27 | - this.need = true}); | 29 | + this.need = true, |
| 30 | + this.oldOjectList}); | ||
| 28 | 31 | ||
| 29 | @override | 32 | @override |
| 30 | State<StatefulWidget> createState() { | 33 | State<StatefulWidget> createState() { |
| @@ -81,10 +84,15 @@ class TableItemState extends State<TableItem> { | @@ -81,10 +84,15 @@ class TableItemState extends State<TableItem> { | ||
| 81 | table.selected = !(table.selected ?? false); | 84 | table.selected = !(table.selected ?? false); |
| 82 | }); | 85 | }); |
| 83 | widget.onSelected(table); | 86 | widget.onSelected(table); |
| 84 | - } else if (widget.fromPage == 'table_manage' || | ||
| 85 | - widget.fromPage == 'room_manage') { | 87 | + } else if (widget.fromPage == 'table_manage') { |
| 86 | table.selected = !(table.selected ?? false); | 88 | table.selected = !(table.selected ?? false); |
| 87 | widget.onSelected(table); | 89 | widget.onSelected(table); |
| 90 | + } else if (widget.fromPage == 'room_manage') { | ||
| 91 | + if (table.isExitsClass.toString() != '1' || | ||
| 92 | + widget.oldOjectList.contains(table.id)) { | ||
| 93 | + table.selected = !(table.selected ?? false); | ||
| 94 | + widget.onSelected(table); | ||
| 95 | + } | ||
| 88 | } else if (widget.fromPage == 'tablePhoto') { | 96 | } else if (widget.fromPage == 'tablePhoto') { |
| 89 | // setState(() { | 97 | // setState(() { |
| 90 | // table.selected = true; | 98 | // table.selected = true; |
| @@ -100,7 +108,9 @@ class TableItemState extends State<TableItem> { | @@ -100,7 +108,9 @@ class TableItemState extends State<TableItem> { | ||
| 100 | height: ScreenUtil().setWidth(widget.height), | 108 | height: ScreenUtil().setWidth(widget.height), |
| 101 | margin: EdgeInsets.all(ScreenUtil().setWidth(9)), | 109 | margin: EdgeInsets.all(ScreenUtil().setWidth(9)), |
| 102 | decoration: BoxDecoration( | 110 | decoration: BoxDecoration( |
| 103 | - color: widget.need && table.enable == '0' | 111 | + color: (widget.need && table.enable == '0') || |
| 112 | + (table.isExitsClass.toString() == '1' && | ||
| 113 | + !widget.oldOjectList.contains(table.id)) | ||
| 104 | ? MyColours.color_E0E0E0 | 114 | ? MyColours.color_E0E0E0 |
| 105 | : MyColours.color_A9E3E6, | 115 | : MyColours.color_A9E3E6, |
| 106 | borderRadius: BorderRadius.all( | 116 | borderRadius: BorderRadius.all( |
| @@ -118,7 +128,10 @@ class TableItemState extends State<TableItem> { | @@ -118,7 +128,10 @@ class TableItemState extends State<TableItem> { | ||
| 118 | height: ScreenUtil().setHeight(32), | 128 | height: ScreenUtil().setHeight(32), |
| 119 | alignment: Alignment.center, | 129 | alignment: Alignment.center, |
| 120 | decoration: BoxDecoration( | 130 | decoration: BoxDecoration( |
| 121 | - color: MyColours.color_63a6d1, | 131 | + color: table.isExitsClass.toString() == '1' && |
| 132 | + !widget.oldOjectList.contains(table.id) | ||
| 133 | + ? Color.fromRGBO(147, 147, 147, 1) | ||
| 134 | + : MyColours.color_63a6d1, | ||
| 122 | borderRadius: BorderRadius.only( | 135 | borderRadius: BorderRadius.only( |
| 123 | topLeft: | 136 | topLeft: |
| 124 | Radius.circular(ScreenUtil().setWidth(8)), | 137 | Radius.circular(ScreenUtil().setWidth(8)), |
| @@ -154,7 +167,11 @@ class TableItemState extends State<TableItem> { | @@ -154,7 +167,11 @@ class TableItemState extends State<TableItem> { | ||
| 154 | table.name, | 167 | table.name, |
| 155 | maxLines: 2, | 168 | maxLines: 2, |
| 156 | style: TextStyle( | 169 | style: TextStyle( |
| 157 | - color: widget.need && table.enable == '0' | 170 | + color: (widget.need && table.enable == '0') || |
| 171 | + (table.isExitsClass.toString() == | ||
| 172 | + '1' && | ||
| 173 | + !widget.oldOjectList | ||
| 174 | + .contains(table.id)) | ||
| 158 | ? MyColours.color_999999 | 175 | ? MyColours.color_999999 |
| 159 | : MyColours.color_353535, | 176 | : MyColours.color_353535, |
| 160 | fontSize: ScreenUtil().setSp(28), | 177 | fontSize: ScreenUtil().setSp(28), |
| @@ -188,7 +205,11 @@ class TableItemState extends State<TableItem> { | @@ -188,7 +205,11 @@ class TableItemState extends State<TableItem> { | ||
| 188 | ? table.tableNum | 205 | ? table.tableNum |
| 189 | : table.reserver, | 206 | : table.reserver, |
| 190 | style: TextStyle( | 207 | style: TextStyle( |
| 191 | - color: signStr == '已停用' | 208 | + color: widget.fromPage == 'room_manage' && |
| 209 | + table.isExitsClass.toString() == '1' && | ||
| 210 | + !widget.oldOjectList.contains(table.id) | ||
| 211 | + ? Color.fromRGBO(147, 147, 147, 1) | ||
| 212 | + : signStr == '已停用' | ||
| 192 | ? MyColours.color_999999 | 213 | ? MyColours.color_999999 |
| 193 | : (table.reserver == null || | 214 | : (table.reserver == null || |
| 194 | table.reserver.isEmpty) | 215 | table.reserver.isEmpty) |
| @@ -203,7 +224,10 @@ class TableItemState extends State<TableItem> { | @@ -203,7 +224,10 @@ class TableItemState extends State<TableItem> { | ||
| 203 | Text( | 224 | Text( |
| 204 | table.lowStr, | 225 | table.lowStr, |
| 205 | style: TextStyle( | 226 | style: TextStyle( |
| 206 | - color: MyColours.color_777777, | 227 | + color: table.isExitsClass.toString() == '1' && |
| 228 | + !widget.oldOjectList.contains(table.id) | ||
| 229 | + ? MyColours.color_999999 | ||
| 230 | + : MyColours.color_777777, | ||
| 207 | fontSize: ScreenUtil().setSp(26), | 231 | fontSize: ScreenUtil().setSp(26), |
| 208 | decoration: TextDecoration.none, | 232 | decoration: TextDecoration.none, |
| 209 | fontWeight: FontWeight.normal), | 233 | fontWeight: FontWeight.normal), |
-
Please register or login to post a comment