Showing
14 changed files
with
795 additions
and
595 deletions
| @@ -11,12 +11,12 @@ if (flutterRoot == null) { | @@ -11,12 +11,12 @@ if (flutterRoot == null) { | ||
| 11 | throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.") | 11 | throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.") |
| 12 | } | 12 | } |
| 13 | 13 | ||
| 14 | -def flutterVersionCode = localProperties.getProperty('flutter.versionCode') | 14 | +def flutterVersionCode = "121" |
| 15 | if (flutterVersionCode == null) { | 15 | if (flutterVersionCode == null) { |
| 16 | flutterVersionCode = '131' | 16 | flutterVersionCode = '131' |
| 17 | } | 17 | } |
| 18 | 18 | ||
| 19 | -def flutterVersionName = localProperties.getProperty('flutter.versionName') | 19 | +def flutterVersionName = "1.2.1" |
| 20 | if (flutterVersionName == null) { | 20 | if (flutterVersionName == null) { |
| 21 | flutterVersionName = '1.3.1' | 21 | flutterVersionName = '1.3.1' |
| 22 | } | 22 | } |
| @@ -43,8 +43,8 @@ android { | @@ -43,8 +43,8 @@ android { | ||
| 43 | applicationId "com.naji.one_key" | 43 | applicationId "com.naji.one_key" |
| 44 | minSdkVersion 21 | 44 | minSdkVersion 21 |
| 45 | targetSdkVersion 28 | 45 | targetSdkVersion 28 |
| 46 | - versionCode 118 | ||
| 47 | - versionName "1.1.8" | 46 | + versionCode flutterVersionCode.toInteger() |
| 47 | + versionName flutterVersionName | ||
| 48 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" | 48 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" |
| 49 | 49 | ||
| 50 | ndk { | 50 | ndk { |
| @@ -180,6 +180,7 @@ class DioUtil { | @@ -180,6 +180,7 @@ class DioUtil { | ||
| 180 | } | 180 | } |
| 181 | if (showLoading) Loading.showLoading(context); | 181 | if (showLoading) Loading.showLoading(context); |
| 182 | try { | 182 | try { |
| 183 | + print('--------' + path + '---------'); | ||
| 183 | Response response = await _dio.request(path, | 184 | Response response = await _dio.request(path, |
| 184 | data: data, | 185 | data: data, |
| 185 | options: _checkOptions(method, options), | 186 | options: _checkOptions(method, options), |
| @@ -413,8 +414,8 @@ class DioUtil { | @@ -413,8 +414,8 @@ class DioUtil { | ||
| 413 | Options options = new Options(); | 414 | Options options = new Options(); |
| 414 | options.contentType = | 415 | options.contentType = |
| 415 | ContentType.parse("application/x-www-form-urlencoded"); | 416 | ContentType.parse("application/x-www-form-urlencoded"); |
| 416 | - options.connectTimeout = 1000 * 10;//默认10s | ||
| 417 | - options.receiveTimeout = 1000 * 10;//默认10s | 417 | + options.connectTimeout = 1000 * 10; //默认10s |
| 418 | + options.receiveTimeout = 1000 * 10; //默认10s | ||
| 418 | return options; | 419 | return options; |
| 419 | } | 420 | } |
| 420 | } | 421 | } |
| @@ -2,6 +2,7 @@ import 'dart:convert'; | @@ -2,6 +2,7 @@ import 'dart:convert'; | ||
| 2 | 2 | ||
| 3 | import 'package:flutter/material.dart'; | 3 | import 'package:flutter/material.dart'; |
| 4 | import 'package:flutter_screenutil/flutter_screenutil.dart'; | 4 | import 'package:flutter_screenutil/flutter_screenutil.dart'; |
| 5 | +import 'package:one_key/constant/state.dart'; | ||
| 5 | import 'package:one_key/models/manager.dart'; | 6 | import 'package:one_key/models/manager.dart'; |
| 6 | import 'package:one_key/models/notebook_detail.dart'; | 7 | import 'package:one_key/models/notebook_detail.dart'; |
| 7 | import 'package:one_key/provider/notebook_detail_model.dart'; | 8 | import 'package:one_key/provider/notebook_detail_model.dart'; |
| @@ -14,6 +15,7 @@ import 'package:one_key/widgets/MyDivider.dart'; | @@ -14,6 +15,7 @@ import 'package:one_key/widgets/MyDivider.dart'; | ||
| 14 | import 'package:one_key/widgets/app_bar.dart'; | 15 | import 'package:one_key/widgets/app_bar.dart'; |
| 15 | import 'package:one_key/widgets/common_button.dart'; | 16 | import 'package:one_key/widgets/common_button.dart'; |
| 16 | import 'package:one_key/widgets/need_item.dart'; | 17 | import 'package:one_key/widgets/need_item.dart'; |
| 18 | +import 'package:one_key/widgets/page_exception.dart'; | ||
| 17 | import 'package:one_key/widgets/row_multi_text.dart'; | 19 | import 'package:one_key/widgets/row_multi_text.dart'; |
| 18 | import 'package:one_key/widgets/table_item.dart'; | 20 | import 'package:one_key/widgets/table_item.dart'; |
| 19 | import 'package:one_key/models/table.dart' as t; | 21 | import 'package:one_key/models/table.dart' as t; |
| @@ -37,7 +39,7 @@ class HandleOnlinePage extends StatefulWidget { | @@ -37,7 +39,7 @@ class HandleOnlinePage extends StatefulWidget { | ||
| 37 | } | 39 | } |
| 38 | 40 | ||
| 39 | class HandleOnlinePageState extends State<HandleOnlinePage> { | 41 | class HandleOnlinePageState extends State<HandleOnlinePage> { |
| 40 | - NotebookDetailModel detailModel = NotebookDetailModel(); | 42 | + NotebookDetailModel detailModel; |
| 41 | 43 | ||
| 42 | NotebookDetail detailEntity; | 44 | NotebookDetail detailEntity; |
| 43 | 45 | ||
| @@ -47,43 +49,52 @@ class HandleOnlinePageState extends State<HandleOnlinePage> { | @@ -47,43 +49,52 @@ class HandleOnlinePageState extends State<HandleOnlinePage> { | ||
| 47 | 49 | ||
| 48 | Manager manager = Manager(); | 50 | Manager manager = Manager(); |
| 49 | 51 | ||
| 50 | - bool isCallTel=false; | 52 | + bool isCallTel = false; |
| 51 | 53 | ||
| 52 | - String formatPhone="";//格式客户号码 | 54 | + String formatPhone = ""; //格式客户号码 |
| 53 | 55 | ||
| 54 | @override | 56 | @override |
| 55 | void initState() { | 57 | void initState() { |
| 56 | // TODO: implement initState | 58 | // TODO: implement initState |
| 57 | super.initState(); | 59 | super.initState(); |
| 58 | - WidgetsBinding.instance.addPostFrameCallback((_) async { | ||
| 59 | - detailEntity = await detailModel.getReserveDetail(context, { | ||
| 60 | - "rid": widget.rid, | ||
| 61 | - }); | ||
| 62 | - setState(() { | ||
| 63 | - //未处理 | ||
| 64 | - cusmanText = detailEntity.cusman.isEmpty ? "请选择" : detailEntity.cusman; | ||
| 65 | - formatPhone=detailEntity.phone; | ||
| 66 | - if(App.sp.getString("is_call_tel")!=null&&App.sp.getString("is_call_tel")=="1"){ | ||
| 67 | - isCallTel=true; | ||
| 68 | - }else{ | ||
| 69 | - isCallTel=false; | ||
| 70 | - if(detailEntity.phone.isNotEmpty&&detailEntity.phone.length==11&&(detailEntity.status=="0"||detailEntity.status=="6")){ | ||
| 71 | - formatPhone=detailEntity.phone.substring(0,3)+"****"+detailEntity.phone.substring(7); | ||
| 72 | - } | ||
| 73 | - } | ||
| 74 | - }); | ||
| 75 | - if (detailEntity.status != "0") { | ||
| 76 | - //已处理 | ||
| 77 | - Future.delayed(Duration(milliseconds: 200), () { | ||
| 78 | - NavigatorUtil.goNotebookDetailPage(context, detailEntity.id, | ||
| 79 | - fromNotify: widget.fromNotify, replace: true); | ||
| 80 | - }); | ||
| 81 | - setMessageStatus(); | 60 | + WidgetsBinding.instance.addPostFrameCallback((_) { |
| 61 | + _getOrderListData(); | ||
| 62 | + }); | ||
| 63 | + } | ||
| 64 | + | ||
| 65 | + /// 获取当前预订订单详情 | ||
| 66 | + _getOrderListData() async { | ||
| 67 | + detailEntity = await detailModel.getReserveDetail(context, { | ||
| 68 | + "rid": widget.rid, | ||
| 69 | + }); | ||
| 70 | + setState(() { | ||
| 71 | + //未处理 | ||
| 72 | + cusmanText = detailEntity.cusman.isEmpty ? "请选择" : detailEntity.cusman; | ||
| 73 | + formatPhone = detailEntity.phone; | ||
| 74 | + if (App.sp.getString("is_call_tel") != null && | ||
| 75 | + App.sp.getString("is_call_tel") == "1") { | ||
| 76 | + isCallTel = true; | ||
| 82 | } else { | 77 | } else { |
| 83 | - managers = await detailModel.getManagers(context); | 78 | + isCallTel = false; |
| 79 | + if (detailEntity.phone.isNotEmpty && | ||
| 80 | + detailEntity.phone.length == 11 && | ||
| 81 | + (detailEntity.status == "0" || detailEntity.status == "6")) { | ||
| 82 | + formatPhone = detailEntity.phone.substring(0, 3) + | ||
| 83 | + "****" + | ||
| 84 | + detailEntity.phone.substring(7); | ||
| 85 | + } | ||
| 84 | } | 86 | } |
| 85 | }); | 87 | }); |
| 86 | - | 88 | + if (detailEntity.status != "0") { |
| 89 | + //已处理 | ||
| 90 | + Future.delayed(Duration(milliseconds: 200), () { | ||
| 91 | + NavigatorUtil.goNotebookDetailPage(context, detailEntity.id, | ||
| 92 | + fromNotify: widget.fromNotify, replace: true); | ||
| 93 | + }); | ||
| 94 | + setMessageStatus(); | ||
| 95 | + } else { | ||
| 96 | + managers = await detailModel.getManagers(context); | ||
| 97 | + } | ||
| 87 | } | 98 | } |
| 88 | 99 | ||
| 89 | //设置当前客户经理 | 100 | //设置当前客户经理 |
| @@ -136,7 +147,7 @@ class HandleOnlinePageState extends State<HandleOnlinePage> { | @@ -136,7 +147,7 @@ class HandleOnlinePageState extends State<HandleOnlinePage> { | ||
| 136 | widget.rid, | 147 | widget.rid, |
| 137 | int.parse(detailEntity.ddate) * 1000, | 148 | int.parse(detailEntity.ddate) * 1000, |
| 138 | detailEntity.ddate_solt); | 149 | detailEntity.ddate_solt); |
| 139 | - if (temp['tid'] != null) { | 150 | + if (temp != null && temp['tid'] != null) { |
| 140 | setReserveStatus("5", tid: temp['tid']); | 151 | setReserveStatus("5", tid: temp['tid']); |
| 141 | } | 152 | } |
| 142 | }, | 153 | }, |
| @@ -164,7 +175,7 @@ class HandleOnlinePageState extends State<HandleOnlinePage> { | @@ -164,7 +175,7 @@ class HandleOnlinePageState extends State<HandleOnlinePage> { | ||
| 164 | }; | 175 | }; |
| 165 | bool success = | 176 | bool success = |
| 166 | await detailModel.setReserveStatus(context, params, showLoading: true); | 177 | await detailModel.setReserveStatus(context, params, showLoading: true); |
| 167 | - if (success!=null&&success) { | 178 | + if (success != null && success) { |
| 168 | bus.emit("refresh_book_list"); | 179 | bus.emit("refresh_book_list"); |
| 169 | } | 180 | } |
| 170 | } | 181 | } |
| @@ -180,34 +191,39 @@ class HandleOnlinePageState extends State<HandleOnlinePage> { | @@ -180,34 +191,39 @@ class HandleOnlinePageState extends State<HandleOnlinePage> { | ||
| 180 | detailModel.setMessageStatus(context, params); | 191 | detailModel.setMessageStatus(context, params); |
| 181 | } | 192 | } |
| 182 | 193 | ||
| 183 | - | ||
| 184 | - | ||
| 185 | @override | 194 | @override |
| 186 | Widget build(BuildContext context) { | 195 | Widget build(BuildContext context) { |
| 187 | - // TODO: implement build | ||
| 188 | - | ||
| 189 | - return SafeArea( | ||
| 190 | - child: WillPopScope( | ||
| 191 | - child: detailEntity == null | ||
| 192 | - ? Container( | ||
| 193 | - width: double.infinity, | ||
| 194 | - height: double.infinity, | ||
| 195 | - color: MyColours.color_ffffff, | ||
| 196 | - ) | ||
| 197 | - : Column( | ||
| 198 | - children: <Widget>[ | ||
| 199 | - MyAppBar( | ||
| 200 | - "在线预订详情", | ||
| 201 | - showBack: true, | 196 | + detailModel = Provider.of<NotebookDetailModel>(context, listen: true); |
| 197 | + return Scaffold( | ||
| 198 | + body: SafeArea( | ||
| 199 | + child: WillPopScope( | ||
| 200 | + child: Column( | ||
| 201 | + children: <Widget>[ | ||
| 202 | + MyAppBar( | ||
| 203 | + "在线预订详情", | ||
| 204 | + showBack: true, | ||
| 205 | + callback: () { | ||
| 206 | + if (widget.fromNotify) { | ||
| 207 | + NavigatorUtil.goHomePage(context, initialIndex: 0); | ||
| 208 | + } else { | ||
| 209 | + Navigator.of(context).pop(); | ||
| 210 | + } | ||
| 211 | + }, | ||
| 212 | + ), | ||
| 213 | + Expanded(child: Consumer<NotebookDetailModel>( | ||
| 214 | + builder: (context, model, _) { | ||
| 215 | + if (model.pageState != PageState.Success) { | ||
| 216 | + return ExceptionPage( | ||
| 217 | + pageState: model.pageState, | ||
| 202 | callback: () { | 218 | callback: () { |
| 203 | - if (widget.fromNotify) { | ||
| 204 | - NavigatorUtil.goHomePage(context, initialIndex: 0); | ||
| 205 | - } else { | ||
| 206 | - Navigator.of(context).pop(); | ||
| 207 | - } | 219 | + _getOrderListData(); |
| 208 | }, | 220 | }, |
| 209 | - ), | ||
| 210 | - Expanded( | 221 | + emptyMsg: "暂时没有预订列表信息哦", |
| 222 | + emptyImg: "empty_search", | ||
| 223 | + showMsg: "加载中,请稍后...", | ||
| 224 | + ); | ||
| 225 | + } else { | ||
| 226 | + return Expanded( | ||
| 211 | child: DefaultTextStyle( | 227 | child: DefaultTextStyle( |
| 212 | style: TextStyle(decoration: TextDecoration.none), | 228 | style: TextStyle(decoration: TextDecoration.none), |
| 213 | child: Container( | 229 | child: Container( |
| @@ -286,8 +302,7 @@ class HandleOnlinePageState extends State<HandleOnlinePage> { | @@ -286,8 +302,7 @@ class HandleOnlinePageState extends State<HandleOnlinePage> { | ||
| 286 | )), | 302 | )), |
| 287 | RowMultiText( | 303 | RowMultiText( |
| 288 | "客户姓名", detailEntity.rnameStr), | 304 | "客户姓名", detailEntity.rnameStr), |
| 289 | - RowMultiText( | ||
| 290 | - "客户电话", formatPhone), | 305 | + RowMultiText("客户电话", formatPhone), |
| 291 | RowMultiText("备注信息", | 306 | RowMultiText("备注信息", |
| 292 | detailEntity.cusdem ?? ""), | 307 | detailEntity.cusdem ?? ""), |
| 293 | MyDivider(double.infinity, | 308 | MyDivider(double.infinity, |
| @@ -376,7 +391,7 @@ class HandleOnlinePageState extends State<HandleOnlinePage> { | @@ -376,7 +391,7 @@ class HandleOnlinePageState extends State<HandleOnlinePage> { | ||
| 376 | int.parse(detailEntity.ddate) * | 391 | int.parse(detailEntity.ddate) * |
| 377 | 1000, | 392 | 1000, |
| 378 | detailEntity.ddate_solt); | 393 | detailEntity.ddate_solt); |
| 379 | - if (map!=null&&map['tid'] != null) { | 394 | + if (map != null && map['tid'] != null) { |
| 380 | setReserveStatus("5", | 395 | setReserveStatus("5", |
| 381 | tid: map['tid']); | 396 | tid: map['tid']); |
| 382 | } | 397 | } |
| @@ -412,7 +427,6 @@ class HandleOnlinePageState extends State<HandleOnlinePage> { | @@ -412,7 +427,6 @@ class HandleOnlinePageState extends State<HandleOnlinePage> { | ||
| 412 | _showRefuseDialog(); | 427 | _showRefuseDialog(); |
| 413 | }, | 428 | }, |
| 414 | )), | 429 | )), |
| 415 | - | ||
| 416 | Offstage( | 430 | Offstage( |
| 417 | offstage: !isCallTel, | 431 | offstage: !isCallTel, |
| 418 | child: SizedBox( | 432 | child: SizedBox( |
| @@ -423,31 +437,35 @@ class HandleOnlinePageState extends State<HandleOnlinePage> { | @@ -423,31 +437,35 @@ class HandleOnlinePageState extends State<HandleOnlinePage> { | ||
| 423 | MyDivider( | 437 | MyDivider( |
| 424 | ScreenUtil().setWidth(2), | 438 | ScreenUtil().setWidth(2), |
| 425 | ScreenUtil().setHeight(52), | 439 | ScreenUtil().setHeight(52), |
| 426 | - color: MyColours.color_199095, | 440 | + color: |
| 441 | + MyColours.color_199095, | ||
| 427 | ), | 442 | ), |
| 428 | Expanded( | 443 | Expanded( |
| 429 | child: GestureDetector( | 444 | child: GestureDetector( |
| 430 | - child: Center( | ||
| 431 | - child: Text( | ||
| 432 | - "联系顾客", | ||
| 433 | - style: TextStyle( | ||
| 434 | - color: | ||
| 435 | - MyColours.color_199095, | ||
| 436 | - fontSize: | ||
| 437 | - ScreenUtil().setSp(34)), | ||
| 438 | - ), | ||
| 439 | - ), | ||
| 440 | - onTap: () { | ||
| 441 | - if (detailEntity.phone != null && | ||
| 442 | - detailEntity | ||
| 443 | - .phone.isNotEmpty) { | ||
| 444 | - Utils.goPhone( | ||
| 445 | - detailEntity.phone); | ||
| 446 | - } else { | ||
| 447 | - Utils.showToast("没有客户电话!"); | ||
| 448 | - } | ||
| 449 | - }, | ||
| 450 | - )), | 445 | + child: Center( |
| 446 | + child: Text( | ||
| 447 | + "联系顾客", | ||
| 448 | + style: TextStyle( | ||
| 449 | + color: MyColours | ||
| 450 | + .color_199095, | ||
| 451 | + fontSize: | ||
| 452 | + ScreenUtil() | ||
| 453 | + .setSp(34)), | ||
| 454 | + ), | ||
| 455 | + ), | ||
| 456 | + onTap: () { | ||
| 457 | + if (detailEntity.phone != | ||
| 458 | + null && | ||
| 459 | + detailEntity.phone | ||
| 460 | + .isNotEmpty) { | ||
| 461 | + Utils.goPhone( | ||
| 462 | + detailEntity.phone); | ||
| 463 | + } else { | ||
| 464 | + Utils.showToast( | ||
| 465 | + "没有客户电话!"); | ||
| 466 | + } | ||
| 467 | + }, | ||
| 468 | + )), | ||
| 451 | ], | 469 | ], |
| 452 | ), | 470 | ), |
| 453 | ), | 471 | ), |
| @@ -460,9 +478,12 @@ class HandleOnlinePageState extends State<HandleOnlinePage> { | @@ -460,9 +478,12 @@ class HandleOnlinePageState extends State<HandleOnlinePage> { | ||
| 460 | ) | 478 | ) |
| 461 | ], | 479 | ], |
| 462 | ))), | 480 | ))), |
| 463 | - ) | ||
| 464 | - ], | ||
| 465 | - ), | 481 | + ); |
| 482 | + } | ||
| 483 | + }, | ||
| 484 | + )) | ||
| 485 | + ], | ||
| 486 | + ), | ||
| 466 | onWillPop: () async { | 487 | onWillPop: () async { |
| 467 | if (widget.fromNotify) { | 488 | if (widget.fromNotify) { |
| 468 | NavigatorUtil.goHomePage(context, initialIndex: 0); | 489 | NavigatorUtil.goHomePage(context, initialIndex: 0); |
| @@ -471,6 +492,6 @@ class HandleOnlinePageState extends State<HandleOnlinePage> { | @@ -471,6 +492,6 @@ class HandleOnlinePageState extends State<HandleOnlinePage> { | ||
| 471 | Navigator.of(context).pop(); | 492 | Navigator.of(context).pop(); |
| 472 | return true; | 493 | return true; |
| 473 | }, | 494 | }, |
| 474 | - )); | 495 | + ))); |
| 475 | } | 496 | } |
| 476 | } | 497 | } |
| @@ -3,6 +3,7 @@ import 'dart:convert'; | @@ -3,6 +3,7 @@ import 'dart:convert'; | ||
| 3 | import 'package:flutter/material.dart'; | 3 | import 'package:flutter/material.dart'; |
| 4 | import 'package:flutter_picker/flutter_picker.dart'; | 4 | import 'package:flutter_picker/flutter_picker.dart'; |
| 5 | import 'package:flutter_screenutil/flutter_screenutil.dart'; | 5 | import 'package:flutter_screenutil/flutter_screenutil.dart'; |
| 6 | +import 'package:one_key/constant/state.dart'; | ||
| 6 | import 'package:one_key/models/manager.dart'; | 7 | import 'package:one_key/models/manager.dart'; |
| 7 | import 'package:one_key/models/notebook_detail.dart'; | 8 | import 'package:one_key/models/notebook_detail.dart'; |
| 8 | import 'package:one_key/provider/message_dialog_model.dart'; | 9 | import 'package:one_key/provider/message_dialog_model.dart'; |
| @@ -21,6 +22,7 @@ import 'package:one_key/widgets/dialog.dart'; | @@ -21,6 +22,7 @@ import 'package:one_key/widgets/dialog.dart'; | ||
| 21 | import 'package:one_key/widgets/h_empty_view.dart'; | 22 | import 'package:one_key/widgets/h_empty_view.dart'; |
| 22 | import 'package:one_key/widgets/loading.dart'; | 23 | import 'package:one_key/widgets/loading.dart'; |
| 23 | import 'package:one_key/widgets/need_item.dart'; | 24 | import 'package:one_key/widgets/need_item.dart'; |
| 25 | +import 'package:one_key/widgets/page_exception.dart'; | ||
| 24 | import 'package:one_key/widgets/round_button.dart'; | 26 | import 'package:one_key/widgets/round_button.dart'; |
| 25 | import 'package:one_key/widgets/row_multi_text.dart'; | 27 | import 'package:one_key/widgets/row_multi_text.dart'; |
| 26 | import 'package:one_key/widgets/table_item.dart'; | 28 | import 'package:one_key/widgets/table_item.dart'; |
| @@ -45,7 +47,7 @@ class NotebookDetailPage extends StatefulWidget { | @@ -45,7 +47,7 @@ class NotebookDetailPage extends StatefulWidget { | ||
| 45 | } | 47 | } |
| 46 | 48 | ||
| 47 | class NotebookDetailPageState extends State<NotebookDetailPage> { | 49 | class NotebookDetailPageState extends State<NotebookDetailPage> { |
| 48 | - NotebookDetailModel detailModel = NotebookDetailModel(); | 50 | + NotebookDetailModel detailModel; |
| 49 | 51 | ||
| 50 | NotebookDetail detailEntity; | 52 | NotebookDetail detailEntity; |
| 51 | 53 | ||
| @@ -64,7 +66,7 @@ class NotebookDetailPageState extends State<NotebookDetailPage> { | @@ -64,7 +66,7 @@ class NotebookDetailPageState extends State<NotebookDetailPage> { | ||
| 64 | 66 | ||
| 65 | ScrollController _scrollController; | 67 | ScrollController _scrollController; |
| 66 | 68 | ||
| 67 | - String formatPhone=""; | 69 | + String formatPhone = ""; |
| 68 | 70 | ||
| 69 | @override | 71 | @override |
| 70 | void initState() { | 72 | void initState() { |
| @@ -119,11 +121,16 @@ class NotebookDetailPageState extends State<NotebookDetailPage> { | @@ -119,11 +121,16 @@ class NotebookDetailPageState extends State<NotebookDetailPage> { | ||
| 119 | }); | 121 | }); |
| 120 | setState(() { | 122 | setState(() { |
| 121 | cusmanText = detailEntity.cusman.isEmpty ? "请选择" : detailEntity.cusman; | 123 | cusmanText = detailEntity.cusman.isEmpty ? "请选择" : detailEntity.cusman; |
| 122 | - formatPhone=detailEntity.phone; | ||
| 123 | - if(App.sp.getString("is_call_tel")!=null&&App.sp.getString("is_call_tel")=="1"){ | ||
| 124 | - }else{ | ||
| 125 | - if(detailEntity.phone.isNotEmpty&&detailEntity.phone.length==11&&(detailEntity.status=="0"||detailEntity.status=="6")){ | ||
| 126 | - formatPhone=detailEntity.phone.substring(0,3)+"****"+detailEntity.phone.substring(7); | 124 | + formatPhone = detailEntity.phone; |
| 125 | + if (App.sp.getString("is_call_tel") != null && | ||
| 126 | + App.sp.getString("is_call_tel") == "1") { | ||
| 127 | + } else { | ||
| 128 | + if (detailEntity.phone.isNotEmpty && | ||
| 129 | + detailEntity.phone.length == 11 && | ||
| 130 | + (detailEntity.status == "0" || detailEntity.status == "6")) { | ||
| 131 | + formatPhone = detailEntity.phone.substring(0, 3) + | ||
| 132 | + "****" + | ||
| 133 | + detailEntity.phone.substring(7); | ||
| 127 | } | 134 | } |
| 128 | } | 135 | } |
| 129 | }); | 136 | }); |
| @@ -409,346 +416,383 @@ class NotebookDetailPageState extends State<NotebookDetailPage> { | @@ -409,346 +416,383 @@ class NotebookDetailPageState extends State<NotebookDetailPage> { | ||
| 409 | if (MediaQuery.of(context).viewInsets.bottom == 0) { | 416 | if (MediaQuery.of(context).viewInsets.bottom == 0) { |
| 410 | _cancelNode.unfocus(); | 417 | _cancelNode.unfocus(); |
| 411 | } | 418 | } |
| 412 | - return WillPopScope( | ||
| 413 | - child: detailEntity == null | ||
| 414 | - ? Container( | ||
| 415 | - width: double.infinity, | ||
| 416 | - height: double.infinity, | ||
| 417 | - color: MyColours.color_ffffff, | ||
| 418 | - ) | ||
| 419 | - : Container( | ||
| 420 | - color: MyColours.color_ffffff, | ||
| 421 | - child: Column( | ||
| 422 | - children: <Widget>[ | ||
| 423 | - SizedBox(height: ScreenUtil.statusBarHeight), | ||
| 424 | - MyAppBar( | ||
| 425 | - "订座详情", | ||
| 426 | - showBack: true, | 419 | + detailModel = Provider.of<NotebookDetailModel>(context, listen: true); |
| 420 | + return Scaffold( | ||
| 421 | + body: SafeArea( | ||
| 422 | + child: WillPopScope( | ||
| 423 | + child: Container( | ||
| 424 | + color: MyColours.color_ffffff, | ||
| 425 | + child: Column( | ||
| 426 | + children: <Widget>[ | ||
| 427 | + MyAppBar( | ||
| 428 | + "订座详情", | ||
| 429 | + showBack: true, | ||
| 430 | + callback: () { | ||
| 431 | + if (widget.fromNotify) { | ||
| 432 | + NavigatorUtil.goHomePage(context, initialIndex: 0); | ||
| 433 | + } else { | ||
| 434 | + Navigator.of(context).pop(); | ||
| 435 | + } | ||
| 436 | + }, | ||
| 437 | + ), | ||
| 438 | + Expanded(child: | ||
| 439 | + Consumer<NotebookDetailModel>(builder: (context, model, _) { | ||
| 440 | + if (model.pageState != PageState.Success) { | ||
| 441 | + return ExceptionPage( | ||
| 442 | + pageState: model.pageState, | ||
| 427 | callback: () { | 443 | callback: () { |
| 428 | - if (widget.fromNotify) { | ||
| 429 | - NavigatorUtil.goHomePage(context, initialIndex: 0); | ||
| 430 | - } else { | ||
| 431 | - Navigator.of(context).pop(); | ||
| 432 | - } | 444 | + // _getOrderListData(); |
| 433 | }, | 445 | }, |
| 434 | - ), | ||
| 435 | - Expanded( | ||
| 436 | - child: DefaultTextStyle( | ||
| 437 | - style: TextStyle(decoration: TextDecoration.none), | ||
| 438 | - child: Container( | ||
| 439 | - color: MyColours.color_ffffff, | ||
| 440 | - child: SingleChildScrollView( | 446 | + emptyMsg: "暂时没有预订列表信息哦", |
| 447 | + emptyImg: "empty_search", | ||
| 448 | + showMsg: "加载中,请稍后...", | ||
| 449 | + ); | ||
| 450 | + } else { | ||
| 451 | + return Column( | ||
| 452 | + children: [ | ||
| 453 | + Expanded( | ||
| 454 | + child: DefaultTextStyle( | ||
| 455 | + style: TextStyle(decoration: TextDecoration.none), | ||
| 441 | child: Container( | 456 | child: Container( |
| 442 | - color: MyColours.color_ffffff, | ||
| 443 | - padding: EdgeInsets.symmetric( | ||
| 444 | - horizontal: ScreenUtil().setWidth(43)), | ||
| 445 | - child: Column( | ||
| 446 | - children: <Widget>[ | ||
| 447 | - RowMultiText("用餐时段", detailEntity.ddateMd), | ||
| 448 | - Stack( | ||
| 449 | - alignment: Alignment.center, | 457 | + color: MyColours.color_ffffff, |
| 458 | + child: SingleChildScrollView( | ||
| 459 | + child: Container( | ||
| 460 | + color: MyColours.color_ffffff, | ||
| 461 | + padding: EdgeInsets.symmetric( | ||
| 462 | + horizontal: ScreenUtil().setWidth(43)), | ||
| 463 | + child: Column( | ||
| 450 | children: <Widget>[ | 464 | children: <Widget>[ |
| 451 | - Column( | 465 | + RowMultiText( |
| 466 | + "用餐时段", detailEntity.ddateMd), | ||
| 467 | + Stack( | ||
| 468 | + alignment: Alignment.center, | ||
| 452 | children: <Widget>[ | 469 | children: <Widget>[ |
| 453 | - RowMultiText( | ||
| 454 | - "用餐时间", detailEntity.ddateHm), | ||
| 455 | - Offstage( | ||
| 456 | - offstage: detailEntity.type == "0" | ||
| 457 | - ? false | ||
| 458 | - : true, | ||
| 459 | - child: RowMultiText( | ||
| 460 | - "用餐人数", detailEntity.pnum), | 470 | + Column( |
| 471 | + children: <Widget>[ | ||
| 472 | + RowMultiText("用餐时间", | ||
| 473 | + detailEntity.ddateHm), | ||
| 474 | + Offstage( | ||
| 475 | + offstage: | ||
| 476 | + detailEntity.type == "0" | ||
| 477 | + ? false | ||
| 478 | + : true, | ||
| 479 | + child: RowMultiText("用餐人数", | ||
| 480 | + detailEntity.pnum), | ||
| 481 | + ) | ||
| 482 | + ], | ||
| 483 | + ), | ||
| 484 | + Image.asset( | ||
| 485 | + detailEntity.statuImgAssets, | ||
| 486 | + width: ScreenUtil().setWidth(100), | ||
| 487 | + height: ScreenUtil().setWidth(30), | ||
| 461 | ) | 488 | ) |
| 462 | ], | 489 | ], |
| 463 | ), | 490 | ), |
| 464 | - Image.asset( | ||
| 465 | - detailEntity.statuImgAssets, | ||
| 466 | - width: ScreenUtil().setWidth(100), | ||
| 467 | - height: ScreenUtil().setWidth(30), | ||
| 468 | - ) | ||
| 469 | - ], | ||
| 470 | - ), | ||
| 471 | - Offstage( | ||
| 472 | - offstage: detailEntity.demands.length <= 0 | ||
| 473 | - ? true | ||
| 474 | - : false, | ||
| 475 | - child: Column( | ||
| 476 | - children: <Widget>[ | ||
| 477 | - RowMultiText( | ||
| 478 | - "包间需求", | ||
| 479 | - (detailEntity.demands.length | ||
| 480 | - .toString() + | ||
| 481 | - "个") ?? | ||
| 482 | - ""), | ||
| 483 | - Align( | ||
| 484 | - alignment: Alignment.centerRight, | ||
| 485 | - child: Offstage( | ||
| 486 | - offstage: detailEntity | ||
| 487 | - .demands.length > | ||
| 488 | - 0 | ||
| 489 | - ? false | ||
| 490 | - : true, | ||
| 491 | - child: Container( | ||
| 492 | - height: ScreenUtil() | ||
| 493 | - .setHeight(210), | ||
| 494 | - child: ListView.builder( | ||
| 495 | - itemBuilder: | ||
| 496 | - (BuildContext contxt, | ||
| 497 | - int index) { | ||
| 498 | - return NeedItem( | ||
| 499 | - detailEntity | ||
| 500 | - .demands[index]); | ||
| 501 | - }, | ||
| 502 | - itemCount: detailEntity | ||
| 503 | - .demands.length, | ||
| 504 | - shrinkWrap: true, | ||
| 505 | - scrollDirection: | ||
| 506 | - Axis.horizontal, | ||
| 507 | - ), | ||
| 508 | - ), | ||
| 509 | - )) | ||
| 510 | - ], | ||
| 511 | - ), | ||
| 512 | - ), | ||
| 513 | - RowMultiText( | ||
| 514 | - "预订桌位", | ||
| 515 | - (detailEntity.tables.length.toString() + | ||
| 516 | - "个")), | ||
| 517 | - Align( | ||
| 518 | - alignment: Alignment.centerRight, | ||
| 519 | - child: Offstage( | 491 | + Offstage( |
| 520 | offstage: | 492 | offstage: |
| 521 | - detailEntity.tables.length > 0 | ||
| 522 | - ? false | ||
| 523 | - : true, | ||
| 524 | - child: Container( | ||
| 525 | - height: ScreenUtil().setHeight(210), | ||
| 526 | - child: ListView.builder( | ||
| 527 | - itemBuilder: (BuildContext contxt, | ||
| 528 | - int index) { | ||
| 529 | - return TableItem( | ||
| 530 | - detailEntity.tables[index]); | ||
| 531 | - }, | ||
| 532 | - itemCount: | ||
| 533 | - detailEntity.tables.length, | ||
| 534 | - shrinkWrap: true, | ||
| 535 | - scrollDirection: Axis.horizontal, | ||
| 536 | - ), | ||
| 537 | - ), | ||
| 538 | - )), | ||
| 539 | - RowMultiText("客户姓名", detailEntity.rnameStr), | ||
| 540 | - RowMultiText( | ||
| 541 | - "客户电话", formatPhone), | ||
| 542 | - Offstage( | ||
| 543 | - offstage: detailEntity.cusdem == '' || | ||
| 544 | - detailEntity.cusdem == null, | ||
| 545 | - child: RowMultiText( | ||
| 546 | - "备注信息", detailEntity.cusdem ?? ""), | ||
| 547 | - ), | ||
| 548 | - MyDivider(double.infinity, | ||
| 549 | - ScreenUtil().setHeight(1)), | ||
| 550 | - Container( | ||
| 551 | - color: MyColours.color_ffffff, | ||
| 552 | - width: double.infinity, | ||
| 553 | - height: ScreenUtil().setHeight(80), | ||
| 554 | - alignment: Alignment.center, | ||
| 555 | - child: Stack( | ||
| 556 | - alignment: Alignment.center, | ||
| 557 | - children: <Widget>[ | ||
| 558 | - Positioned( | ||
| 559 | - left: 0, | ||
| 560 | - child: Text( | ||
| 561 | - "客户经理", | ||
| 562 | - style: TextStyle( | ||
| 563 | - color: MyColours.color_828282, | ||
| 564 | - fontSize: | ||
| 565 | - ScreenUtil().setSp(30)), | ||
| 566 | - ), | 493 | + detailEntity.demands.length <= 0 |
| 494 | + ? true | ||
| 495 | + : false, | ||
| 496 | + child: Column( | ||
| 497 | + children: <Widget>[ | ||
| 498 | + RowMultiText( | ||
| 499 | + "包间需求", | ||
| 500 | + (detailEntity.demands.length | ||
| 501 | + .toString() + | ||
| 502 | + "个") ?? | ||
| 503 | + ""), | ||
| 504 | + Align( | ||
| 505 | + alignment: | ||
| 506 | + Alignment.centerRight, | ||
| 507 | + child: Offstage( | ||
| 508 | + offstage: detailEntity | ||
| 509 | + .demands | ||
| 510 | + .length > | ||
| 511 | + 0 | ||
| 512 | + ? false | ||
| 513 | + : true, | ||
| 514 | + child: Container( | ||
| 515 | + height: ScreenUtil() | ||
| 516 | + .setHeight(210), | ||
| 517 | + child: ListView.builder( | ||
| 518 | + itemBuilder: | ||
| 519 | + (BuildContext | ||
| 520 | + contxt, | ||
| 521 | + int index) { | ||
| 522 | + return NeedItem( | ||
| 523 | + detailEntity | ||
| 524 | + .demands[ | ||
| 525 | + index]); | ||
| 526 | + }, | ||
| 527 | + itemCount: detailEntity | ||
| 528 | + .demands.length, | ||
| 529 | + shrinkWrap: true, | ||
| 530 | + scrollDirection: | ||
| 531 | + Axis.horizontal, | ||
| 532 | + ), | ||
| 533 | + ), | ||
| 534 | + )) | ||
| 535 | + ], | ||
| 567 | ), | 536 | ), |
| 568 | - Positioned( | ||
| 569 | - right: 0, | ||
| 570 | - child: GestureDetector( | ||
| 571 | - onTap: () async { | ||
| 572 | - List<String> list = []; | ||
| 573 | - for (Manager manager | ||
| 574 | - in managers) { | ||
| 575 | - list.add( | ||
| 576 | - manager.roleUserName); | ||
| 577 | - } | ||
| 578 | - DialogUtil | ||
| 579 | - .showSelectCusmanDialog( | ||
| 580 | - context, list, (value) { | ||
| 581 | - if (value != null) { | ||
| 582 | - setState(() { | ||
| 583 | - cusmanText = | ||
| 584 | - managers[value.first] | ||
| 585 | - .userName; | ||
| 586 | - }); | ||
| 587 | - _setCurrManager(); | ||
| 588 | - } | ||
| 589 | - }).then((value) {}); | ||
| 590 | - }, | ||
| 591 | - child: Text( | ||
| 592 | - cusmanText, | ||
| 593 | - style: TextStyle( | ||
| 594 | - color: MyColours.color_353535, | ||
| 595 | - fontSize: | ||
| 596 | - ScreenUtil().setSp(30), | ||
| 597 | - decoration: | ||
| 598 | - TextDecoration.underline, | 537 | + ), |
| 538 | + RowMultiText( | ||
| 539 | + "预订桌位", | ||
| 540 | + (detailEntity.tables.length | ||
| 541 | + .toString() + | ||
| 542 | + "个")), | ||
| 543 | + Align( | ||
| 544 | + alignment: Alignment.centerRight, | ||
| 545 | + child: Offstage( | ||
| 546 | + offstage: | ||
| 547 | + detailEntity.tables.length > 0 | ||
| 548 | + ? false | ||
| 549 | + : true, | ||
| 550 | + child: Container( | ||
| 551 | + height: | ||
| 552 | + ScreenUtil().setHeight(210), | ||
| 553 | + child: ListView.builder( | ||
| 554 | + itemBuilder: | ||
| 555 | + (BuildContext contxt, | ||
| 556 | + int index) { | ||
| 557 | + return TableItem( | ||
| 558 | + detailEntity | ||
| 559 | + .tables[index]); | ||
| 560 | + }, | ||
| 561 | + itemCount: detailEntity | ||
| 562 | + .tables.length, | ||
| 563 | + shrinkWrap: true, | ||
| 564 | + scrollDirection: | ||
| 565 | + Axis.horizontal, | ||
| 599 | ), | 566 | ), |
| 600 | ), | 567 | ), |
| 601 | - ), | ||
| 602 | - ) | ||
| 603 | - ], | ||
| 604 | - ), | ||
| 605 | - ), | ||
| 606 | - Offstage( | ||
| 607 | - offstage: detailEntity.note_name == '' || | ||
| 608 | - detailEntity.note_name == null, | ||
| 609 | - child: RowMultiText( | ||
| 610 | - "记录人", detailEntity.note_name ?? ""), | ||
| 611 | - ), | ||
| 612 | - Offstage( | ||
| 613 | - offstage: (detailEntity.status == "4" && | ||
| 614 | - detailEntity.cancel != null) | ||
| 615 | - ? false | ||
| 616 | - : true, | ||
| 617 | - child: Column( | ||
| 618 | - children: <Widget>[ | ||
| 619 | - MyDivider(double.infinity, | ||
| 620 | - ScreenUtil().setHeight(2)), | ||
| 621 | - RowMultiText("取消原因", | ||
| 622 | - detailEntity.cancel?.desc ?? "", | ||
| 623 | - textAlign: TextAlign.left), | ||
| 624 | - RowMultiText( | ||
| 625 | - "取消时间", | ||
| 626 | - detailEntity.cancel?.cdateStr ?? | ||
| 627 | - ""), | ||
| 628 | - RowMultiText( | ||
| 629 | - "操作人", | ||
| 630 | - detailEntity.abolition == '2' | ||
| 631 | - ? '顾客在线取消' | ||
| 632 | - : detailEntity | ||
| 633 | - .cancel?.uname ?? | 568 | + )), |
| 569 | + RowMultiText( | ||
| 570 | + "客户姓名", detailEntity.rnameStr), | ||
| 571 | + RowMultiText("客户电话", formatPhone), | ||
| 572 | + Offstage( | ||
| 573 | + offstage: detailEntity.cusdem == '' || | ||
| 574 | + detailEntity.cusdem == null, | ||
| 575 | + child: RowMultiText("备注信息", | ||
| 576 | + detailEntity.cusdem ?? ""), | ||
| 577 | + ), | ||
| 578 | + MyDivider(double.infinity, | ||
| 579 | + ScreenUtil().setHeight(1)), | ||
| 580 | + Container( | ||
| 581 | + color: MyColours.color_ffffff, | ||
| 582 | + width: double.infinity, | ||
| 583 | + height: ScreenUtil().setHeight(80), | ||
| 584 | + alignment: Alignment.center, | ||
| 585 | + child: Stack( | ||
| 586 | + alignment: Alignment.center, | ||
| 587 | + children: <Widget>[ | ||
| 588 | + Positioned( | ||
| 589 | + left: 0, | ||
| 590 | + child: Text( | ||
| 591 | + "客户经理", | ||
| 592 | + style: TextStyle( | ||
| 593 | + color: MyColours | ||
| 594 | + .color_828282, | ||
| 595 | + fontSize: ScreenUtil() | ||
| 596 | + .setSp(30)), | ||
| 597 | + ), | ||
| 598 | + ), | ||
| 599 | + Positioned( | ||
| 600 | + right: 0, | ||
| 601 | + child: GestureDetector( | ||
| 602 | + onTap: () async { | ||
| 603 | + List<String> list = []; | ||
| 604 | + for (Manager manager | ||
| 605 | + in managers) { | ||
| 606 | + list.add( | ||
| 607 | + manager.roleUserName); | ||
| 608 | + } | ||
| 609 | + DialogUtil | ||
| 610 | + .showSelectCusmanDialog( | ||
| 611 | + context, list, | ||
| 612 | + (value) { | ||
| 613 | + if (value != null) { | ||
| 614 | + setState(() { | ||
| 615 | + cusmanText = managers[ | ||
| 616 | + value.first] | ||
| 617 | + .userName; | ||
| 618 | + }); | ||
| 619 | + _setCurrManager(); | ||
| 620 | + } | ||
| 621 | + }).then((value) {}); | ||
| 622 | + }, | ||
| 623 | + child: Text( | ||
| 624 | + cusmanText, | ||
| 625 | + style: TextStyle( | ||
| 626 | + color: MyColours | ||
| 627 | + .color_353535, | ||
| 628 | + fontSize: ScreenUtil() | ||
| 629 | + .setSp(30), | ||
| 630 | + decoration: TextDecoration | ||
| 631 | + .underline, | ||
| 632 | + ), | ||
| 633 | + ), | ||
| 634 | + ), | ||
| 635 | + ) | ||
| 636 | + ], | ||
| 637 | + ), | ||
| 638 | + ), | ||
| 639 | + Offstage( | ||
| 640 | + offstage: detailEntity.note_name == | ||
| 641 | + '' || | ||
| 642 | + detailEntity.note_name == null, | ||
| 643 | + child: RowMultiText("记录人", | ||
| 644 | + detailEntity.note_name ?? ""), | ||
| 645 | + ), | ||
| 646 | + Offstage( | ||
| 647 | + offstage: (detailEntity.status == | ||
| 648 | + "4" && | ||
| 649 | + detailEntity.cancel != null) | ||
| 650 | + ? false | ||
| 651 | + : true, | ||
| 652 | + child: Column( | ||
| 653 | + children: <Widget>[ | ||
| 654 | + MyDivider(double.infinity, | ||
| 655 | + ScreenUtil().setHeight(2)), | ||
| 656 | + RowMultiText( | ||
| 657 | + "取消原因", | ||
| 658 | + detailEntity.cancel?.desc ?? | ||
| 659 | + "", | ||
| 660 | + textAlign: TextAlign.left), | ||
| 661 | + RowMultiText( | ||
| 662 | + "取消时间", | ||
| 663 | + detailEntity | ||
| 664 | + .cancel?.cdateStr ?? | ||
| 634 | ""), | 665 | ""), |
| 635 | - ], | ||
| 636 | - ), | ||
| 637 | - ), | ||
| 638 | - ], | ||
| 639 | - )), | ||
| 640 | - ), | ||
| 641 | - )), | ||
| 642 | - ), | ||
| 643 | - Offstage( | ||
| 644 | - offstage: (detailEntity.status == "3" || | ||
| 645 | - detailEntity.status == "4" || | ||
| 646 | - detailEntity.status == "6") | ||
| 647 | - ? true | ||
| 648 | - : false, | ||
| 649 | - child: Container( | ||
| 650 | - width: double.infinity, | ||
| 651 | - decoration: BoxDecoration( | ||
| 652 | - color: MyColours.color_ffffff, | ||
| 653 | - border: Border( | ||
| 654 | - top: BorderSide( | ||
| 655 | - color: MyColours.color_dbe3e3, | ||
| 656 | - width: ScreenUtil().setWidth(1)))), | ||
| 657 | - padding: EdgeInsets.fromLTRB( | ||
| 658 | - ScreenUtil().setHeight(40), | ||
| 659 | - ScreenUtil().setHeight(40), | ||
| 660 | - ScreenUtil().setHeight(40), | ||
| 661 | - ScreenUtil().setHeight(0)), | ||
| 662 | - margin: EdgeInsets.symmetric( | ||
| 663 | - vertical: ScreenUtil().setHeight(20)), | ||
| 664 | - child: CommonButton( | ||
| 665 | - content: "通知客户", | ||
| 666 | - width: 669, | ||
| 667 | - height: 84, | ||
| 668 | - fontSize: 34, | ||
| 669 | - onPress: () { | ||
| 670 | - DialogUtil.showShareDialog(context)?.then((value) { | ||
| 671 | - switch (value) { | ||
| 672 | - case 1: //微信 | ||
| 673 | - NavigatorUtil.goInvicationPage( | ||
| 674 | - context, | ||
| 675 | - detailEntity.id, | ||
| 676 | - detailEntity.tableinfoStr, | ||
| 677 | - detailEntity.ddate, | ||
| 678 | - detailEntity.ddateStr); | ||
| 679 | - break; | ||
| 680 | - case 2: //短信 | ||
| 681 | - NavigatorUtil.goSmsPage( | ||
| 682 | - context, detailEntity.id); | ||
| 683 | - break; | ||
| 684 | - case 3: //电话 | ||
| 685 | - if (detailEntity.phone != null && | ||
| 686 | - detailEntity.phone.isNotEmpty) { | ||
| 687 | - Utils.goPhone(detailEntity.phone); | ||
| 688 | - } else { | ||
| 689 | - Utils.showToast("没有客户电话!"); | ||
| 690 | - } | ||
| 691 | - break; | ||
| 692 | - } | ||
| 693 | - }); | ||
| 694 | - }, | 666 | + RowMultiText( |
| 667 | + "操作人", | ||
| 668 | + detailEntity.abolition == '2' | ||
| 669 | + ? '顾客在线取消' | ||
| 670 | + : detailEntity | ||
| 671 | + .cancel?.uname ?? | ||
| 672 | + ""), | ||
| 673 | + ], | ||
| 674 | + ), | ||
| 675 | + ), | ||
| 676 | + ], | ||
| 677 | + )), | ||
| 678 | + ), | ||
| 679 | + )), | ||
| 695 | ), | 680 | ), |
| 696 | - ), | ||
| 697 | - ), | ||
| 698 | - Offstage( | ||
| 699 | - offstage: (detailEntity.status == "3" || | ||
| 700 | - detailEntity.status == "4" || | ||
| 701 | - detailEntity.status == "6") | ||
| 702 | - ? true | ||
| 703 | - : false, | ||
| 704 | - child: Container( | ||
| 705 | - width: double.infinity, | ||
| 706 | - height: ScreenUtil().setWidth(84), | ||
| 707 | - margin: EdgeInsets.symmetric( | ||
| 708 | - horizontal: ScreenUtil().setHeight(40)), | ||
| 709 | - decoration: BoxDecoration( | ||
| 710 | - border: Border.all( | ||
| 711 | - color: MyColours.color_199095, | ||
| 712 | - width: ScreenUtil().setWidth(2)), | ||
| 713 | - borderRadius: | ||
| 714 | - BorderRadius.circular(ScreenUtil().setWidth(10)), | 681 | + Offstage( |
| 682 | + offstage: (detailEntity.status == "3" || | ||
| 683 | + detailEntity.status == "4" || | ||
| 684 | + detailEntity.status == "6") | ||
| 685 | + ? true | ||
| 686 | + : false, | ||
| 687 | + child: Container( | ||
| 688 | + width: double.infinity, | ||
| 689 | + decoration: BoxDecoration( | ||
| 690 | + color: MyColours.color_ffffff, | ||
| 691 | + border: Border( | ||
| 692 | + top: BorderSide( | ||
| 693 | + color: MyColours.color_dbe3e3, | ||
| 694 | + width: ScreenUtil().setWidth(1)))), | ||
| 695 | + padding: EdgeInsets.fromLTRB( | ||
| 696 | + ScreenUtil().setHeight(40), | ||
| 697 | + ScreenUtil().setHeight(40), | ||
| 698 | + ScreenUtil().setHeight(40), | ||
| 699 | + ScreenUtil().setHeight(0)), | ||
| 700 | + margin: EdgeInsets.symmetric( | ||
| 701 | + vertical: ScreenUtil().setHeight(20)), | ||
| 702 | + child: CommonButton( | ||
| 703 | + content: "通知客户", | ||
| 704 | + width: 669, | ||
| 705 | + height: 84, | ||
| 706 | + fontSize: 34, | ||
| 707 | + onPress: () { | ||
| 708 | + DialogUtil.showShareDialog(context) | ||
| 709 | + ?.then((value) { | ||
| 710 | + switch (value) { | ||
| 711 | + case 1: //微信 | ||
| 712 | + NavigatorUtil.goInvicationPage( | ||
| 713 | + context, | ||
| 714 | + detailEntity.id, | ||
| 715 | + detailEntity.tableinfoStr, | ||
| 716 | + detailEntity.ddate, | ||
| 717 | + detailEntity.ddateStr); | ||
| 718 | + break; | ||
| 719 | + case 2: //短信 | ||
| 720 | + NavigatorUtil.goSmsPage( | ||
| 721 | + context, detailEntity.id); | ||
| 722 | + break; | ||
| 723 | + case 3: //电话 | ||
| 724 | + if (detailEntity.phone != null && | ||
| 725 | + detailEntity.phone.isNotEmpty) { | ||
| 726 | + Utils.goPhone(detailEntity.phone); | ||
| 727 | + } else { | ||
| 728 | + Utils.showToast("没有客户电话!"); | ||
| 729 | + } | ||
| 730 | + break; | ||
| 731 | + } | ||
| 732 | + }); | ||
| 733 | + }, | ||
| 734 | + ), | ||
| 735 | + ), | ||
| 715 | ), | 736 | ), |
| 716 | - // child: Text('fff'), | ||
| 717 | - child: Material( | ||
| 718 | - color: Colors.transparent, | ||
| 719 | - child: Row( | ||
| 720 | - children: [ | ||
| 721 | - Expanded( | ||
| 722 | - child: _cancelAndChangeBtn(() { | ||
| 723 | - print('点击变更预订'); | ||
| 724 | - NavigatorUtil.goNoteBookChangePage( | ||
| 725 | - context, detailEntity, widget.rid); | ||
| 726 | - }, '变更预订')), | ||
| 727 | - MyDivider( | ||
| 728 | - ScreenUtil().setWidth(2), | ||
| 729 | - ScreenUtil().setWidth(50), | 737 | + Offstage( |
| 738 | + offstage: (detailEntity.status == "3" || | ||
| 739 | + detailEntity.status == "4" || | ||
| 740 | + detailEntity.status == "6") | ||
| 741 | + ? true | ||
| 742 | + : false, | ||
| 743 | + child: Container( | ||
| 744 | + width: double.infinity, | ||
| 745 | + height: ScreenUtil().setWidth(84), | ||
| 746 | + margin: EdgeInsets.symmetric( | ||
| 747 | + horizontal: ScreenUtil().setHeight(40)), | ||
| 748 | + decoration: BoxDecoration( | ||
| 749 | + border: Border.all( | ||
| 730 | color: MyColours.color_199095, | 750 | color: MyColours.color_199095, |
| 731 | - ), | ||
| 732 | - Expanded( | ||
| 733 | - child: _cancelAndChangeBtn(() { | ||
| 734 | - _showCancelWidget(context); | ||
| 735 | - }, '取消预订')), | ||
| 736 | - ], | ||
| 737 | - )), | ||
| 738 | - ), | ||
| 739 | - ), | ||
| 740 | - VEmptyView(ScreenUtil().setWidth(60)) | ||
| 741 | - ], | ||
| 742 | - ), | ||
| 743 | - ), | ||
| 744 | - onWillPop: () async { | ||
| 745 | - if (widget.fromNotify) { | ||
| 746 | - NavigatorUtil.goHomePage(context, initialIndex: 0); | 751 | + width: ScreenUtil().setWidth(2)), |
| 752 | + borderRadius: BorderRadius.circular( | ||
| 753 | + ScreenUtil().setWidth(10)), | ||
| 754 | + ), | ||
| 755 | + // child: Text('fff'), | ||
| 756 | + child: Material( | ||
| 757 | + color: Colors.transparent, | ||
| 758 | + child: Row( | ||
| 759 | + children: [ | ||
| 760 | + Expanded( | ||
| 761 | + child: _cancelAndChangeBtn(() { | ||
| 762 | + print('点击变更预订'); | ||
| 763 | + NavigatorUtil.goNoteBookChangePage( | ||
| 764 | + context, detailEntity, widget.rid); | ||
| 765 | + }, '变更预订')), | ||
| 766 | + MyDivider( | ||
| 767 | + ScreenUtil().setWidth(2), | ||
| 768 | + ScreenUtil().setWidth(50), | ||
| 769 | + color: MyColours.color_199095, | ||
| 770 | + ), | ||
| 771 | + Expanded( | ||
| 772 | + child: _cancelAndChangeBtn(() { | ||
| 773 | + _showCancelWidget(context); | ||
| 774 | + }, '取消预订')), | ||
| 775 | + ], | ||
| 776 | + )), | ||
| 777 | + ), | ||
| 778 | + ), | ||
| 779 | + VEmptyView(ScreenUtil().setWidth(60)) | ||
| 780 | + ], | ||
| 781 | + ); | ||
| 782 | + } | ||
| 783 | + })), | ||
| 784 | + ], | ||
| 785 | + ), | ||
| 786 | + ), | ||
| 787 | + onWillPop: () async { | ||
| 788 | + if (widget.fromNotify) { | ||
| 789 | + NavigatorUtil.goHomePage(context, initialIndex: 0); | ||
| 790 | + return true; | ||
| 791 | + } | ||
| 792 | + Navigator.of(context).pop(); | ||
| 747 | return true; | 793 | return true; |
| 748 | - } | ||
| 749 | - Navigator.of(context).pop(); | ||
| 750 | - return true; | ||
| 751 | - }, | 794 | + }, |
| 795 | + )), | ||
| 752 | ); | 796 | ); |
| 753 | } | 797 | } |
| 754 | } | 798 | } |
| @@ -59,9 +59,13 @@ class NotebookItemState extends State<NoteBookItem> { | @@ -59,9 +59,13 @@ class NotebookItemState extends State<NoteBookItem> { | ||
| 59 | children: <Widget>[ | 59 | children: <Widget>[ |
| 60 | Container( | 60 | Container( |
| 61 | width: ScreenUtil().setWidth(171), | 61 | width: ScreenUtil().setWidth(171), |
| 62 | + padding: EdgeInsets.symmetric( | ||
| 63 | + horizontal: ScreenUtil().setWidth(24)), | ||
| 62 | alignment: Alignment.center, | 64 | alignment: Alignment.center, |
| 63 | child: Text( | 65 | child: Text( |
| 64 | notebook.tableinfoStr?.trim(), | 66 | notebook.tableinfoStr?.trim(), |
| 67 | + maxLines: 2, | ||
| 68 | + overflow: TextOverflow.ellipsis, | ||
| 65 | style: TextStyle( | 69 | style: TextStyle( |
| 66 | color: textColor, | 70 | color: textColor, |
| 67 | // fontWeight: FontWeight.bold, | 71 | // fontWeight: FontWeight.bold, |
| @@ -81,6 +85,9 @@ class NotebookItemState extends State<NoteBookItem> { | @@ -81,6 +85,9 @@ class NotebookItemState extends State<NoteBookItem> { | ||
| 81 | children: <Widget>[ | 85 | children: <Widget>[ |
| 82 | Text( | 86 | Text( |
| 83 | notebook.rnameStr, | 87 | notebook.rnameStr, |
| 88 | + // 'nnnnnnnnnnnnnn', | ||
| 89 | + maxLines: 1, | ||
| 90 | + overflow: TextOverflow.ellipsis, | ||
| 84 | style: TextStyle( | 91 | style: TextStyle( |
| 85 | color: textColor, | 92 | color: textColor, |
| 86 | // fontWeight: FontWeight.bold, | 93 | // fontWeight: FontWeight.bold, |
| @@ -89,6 +96,8 @@ class NotebookItemState extends State<NoteBookItem> { | @@ -89,6 +96,8 @@ class NotebookItemState extends State<NoteBookItem> { | ||
| 89 | VEmptyView(10), | 96 | VEmptyView(10), |
| 90 | Text( | 97 | Text( |
| 91 | notebook.phoneStr, | 98 | notebook.phoneStr, |
| 99 | + maxLines: 1, | ||
| 100 | + overflow: TextOverflow.ellipsis, | ||
| 92 | style: TextStyle( | 101 | style: TextStyle( |
| 93 | color: textColor, | 102 | color: textColor, |
| 94 | // fontWeight: FontWeight.bold, | 103 | // fontWeight: FontWeight.bold, |
| @@ -433,7 +433,7 @@ class NoteBookPageState extends State<NoteBookPage> { | @@ -433,7 +433,7 @@ class NoteBookPageState extends State<NoteBookPage> { | ||
| 433 | (BuildContext context, int index) { | 433 | (BuildContext context, int index) { |
| 434 | return NoteBookItem(model.notebooks[index], index); | 434 | return NoteBookItem(model.notebooks[index], index); |
| 435 | }, childCount: model.notebooks.length), | 435 | }, childCount: model.notebooks.length), |
| 436 | - itemExtent: ScreenUtil().setHeight(112), | 436 | + itemExtent: ScreenUtil().setWidth(112), |
| 437 | ) | 437 | ) |
| 438 | ], | 438 | ], |
| 439 | onRefresh: () async { | 439 | onRefresh: () async { |
| @@ -2,6 +2,7 @@ import 'dart:ffi'; | @@ -2,6 +2,7 @@ import 'dart:ffi'; | ||
| 2 | 2 | ||
| 3 | import 'package:flutter/material.dart'; | 3 | import 'package:flutter/material.dart'; |
| 4 | import 'package:flutter_screenutil/flutter_screenutil.dart'; | 4 | import 'package:flutter_screenutil/flutter_screenutil.dart'; |
| 5 | +import 'package:one_key/constant/state.dart'; | ||
| 5 | import 'package:one_key/models/area.dart'; | 6 | import 'package:one_key/models/area.dart'; |
| 6 | import 'package:one_key/models/notebook.dart'; | 7 | import 'package:one_key/models/notebook.dart'; |
| 7 | import 'package:one_key/models/tableOuter.dart'; | 8 | import 'package:one_key/models/tableOuter.dart'; |
| @@ -16,6 +17,7 @@ import 'package:one_key/utils/utils.dart'; | @@ -16,6 +17,7 @@ import 'package:one_key/utils/utils.dart'; | ||
| 16 | import 'package:one_key/widgets/app_bar.dart'; | 17 | import 'package:one_key/widgets/app_bar.dart'; |
| 17 | import 'package:one_key/widgets/area_item.dart'; | 18 | import 'package:one_key/widgets/area_item.dart'; |
| 18 | import 'package:one_key/widgets/common_button.dart'; | 19 | import 'package:one_key/widgets/common_button.dart'; |
| 20 | +import 'package:one_key/widgets/page_exception.dart'; | ||
| 19 | import 'package:one_key/widgets/table_item.dart'; | 21 | import 'package:one_key/widgets/table_item.dart'; |
| 20 | import 'package:one_key/models/table.dart' as t; | 22 | import 'package:one_key/models/table.dart' as t; |
| 21 | import 'package:provider/provider.dart'; | 23 | import 'package:provider/provider.dart'; |
| @@ -46,8 +48,6 @@ class SelectTablePageState extends State<SelectTablePage> { | @@ -46,8 +48,6 @@ class SelectTablePageState extends State<SelectTablePage> { | ||
| 46 | 48 | ||
| 47 | Map<String, List<t.Table>> areaTableMap = {}; //区域-桌位Map | 49 | Map<String, List<t.Table>> areaTableMap = {}; //区域-桌位Map |
| 48 | 50 | ||
| 49 | - SelectTableModel selectTableModel = new SelectTableModel(); | ||
| 50 | - | ||
| 51 | ChooseTableModel _chooseTableModel; | 51 | ChooseTableModel _chooseTableModel; |
| 52 | 52 | ||
| 53 | Map<String, Notebook> tableMap = {}; //记录已预订桌位对应的订单 | 53 | Map<String, Notebook> tableMap = {}; //记录已预订桌位对应的订单 |
| @@ -67,7 +67,10 @@ class SelectTablePageState extends State<SelectTablePage> { | @@ -67,7 +67,10 @@ class SelectTablePageState extends State<SelectTablePage> { | ||
| 67 | getTableList() async { | 67 | getTableList() async { |
| 68 | UserModel userModel = Provider.of<UserModel>(context, listen: false); | 68 | UserModel userModel = Provider.of<UserModel>(context, listen: false); |
| 69 | Map<String, String> params = {"sellerid": userModel.user.sellerid}; | 69 | Map<String, String> params = {"sellerid": userModel.user.sellerid}; |
| 70 | - tableOuterList = await selectTableModel.getTableList(context, params); | 70 | + tableOuterList = await _chooseTableModel.getTableList( |
| 71 | + context, | ||
| 72 | + params, | ||
| 73 | + ); | ||
| 71 | for (TableOuter item in tableOuterList) { | 74 | for (TableOuter item in tableOuterList) { |
| 72 | // if (item.name == "推荐") { | 75 | // if (item.name == "推荐") { |
| 73 | // itemModelList.remove(item); | 76 | // itemModelList.remove(item); |
| @@ -83,7 +86,9 @@ class SelectTablePageState extends State<SelectTablePage> { | @@ -83,7 +86,9 @@ class SelectTablePageState extends State<SelectTablePage> { | ||
| 83 | } | 86 | } |
| 84 | } | 87 | } |
| 85 | } | 88 | } |
| 86 | - _getReserveList(userModel.user.sellerid); | 89 | + if (_chooseTableModel.pageState == PageState.Success) { |
| 90 | + _getReserveList(userModel.user.sellerid); | ||
| 91 | + } | ||
| 87 | } | 92 | } |
| 88 | 93 | ||
| 89 | //获取已预订列表 | 94 | //获取已预订列表 |
| @@ -175,101 +180,124 @@ class SelectTablePageState extends State<SelectTablePage> { | @@ -175,101 +180,124 @@ class SelectTablePageState extends State<SelectTablePage> { | ||
| 175 | @override | 180 | @override |
| 176 | Widget build(BuildContext context) { | 181 | Widget build(BuildContext context) { |
| 177 | _chooseTableModel = Provider.of<ChooseTableModel>(context); | 182 | _chooseTableModel = Provider.of<ChooseTableModel>(context); |
| 178 | - return SafeArea( | ||
| 179 | - child: areaTableMap.isEmpty | ||
| 180 | - ? Container( | ||
| 181 | - width: double.infinity, | ||
| 182 | - height: double.infinity, | ||
| 183 | - color: MyColours.color_ffffff, | ||
| 184 | - ) | ||
| 185 | - : Column( | ||
| 186 | - children: <Widget>[ | ||
| 187 | - MyAppBar( | ||
| 188 | - "选择桌位", | ||
| 189 | - showBack: true, | ||
| 190 | - ), | ||
| 191 | - Expanded( | ||
| 192 | - child: Container( | ||
| 193 | - color: MyColours.color_ffffff, | ||
| 194 | - child: Row( | ||
| 195 | - children: <Widget>[ | ||
| 196 | - Container( | ||
| 197 | - width: ScreenUtil().setWidth(170), | ||
| 198 | - height: double.infinity, | ||
| 199 | - color: MyColours.color_f1f1f1, | ||
| 200 | - child: ListView.builder( | ||
| 201 | - itemBuilder: (context, index) { | ||
| 202 | - return AreaItem(areas[index], currentArea, | ||
| 203 | - (area) { | ||
| 204 | - setState(() { | ||
| 205 | - currentArea = (area as Area).name; | ||
| 206 | - }); | 183 | + return Scaffold( |
| 184 | + body: SafeArea( | ||
| 185 | + child: Column( | ||
| 186 | + children: <Widget>[ | ||
| 187 | + MyAppBar( | ||
| 188 | + "选择桌位", | ||
| 189 | + showBack: true, | ||
| 190 | + ), | ||
| 191 | + Expanded( | ||
| 192 | + child: Consumer<ChooseTableModel>(builder: (context, model, _) { | ||
| 193 | + if (model.pageState != PageState.Success) { | ||
| 194 | + return ExceptionPage( | ||
| 195 | + pageState: model.pageState, | ||
| 196 | + callback: () { | ||
| 197 | + getTableList(); | ||
| 198 | + }, | ||
| 199 | + emptyMsg: "暂时没有预订哦", | ||
| 200 | + emptyImg: "empty_search", | ||
| 201 | + showMsg: "加载中,请稍后...", | ||
| 202 | + ); | ||
| 203 | + } else { | ||
| 204 | + return Container( | ||
| 205 | + color: MyColours.color_ffffff, | ||
| 206 | + child: Row( | ||
| 207 | + children: <Widget>[ | ||
| 208 | + Container( | ||
| 209 | + width: ScreenUtil().setWidth(170), | ||
| 210 | + height: double.infinity, | ||
| 211 | + color: MyColours.color_f1f1f1, | ||
| 212 | + child: ListView.builder( | ||
| 213 | + itemBuilder: (context, index) { | ||
| 214 | + return AreaItem(areas[index], currentArea, (area) { | ||
| 215 | + setState(() { | ||
| 216 | + currentArea = (area as Area).name; | ||
| 207 | }); | 217 | }); |
| 208 | - }, | ||
| 209 | - itemExtent: ScreenUtil().setHeight(207), | ||
| 210 | - itemCount: areas.length, | ||
| 211 | - ), | 218 | + }); |
| 219 | + }, | ||
| 220 | + itemExtent: ScreenUtil().setHeight(207), | ||
| 221 | + itemCount: areas.length, | ||
| 212 | ), | 222 | ), |
| 213 | - Expanded( | ||
| 214 | - child: Padding( | ||
| 215 | - padding: EdgeInsets.symmetric( | ||
| 216 | - vertical: ScreenUtil().setHeight(10), | ||
| 217 | - horizontal: ScreenUtil().setWidth(9)), | ||
| 218 | - child: Column( | ||
| 219 | - children: [ | ||
| 220 | - Expanded( | ||
| 221 | - child: GridView.builder( | ||
| 222 | - gridDelegate: | ||
| 223 | - SliverGridDelegateWithFixedCrossAxisCount( | ||
| 224 | - crossAxisCount: 3, | ||
| 225 | - childAspectRatio: 8 / 9), | ||
| 226 | - itemBuilder: (context, index) { | ||
| 227 | - return TableItem( | ||
| 228 | - areaTableMap[currentArea][index], | ||
| 229 | - onSelected: (table) { | ||
| 230 | - if ((table as t.Table).selected) { | ||
| 231 | - selectTables.add(table); | ||
| 232 | - widget.tableList | ||
| 233 | - .add(tableToTableList(table)); | ||
| 234 | - } else { | ||
| 235 | - widget.tableList.removeWhere( | ||
| 236 | - (t) => t.id == table.id); | ||
| 237 | - selectTables.removeWhere( | ||
| 238 | - (t) => t.id == table.id); | ||
| 239 | - } | ||
| 240 | - }, | ||
| 241 | - canSelected: true, | ||
| 242 | - canChoose: widget.canChoose, | ||
| 243 | - tableMap: tableMap, | ||
| 244 | - rid: widget.rid); | 223 | + ), |
| 224 | + Expanded( | ||
| 225 | + child: Padding( | ||
| 226 | + padding: EdgeInsets.symmetric( | ||
| 227 | + vertical: ScreenUtil().setHeight(10), | ||
| 228 | + horizontal: ScreenUtil().setWidth(9)), | ||
| 229 | + child: Column( | ||
| 230 | + children: [ | ||
| 231 | + Expanded( | ||
| 232 | + child: GridView.builder( | ||
| 233 | + gridDelegate: | ||
| 234 | + SliverGridDelegateWithFixedCrossAxisCount( | ||
| 235 | + crossAxisCount: 3, | ||
| 236 | + childAspectRatio: 8 / 9), | ||
| 237 | + itemBuilder: (context, index) { | ||
| 238 | + return TableItem( | ||
| 239 | + areaTableMap[currentArea][index], | ||
| 240 | + onSelected: (table) { | ||
| 241 | + if ((table as t.Table).selected) { | ||
| 242 | + selectTables.add(table); | ||
| 243 | + widget.tableList | ||
| 244 | + .add(tableToTableList(table)); | ||
| 245 | + } else { | ||
| 246 | + widget.tableList.removeWhere( | ||
| 247 | + (t) => t.id == table.id); | ||
| 248 | + selectTables.removeWhere( | ||
| 249 | + (t) => t.id == table.id); | ||
| 250 | + } | ||
| 245 | }, | 251 | }, |
| 246 | - itemCount: areaTableMap[currentArea].length, | ||
| 247 | - )), | ||
| 248 | - Container( | ||
| 249 | - width: double.infinity, | ||
| 250 | - height: ScreenUtil().setHeight(84), | ||
| 251 | - margin: EdgeInsets.only( | ||
| 252 | - bottom: ScreenUtil().setWidth(50)), | ||
| 253 | - padding: EdgeInsets.symmetric( | ||
| 254 | - horizontal: | ||
| 255 | - ScreenUtil().setWidth(31)), | ||
| 256 | - alignment: Alignment.center, | ||
| 257 | - color: MyColours.color_ffffff, | ||
| 258 | - child: CommonButton( | ||
| 259 | - content: "确定", | ||
| 260 | - width: 500, | ||
| 261 | - height: 84, | ||
| 262 | - fontSize: 34, | ||
| 263 | - state: 1, | ||
| 264 | - onPress: () { | ||
| 265 | - if (widget.canChoose) { | ||
| 266 | - // if (widget.tableList.length > 0) { | 252 | + canSelected: true, |
| 253 | + canChoose: widget.canChoose, | ||
| 254 | + tableMap: tableMap, | ||
| 255 | + rid: widget.rid); | ||
| 256 | + }, | ||
| 257 | + itemCount: areaTableMap[currentArea].length, | ||
| 258 | + )), | ||
| 259 | + Container( | ||
| 260 | + width: double.infinity, | ||
| 261 | + height: ScreenUtil().setHeight(84), | ||
| 262 | + margin: EdgeInsets.only( | ||
| 263 | + bottom: ScreenUtil().setWidth(50)), | ||
| 264 | + padding: EdgeInsets.symmetric( | ||
| 265 | + horizontal: ScreenUtil().setWidth(31)), | ||
| 266 | + alignment: Alignment.center, | ||
| 267 | + color: MyColours.color_ffffff, | ||
| 268 | + child: CommonButton( | ||
| 269 | + content: "确定", | ||
| 270 | + width: 500, | ||
| 271 | + height: 84, | ||
| 272 | + fontSize: 34, | ||
| 273 | + state: 1, | ||
| 274 | + onPress: () { | ||
| 275 | + if (widget.canChoose) { | ||
| 276 | + // if (widget.tableList.length > 0) { | ||
| 277 | + String tid = ""; | ||
| 278 | + for (TableList table | ||
| 279 | + in widget.tableList) { | ||
| 280 | + tid += table.id + ","; | ||
| 281 | + } | ||
| 282 | + if (widget.tableList.length > 0) { | ||
| 283 | + tid = tid.substring( | ||
| 284 | + 0, tid.length - 1); | ||
| 285 | + } | ||
| 286 | + | ||
| 287 | + Map temp = { | ||
| 288 | + 'object': widget.tableList, | ||
| 289 | + 'tid': tid | ||
| 290 | + }; | ||
| 291 | + Navigator.of(context).pop(temp); | ||
| 292 | + // } | ||
| 293 | + } else { | ||
| 294 | + if (selectTables.length > 0) { | ||
| 267 | String tid = ""; | 295 | String tid = ""; |
| 268 | - for (TableList table | ||
| 269 | - in widget.tableList) { | 296 | + for (t.Table table |
| 297 | + in selectTables) { | ||
| 270 | tid += table.id + ","; | 298 | tid += table.id + ","; |
| 271 | } | 299 | } |
| 272 | - if (widget.tableList.length > 0) { | 300 | + if (selectTables.length > 0) { |
| 273 | tid = tid.substring( | 301 | tid = tid.substring( |
| 274 | 0, tid.length - 1); | 302 | 0, tid.length - 1); |
| 275 | } | 303 | } |
| @@ -279,38 +307,22 @@ class SelectTablePageState extends State<SelectTablePage> { | @@ -279,38 +307,22 @@ class SelectTablePageState extends State<SelectTablePage> { | ||
| 279 | 'tid': tid | 307 | 'tid': tid |
| 280 | }; | 308 | }; |
| 281 | Navigator.of(context).pop(temp); | 309 | Navigator.of(context).pop(temp); |
| 282 | - // } | ||
| 283 | - } else { | ||
| 284 | - if (selectTables.length > 0) { | ||
| 285 | - String tid = ""; | ||
| 286 | - for (t.Table table | ||
| 287 | - in selectTables) { | ||
| 288 | - tid += table.id + ","; | ||
| 289 | - } | ||
| 290 | - if (selectTables.length > 0) { | ||
| 291 | - tid = tid.substring( | ||
| 292 | - 0, tid.length - 1); | ||
| 293 | - } | ||
| 294 | - | ||
| 295 | - Map temp = { | ||
| 296 | - 'object': widget.tableList, | ||
| 297 | - 'tid': tid | ||
| 298 | - }; | ||
| 299 | - Navigator.of(context).pop(temp); | ||
| 300 | - } | ||
| 301 | } | 310 | } |
| 302 | - }, | ||
| 303 | - )), | ||
| 304 | - ], | ||
| 305 | - )), | ||
| 306 | - ) | ||
| 307 | - ], | ||
| 308 | - ), | 311 | + } |
| 312 | + }, | ||
| 313 | + )), | ||
| 314 | + ], | ||
| 315 | + )), | ||
| 316 | + ) | ||
| 317 | + ], | ||
| 309 | ), | 318 | ), |
| 310 | - ), | ||
| 311 | - ], | ||
| 312 | - ), | ||
| 313 | - ); | 319 | + ); |
| 320 | + } | ||
| 321 | + }), | ||
| 322 | + ), | ||
| 323 | + ], | ||
| 324 | + ), | ||
| 325 | + )); | ||
| 314 | } | 326 | } |
| 315 | 327 | ||
| 316 | tableToTableList(t.Table table) { | 328 | tableToTableList(t.Table table) { |
| 1 | import 'package:flutter/material.dart'; | 1 | import 'package:flutter/material.dart'; |
| 2 | +import 'package:one_key/constant/constant.dart'; | ||
| 3 | +import 'package:one_key/constant/error.dart'; | ||
| 4 | +import 'package:one_key/constant/state.dart'; | ||
| 5 | +import 'package:one_key/models/tableOuter.dart'; | ||
| 2 | import 'package:one_key/models/table_list.dart'; | 6 | import 'package:one_key/models/table_list.dart'; |
| 7 | +import 'package:one_key/net/base_resp.dart'; | ||
| 8 | +import 'package:one_key/net/dio_util.dart'; | ||
| 9 | +import 'package:one_key/net/http_url.dart'; | ||
| 10 | +import 'package:one_key/models/table.dart' as t; | ||
| 3 | 11 | ||
| 4 | class ChooseTableModel with ChangeNotifier { | 12 | class ChooseTableModel with ChangeNotifier { |
| 5 | List<TableList> tableList = []; | 13 | List<TableList> tableList = []; |
| 14 | + PageState pageState = PageState.Loading; | ||
| 15 | + | ||
| 16 | + //获取桌位数据 | ||
| 17 | + Future<List<TableOuter>> getTableList( | ||
| 18 | + BuildContext context, Map<String, String> params, | ||
| 19 | + {isShowLoading = true}) async { | ||
| 20 | + if (isShowLoading) { | ||
| 21 | + pageState = PageState.Loading; | ||
| 22 | + notifyListeners(); | ||
| 23 | + } | ||
| 24 | + BaseResp<List> baseResp = await DioUtil() | ||
| 25 | + .request<List>(context, Method.get, HttpUrl.table_list, | ||
| 26 | + data: params, showLoading: false) | ||
| 27 | + .catchError((error) { | ||
| 28 | + print(error.toString()); | ||
| 29 | + if (error is MyError) { | ||
| 30 | + switch (error.type) { | ||
| 31 | + case 1: | ||
| 32 | + pageState = PageState.ConnectivityError; | ||
| 33 | + break; | ||
| 34 | + case 2: | ||
| 35 | + pageState = PageState.ConnectivityTimeOut; | ||
| 36 | + break; | ||
| 37 | + default: | ||
| 38 | + pageState = PageState.ConnectivityError; | ||
| 39 | + break; | ||
| 40 | + } | ||
| 41 | + } | ||
| 42 | + notifyListeners(); | ||
| 43 | + }); | ||
| 44 | + if (baseResp.code == Constant.status_success) { | ||
| 45 | + if ((baseResp.data[0] as List).isEmpty) { | ||
| 46 | + pageState = PageState.Empty; | ||
| 47 | + notifyListeners(); | ||
| 48 | + } else { | ||
| 49 | + pageState = PageState.Success; | ||
| 50 | + } | ||
| 51 | + | ||
| 52 | + return (baseResp.data[0] as List).map((value) { | ||
| 53 | + TableOuter tableOuter = TableOuter(); | ||
| 54 | + tableOuter.name = value["name"]; | ||
| 55 | + tableOuter.list = (value["list"] as List).map((table) { | ||
| 56 | + return t.Table.fromJson(table as Map<String, dynamic>); | ||
| 57 | + }).toList(); | ||
| 58 | + return tableOuter; | ||
| 59 | + }).toList(); | ||
| 60 | + } else { | ||
| 61 | + pageState = PageState.ConnectivityError; | ||
| 62 | + notifyListeners(); | ||
| 63 | + } | ||
| 64 | + return []; | ||
| 65 | + } | ||
| 6 | } | 66 | } |
| 1 | import 'package:flutter/material.dart'; | 1 | import 'package:flutter/material.dart'; |
| 2 | import 'package:one_key/constant/constant.dart'; | 2 | import 'package:one_key/constant/constant.dart'; |
| 3 | +import 'package:one_key/constant/error.dart'; | ||
| 4 | +import 'package:one_key/constant/state.dart'; | ||
| 3 | import 'package:one_key/models/manager.dart'; | 5 | import 'package:one_key/models/manager.dart'; |
| 4 | import 'package:one_key/models/notebook_detail.dart'; | 6 | import 'package:one_key/models/notebook_detail.dart'; |
| 5 | import 'package:one_key/net/base_resp.dart'; | 7 | import 'package:one_key/net/base_resp.dart'; |
| @@ -11,18 +13,50 @@ import 'package:one_key/utils/utils.dart'; | @@ -11,18 +13,50 @@ import 'package:one_key/utils/utils.dart'; | ||
| 11 | import 'package:provider/provider.dart'; | 13 | import 'package:provider/provider.dart'; |
| 12 | 14 | ||
| 13 | class NotebookDetailModel extends ChangeNotifier { | 15 | class NotebookDetailModel extends ChangeNotifier { |
| 16 | + PageState pageState = PageState.Loading; | ||
| 17 | + | ||
| 14 | ///获取已预订订单 | 18 | ///获取已预订订单 |
| 15 | Future<NotebookDetail> getReserveDetail( | 19 | Future<NotebookDetail> getReserveDetail( |
| 16 | - BuildContext context, Map<String, String> params) async { | 20 | + BuildContext context, Map<String, String> params, |
| 21 | + {isShowLoading = true}) async { | ||
| 22 | + if (isShowLoading) { | ||
| 23 | + pageState = PageState.Loading; | ||
| 24 | + notifyListeners(); | ||
| 25 | + } | ||
| 17 | BaseResp<Map<String, dynamic>> baseResp = await DioUtil() | 26 | BaseResp<Map<String, dynamic>> baseResp = await DioUtil() |
| 18 | .request<Map<String, dynamic>>( | 27 | .request<Map<String, dynamic>>( |
| 19 | context, Method.get, HttpUrl.reserve_detail, | 28 | context, Method.get, HttpUrl.reserve_detail, |
| 20 | - data: params) | 29 | + data: params, showLoading: false) |
| 21 | .catchError((error) { | 30 | .catchError((error) { |
| 22 | print(error.toString()); | 31 | print(error.toString()); |
| 32 | + if (error is MyError) { | ||
| 33 | + switch (error.type) { | ||
| 34 | + case 1: | ||
| 35 | + pageState = PageState.ConnectivityError; | ||
| 36 | + break; | ||
| 37 | + case 2: | ||
| 38 | + pageState = PageState.ConnectivityTimeOut; | ||
| 39 | + break; | ||
| 40 | + default: | ||
| 41 | + pageState = PageState.ConnectivityError; | ||
| 42 | + break; | ||
| 43 | + } | ||
| 44 | + } | ||
| 45 | + notifyListeners(); | ||
| 23 | }); | 46 | }); |
| 24 | if (baseResp.code == Constant.status_success) { | 47 | if (baseResp.code == Constant.status_success) { |
| 48 | + if (baseResp.data.isEmpty) { | ||
| 49 | + pageState = PageState.ConnectivityError; | ||
| 50 | + } else { | ||
| 51 | + pageState = PageState.Success; | ||
| 52 | + } | ||
| 53 | + notifyListeners(); | ||
| 25 | return NotebookDetail.fromJson(baseResp.data); | 54 | return NotebookDetail.fromJson(baseResp.data); |
| 55 | + } else { | ||
| 56 | + pageState = PageState.ConnectivityError; | ||
| 57 | + if (baseResp != null) { | ||
| 58 | + Utils.showToast(baseResp.msg ?? ""); | ||
| 59 | + } | ||
| 26 | } | 60 | } |
| 27 | } | 61 | } |
| 28 | 62 | ||
| @@ -35,7 +69,7 @@ class NotebookDetailModel extends ChangeNotifier { | @@ -35,7 +69,7 @@ class NotebookDetailModel extends ChangeNotifier { | ||
| 35 | }; | 69 | }; |
| 36 | BaseResp<Map<String, dynamic>> baseResp = await DioUtil() | 70 | BaseResp<Map<String, dynamic>> baseResp = await DioUtil() |
| 37 | .request<Map<String, dynamic>>(context, Method.get, HttpUrl.sellerinfo, | 71 | .request<Map<String, dynamic>>(context, Method.get, HttpUrl.sellerinfo, |
| 38 | - data: params) | 72 | + data: params, showLoading: false) |
| 39 | .catchError((error) { | 73 | .catchError((error) { |
| 40 | print(error.toString()); | 74 | print(error.toString()); |
| 41 | }); | 75 | }); |
| @@ -61,7 +95,8 @@ class NotebookDetailModel extends ChangeNotifier { | @@ -61,7 +95,8 @@ class NotebookDetailModel extends ChangeNotifier { | ||
| 61 | } | 95 | } |
| 62 | 96 | ||
| 63 | //安排在线预订 | 97 | //安排在线预订 |
| 64 | - Future<bool> setReserveStatus(BuildContext context, Map<String, String> params, | 98 | + Future<bool> setReserveStatus( |
| 99 | + BuildContext context, Map<String, String> params, | ||
| 65 | {ifPush = true, showLoading = false}) async { | 100 | {ifPush = true, showLoading = false}) async { |
| 66 | BaseResp<Map<String, dynamic>> baseResp = await DioUtil() | 101 | BaseResp<Map<String, dynamic>> baseResp = await DioUtil() |
| 67 | .request<Map<String, dynamic>>( | 102 | .request<Map<String, dynamic>>( |
| @@ -70,7 +105,7 @@ class NotebookDetailModel extends ChangeNotifier { | @@ -70,7 +105,7 @@ class NotebookDetailModel extends ChangeNotifier { | ||
| 70 | .catchError((error) { | 105 | .catchError((error) { |
| 71 | print(error.toString()); | 106 | print(error.toString()); |
| 72 | }); | 107 | }); |
| 73 | - if(baseResp==null) return false; | 108 | + if (baseResp == null) return false; |
| 74 | if (baseResp.code == Constant.status_success) { | 109 | if (baseResp.code == Constant.status_success) { |
| 75 | if (ifPush) { | 110 | if (ifPush) { |
| 76 | NavigatorUtil.goNotebookDetailPage(context, params["rid"], | 111 | NavigatorUtil.goNotebookDetailPage(context, params["rid"], |
| 1 | -import 'package:flutter/material.dart'; | ||
| 2 | -import 'package:one_key/constant/constant.dart'; | ||
| 3 | -import 'package:one_key/models/tableOuter.dart'; | ||
| 4 | -import 'package:one_key/net/base_resp.dart'; | ||
| 5 | -import 'package:one_key/net/dio_util.dart'; | ||
| 6 | -import 'package:one_key/net/http_url.dart'; | ||
| 7 | -import 'package:one_key/models/table.dart' as t; | ||
| 8 | -import 'package:one_key/utils/navigator_util.dart'; | ||
| 9 | -import 'package:one_key/utils/utils.dart'; | 1 | +// import 'package:flutter/material.dart'; |
| 2 | +// import 'package:one_key/constant/constant.dart'; | ||
| 3 | +// import 'package:one_key/constant/state.dart'; | ||
| 4 | +// import 'package:one_key/models/tableOuter.dart'; | ||
| 5 | +// import 'package:one_key/net/base_resp.dart'; | ||
| 6 | +// import 'package:one_key/net/dio_util.dart'; | ||
| 7 | +// import 'package:one_key/net/http_url.dart'; | ||
| 8 | +// import 'package:one_key/models/table.dart' as t; | ||
| 9 | +// import 'package:one_key/utils/navigator_util.dart'; | ||
| 10 | +// import 'package:one_key/utils/utils.dart'; | ||
| 10 | 11 | ||
| 11 | -class SelectTableModel{ | 12 | +// class SelectTableModel { |
| 13 | +// PageState pageState = PageState.Loading; | ||
| 12 | 14 | ||
| 13 | - //获取桌位数据 | ||
| 14 | - Future<List<TableOuter>> getTableList(BuildContext context,Map<String,String> params) async { | ||
| 15 | - BaseResp<List> baseResp = await DioUtil() | ||
| 16 | - .request<List>(context, Method.get, HttpUrl.table_list, | ||
| 17 | - data: params,showLoading: true) | ||
| 18 | - .catchError((error) { | ||
| 19 | - print(error.toString()); | ||
| 20 | - }); | ||
| 21 | - if(baseResp.code==Constant.status_success){ | ||
| 22 | - return (baseResp.data[0] as List).map((value){ | ||
| 23 | - TableOuter tableOuter=TableOuter(); | ||
| 24 | - tableOuter.name=value["name"]; | ||
| 25 | - tableOuter.list=(value["list"] as List).map((table){ | ||
| 26 | - return t.Table.fromJson(table as Map<String,dynamic>); | ||
| 27 | - }).toList(); | ||
| 28 | - return tableOuter; | ||
| 29 | - }).toList(); | ||
| 30 | - } | ||
| 31 | - return []; | ||
| 32 | - } | ||
| 33 | -} | ||
| 15 | +// //获取桌位数据 | ||
| 16 | +// Future<List<TableOuter>> getTableList( | ||
| 17 | +// BuildContext context, Map<String, String> params, | ||
| 18 | +// {isShowLoading = true}) async { | ||
| 19 | +// if (isShowLoading) { | ||
| 20 | +// pageState = PageState.Loading; | ||
| 21 | +// notifyListeners(); | ||
| 22 | +// } | ||
| 23 | +// BaseResp<List> baseResp = await DioUtil() | ||
| 24 | +// .request<List>(context, Method.get, HttpUrl.table_list, | ||
| 25 | +// data: params, showLoading: true) | ||
| 26 | +// .catchError((error) { | ||
| 27 | +// print(error.toString()); | ||
| 28 | +// }); | ||
| 29 | +// if (baseResp.code == Constant.status_success) { | ||
| 30 | +// return (baseResp.data[0] as List).map((value) { | ||
| 31 | +// TableOuter tableOuter = TableOuter(); | ||
| 32 | +// tableOuter.name = value["name"]; | ||
| 33 | +// tableOuter.list = (value["list"] as List).map((table) { | ||
| 34 | +// return t.Table.fromJson(table as Map<String, dynamic>); | ||
| 35 | +// }).toList(); | ||
| 36 | +// return tableOuter; | ||
| 37 | +// }).toList(); | ||
| 38 | +// } | ||
| 39 | +// return []; | ||
| 40 | +// } | ||
| 41 | +// } |
| @@ -17,6 +17,7 @@ import 'package:one_key/pages/table/select_table_page.dart'; | @@ -17,6 +17,7 @@ import 'package:one_key/pages/table/select_table_page.dart'; | ||
| 17 | import 'package:one_key/pages/webview/webview_page.dart'; | 17 | import 'package:one_key/pages/webview/webview_page.dart'; |
| 18 | import 'package:one_key/provider/choose_table_model.dart'; | 18 | import 'package:one_key/provider/choose_table_model.dart'; |
| 19 | import 'package:one_key/provider/notebook_detail_change_model.dart'; | 19 | import 'package:one_key/provider/notebook_detail_change_model.dart'; |
| 20 | +import 'package:one_key/provider/notebook_detail_model.dart'; | ||
| 20 | import 'package:one_key/utils/fluro_convert_utils.dart'; | 21 | import 'package:one_key/utils/fluro_convert_utils.dart'; |
| 21 | import 'package:one_key/utils/log_util.dart'; | 22 | import 'package:one_key/utils/log_util.dart'; |
| 22 | import 'package:provider/provider.dart'; | 23 | import 'package:provider/provider.dart'; |
| @@ -40,9 +41,15 @@ var homeHandler = new Handler( | @@ -40,9 +41,15 @@ var homeHandler = new Handler( | ||
| 40 | var reserveDetailHandler = new Handler( | 41 | var reserveDetailHandler = new Handler( |
| 41 | handlerFunc: (BuildContext context, Map<String, List<Object>> params) { | 42 | handlerFunc: (BuildContext context, Map<String, List<Object>> params) { |
| 42 | String rid = params['rid'].first; | 43 | String rid = params['rid'].first; |
| 43 | - String mid=params['mid'].first; | ||
| 44 | - bool fromNotify=FluroConvertUtils.string2bool(params["fromNotify"].first); | ||
| 45 | - return NotebookDetailPage(rid,mid:mid,fromNotify: fromNotify,); | 44 | + String mid = params['mid'].first; |
| 45 | + bool fromNotify = FluroConvertUtils.string2bool(params["fromNotify"].first); | ||
| 46 | + return ChangeNotifierProvider<NotebookDetailModel>( | ||
| 47 | + create: (_) => NotebookDetailModel(), | ||
| 48 | + child: NotebookDetailPage( | ||
| 49 | + rid, | ||
| 50 | + mid: mid, | ||
| 51 | + fromNotify: fromNotify, | ||
| 52 | + )); | ||
| 46 | }); | 53 | }); |
| 47 | 54 | ||
| 48 | // 跳转到处理在线预订 | 55 | // 跳转到处理在线预订 |
| @@ -50,8 +57,11 @@ var handleOnlineHandler = new Handler( | @@ -50,8 +57,11 @@ var handleOnlineHandler = new Handler( | ||
| 50 | handlerFunc: (BuildContext context, Map<String, List<Object>> params) { | 57 | handlerFunc: (BuildContext context, Map<String, List<Object>> params) { |
| 51 | String rid = params['rid'].first; | 58 | String rid = params['rid'].first; |
| 52 | String mid = params["mid"].first; | 59 | String mid = params["mid"].first; |
| 53 | - bool fromNotify=FluroConvertUtils.string2bool(params["fromNotify"].first); | ||
| 54 | - return HandleOnlinePage(rid, mid,fromNotify: fromNotify,); | 60 | + bool fromNotify = FluroConvertUtils.string2bool(params["fromNotify"].first); |
| 61 | + return ChangeNotifierProvider<NotebookDetailModel>( | ||
| 62 | + create: (_) => NotebookDetailModel(), | ||
| 63 | + child: HandleOnlinePage(rid, mid, fromNotify: fromNotify)); | ||
| 64 | + // return HandleOnlinePage(rid, mid,fromNotify: fromNotify); | ||
| 55 | }); | 65 | }); |
| 56 | 66 | ||
| 57 | // 跳转到选择桌位 | 67 | // 跳转到选择桌位 |
| @@ -107,13 +107,12 @@ class NewTableItemState extends State<NewTableItem> { | @@ -107,13 +107,12 @@ class NewTableItemState extends State<NewTableItem> { | ||
| 107 | fontWeight: FontWeight.normal), | 107 | fontWeight: FontWeight.normal), |
| 108 | overflow: TextOverflow.ellipsis, | 108 | overflow: TextOverflow.ellipsis, |
| 109 | strutStyle: StrutStyle( | 109 | strutStyle: StrutStyle( |
| 110 | - forceStrutHeight: true, | ||
| 111 | - height: 1, | ||
| 112 | - leading: 0.2), | 110 | + forceStrutHeight: true, |
| 111 | + height: ScreenUtil().setWidth(2), | ||
| 112 | + // leading: ScreenUtil().setWidth(0.4) | ||
| 113 | + ), | ||
| 113 | ), | 114 | ), |
| 114 | - ) | ||
| 115 | - | ||
| 116 | - ), | 115 | + )), |
| 117 | // Text( | 116 | // Text( |
| 118 | // table.name, | 117 | // table.name, |
| 119 | // maxLines: 2, | 118 | // maxLines: 2, |
| @@ -66,7 +66,7 @@ class ExceptionPageState extends State<ExceptionPage> { | @@ -66,7 +66,7 @@ class ExceptionPageState extends State<ExceptionPage> { | ||
| 66 | page = Container( | 66 | page = Container( |
| 67 | width: 0, | 67 | width: 0, |
| 68 | height: 10, | 68 | height: 10, |
| 69 | - color: Colors.blue, | 69 | + color: Colors.white, |
| 70 | ); | 70 | ); |
| 71 | break; | 71 | break; |
| 72 | default: | 72 | default: |
| @@ -144,8 +144,9 @@ class TableItemState extends State<TableItem> { | @@ -144,8 +144,9 @@ class TableItemState extends State<TableItem> { | ||
| 144 | overflow: TextOverflow.ellipsis, | 144 | overflow: TextOverflow.ellipsis, |
| 145 | strutStyle: StrutStyle( | 145 | strutStyle: StrutStyle( |
| 146 | forceStrutHeight: true, | 146 | forceStrutHeight: true, |
| 147 | - height: 1, | ||
| 148 | - leading: 0.2), | 147 | + height: ScreenUtil().setWidth(2), |
| 148 | + // leading: ScreenUtil().setWidth(0.4) | ||
| 149 | + ), | ||
| 149 | ), | 150 | ), |
| 150 | ) | 151 | ) |
| 151 | // Text( | 152 | // Text( |
-
Please register or login to post a comment