Showing
13 changed files
with
995 additions
and
119 deletions
| @@ -12,14 +12,14 @@ if (flutterRoot == null) { | @@ -12,14 +12,14 @@ if (flutterRoot == null) { | ||
| 12 | } | 12 | } |
| 13 | 13 | ||
| 14 | 14 | ||
| 15 | -def flutterVersionCode = "361" | 15 | +def flutterVersionCode = "370" |
| 16 | if (flutterVersionCode == null) { | 16 | if (flutterVersionCode == null) { |
| 17 | - flutterVersionCode = '361' | 17 | + flutterVersionCode = '370' |
| 18 | } | 18 | } |
| 19 | 19 | ||
| 20 | -def flutterVersionName = "3.6.1" | 20 | +def flutterVersionName = "3.7.0" |
| 21 | if (flutterVersionName == null) { | 21 | if (flutterVersionName == null) { |
| 22 | - flutterVersionName = '3.6.1' | 22 | + flutterVersionName = '3.7.0' |
| 23 | } | 23 | } |
| 24 | apply plugin: 'com.android.application' | 24 | apply plugin: 'com.android.application' |
| 25 | apply plugin: 'kotlin-android' | 25 | apply plugin: 'kotlin-android' |
assets/cancel_go.png
0 → 100644
3.14 KB
assets/online_go.png
0 → 100644
3.62 KB
assets/online_order_go.png
0 → 100644
3.63 KB
assets/order_go.png
0 → 100644
3.61 KB
assets/store_info_go.png
0 → 100644
3.62 KB
| @@ -49,9 +49,9 @@ class Message { | @@ -49,9 +49,9 @@ class Message { | ||
| 49 | DateTime dateTime = DateTime.fromMillisecondsSinceEpoch( | 49 | DateTime dateTime = DateTime.fromMillisecondsSinceEpoch( |
| 50 | int.parse(ddate_long.toString()) * 1000); | 50 | int.parse(ddate_long.toString()) * 1000); |
| 51 | ymd = dateTime.year.toString() + | 51 | ymd = dateTime.year.toString() + |
| 52 | - "/" + | 52 | + "-" + |
| 53 | Utils.addZeroNumber(dateTime.month) + | 53 | Utils.addZeroNumber(dateTime.month) + |
| 54 | - "/" + | 54 | + "-" + |
| 55 | Utils.addZeroNumber(dateTime.day); | 55 | Utils.addZeroNumber(dateTime.day); |
| 56 | } else { | 56 | } else { |
| 57 | ymd = ddate.substring(0, 10); | 57 | ymd = ddate.substring(0, 10); |
| @@ -96,9 +96,9 @@ class Message { | @@ -96,9 +96,9 @@ class Message { | ||
| 96 | return "刚刚"; | 96 | return "刚刚"; |
| 97 | } else { | 97 | } else { |
| 98 | return dateTime.year.toString() + | 98 | return dateTime.year.toString() + |
| 99 | - "/" + | 99 | + "-" + |
| 100 | Utils.addZeroNumber(dateTime.month) + | 100 | Utils.addZeroNumber(dateTime.month) + |
| 101 | - "/" + | 101 | + "-" + |
| 102 | Utils.addZeroNumber(dateTime.day) + | 102 | Utils.addZeroNumber(dateTime.day) + |
| 103 | " " + | 103 | " " + |
| 104 | Utils.addZeroNumber(dateTime.hour) + | 104 | Utils.addZeroNumber(dateTime.hour) + |
lib/pages/message/message_item_f.dart
0 → 100644
| 1 | +import 'package:flutter/material.dart'; | ||
| 2 | +import 'package:flutter_screenutil/flutter_screenutil.dart'; | ||
| 3 | +import 'package:one_key/models/message.dart'; | ||
| 4 | +import 'package:one_key/provider/message_dialog_model.dart'; | ||
| 5 | +import 'package:one_key/provider/user_model.dart'; | ||
| 6 | +import 'package:one_key/res/colors.dart'; | ||
| 7 | +import 'package:one_key/utils/event_bus.dart'; | ||
| 8 | +import 'package:one_key/route/navigator_util.dart'; | ||
| 9 | +import 'package:one_key/utils/utils.dart'; | ||
| 10 | +import 'package:one_key/widgets/common_button.dart'; | ||
| 11 | +import 'package:one_key/widgets/h_empty_view.dart'; | ||
| 12 | +import 'package:one_key/widgets/v_empty_view.dart'; | ||
| 13 | +import 'package:provider/provider.dart'; | ||
| 14 | + | ||
| 15 | +class MessageItemF extends StatelessWidget { | ||
| 16 | + final Message message; | ||
| 17 | + final bool isTreated; | ||
| 18 | + MessageItemF(this.message, {this.isTreated = false}); | ||
| 19 | + | ||
| 20 | + @override | ||
| 21 | + Widget build(BuildContext context) { | ||
| 22 | + // TODO: implement build | ||
| 23 | + Color textColor = | ||
| 24 | + isTreated ? MyColours.color_999999 : MyColours.color_353535; | ||
| 25 | + String titleText = ""; | ||
| 26 | + String subTitleTextFir = ""; | ||
| 27 | + String subTitleTextSec = ""; | ||
| 28 | + String attr = ''; | ||
| 29 | + Color bgcolor = MyColours.color_438E93; | ||
| 30 | + String btnname = 'online_go'; | ||
| 31 | + if (message.message_type == "10") { | ||
| 32 | + titleText = "在线\n预订"; | ||
| 33 | + subTitleTextFir = '包间需求'; | ||
| 34 | + subTitleTextSec = '就餐时间'; | ||
| 35 | + } else if (message.message_type == "11") { | ||
| 36 | + titleText = "取消\n预订"; | ||
| 37 | + bgcolor = MyColours.color_999999; | ||
| 38 | + btnname = 'cancel_go'; | ||
| 39 | + } else if (message.message_type == "1") { | ||
| 40 | + titleText = "提前\n点餐"; | ||
| 41 | + subTitleTextFir = '桌位信息'; | ||
| 42 | + subTitleTextSec = '就餐时间'; | ||
| 43 | + bgcolor = MyColours.color_F78D94; | ||
| 44 | + btnname = 'order_go'; | ||
| 45 | + } else if (message.message_type == "12") { | ||
| 46 | + titleText = "在线\n买单"; | ||
| 47 | + subTitleTextFir = '桌位信息'; | ||
| 48 | + subTitleTextSec = '申请时间'; | ||
| 49 | + bgcolor = MyColours.color_F2995F; | ||
| 50 | + btnname = 'online_order_go'; | ||
| 51 | + } else if (message.message_type == "13") { | ||
| 52 | + titleText = "买单\n通知"; | ||
| 53 | + subTitleTextFir = '桌位信息'; | ||
| 54 | + subTitleTextSec = '申请时间'; | ||
| 55 | + } else if (message.message_type == "14") { | ||
| 56 | + titleText = "发票\n申请"; | ||
| 57 | + subTitleTextFir = '桌位信息'; | ||
| 58 | + subTitleTextSec = '申请时间'; | ||
| 59 | + } else if (message.message_type == "店内消息") { | ||
| 60 | + titleText = "店内\n消息"; | ||
| 61 | + bgcolor = MyColours.color_5F7292; | ||
| 62 | + btnname = 'store_info_go'; | ||
| 63 | + } | ||
| 64 | + | ||
| 65 | + MessageDialogModel messageDialogModel = | ||
| 66 | + Provider.of<MessageDialogModel>(context, listen: false); | ||
| 67 | + return GestureDetector( | ||
| 68 | + onTap: () async { | ||
| 69 | + //true已处理跳转 false未处理列表不需要点击事件 | ||
| 70 | + if (isTreated) { | ||
| 71 | + if (message.message_type == "10") { | ||
| 72 | + NavigatorUtil.goNotebookDetailPage( | ||
| 73 | + context, message.rid.toString(), message.uid); | ||
| 74 | + } else if (message.message_type == "1") { | ||
| 75 | + NavigatorUtil.goHasOrderFoodPage(context, rid: message.rid); | ||
| 76 | + } else if (message.message_type == "11") { | ||
| 77 | + NavigatorUtil.goNotebookDetailPage( | ||
| 78 | + context, message.rid.toString(), message.uid); | ||
| 79 | + } else if (message.message_type == "12") { | ||
| 80 | + //在线买单消息查看 | ||
| 81 | + NavigatorUtil.goOnlineCheckDetailPage(context, | ||
| 82 | + rid: '${message.rid}'); | ||
| 83 | + } else if (message.message_type == "13") { | ||
| 84 | + //买单通知,跳转至买单详情查看 | ||
| 85 | + NavigatorUtil.goOnlineCheckDetailPage(context, | ||
| 86 | + rid: '${message.rid}'); | ||
| 87 | + } else if (message.message_type == "14") { | ||
| 88 | + //发票详情页面跳转 | ||
| 89 | + NavigatorUtil.goInvoiceDetailPage(context, rid: '${message.rid}'); | ||
| 90 | + } | ||
| 91 | + } else { | ||
| 92 | + messageDialogModel.removeMessage(message.id); | ||
| 93 | + //message_type:10 跳转在线预订 11 取消订单 1 提前点餐 | ||
| 94 | + if (message.message_type == "10") { | ||
| 95 | + NavigatorUtil.goHandleOnlinePage( | ||
| 96 | + context, message.rid.toString(), message.id); | ||
| 97 | + } else if (message.message_type == "11") { | ||
| 98 | + NavigatorUtil.goNotebookDetailPage( | ||
| 99 | + context, message.rid.toString(), message.uid); | ||
| 100 | + bus.emit("remove_untreated_message", message.id); | ||
| 101 | + | ||
| 102 | + Map<String, String> params = { | ||
| 103 | + "sid": Provider.of<UserModel>(context, listen: false) | ||
| 104 | + .user | ||
| 105 | + .sellerid, | ||
| 106 | + "id": message.id, | ||
| 107 | + "status": message.message_type == "1" ? "is_read" : "is_handle" | ||
| 108 | + }; | ||
| 109 | + await messageDialogModel.setMessageStatus(context, params); | ||
| 110 | + bus.emit("refresh_untreated_num"); //刷新未读消息数目 | ||
| 111 | + } else if (message.message_type == "1") { | ||
| 112 | + //提前点餐 | ||
| 113 | + NavigatorUtil.goHasOrderFoodPage(context, rid: message.rid); | ||
| 114 | + bus.emit("remove_untreated_message", message.id); | ||
| 115 | + | ||
| 116 | + Map<String, String> params = { | ||
| 117 | + "sid": Provider.of<UserModel>(context, listen: false) | ||
| 118 | + .user | ||
| 119 | + .sellerid, | ||
| 120 | + "id": message.id, | ||
| 121 | + "status": message.message_type == "1" ? "is_read" : "is_handle" | ||
| 122 | + }; | ||
| 123 | + await messageDialogModel.setMessageStatus(context, params); | ||
| 124 | + bus.emit("refresh_untreated_num"); //刷新未读消息数目 | ||
| 125 | + } else if ('${message.message_type}' == "12") { | ||
| 126 | + //在线买单消息 去处理 跳转在线买单处理页面 | ||
| 127 | + NavigatorUtil.goOnlineCheckEditPage(context, | ||
| 128 | + rid: '${message.rid}', mid: message.id); | ||
| 129 | + } else if ('${message.message_type}' == "13") { | ||
| 130 | + //在线买单消息 去查看 跳转在线买单详情页面 | ||
| 131 | + NavigatorUtil.goOnlineCheckDetailPage(context, | ||
| 132 | + rid: '${message.rid}'); | ||
| 133 | + bus.emit("remove_untreated_message", message.id); | ||
| 134 | + | ||
| 135 | + Map<String, String> params = { | ||
| 136 | + "sid": Provider.of<UserModel>(context, listen: false) | ||
| 137 | + .user | ||
| 138 | + .sellerid, | ||
| 139 | + "id": message.id, | ||
| 140 | + "status": message.message_type == "1" ? "is_read" : "is_handle" | ||
| 141 | + }; | ||
| 142 | + await messageDialogModel.setMessageStatus(context, params); | ||
| 143 | + bus.emit("refresh_untreated_num"); //刷新未读消息数目 | ||
| 144 | + } else if (message.message_type == "14") { | ||
| 145 | + //发票详情页面跳转 | ||
| 146 | + NavigatorUtil.goInvoiceDetailPage(context, rid: '${message.rid}'); | ||
| 147 | + bus.emit("remove_untreated_message", message.id); | ||
| 148 | + | ||
| 149 | + Map<String, String> params = { | ||
| 150 | + "sid": Provider.of<UserModel>(context, listen: false) | ||
| 151 | + .user | ||
| 152 | + .sellerid, | ||
| 153 | + "id": message.id, | ||
| 154 | + "status": message.message_type == "1" ? "is_read" : "is_handle" | ||
| 155 | + }; | ||
| 156 | + await messageDialogModel.setMessageStatus(context, params); | ||
| 157 | + bus.emit("refresh_untreated_num"); //刷新未读消息数目 | ||
| 158 | + } | ||
| 159 | + } | ||
| 160 | + }, | ||
| 161 | + child: Stack( | ||
| 162 | + children: <Widget>[ | ||
| 163 | + Container( | ||
| 164 | + margin: EdgeInsets.symmetric( | ||
| 165 | + horizontal: ScreenUtil().setWidth(24 * 2), | ||
| 166 | + vertical: ScreenUtil().setWidth(20)), | ||
| 167 | + padding: EdgeInsets.only( | ||
| 168 | + right: ScreenUtil().setWidth(32), | ||
| 169 | + ), | ||
| 170 | + decoration: BoxDecoration( | ||
| 171 | + border: Border.all( | ||
| 172 | + width: ScreenUtil().setWidth(2), color: bgcolor), | ||
| 173 | + borderRadius: BorderRadius.all( | ||
| 174 | + Radius.circular(ScreenUtil().setWidth(18)))), | ||
| 175 | + child: Row( | ||
| 176 | + // mainAxisSize: MainAxisSize.min, | ||
| 177 | + // crossAxisAlignment: CrossAxisAlignment.start, | ||
| 178 | + children: <Widget>[ | ||
| 179 | + Container( | ||
| 180 | + width: ScreenUtil().setWidth(128), | ||
| 181 | + height: ScreenUtil().setWidth(160), | ||
| 182 | + alignment: Alignment.center, | ||
| 183 | + decoration: BoxDecoration( | ||
| 184 | + color: bgcolor, | ||
| 185 | + borderRadius: BorderRadius.only( | ||
| 186 | + topLeft: Radius.circular(ScreenUtil().setWidth(16)), | ||
| 187 | + bottomLeft: | ||
| 188 | + Radius.circular(ScreenUtil().setWidth(16)))), | ||
| 189 | + child: Transform.translate( | ||
| 190 | + offset: Offset(0, 0.1 / 2), //1为 StrutStyle 的 leading的值 | ||
| 191 | + child: Text( | ||
| 192 | + titleText, | ||
| 193 | + style: TextStyle( | ||
| 194 | + color: MyColours.color_ffffff, | ||
| 195 | + fontSize: ScreenUtil().setSp(24), | ||
| 196 | + ), | ||
| 197 | + strutStyle: StrutStyle( | ||
| 198 | + forceStrutHeight: true, height: 1, leading: 0.1), | ||
| 199 | + ), | ||
| 200 | + ), | ||
| 201 | + ), | ||
| 202 | + HEmptyView(34), | ||
| 203 | + message.message_type == "10" || message.message_type == "12" | ||
| 204 | + ? Column( | ||
| 205 | + crossAxisAlignment: CrossAxisAlignment.start, | ||
| 206 | + children: <Widget>[ | ||
| 207 | + Row(children: [ | ||
| 208 | + Padding( | ||
| 209 | + padding: EdgeInsets.only( | ||
| 210 | + right: ScreenUtil().setWidth(12)), | ||
| 211 | + child: Text( | ||
| 212 | + message.rnameStr, | ||
| 213 | + style: TextStyle( | ||
| 214 | + color: MyColours.color_515151, | ||
| 215 | + fontSize: ScreenUtil().setSp(32)), | ||
| 216 | + )), | ||
| 217 | + attr == '' || attr == null | ||
| 218 | + ? Container( | ||
| 219 | + margin: EdgeInsets.only( | ||
| 220 | + right: ScreenUtil().setWidth(12)), | ||
| 221 | + padding: EdgeInsets.symmetric( | ||
| 222 | + horizontal: ScreenUtil().setWidth(16), | ||
| 223 | + vertical: ScreenUtil().setWidth(6)), | ||
| 224 | + decoration: BoxDecoration( | ||
| 225 | + color: attr == '沉睡' | ||
| 226 | + ? Color.fromRGBO(223, 33, 81, 1) | ||
| 227 | + : attr == '活跃' | ||
| 228 | + ? Color.fromRGBO( | ||
| 229 | + 81, 170, 94, 1) | ||
| 230 | + : attr == '流失' | ||
| 231 | + ? Color.fromRGBO( | ||
| 232 | + 109, 101, 248, 1) | ||
| 233 | + : Color.fromRGBO( | ||
| 234 | + 239, 143, 49, 1), | ||
| 235 | + borderRadius: | ||
| 236 | + BorderRadius.circular(8)), | ||
| 237 | + child: Text( | ||
| 238 | + '活跃', | ||
| 239 | + style: TextStyle( | ||
| 240 | + color: MyColours.color_ffffff, | ||
| 241 | + fontSize: ScreenUtil().setSp(24)), | ||
| 242 | + ), | ||
| 243 | + ) | ||
| 244 | + : SizedBox(), | ||
| 245 | + Container( | ||
| 246 | + padding: EdgeInsets.symmetric( | ||
| 247 | + horizontal: ScreenUtil().setWidth(16), | ||
| 248 | + vertical: ScreenUtil().setWidth(6)), | ||
| 249 | + decoration: BoxDecoration( | ||
| 250 | + border: Border.all( | ||
| 251 | + width: ScreenUtil().setWidth(2), | ||
| 252 | + color: MyColours.color_F2995F, | ||
| 253 | + ), | ||
| 254 | + borderRadius: BorderRadius.circular(8)), | ||
| 255 | + child: Text( | ||
| 256 | + 'biaoqianvipdsds', | ||
| 257 | + style: TextStyle( | ||
| 258 | + color: MyColours.color_F2995F, | ||
| 259 | + fontSize: ScreenUtil().setSp(24)), | ||
| 260 | + ), | ||
| 261 | + ) | ||
| 262 | + ]), | ||
| 263 | + VEmptyView(16), | ||
| 264 | + Text( | ||
| 265 | + '${message.ddateStr}', | ||
| 266 | + style: TextStyle( | ||
| 267 | + color: MyColours.color_999999, | ||
| 268 | + fontSize: ScreenUtil().setSp(24)), | ||
| 269 | + ), | ||
| 270 | + VEmptyView(8), | ||
| 271 | + Container( | ||
| 272 | + padding: EdgeInsets.symmetric( | ||
| 273 | + horizontal: ScreenUtil().setWidth(16), | ||
| 274 | + vertical: ScreenUtil().setWidth(6)), | ||
| 275 | + decoration: BoxDecoration( | ||
| 276 | + color: bgcolor, | ||
| 277 | + borderRadius: BorderRadius.circular(8)), | ||
| 278 | + child: Text( | ||
| 279 | + '${message.message_type == '1' ? message.room_info : message.room_demand}', | ||
| 280 | + style: TextStyle( | ||
| 281 | + color: MyColours.color_ffffff, | ||
| 282 | + fontSize: ScreenUtil().setSp(20)), | ||
| 283 | + ), | ||
| 284 | + ) | ||
| 285 | + ], | ||
| 286 | + ) | ||
| 287 | + : SizedBox(), | ||
| 288 | + message.message_type == "11" || message.message_type == "1" | ||
| 289 | + ? Column( | ||
| 290 | + crossAxisAlignment: CrossAxisAlignment.start, | ||
| 291 | + children: [ | ||
| 292 | + Text( | ||
| 293 | + "预订日期:${message.ddateStr}", | ||
| 294 | + style: TextStyle( | ||
| 295 | + color: MyColours.color_BFC4D4, | ||
| 296 | + fontSize: ScreenUtil().setSp(28)), | ||
| 297 | + ), | ||
| 298 | + VEmptyView(8), | ||
| 299 | + message.room_demand == '' | ||
| 300 | + ? SizedBox() | ||
| 301 | + : Container( | ||
| 302 | + padding: EdgeInsets.symmetric( | ||
| 303 | + horizontal: ScreenUtil().setWidth(16), | ||
| 304 | + vertical: ScreenUtil().setWidth(6)), | ||
| 305 | + decoration: BoxDecoration( | ||
| 306 | + color: bgcolor, | ||
| 307 | + borderRadius: BorderRadius.circular(8)), | ||
| 308 | + child: Text( | ||
| 309 | + '${message.room_demand}', | ||
| 310 | + style: TextStyle( | ||
| 311 | + color: MyColours.color_ffffff, | ||
| 312 | + fontSize: ScreenUtil().setSp(20)), | ||
| 313 | + ), | ||
| 314 | + ), | ||
| 315 | + message.message_type == "1" | ||
| 316 | + ? SizedBox() | ||
| 317 | + : Text( | ||
| 318 | + true ? '取消操作人:顾客在线取消' : '取消操作人:方硕', | ||
| 319 | + style: TextStyle( | ||
| 320 | + color: MyColours.color_999999, | ||
| 321 | + fontSize: ScreenUtil().setSp(24)), | ||
| 322 | + ) | ||
| 323 | + ], | ||
| 324 | + ) | ||
| 325 | + : SizedBox(), | ||
| 326 | + message.message_type == "店内消息" | ||
| 327 | + ? Column( | ||
| 328 | + crossAxisAlignment: CrossAxisAlignment.start, | ||
| 329 | + children: [ | ||
| 330 | + Text( | ||
| 331 | + "请确认 2022-04-02 午餐 客人是否会如约到店!", | ||
| 332 | + style: TextStyle( | ||
| 333 | + color: MyColours.color_515151, | ||
| 334 | + fontSize: ScreenUtil().setSp(28)), | ||
| 335 | + ), | ||
| 336 | + VEmptyView(8), | ||
| 337 | + Text( | ||
| 338 | + "发起人:系统自动", | ||
| 339 | + style: TextStyle( | ||
| 340 | + color: MyColours.color_999999, | ||
| 341 | + fontSize: ScreenUtil().setSp(24)), | ||
| 342 | + ), | ||
| 343 | + ], | ||
| 344 | + ) | ||
| 345 | + : SizedBox() | ||
| 346 | + ], | ||
| 347 | + ), | ||
| 348 | + ), | ||
| 349 | + Positioned( | ||
| 350 | + right: ScreenUtil().setWidth(24 * 2 + 16 * 2), | ||
| 351 | + top: ScreenUtil().setWidth(28 + 24 * 2), | ||
| 352 | + child: Offstage( | ||
| 353 | + offstage: isTreated ? true : false, | ||
| 354 | + child: InkWell( | ||
| 355 | + onTap: () async { | ||
| 356 | + messageDialogModel.removeMessage(message.id); | ||
| 357 | + //message_type:10 跳转在线预订 11 取消订单 1 提前点餐 | ||
| 358 | + if (message.message_type == "10") { | ||
| 359 | + NavigatorUtil.goHandleOnlinePage( | ||
| 360 | + context, message.rid.toString(), message.id); | ||
| 361 | + } else if (message.message_type == "11") { | ||
| 362 | + NavigatorUtil.goNotebookDetailPage( | ||
| 363 | + context, message.rid.toString(), message.uid); | ||
| 364 | + bus.emit("remove_untreated_message", message.id); | ||
| 365 | + | ||
| 366 | + Map<String, String> params = { | ||
| 367 | + "sid": Provider.of<UserModel>(context, listen: false) | ||
| 368 | + .user | ||
| 369 | + .sellerid, | ||
| 370 | + "id": message.id, | ||
| 371 | + "status": message.message_type == "1" | ||
| 372 | + ? "is_read" | ||
| 373 | + : "is_handle" | ||
| 374 | + }; | ||
| 375 | + await messageDialogModel.setMessageStatus( | ||
| 376 | + context, params); | ||
| 377 | + bus.emit("refresh_untreated_num"); //刷新未读消息数目 | ||
| 378 | + } else if (message.message_type == "1") { | ||
| 379 | + //提前点餐 | ||
| 380 | + NavigatorUtil.goHasOrderFoodPage(context, | ||
| 381 | + rid: message.rid); | ||
| 382 | + bus.emit("remove_untreated_message", message.id); | ||
| 383 | + | ||
| 384 | + Map<String, String> params = { | ||
| 385 | + "sid": Provider.of<UserModel>(context, listen: false) | ||
| 386 | + .user | ||
| 387 | + .sellerid, | ||
| 388 | + "id": message.id, | ||
| 389 | + "status": message.message_type == "1" | ||
| 390 | + ? "is_read" | ||
| 391 | + : "is_handle" | ||
| 392 | + }; | ||
| 393 | + await messageDialogModel.setMessageStatus( | ||
| 394 | + context, params); | ||
| 395 | + bus.emit("refresh_untreated_num"); //刷新未读消息数目 | ||
| 396 | + } else if ('${message.message_type}' == "12") { | ||
| 397 | + //在线买单消息 去处理 跳转在线买单处理页面 | ||
| 398 | + NavigatorUtil.goOnlineCheckEditPage(context, | ||
| 399 | + rid: '${message.rid}', mid: message.id); | ||
| 400 | + } else if ('${message.message_type}' == "13") { | ||
| 401 | + //在线买单消息 去查看 跳转在线买单详情页面 | ||
| 402 | + NavigatorUtil.goOnlineCheckDetailPage(context, | ||
| 403 | + rid: '${message.rid}'); | ||
| 404 | + bus.emit("remove_untreated_message", message.id); | ||
| 405 | + | ||
| 406 | + Map<String, String> params = { | ||
| 407 | + "sid": Provider.of<UserModel>(context, listen: false) | ||
| 408 | + .user | ||
| 409 | + .sellerid, | ||
| 410 | + "id": message.id, | ||
| 411 | + "status": message.message_type == "1" | ||
| 412 | + ? "is_read" | ||
| 413 | + : "is_handle" | ||
| 414 | + }; | ||
| 415 | + await messageDialogModel.setMessageStatus( | ||
| 416 | + context, params); | ||
| 417 | + bus.emit("refresh_untreated_num"); //刷新未读消息数目 | ||
| 418 | + } else if (message.message_type == "14") { | ||
| 419 | + //发票详情页面跳转 | ||
| 420 | + NavigatorUtil.goInvoiceDetailPage(context, | ||
| 421 | + rid: '${message.rid}'); | ||
| 422 | + bus.emit("remove_untreated_message", message.id); | ||
| 423 | + | ||
| 424 | + Map<String, String> params = { | ||
| 425 | + "sid": Provider.of<UserModel>(context, listen: false) | ||
| 426 | + .user | ||
| 427 | + .sellerid, | ||
| 428 | + "id": message.id, | ||
| 429 | + "status": message.message_type == "1" | ||
| 430 | + ? "is_read" | ||
| 431 | + : "is_handle" | ||
| 432 | + }; | ||
| 433 | + await messageDialogModel.setMessageStatus( | ||
| 434 | + context, params); | ||
| 435 | + bus.emit("refresh_untreated_num"); //刷新未读消息数目 | ||
| 436 | + } | ||
| 437 | + }, | ||
| 438 | + child: Image.asset( | ||
| 439 | + Utils.getImgPath('$btnname'), | ||
| 440 | + width: ScreenUtil().setWidth(24 * 2), | ||
| 441 | + height: ScreenUtil().setWidth(24 * 2), | ||
| 442 | + ), | ||
| 443 | + ), | ||
| 444 | + ), | ||
| 445 | + ) | ||
| 446 | + ], | ||
| 447 | + )); | ||
| 448 | + } | ||
| 449 | +} |
| @@ -2,6 +2,7 @@ import 'package:flutter/material.dart'; | @@ -2,6 +2,7 @@ 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/constant/state.dart'; | 3 | import 'package:one_key/constant/state.dart'; |
| 4 | import 'package:one_key/pages/message/message_online_check_page.dart'; | 4 | import 'package:one_key/pages/message/message_online_check_page.dart'; |
| 5 | +import 'package:one_key/pages/message/message_untreated_page.dart'; | ||
| 5 | import 'package:one_key/provider/message_dialog_model.dart'; | 6 | import 'package:one_key/provider/message_dialog_model.dart'; |
| 6 | import 'package:one_key/provider/message_model.dart'; | 7 | import 'package:one_key/provider/message_model.dart'; |
| 7 | import 'package:one_key/provider/user_model.dart'; | 8 | import 'package:one_key/provider/user_model.dart'; |
| @@ -26,8 +27,8 @@ class MessagePage extends StatefulWidget { | @@ -26,8 +27,8 @@ class MessagePage extends StatefulWidget { | ||
| 26 | 27 | ||
| 27 | class MessagePageState extends State<MessagePage> | 28 | class MessagePageState extends State<MessagePage> |
| 28 | with TickerProviderStateMixin { | 29 | with TickerProviderStateMixin { |
| 29 | - Color selectedColor = MyColours.color_199095; | ||
| 30 | - Color unSelectedColor = MyColours.color_999999; | 30 | + Color selectedColor = MyColours.color_ffffff; |
| 31 | + Color unSelectedColor = MyColours.color_BFC4D4; | ||
| 31 | 32 | ||
| 32 | TabController tabController; | 33 | TabController tabController; |
| 33 | 34 | ||
| @@ -38,7 +39,7 @@ class MessagePageState extends State<MessagePage> | @@ -38,7 +39,7 @@ class MessagePageState extends State<MessagePage> | ||
| 38 | @override | 39 | @override |
| 39 | void initState() { | 40 | void initState() { |
| 40 | super.initState(); | 41 | super.initState(); |
| 41 | - tabController = TabController(length: 3, vsync: this); | 42 | + tabController = TabController(length: 2, vsync: this); |
| 42 | tabController.addListener(() { | 43 | tabController.addListener(() { |
| 43 | //点击tab时或滑动tab回调一次 | 44 | //点击tab时或滑动tab回调一次 |
| 44 | if (tabController.index.toDouble() == tabController.animation.value) { | 45 | if (tabController.index.toDouble() == tabController.animation.value) { |
| @@ -104,123 +105,151 @@ class MessagePageState extends State<MessagePage> | @@ -104,123 +105,151 @@ class MessagePageState extends State<MessagePage> | ||
| 104 | "消息中心", | 105 | "消息中心", |
| 105 | showBack: false, | 106 | showBack: false, |
| 106 | ), | 107 | ), |
| 107 | - TabBar( | ||
| 108 | - controller: tabController, | ||
| 109 | - tabs: [ | ||
| 110 | - Tab( | ||
| 111 | - child: SizedBox( | ||
| 112 | - height: ScreenUtil().setWidth(60), | ||
| 113 | - width: ScreenUtil().setWidth(144), | ||
| 114 | - child: Stack( | ||
| 115 | - children: [ | ||
| 116 | - Text( | ||
| 117 | - "在线预订", | ||
| 118 | - style: TextStyle( | ||
| 119 | - color: tabController.index == 0 | ||
| 120 | - ? selectedColor | ||
| 121 | - : unSelectedColor, | ||
| 122 | - fontSize: ScreenUtil().setSp(32), | ||
| 123 | - fontWeight: FontWeight.bold), | 108 | + Padding( |
| 109 | + padding: EdgeInsets.symmetric( | ||
| 110 | + horizontal: ScreenUtil().setWidth(24 * 2)), | ||
| 111 | + child: TabBar( | ||
| 112 | + controller: tabController, | ||
| 113 | + isScrollable: true, | ||
| 114 | + labelPadding: EdgeInsets.zero, //tabs控件之间的间距 | ||
| 115 | + tabs: [ | ||
| 116 | + Tab( | ||
| 117 | + child: Container( | ||
| 118 | + width: (ScreenUtil.screenWidthDp - | ||
| 119 | + ScreenUtil().setWidth(24 * 2 * 2)) / | ||
| 120 | + 2, | ||
| 121 | + height: ScreenUtil().setWidth(36 * 2), | ||
| 122 | + decoration: BoxDecoration( | ||
| 123 | + border: Border( | ||
| 124 | + bottom: BorderSide( | ||
| 125 | + width: ScreenUtil().setWidth(2), | ||
| 126 | + color: tabController.index == 0 | ||
| 127 | + ? MyColours.color_438E93 | ||
| 128 | + : MyColours.color_BFC4D4), | ||
| 129 | + left: BorderSide( | ||
| 130 | + width: ScreenUtil().setWidth(2), | ||
| 131 | + color: tabController.index == 0 | ||
| 132 | + ? MyColours.color_438E93 | ||
| 133 | + : MyColours.color_BFC4D4), | ||
| 134 | + top: BorderSide( | ||
| 135 | + width: ScreenUtil().setWidth(2), | ||
| 136 | + color: tabController.index == 0 | ||
| 137 | + ? MyColours.color_438E93 | ||
| 138 | + : MyColours.color_BFC4D4), | ||
| 139 | + right: BorderSide( | ||
| 140 | + width: ScreenUtil().setWidth(2), | ||
| 141 | + color: tabController.index == 0 | ||
| 142 | + ? MyColours.color_438E93 | ||
| 143 | + : MyColours.color_BFC4D4)), | ||
| 144 | + borderRadius: BorderRadius.only( | ||
| 145 | + topLeft: | ||
| 146 | + Radius.circular(ScreenUtil().setWidth(16)), | ||
| 147 | + bottomLeft: | ||
| 148 | + Radius.circular(ScreenUtil().setWidth(16))), | ||
| 149 | + color: tabController.index == 0 | ||
| 150 | + ? MyColours.color_438E93 | ||
| 151 | + : MyColours.color_ffffff), | ||
| 152 | + alignment: Alignment.center, | ||
| 153 | + child: Row( | ||
| 154 | + mainAxisAlignment: MainAxisAlignment.center, | ||
| 155 | + children: [ | ||
| 156 | + Text("未处理", | ||
| 157 | + style: TextStyle( | ||
| 158 | + color: tabController.index == 0 | ||
| 159 | + ? selectedColor | ||
| 160 | + : unSelectedColor, | ||
| 161 | + fontSize: tabController.index == 0 | ||
| 162 | + ? ScreenUtil().setSp(32) | ||
| 163 | + : ScreenUtil().setSp(24), | ||
| 164 | + )), | ||
| 165 | + Offstage( | ||
| 166 | + offstage: false, | ||
| 167 | + child: Container( | ||
| 168 | + width: ScreenUtil().setWidth(36), | ||
| 169 | + height: ScreenUtil().setWidth(36), | ||
| 170 | + margin: EdgeInsets.only( | ||
| 171 | + left: ScreenUtil().setWidth(20)), | ||
| 172 | + decoration: BoxDecoration( | ||
| 173 | + borderRadius: BorderRadius.circular( | ||
| 174 | + ScreenUtil().setWidth(36)), | ||
| 175 | + color: true | ||
| 176 | + ? MyColours.color_E34D59 | ||
| 177 | + : MyColours.color_ffffff), | ||
| 178 | + alignment: Alignment.center, | ||
| 179 | + child: Text("5", | ||
| 180 | + style: TextStyle( | ||
| 181 | + color: MyColours.color_ffffff, | ||
| 182 | + fontSize: ScreenUtil().setSp(28), | ||
| 183 | + )), | ||
| 184 | + )), | ||
| 185 | + ], | ||
| 124 | ), | 186 | ), |
| 125 | - Positioned( | ||
| 126 | - top: 0, | ||
| 127 | - right: 0, | ||
| 128 | - child: Container( | ||
| 129 | - width: ScreenUtil().setWidth(16), | ||
| 130 | - height: ScreenUtil().setWidth(16), | ||
| 131 | - decoration: BoxDecoration( | ||
| 132 | - borderRadius: BorderRadius.circular( | ||
| 133 | - ScreenUtil().setWidth(16)), | ||
| 134 | - color: messageModel.onlineTotal > 0 | ||
| 135 | - ? MyColours.color_fa5151 | ||
| 136 | - : MyColours.color_ffffff), | ||
| 137 | - ), | ||
| 138 | - ) | ||
| 139 | - ], | 187 | + ), |
| 140 | ), | 188 | ), |
| 141 | - ), | ||
| 142 | - ), | ||
| 143 | - Tab( | ||
| 144 | - child: SizedBox( | ||
| 145 | - height: ScreenUtil().setWidth(60), | ||
| 146 | - width: ScreenUtil().setWidth(144), | ||
| 147 | - child: Stack( | ||
| 148 | - children: [ | ||
| 149 | - Text( | ||
| 150 | - "提前点餐", | ||
| 151 | - style: TextStyle( | 189 | + Tab( |
| 190 | + child: Container( | ||
| 191 | + width: (ScreenUtil.screenWidthDp - | ||
| 192 | + ScreenUtil().setWidth(24 * 2 * 2)) / | ||
| 193 | + 2, | ||
| 194 | + height: ScreenUtil().setWidth(36 * 2), | ||
| 195 | + decoration: BoxDecoration( | ||
| 196 | + border: Border( | ||
| 197 | + left: BorderSide( | ||
| 198 | + width: ScreenUtil().setWidth(2), | ||
| 199 | + color: tabController.index == 1 | ||
| 200 | + ? MyColours.color_438E93 | ||
| 201 | + : MyColours.color_BFC4D4), | ||
| 202 | + bottom: BorderSide( | ||
| 203 | + width: ScreenUtil().setWidth(2), | ||
| 204 | + color: tabController.index == 1 | ||
| 205 | + ? MyColours.color_438E93 | ||
| 206 | + : MyColours.color_BFC4D4), | ||
| 207 | + right: BorderSide( | ||
| 208 | + width: ScreenUtil().setWidth(2), | ||
| 209 | + color: tabController.index == 1 | ||
| 210 | + ? MyColours.color_438E93 | ||
| 211 | + : MyColours.color_BFC4D4), | ||
| 212 | + top: BorderSide( | ||
| 213 | + width: ScreenUtil().setWidth(2), | ||
| 214 | + color: tabController.index == 1 | ||
| 215 | + ? MyColours.color_438E93 | ||
| 216 | + : MyColours.color_BFC4D4)), | ||
| 217 | + borderRadius: BorderRadius.only( | ||
| 218 | + topRight: | ||
| 219 | + Radius.circular(ScreenUtil().setWidth(16)), | ||
| 220 | + bottomRight: | ||
| 221 | + Radius.circular(ScreenUtil().setWidth(16))), | ||
| 152 | color: tabController.index == 1 | 222 | color: tabController.index == 1 |
| 153 | - ? selectedColor | ||
| 154 | - : unSelectedColor, | ||
| 155 | - fontSize: ScreenUtil().setSp(32), | ||
| 156 | - fontWeight: FontWeight.bold), | ||
| 157 | - ), | ||
| 158 | - Positioned( | ||
| 159 | - top: 0, | ||
| 160 | - right: 0, | ||
| 161 | - child: Container( | ||
| 162 | - width: ScreenUtil().setWidth(16), | ||
| 163 | - height: ScreenUtil().setWidth(16), | ||
| 164 | - decoration: BoxDecoration( | ||
| 165 | - borderRadius: BorderRadius.circular( | ||
| 166 | - ScreenUtil().setWidth(16)), | ||
| 167 | - color: messageModel.orderTotal > 0 | ||
| 168 | - ? MyColours.color_fa5151 | ||
| 169 | - : MyColours.color_ffffff), | ||
| 170 | - ), | ||
| 171 | - ) | ||
| 172 | - ], | ||
| 173 | - ), | ||
| 174 | - ), | ||
| 175 | - ), | ||
| 176 | - Tab( | ||
| 177 | - child: SizedBox( | ||
| 178 | - height: ScreenUtil().setWidth(60), | ||
| 179 | - width: ScreenUtil().setWidth(144), | ||
| 180 | - child: Stack( | ||
| 181 | - children: [ | ||
| 182 | - Text( | ||
| 183 | - "在线买单", | ||
| 184 | - style: TextStyle( | ||
| 185 | - color: tabController.index == 2 | ||
| 186 | - ? selectedColor | ||
| 187 | - : unSelectedColor, | ||
| 188 | - fontSize: ScreenUtil().setSp(32), | ||
| 189 | - fontWeight: FontWeight.bold), | ||
| 190 | - ), | ||
| 191 | - Positioned( | ||
| 192 | - top: 0, | ||
| 193 | - right: 0, | ||
| 194 | - child: Container( | ||
| 195 | - width: ScreenUtil().setWidth(16), | ||
| 196 | - height: ScreenUtil().setWidth(16), | ||
| 197 | - decoration: BoxDecoration( | ||
| 198 | - borderRadius: BorderRadius.circular( | ||
| 199 | - ScreenUtil().setWidth(16)), | ||
| 200 | - color: messageModel.checkTotal > 0 | ||
| 201 | - ? MyColours.color_fa5151 | ||
| 202 | - : MyColours.color_ffffff), | ||
| 203 | - ), | ||
| 204 | - ) | ||
| 205 | - ], | 223 | + ? MyColours.color_438E93 |
| 224 | + : MyColours.color_ffffff), | ||
| 225 | + alignment: Alignment.center, | ||
| 226 | + child: Text( | ||
| 227 | + "已处理", | ||
| 228 | + style: TextStyle( | ||
| 229 | + color: tabController.index == 1 | ||
| 230 | + ? selectedColor | ||
| 231 | + : unSelectedColor, | ||
| 232 | + fontSize: tabController.index == 1 | ||
| 233 | + ? ScreenUtil().setSp(32) | ||
| 234 | + : ScreenUtil().setSp(24)), | ||
| 235 | + )), | ||
| 206 | ), | 236 | ), |
| 207 | - ), | ||
| 208 | - ) | ||
| 209 | - ], | ||
| 210 | - indicatorColor: MyColours.color_199095, | ||
| 211 | - indicatorSize: TabBarIndicatorSize.label, | ||
| 212 | - indicatorPadding: EdgeInsets.only( | ||
| 213 | - left: ScreenUtil().setWidth(16), | ||
| 214 | - right: ScreenUtil().setWidth(32)), | ||
| 215 | - indicatorWeight: ScreenUtil().setWidth(6.0), | ||
| 216 | - ), | 237 | + ], |
| 238 | + indicatorColor: Colors.transparent, | ||
| 239 | + indicatorSize: TabBarIndicatorSize.tab, | ||
| 240 | + | ||
| 241 | + // indicatorPadding: EdgeInsets.only( | ||
| 242 | + // left: ScreenUtil().setWidth(16), | ||
| 243 | + // right: ScreenUtil().setWidth(32)), | ||
| 244 | + // indicatorWeight: ScreenUtil().setWidth(6.0), | ||
| 245 | + )), | ||
| 217 | VEmptyView(11), | 246 | VEmptyView(11), |
| 218 | Expanded( | 247 | Expanded( |
| 219 | flex: 1, | 248 | flex: 1, |
| 220 | child: TabBarView(controller: tabController, children: [ | 249 | child: TabBarView(controller: tabController, children: [ |
| 221 | - MessageOnlinePage(), | 250 | + MessageUntreatedPage(), |
| 222 | MessageOrderPage(), | 251 | MessageOrderPage(), |
| 223 | - MessageOnlineCheckPage() | 252 | + // MessageOnlineCheckPage() |
| 224 | ]), | 253 | ]), |
| 225 | ) | 254 | ) |
| 226 | ], | 255 | ], |
lib/pages/message/message_page_old.dart
0 → 100644
| 1 | +// import 'package:flutter/material.dart'; | ||
| 2 | +// import 'package:flutter_screenutil/flutter_screenutil.dart'; | ||
| 3 | +// import 'package:one_key/constant/state.dart'; | ||
| 4 | +// import 'package:one_key/pages/message/message_online_check_page.dart'; | ||
| 5 | +// import 'package:one_key/provider/message_dialog_model.dart'; | ||
| 6 | +// import 'package:one_key/provider/message_model.dart'; | ||
| 7 | +// import 'package:one_key/provider/user_model.dart'; | ||
| 8 | +// import 'package:one_key/res/colors.dart'; | ||
| 9 | +// import 'package:one_key/utils/event_bus.dart'; | ||
| 10 | +// import 'package:one_key/widgets/app_bar.dart'; | ||
| 11 | +// import 'package:one_key/widgets/v_empty_view.dart'; | ||
| 12 | +// import 'package:provider/provider.dart'; | ||
| 13 | +// import 'message_online_page.dart'; | ||
| 14 | +// import 'message_order_page.dart'; | ||
| 15 | + | ||
| 16 | +// /* | ||
| 17 | +// 消息中心 | ||
| 18 | +// */ | ||
| 19 | +// class MessagePage extends StatefulWidget { | ||
| 20 | +// @override | ||
| 21 | +// State<StatefulWidget> createState() { | ||
| 22 | +// // TODO: implement createState | ||
| 23 | +// return new MessagePageState(); | ||
| 24 | +// } | ||
| 25 | +// } | ||
| 26 | + | ||
| 27 | +// class MessagePageState extends State<MessagePage> | ||
| 28 | +// with TickerProviderStateMixin { | ||
| 29 | +// Color selectedColor = MyColours.color_199095; | ||
| 30 | +// Color unSelectedColor = MyColours.color_999999; | ||
| 31 | + | ||
| 32 | +// TabController tabController; | ||
| 33 | + | ||
| 34 | +// MessageModel messageModel; | ||
| 35 | +// UserModel userModel; | ||
| 36 | +// MessageDialogModel messageDialogModel; | ||
| 37 | + | ||
| 38 | +// @override | ||
| 39 | +// void initState() { | ||
| 40 | +// super.initState(); | ||
| 41 | +// tabController = TabController(length: 3, vsync: this); | ||
| 42 | +// tabController.addListener(() { | ||
| 43 | +// //点击tab时或滑动tab回调一次 | ||
| 44 | +// if (tabController.index.toDouble() == tabController.animation.value) { | ||
| 45 | +// getMessage(index: tabController.index); | ||
| 46 | +// } | ||
| 47 | +// }); | ||
| 48 | +// WidgetsBinding.instance.addPostFrameCallback((timeStamp) { | ||
| 49 | +// getMessage(index: 0); | ||
| 50 | +// }); | ||
| 51 | +// //刷新未读数 | ||
| 52 | +// bus.on("refresh_untreated_num", (arg) { | ||
| 53 | +// _getUnMsgNum(); | ||
| 54 | +// }); | ||
| 55 | +// //移除在线预订消息 | ||
| 56 | +// bus.on("remove_untreated_message", (args) { | ||
| 57 | +// messageModel.removeUntreatedMessageByMid(args.toString()); | ||
| 58 | +// messageDialogModel.removeMessage(args.toString()); | ||
| 59 | +// }); | ||
| 60 | +// } | ||
| 61 | + | ||
| 62 | +// //三种分类各自的未读消息数目 | ||
| 63 | +// _getUnMsgNum() async { | ||
| 64 | +// if (mounted) { | ||
| 65 | +// Map<String, String> params = {"sid": userModel.user.sellerid}; | ||
| 66 | +// await messageModel.getUnMsgNum(context, params); | ||
| 67 | +// } | ||
| 68 | +// } | ||
| 69 | + | ||
| 70 | +// //获取在线预订消息status 0未处理 1已处理 | ||
| 71 | +// getMessage({bool showLoading = true, int index}) async { | ||
| 72 | +// String typeId = ''; | ||
| 73 | +// if (index == 0) { | ||
| 74 | +// typeId = '10'; | ||
| 75 | +// } else if (index == 1) { | ||
| 76 | +// typeId = '1'; | ||
| 77 | +// } else if (index == 2) { | ||
| 78 | +// typeId = '12'; | ||
| 79 | +// } | ||
| 80 | +// Map<String, String> params = { | ||
| 81 | +// "sid": userModel.user.sellerid, | ||
| 82 | +// "type_id": typeId, //1提前点餐2内部预订10在线预订 | ||
| 83 | +// "status": '0', | ||
| 84 | +// "offset": '0', | ||
| 85 | +// "limit": "20", | ||
| 86 | +// }; | ||
| 87 | +// await messageModel.getMessages(context, params, showLoading: showLoading); | ||
| 88 | +// _getUnMsgNum(); | ||
| 89 | +// } | ||
| 90 | + | ||
| 91 | +// @override | ||
| 92 | +// Widget build(BuildContext context) { | ||
| 93 | +// messageModel = Provider.of<MessageModel>(context, listen: true); | ||
| 94 | +// userModel = Provider.of<UserModel>(context, listen: false); | ||
| 95 | +// messageDialogModel = | ||
| 96 | +// Provider.of<MessageDialogModel>(context, listen: false); | ||
| 97 | +// return Container( | ||
| 98 | +// width: double.infinity, | ||
| 99 | +// height: double.infinity, | ||
| 100 | +// color: MyColours.color_ffffff, | ||
| 101 | +// child: Column( | ||
| 102 | +// children: <Widget>[ | ||
| 103 | +// MyAppBar( | ||
| 104 | +// "消息中心", | ||
| 105 | +// showBack: false, | ||
| 106 | +// ), | ||
| 107 | +// TabBar( | ||
| 108 | +// controller: tabController, | ||
| 109 | +// tabs: [ | ||
| 110 | +// Tab( | ||
| 111 | +// child: SizedBox( | ||
| 112 | +// height: ScreenUtil().setWidth(60), | ||
| 113 | +// width: ScreenUtil().setWidth(144), | ||
| 114 | +// child: Stack( | ||
| 115 | +// children: [ | ||
| 116 | +// Text( | ||
| 117 | +// "在线预订", | ||
| 118 | +// style: TextStyle( | ||
| 119 | +// color: tabController.index == 0 | ||
| 120 | +// ? selectedColor | ||
| 121 | +// : unSelectedColor, | ||
| 122 | +// fontSize: ScreenUtil().setSp(32), | ||
| 123 | +// fontWeight: FontWeight.bold), | ||
| 124 | +// ), | ||
| 125 | +// Positioned( | ||
| 126 | +// top: 0, | ||
| 127 | +// right: 0, | ||
| 128 | +// child: Container( | ||
| 129 | +// width: ScreenUtil().setWidth(16), | ||
| 130 | +// height: ScreenUtil().setWidth(16), | ||
| 131 | +// decoration: BoxDecoration( | ||
| 132 | +// borderRadius: BorderRadius.circular( | ||
| 133 | +// ScreenUtil().setWidth(16)), | ||
| 134 | +// color: messageModel.onlineTotal > 0 | ||
| 135 | +// ? MyColours.color_fa5151 | ||
| 136 | +// : MyColours.color_ffffff), | ||
| 137 | +// ), | ||
| 138 | +// ) | ||
| 139 | +// ], | ||
| 140 | +// ), | ||
| 141 | +// ), | ||
| 142 | +// ), | ||
| 143 | +// Tab( | ||
| 144 | +// child: SizedBox( | ||
| 145 | +// height: ScreenUtil().setWidth(60), | ||
| 146 | +// width: ScreenUtil().setWidth(144), | ||
| 147 | +// child: Stack( | ||
| 148 | +// children: [ | ||
| 149 | +// Text( | ||
| 150 | +// "提前点餐", | ||
| 151 | +// style: TextStyle( | ||
| 152 | +// color: tabController.index == 1 | ||
| 153 | +// ? selectedColor | ||
| 154 | +// : unSelectedColor, | ||
| 155 | +// fontSize: ScreenUtil().setSp(32), | ||
| 156 | +// fontWeight: FontWeight.bold), | ||
| 157 | +// ), | ||
| 158 | +// Positioned( | ||
| 159 | +// top: 0, | ||
| 160 | +// right: 0, | ||
| 161 | +// child: Container( | ||
| 162 | +// width: ScreenUtil().setWidth(16), | ||
| 163 | +// height: ScreenUtil().setWidth(16), | ||
| 164 | +// decoration: BoxDecoration( | ||
| 165 | +// borderRadius: BorderRadius.circular( | ||
| 166 | +// ScreenUtil().setWidth(16)), | ||
| 167 | +// color: messageModel.orderTotal > 0 | ||
| 168 | +// ? MyColours.color_fa5151 | ||
| 169 | +// : MyColours.color_ffffff), | ||
| 170 | +// ), | ||
| 171 | +// ) | ||
| 172 | +// ], | ||
| 173 | +// ), | ||
| 174 | +// ), | ||
| 175 | +// ), | ||
| 176 | +// Tab( | ||
| 177 | +// child: SizedBox( | ||
| 178 | +// height: ScreenUtil().setWidth(60), | ||
| 179 | +// width: ScreenUtil().setWidth(144), | ||
| 180 | +// child: Stack( | ||
| 181 | +// children: [ | ||
| 182 | +// Text( | ||
| 183 | +// "在线买单", | ||
| 184 | +// style: TextStyle( | ||
| 185 | +// color: tabController.index == 2 | ||
| 186 | +// ? selectedColor | ||
| 187 | +// : unSelectedColor, | ||
| 188 | +// fontSize: ScreenUtil().setSp(32), | ||
| 189 | +// fontWeight: FontWeight.bold), | ||
| 190 | +// ), | ||
| 191 | +// Positioned( | ||
| 192 | +// top: 0, | ||
| 193 | +// right: 0, | ||
| 194 | +// child: Container( | ||
| 195 | +// width: ScreenUtil().setWidth(16), | ||
| 196 | +// height: ScreenUtil().setWidth(16), | ||
| 197 | +// decoration: BoxDecoration( | ||
| 198 | +// borderRadius: BorderRadius.circular( | ||
| 199 | +// ScreenUtil().setWidth(16)), | ||
| 200 | +// color: messageModel.checkTotal > 0 | ||
| 201 | +// ? MyColours.color_fa5151 | ||
| 202 | +// : MyColours.color_ffffff), | ||
| 203 | +// ), | ||
| 204 | +// ) | ||
| 205 | +// ], | ||
| 206 | +// ), | ||
| 207 | +// ), | ||
| 208 | +// ) | ||
| 209 | +// ], | ||
| 210 | +// indicatorColor: MyColours.color_199095, | ||
| 211 | +// indicatorSize: TabBarIndicatorSize.label, | ||
| 212 | +// indicatorPadding: EdgeInsets.only( | ||
| 213 | +// left: ScreenUtil().setWidth(16), | ||
| 214 | +// right: ScreenUtil().setWidth(32)), | ||
| 215 | +// indicatorWeight: ScreenUtil().setWidth(6.0), | ||
| 216 | +// ), | ||
| 217 | +// VEmptyView(11), | ||
| 218 | +// Expanded( | ||
| 219 | +// flex: 1, | ||
| 220 | +// child: TabBarView(controller: tabController, children: [ | ||
| 221 | +// MessageOnlinePage(), | ||
| 222 | +// MessageOrderPage(), | ||
| 223 | +// MessageOnlineCheckPage() | ||
| 224 | +// ]), | ||
| 225 | +// ) | ||
| 226 | +// ], | ||
| 227 | +// ), | ||
| 228 | +// ); | ||
| 229 | +// } | ||
| 230 | + | ||
| 231 | +// @override | ||
| 232 | +// void dispose() { | ||
| 233 | +// // TODO: implement dispose | ||
| 234 | +// super.dispose(); | ||
| 235 | +// bus.off("refresh_untreated_num"); | ||
| 236 | +// bus.off("remove_untreated_message"); | ||
| 237 | +// } | ||
| 238 | +// } |
lib/pages/message/message_treated_page.dart
0 → 100644
| 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/models/message.dart'; | ||
| 6 | +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/provider/message_dialog_model.dart'; | ||
| 9 | +import 'package:one_key/provider/message_model.dart'; | ||
| 10 | +import 'package:one_key/provider/user_model.dart'; | ||
| 11 | +import 'package:one_key/res/colors.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 | +import 'package:one_key/utils/event_bus.dart'; | ||
| 16 | + | ||
| 17 | +/** | ||
| 18 | + * 未处理消息 | ||
| 19 | + */ | ||
| 20 | +class MessageUntreatedPage extends StatefulWidget { | ||
| 21 | + @override | ||
| 22 | + State<StatefulWidget> createState() { | ||
| 23 | + // TODO: implement createState | ||
| 24 | + return new MessageUntreatedPageState(); | ||
| 25 | + } | ||
| 26 | +} | ||
| 27 | + | ||
| 28 | +class MessageUntreatedPageState extends State<MessageUntreatedPage> { | ||
| 29 | + EasyRefreshController _controller; | ||
| 30 | + | ||
| 31 | + Color selectedColor = MyColours.color_199095; | ||
| 32 | + Color unSelectedColor = MyColours.color_999999; | ||
| 33 | + | ||
| 34 | + int selectedIndex = 0; | ||
| 35 | + | ||
| 36 | + int offset = 0; | ||
| 37 | + MessageModel messageModel; | ||
| 38 | + UserModel userModel; | ||
| 39 | + MessageDialogModel messageDialogModel; | ||
| 40 | + | ||
| 41 | + @override | ||
| 42 | + void initState() { | ||
| 43 | + // TODO: implement initState | ||
| 44 | + super.initState(); | ||
| 45 | + // //移除在线预订消息 | ||
| 46 | + // bus.on("remove_untreated_message", (args) { | ||
| 47 | + // messageModel.removeUntreatedMessageByMid(args.toString()); | ||
| 48 | + // messageDialogModel.removeMessage(args.toString()); | ||
| 49 | + // }); | ||
| 50 | + _controller = EasyRefreshController(); | ||
| 51 | + // messageModel.pageState = PageState.Loading; | ||
| 52 | + WidgetsBinding.instance.addPostFrameCallback((_) { | ||
| 53 | + // getMessage(); | ||
| 54 | + // setState(() { | ||
| 55 | + // messageModel.pageState = PageState.Loading; | ||
| 56 | + // }); | ||
| 57 | + messageModel.pageState = PageState.Loading; | ||
| 58 | + messageModel.notifyListeners(); | ||
| 59 | + }); | ||
| 60 | + } | ||
| 61 | + | ||
| 62 | + @override | ||
| 63 | + void dispose() { | ||
| 64 | + // TODO: implement dispose | ||
| 65 | + super.dispose(); | ||
| 66 | + // bus.off("remove_untreated_message"); | ||
| 67 | + } | ||
| 68 | + | ||
| 69 | + //三种分类各自的未读消息数目 | ||
| 70 | + _getUnMsgNum() async { | ||
| 71 | + Map<String, String> params = {"sid": userModel.user.sellerid}; | ||
| 72 | + await messageModel.getUnMsgNum(context, params); | ||
| 73 | + } | ||
| 74 | + | ||
| 75 | + //获取在线预订消息status 0未处理 1已处理 | ||
| 76 | + getMessage({bool showLoading = true}) async { | ||
| 77 | + Map<String, String> params = { | ||
| 78 | + "sid": userModel.user.sellerid, | ||
| 79 | + "type_id": "10", //1提前点餐2内部预订10在线预订 | ||
| 80 | + "status": selectedIndex.toString(), | ||
| 81 | + "offset": offset.toString(), | ||
| 82 | + "limit": "20", | ||
| 83 | + }; | ||
| 84 | + | ||
| 85 | + await messageModel.getMessages(context, params, showLoading: showLoading); | ||
| 86 | + _getUnMsgNum(); | ||
| 87 | + } | ||
| 88 | + | ||
| 89 | + @override | ||
| 90 | + Widget build(BuildContext context) { | ||
| 91 | + messageModel = Provider.of<MessageModel>(context, listen: true); | ||
| 92 | + userModel = Provider.of<UserModel>(context, listen: false); | ||
| 93 | + messageDialogModel = | ||
| 94 | + Provider.of<MessageDialogModel>(context, listen: false); | ||
| 95 | + return Container( | ||
| 96 | + color: MyColours.color_ffffff, | ||
| 97 | + child: Consumer<MessageModel>( | ||
| 98 | + builder: (context, model, _) { | ||
| 99 | + if (model.pageState != PageState.Success) { | ||
| 100 | + return ExceptionPage( | ||
| 101 | + pageState: model.pageState, | ||
| 102 | + callback: () { | ||
| 103 | + offset = 0; | ||
| 104 | + getMessage(showLoading: true); | ||
| 105 | + }, | ||
| 106 | + emptyMsg: "暂时没有未处理的消息哦", | ||
| 107 | + emptyImg: "empty_search", | ||
| 108 | + showMsg: "加载中,请稍后...", | ||
| 109 | + ); | ||
| 110 | + } else { | ||
| 111 | + return EasyRefresh.custom( | ||
| 112 | + controller: _controller, | ||
| 113 | + slivers: [ | ||
| 114 | + SliverList( | ||
| 115 | + delegate: SliverChildBuilderDelegate( | ||
| 116 | + (BuildContext context, int index) { | ||
| 117 | + Message message = model.messages[index]; | ||
| 118 | + if (message.message_type == "10") { | ||
| 119 | + // titleText = "在线预订"; | ||
| 120 | + | ||
| 121 | + } else if (message.message_type == "11") { | ||
| 122 | + // titleText = "取消预订"; | ||
| 123 | + } else if (message.message_type == "1") { | ||
| 124 | + // titleText = "提前点餐"; | ||
| 125 | + | ||
| 126 | + } else if (message.message_type == "12") { | ||
| 127 | + // titleText = "在线买单"; | ||
| 128 | + | ||
| 129 | + } else if (message.message_type == "13") { | ||
| 130 | + // titleText = "买单通知"; //没有 | ||
| 131 | + | ||
| 132 | + } else if (message.message_type == "14") { | ||
| 133 | + // titleText = "发票申请"; //没有 | ||
| 134 | + | ||
| 135 | + } | ||
| 136 | + return MessageItemF( | ||
| 137 | + model.messages[index], | ||
| 138 | + isTreated: selectedIndex == 1, | ||
| 139 | + ); | ||
| 140 | + }, childCount: model.messages.length), | ||
| 141 | + ) | ||
| 142 | + ], | ||
| 143 | + onRefresh: () async { | ||
| 144 | + offset = 0; | ||
| 145 | + getMessage(showLoading: false); | ||
| 146 | + }, | ||
| 147 | + onLoad: () async { | ||
| 148 | + offset++; | ||
| 149 | + getMessage(showLoading: false); | ||
| 150 | + }, | ||
| 151 | + ); | ||
| 152 | + } | ||
| 153 | + }, | ||
| 154 | + ), | ||
| 155 | + ); | ||
| 156 | + } | ||
| 157 | +} |
| 1 | import 'package:flutter/material.dart'; | 1 | import 'package:flutter/material.dart'; |
| 2 | 2 | ||
| 3 | class MyColours { | 3 | class MyColours { |
| 4 | + static const Color color_5F7292 = Color(0xff5F7292); | ||
| 5 | + static const Color color_F2995F = Color(0xffF2995F); | ||
| 6 | + static const Color color_F78D94 = Color(0xffF78D94); | ||
| 4 | static const Color color_E7E7E7 = Color(0xffE7E7E7); | 7 | static const Color color_E7E7E7 = Color(0xffE7E7E7); |
| 5 | static const Color color_E34D59 = Color(0xffE34D59); | 8 | static const Color color_E34D59 = Color(0xffE34D59); |
| 6 | static const Color color_515151 = Color(0xff515151); | 9 | static const Color color_515151 = Color(0xff515151); |
-
Please register or login to post a comment