Showing
9 changed files
with
572 additions
and
328 deletions
| @@ -11,14 +11,14 @@ if (flutterRoot == null) { | @@ -11,14 +11,14 @@ 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 = "135" | 14 | +def flutterVersionCode = "141" |
| 15 | if (flutterVersionCode == null) { | 15 | if (flutterVersionCode == null) { |
| 16 | - flutterVersionCode = '135' | 16 | + flutterVersionCode = '141' |
| 17 | } | 17 | } |
| 18 | 18 | ||
| 19 | -def flutterVersionName = "1.3.5" | 19 | +def flutterVersionName = "1.4.1" |
| 20 | if (flutterVersionName == null) { | 20 | if (flutterVersionName == null) { |
| 21 | - flutterVersionName = '1.3.5' | 21 | + flutterVersionName = '1.4.1' |
| 22 | } | 22 | } |
| 23 | 23 | ||
| 24 | apply plugin: 'com.android.application' | 24 | apply plugin: 'com.android.application' |
assets/icon_refuse_book.png
0 → 100644
2.2 KB
| @@ -406,7 +406,7 @@ | @@ -406,7 +406,7 @@ | ||
| 406 | CODE_SIGN_ENTITLEMENTS = Runner/RunnerProfile.entitlements; | 406 | CODE_SIGN_ENTITLEMENTS = Runner/RunnerProfile.entitlements; |
| 407 | CODE_SIGN_IDENTITY = "Apple Development"; | 407 | CODE_SIGN_IDENTITY = "Apple Development"; |
| 408 | CODE_SIGN_STYLE = Automatic; | 408 | CODE_SIGN_STYLE = Automatic; |
| 409 | - CURRENT_PROJECT_VERSION = 134; | 409 | + CURRENT_PROJECT_VERSION = 136; |
| 410 | DEVELOPMENT_TEAM = 8J59HM8B82; | 410 | DEVELOPMENT_TEAM = 8J59HM8B82; |
| 411 | ENABLE_BITCODE = NO; | 411 | ENABLE_BITCODE = NO; |
| 412 | FRAMEWORK_SEARCH_PATHS = ( | 412 | FRAMEWORK_SEARCH_PATHS = ( |
| @@ -419,7 +419,7 @@ | @@ -419,7 +419,7 @@ | ||
| 419 | "$(inherited)", | 419 | "$(inherited)", |
| 420 | "$(PROJECT_DIR)/Flutter", | 420 | "$(PROJECT_DIR)/Flutter", |
| 421 | ); | 421 | ); |
| 422 | - MARKETING_VERSION = 1.3.4; | 422 | + MARKETING_VERSION = 1.3.6; |
| 423 | PRODUCT_BUNDLE_IDENTIFIER = com.naji.reserveLine; | 423 | PRODUCT_BUNDLE_IDENTIFIER = com.naji.reserveLine; |
| 424 | PRODUCT_NAME = "一键订"; | 424 | PRODUCT_NAME = "一键订"; |
| 425 | PROVISIONING_PROFILE_SPECIFIER = ""; | 425 | PROVISIONING_PROFILE_SPECIFIER = ""; |
| @@ -548,7 +548,7 @@ | @@ -548,7 +548,7 @@ | ||
| 548 | CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; | 548 | CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; |
| 549 | CODE_SIGN_IDENTITY = "Apple Development"; | 549 | CODE_SIGN_IDENTITY = "Apple Development"; |
| 550 | CODE_SIGN_STYLE = Automatic; | 550 | CODE_SIGN_STYLE = Automatic; |
| 551 | - CURRENT_PROJECT_VERSION = 134; | 551 | + CURRENT_PROJECT_VERSION = 136; |
| 552 | DEVELOPMENT_TEAM = 8J59HM8B82; | 552 | DEVELOPMENT_TEAM = 8J59HM8B82; |
| 553 | ENABLE_BITCODE = NO; | 553 | ENABLE_BITCODE = NO; |
| 554 | FRAMEWORK_SEARCH_PATHS = ( | 554 | FRAMEWORK_SEARCH_PATHS = ( |
| @@ -561,7 +561,7 @@ | @@ -561,7 +561,7 @@ | ||
| 561 | "$(inherited)", | 561 | "$(inherited)", |
| 562 | "$(PROJECT_DIR)/Flutter", | 562 | "$(PROJECT_DIR)/Flutter", |
| 563 | ); | 563 | ); |
| 564 | - MARKETING_VERSION = 1.3.4; | 564 | + MARKETING_VERSION = 1.3.6; |
| 565 | PRODUCT_BUNDLE_IDENTIFIER = com.naji.reserveLine; | 565 | PRODUCT_BUNDLE_IDENTIFIER = com.naji.reserveLine; |
| 566 | PRODUCT_NAME = "一键订"; | 566 | PRODUCT_NAME = "一键订"; |
| 567 | PROVISIONING_PROFILE_SPECIFIER = ""; | 567 | PROVISIONING_PROFILE_SPECIFIER = ""; |
| @@ -581,7 +581,7 @@ | @@ -581,7 +581,7 @@ | ||
| 581 | CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; | 581 | CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; |
| 582 | CODE_SIGN_IDENTITY = "Apple Development"; | 582 | CODE_SIGN_IDENTITY = "Apple Development"; |
| 583 | CODE_SIGN_STYLE = Automatic; | 583 | CODE_SIGN_STYLE = Automatic; |
| 584 | - CURRENT_PROJECT_VERSION = 134; | 584 | + CURRENT_PROJECT_VERSION = 136; |
| 585 | DEVELOPMENT_TEAM = 8J59HM8B82; | 585 | DEVELOPMENT_TEAM = 8J59HM8B82; |
| 586 | ENABLE_BITCODE = NO; | 586 | ENABLE_BITCODE = NO; |
| 587 | FRAMEWORK_SEARCH_PATHS = ( | 587 | FRAMEWORK_SEARCH_PATHS = ( |
| @@ -594,7 +594,7 @@ | @@ -594,7 +594,7 @@ | ||
| 594 | "$(inherited)", | 594 | "$(inherited)", |
| 595 | "$(PROJECT_DIR)/Flutter", | 595 | "$(PROJECT_DIR)/Flutter", |
| 596 | ); | 596 | ); |
| 597 | - MARKETING_VERSION = 1.3.4; | 597 | + MARKETING_VERSION = 1.3.6; |
| 598 | PRODUCT_BUNDLE_IDENTIFIER = com.naji.reserveLine; | 598 | PRODUCT_BUNDLE_IDENTIFIER = com.naji.reserveLine; |
| 599 | PRODUCT_NAME = "一键订"; | 599 | PRODUCT_NAME = "一键订"; |
| 600 | PROVISIONING_PROFILE_SPECIFIER = ""; | 600 | PROVISIONING_PROFILE_SPECIFIER = ""; |
| @@ -104,6 +104,14 @@ class NotebookDetail { | @@ -104,6 +104,14 @@ class NotebookDetail { | ||
| 104 | } | 104 | } |
| 105 | } | 105 | } |
| 106 | 106 | ||
| 107 | + String get demandStr{ | ||
| 108 | + String demand=""; | ||
| 109 | + for(t.Table table in demands){ | ||
| 110 | + demand+=table.name+","; | ||
| 111 | + } | ||
| 112 | + return demand.substring(0,demand.length-1); | ||
| 113 | + } | ||
| 114 | + | ||
| 107 | String get ddateMd { | 115 | String get ddateMd { |
| 108 | DateTime dateTime = | 116 | DateTime dateTime = |
| 109 | DateTime.fromMillisecondsSinceEpoch(int.parse(ddate) * 1000); | 117 | DateTime.fromMillisecondsSinceEpoch(int.parse(ddate) * 1000); |
| @@ -14,6 +14,7 @@ import 'package:one_key/utils/utils.dart'; | @@ -14,6 +14,7 @@ import 'package:one_key/utils/utils.dart'; | ||
| 14 | import 'package:one_key/widgets/MyDivider.dart'; | 14 | import 'package:one_key/widgets/MyDivider.dart'; |
| 15 | import 'package:one_key/widgets/app_bar.dart'; | 15 | import 'package:one_key/widgets/app_bar.dart'; |
| 16 | import 'package:one_key/widgets/common_button.dart'; | 16 | import 'package:one_key/widgets/common_button.dart'; |
| 17 | +import 'package:one_key/widgets/h_empty_view.dart'; | ||
| 17 | import 'package:one_key/widgets/need_item.dart'; | 18 | import 'package:one_key/widgets/need_item.dart'; |
| 18 | import 'package:one_key/widgets/page_exception.dart'; | 19 | import 'package:one_key/widgets/page_exception.dart'; |
| 19 | import 'package:one_key/widgets/row_multi_text.dart'; | 20 | import 'package:one_key/widgets/row_multi_text.dart'; |
| @@ -54,6 +55,10 @@ class HandleOnlinePageState extends State<HandleOnlinePage> { | @@ -54,6 +55,10 @@ class HandleOnlinePageState extends State<HandleOnlinePage> { | ||
| 54 | 55 | ||
| 55 | String formatPhone = ""; //格式客户号码 | 56 | String formatPhone = ""; //格式客户号码 |
| 56 | 57 | ||
| 58 | + bool isRefused = false; //是否已拒绝 | ||
| 59 | + bool isPause = false; //是否暂停预订 | ||
| 60 | + StateSetter refuseDialogState; //决绝弹框setState | ||
| 61 | + | ||
| 57 | @override | 62 | @override |
| 58 | void initState() { | 63 | void initState() { |
| 59 | // TODO: implement initState | 64 | // TODO: implement initState |
| @@ -86,7 +91,7 @@ class HandleOnlinePageState extends State<HandleOnlinePage> { | @@ -86,7 +91,7 @@ class HandleOnlinePageState extends State<HandleOnlinePage> { | ||
| 86 | } | 91 | } |
| 87 | } | 92 | } |
| 88 | }); | 93 | }); |
| 89 | - if (detailEntity.status != "0") { | 94 | + if (detailEntity.status != "0" && !isPause) { |
| 90 | //已处理 | 95 | //已处理 |
| 91 | Future.delayed(Duration(milliseconds: 200), () { | 96 | Future.delayed(Duration(milliseconds: 200), () { |
| 92 | NavigatorUtil.goNotebookDetailPage(context, detailEntity.id, | 97 | NavigatorUtil.goNotebookDetailPage(context, detailEntity.id, |
| @@ -112,54 +117,216 @@ class HandleOnlinePageState extends State<HandleOnlinePage> { | @@ -112,54 +117,216 @@ class HandleOnlinePageState extends State<HandleOnlinePage> { | ||
| 112 | } | 117 | } |
| 113 | 118 | ||
| 114 | //拒绝订单弹框 | 119 | //拒绝订单弹框 |
| 115 | - _showRefuseDialog() { | ||
| 116 | - showDialog( | ||
| 117 | - context: context, | ||
| 118 | - builder: (context) { | ||
| 119 | - return AlertDialog( | ||
| 120 | - title: Text("确定拒绝订单吗?\n拒绝后无法联系客户"), | ||
| 121 | - titleTextStyle: TextStyle( | ||
| 122 | - color: MyColours.color_353535, | ||
| 123 | - fontSize: ScreenUtil().setSp(32)), | ||
| 124 | - content: Text("如果包间类型订满,请及时停用"), | ||
| 125 | - contentTextStyle: TextStyle( | ||
| 126 | - color: MyColours.color_828282, | ||
| 127 | - fontSize: ScreenUtil().setSp(28)), | ||
| 128 | - actions: <Widget>[ | ||
| 129 | - FlatButton( | ||
| 130 | - child: Text( | ||
| 131 | - "拒绝订单", | ||
| 132 | - style: TextStyle(fontSize: ScreenUtil().setSp(32)), | 120 | + _showRefuseDialog2() { |
| 121 | + Widget dialogContent = StatefulBuilder( | ||
| 122 | + builder: (context, setState) { | ||
| 123 | + refuseDialogState = setState; | ||
| 124 | + Container container = Container( | ||
| 125 | + child: Stack( | ||
| 126 | + alignment: AlignmentDirectional.topCenter, | ||
| 127 | + children: [ | ||
| 128 | + Positioned( | ||
| 129 | + right: 0, | ||
| 130 | + top: ScreenUtil().setWidth(6), | ||
| 131 | + child: GestureDetector( | ||
| 132 | + child: Container( | ||
| 133 | + padding: EdgeInsets.all(ScreenUtil().setWidth(21)), | ||
| 134 | + child: Image.asset( | ||
| 135 | + "assets/close.png", | ||
| 136 | + width: ScreenUtil().setWidth(28), | ||
| 137 | + height: ScreenUtil().setWidth(28), | ||
| 138 | + ), | ||
| 139 | + ), | ||
| 140 | + onTap: () { | ||
| 141 | + Navigator.of(context).pop(); | ||
| 142 | + }, | ||
| 133 | ), | 143 | ), |
| 134 | - onPressed: () { | ||
| 135 | - Navigator.of(context).pop(); | ||
| 136 | - setReserveStatus("6"); | ||
| 137 | - }, | ||
| 138 | ), | 144 | ), |
| 139 | - FlatButton( | ||
| 140 | - child: Text( | ||
| 141 | - "去安排", | ||
| 142 | - style: TextStyle(fontSize: ScreenUtil().setSp(32)), | 145 | + Offstage( |
| 146 | + offstage: isRefused, | ||
| 147 | + child: Column( | ||
| 148 | + mainAxisSize: MainAxisSize.min, | ||
| 149 | + children: [ | ||
| 150 | + VEmptyView(40), | ||
| 151 | + Text( | ||
| 152 | + "拒绝订单", | ||
| 153 | + style: TextStyle( | ||
| 154 | + fontSize: ScreenUtil().setSp(32), | ||
| 155 | + color: MyColours.color_353535, | ||
| 156 | + fontWeight: FontWeight.bold), | ||
| 157 | + ), | ||
| 158 | + VEmptyView(60), | ||
| 159 | + Text( | ||
| 160 | + "确定要拒绝订单吗?一旦拒绝无法恢复。", | ||
| 161 | + style: TextStyle( | ||
| 162 | + fontSize: ScreenUtil().setSp(32), | ||
| 163 | + color: MyColours.color_353535), | ||
| 164 | + ), | ||
| 165 | + VEmptyView(80), | ||
| 166 | + GestureDetector( | ||
| 167 | + onTap: () { | ||
| 168 | + setReserveStatus("6", ac: "1"); | ||
| 169 | + }, | ||
| 170 | + child: Container( | ||
| 171 | + width: ScreenUtil().setWidth(336), | ||
| 172 | + height: ScreenUtil().setWidth(80), | ||
| 173 | + alignment: Alignment.center, | ||
| 174 | + color: MyColours.color_199095, | ||
| 175 | + child: Text( | ||
| 176 | + "拒绝并暂停预订", | ||
| 177 | + style: TextStyle( | ||
| 178 | + fontSize: ScreenUtil().setSp(34), | ||
| 179 | + color: MyColours.color_ffffff), | ||
| 180 | + ), | ||
| 181 | + ), | ||
| 182 | + ), | ||
| 183 | + VEmptyView(20), | ||
| 184 | + GestureDetector( | ||
| 185 | + onTap: () { | ||
| 186 | + Navigator.of(context).pop(); | ||
| 187 | + setReserveStatus("6"); | ||
| 188 | + }, | ||
| 189 | + child: Container( | ||
| 190 | + width: ScreenUtil().setWidth(336), | ||
| 191 | + height: ScreenUtil().setWidth(80), | ||
| 192 | + alignment: Alignment.center, | ||
| 193 | + decoration: BoxDecoration( | ||
| 194 | + color: MyColours.color_ffffff, | ||
| 195 | + border: Border.all( | ||
| 196 | + color: MyColours.color_199095, | ||
| 197 | + width: ScreenUtil().setWidth(2))), | ||
| 198 | + child: Text( | ||
| 199 | + "直接拒绝", | ||
| 200 | + style: TextStyle( | ||
| 201 | + fontSize: ScreenUtil().setSp(34), | ||
| 202 | + color: MyColours.color_199095), | ||
| 203 | + ), | ||
| 204 | + ), | ||
| 205 | + ), | ||
| 206 | + VEmptyView(20), | ||
| 207 | + GestureDetector( | ||
| 208 | + onTap: () async { | ||
| 209 | + Navigator.of(context).pop(); | ||
| 210 | + Map temp = await NavigatorUtil.goSelectTablePage( | ||
| 211 | + context, | ||
| 212 | + widget.rid, | ||
| 213 | + int.parse(detailEntity.ddate) * 1000, | ||
| 214 | + detailEntity.ddate_solt); | ||
| 215 | + if (temp != null && temp['tid'] != null) { | ||
| 216 | + setReserveStatus("5", tid: temp['tid']); | ||
| 217 | + } | ||
| 218 | + }, | ||
| 219 | + child: Container( | ||
| 220 | + width: ScreenUtil().setWidth(336), | ||
| 221 | + height: ScreenUtil().setWidth(80), | ||
| 222 | + alignment: Alignment.center, | ||
| 223 | + color: MyColours.color_ffffff, | ||
| 224 | + child: Text( | ||
| 225 | + "去安排包间", | ||
| 226 | + style: TextStyle( | ||
| 227 | + fontSize: ScreenUtil().setSp(34), | ||
| 228 | + color: MyColours.color_199095), | ||
| 229 | + ), | ||
| 230 | + ), | ||
| 231 | + ), | ||
| 232 | + VEmptyView(44), | ||
| 233 | + ], | ||
| 234 | + ), | ||
| 235 | + ), | ||
| 236 | + Offstage( | ||
| 237 | + offstage: !isRefused, | ||
| 238 | + child: Column( | ||
| 239 | + mainAxisSize: MainAxisSize.min, | ||
| 240 | + children: [ | ||
| 241 | + VEmptyView(98), | ||
| 242 | + Row( | ||
| 243 | + mainAxisSize: MainAxisSize.min, | ||
| 244 | + crossAxisAlignment: CrossAxisAlignment.center, | ||
| 245 | + children: [ | ||
| 246 | + Image.asset( | ||
| 247 | + "assets/icon_refuse_book.png", | ||
| 248 | + width: ScreenUtil().setWidth(56), | ||
| 249 | + height: ScreenUtil().setWidth(56), | ||
| 250 | + ), | ||
| 251 | + HEmptyView(10), | ||
| 252 | + Text( | ||
| 253 | + "订单已拒绝", | ||
| 254 | + style: TextStyle( | ||
| 255 | + fontSize: ScreenUtil().setSp(34), | ||
| 256 | + color: MyColours.color_353535), | ||
| 257 | + ) | ||
| 258 | + ], | ||
| 259 | + ), | ||
| 260 | + Offstage( | ||
| 261 | + offstage: !isPause, | ||
| 262 | + child: Column( | ||
| 263 | + mainAxisSize: MainAxisSize.min, | ||
| 264 | + children: [ | ||
| 265 | + VEmptyView(20), | ||
| 266 | + Text( | ||
| 267 | + "并已将${detailEntity.ddateMd}的${detailEntity.demandStr}置满", | ||
| 268 | + style: TextStyle( | ||
| 269 | + fontSize: ScreenUtil().setSp(34), | ||
| 270 | + color: MyColours.color_353535), | ||
| 271 | + ), | ||
| 272 | + ], | ||
| 273 | + ), | ||
| 274 | + ), | ||
| 275 | + VEmptyView(120), | ||
| 276 | + Text( | ||
| 277 | + "如果有包间空出来或其他包间也满了,你可以:", | ||
| 278 | + style: TextStyle( | ||
| 279 | + fontSize: ScreenUtil().setSp(26), | ||
| 280 | + color: MyColours.color_353535), | ||
| 281 | + ), | ||
| 282 | + VEmptyView(20), | ||
| 283 | + GestureDetector( | ||
| 284 | + onTap: () { | ||
| 285 | + Utils.goMiniProgramZm(context, "roomtype/roomtype"); | ||
| 286 | + }, | ||
| 287 | + child: Container( | ||
| 288 | + width: ScreenUtil().setWidth(336), | ||
| 289 | + height: ScreenUtil().setWidth(80), | ||
| 290 | + alignment: Alignment.center, | ||
| 291 | + color: MyColours.color_199095, | ||
| 292 | + child: Text( | ||
| 293 | + "去管理包间", | ||
| 294 | + style: TextStyle( | ||
| 295 | + fontSize: ScreenUtil().setSp(34), | ||
| 296 | + color: MyColours.color_ffffff), | ||
| 297 | + ), | ||
| 298 | + ), | ||
| 299 | + ), | ||
| 300 | + VEmptyView(60) | ||
| 301 | + ], | ||
| 143 | ), | 302 | ), |
| 144 | - onPressed: () async { | ||
| 145 | - Navigator.of(context).pop(); | ||
| 146 | - Map temp = await NavigatorUtil.goSelectTablePage( | ||
| 147 | - context, | ||
| 148 | - widget.rid, | ||
| 149 | - int.parse(detailEntity.ddate) * 1000, | ||
| 150 | - detailEntity.ddate_solt); | ||
| 151 | - if (temp != null && temp['tid'] != null) { | ||
| 152 | - setReserveStatus("5", tid: temp['tid']); | ||
| 153 | - } | ||
| 154 | - }, | ||
| 155 | ) | 303 | ) |
| 156 | ], | 304 | ], |
| 305 | + ), | ||
| 306 | + ); | ||
| 307 | + return container; | ||
| 308 | + }, | ||
| 309 | + ); | ||
| 310 | + Widget dialog = Container( | ||
| 311 | + width: double.infinity, | ||
| 312 | + decoration: BoxDecoration( | ||
| 313 | + color: MyColours.color_ffffff, | ||
| 314 | + borderRadius: BorderRadius.only( | ||
| 315 | + topLeft: Radius.circular(ScreenUtil().setWidth(40)), | ||
| 316 | + topRight: Radius.circular(ScreenUtil().setWidth(40)))), | ||
| 317 | + child: dialogContent); | ||
| 318 | + showModalBottomSheet( | ||
| 319 | + context: context, | ||
| 320 | + backgroundColor: Colors.transparent, | ||
| 321 | + builder: (context) { | ||
| 322 | + return Stack( | ||
| 323 | + children: <Widget>[dialog], | ||
| 157 | ); | 324 | ); |
| 158 | }); | 325 | }); |
| 159 | } | 326 | } |
| 160 | 327 | ||
| 161 | //处理在线预订 | 328 | //处理在线预订 |
| 162 | - setReserveStatus(String status, {String tid = ""}) async { | 329 | + setReserveStatus(String status, {String tid = "", String ac = ""}) async { |
| 163 | bus.emit("remove_untreated_message", widget.mid); | 330 | bus.emit("remove_untreated_message", widget.mid); |
| 164 | UserModel userModel = Provider.of<UserModel>(context, listen: false); | 331 | UserModel userModel = Provider.of<UserModel>(context, listen: false); |
| 165 | Map<String, String> causeMap = { | 332 | Map<String, String> causeMap = { |
| @@ -174,10 +341,21 @@ class HandleOnlinePageState extends State<HandleOnlinePage> { | @@ -174,10 +341,21 @@ class HandleOnlinePageState extends State<HandleOnlinePage> { | ||
| 174 | "mid": widget.mid, | 341 | "mid": widget.mid, |
| 175 | "cause": json.encode(causeMap) | 342 | "cause": json.encode(causeMap) |
| 176 | }; | 343 | }; |
| 177 | - bool success = | ||
| 178 | - await detailModel.setReserveStatus(context, params, showLoading: true); | 344 | + if (status == "6") { |
| 345 | + isPause = true; | ||
| 346 | + params['ac'] = ac; //0=直接拒绝 1=拒绝并暂停预订 | ||
| 347 | + } | ||
| 348 | + bool success = await detailModel.setReserveStatus(context, params, | ||
| 349 | + ifPush: (isPause ? false : true), showLoading: true); | ||
| 179 | if (success != null && success) { | 350 | if (success != null && success) { |
| 180 | bus.emit("refresh_book_list"); | 351 | bus.emit("refresh_book_list"); |
| 352 | + if (status == "6") { | ||
| 353 | + isRefused = true; | ||
| 354 | + } | ||
| 355 | + if (isPause) { | ||
| 356 | + _getOrderListData(); | ||
| 357 | + refuseDialogState(() {}); | ||
| 358 | + } | ||
| 181 | } | 359 | } |
| 182 | } | 360 | } |
| 183 | 361 | ||
| @@ -373,108 +551,119 @@ class HandleOnlinePageState extends State<HandleOnlinePage> { | @@ -373,108 +551,119 @@ class HandleOnlinePageState extends State<HandleOnlinePage> { | ||
| 373 | )), | 551 | )), |
| 374 | ), | 552 | ), |
| 375 | ), | 553 | ), |
| 376 | - Container( | ||
| 377 | - margin: EdgeInsets.only( | ||
| 378 | - top: ScreenUtil().setHeight(30), | ||
| 379 | - bottom: ScreenUtil().setHeight(30)), | ||
| 380 | - child: Column( | ||
| 381 | - children: <Widget>[ | ||
| 382 | - CommonButton( | ||
| 383 | - content: "安排包间", | ||
| 384 | - width: 669, | ||
| 385 | - height: 84, | ||
| 386 | - fontSize: 34, | ||
| 387 | - onPress: () async { | ||
| 388 | - Map map = await NavigatorUtil | ||
| 389 | - .goSelectTablePage( | ||
| 390 | - context, | ||
| 391 | - widget.rid, | ||
| 392 | - int.parse(detailEntity.ddate) * | ||
| 393 | - 1000, | ||
| 394 | - detailEntity.ddate_solt); | ||
| 395 | - if (map != null && map['tid'] != null) { | ||
| 396 | - setReserveStatus("5", | ||
| 397 | - tid: map['tid']); | ||
| 398 | - } | ||
| 399 | - }, | ||
| 400 | - ), | ||
| 401 | - VEmptyView(20), | ||
| 402 | - Container( | ||
| 403 | - width: ScreenUtil().setWidth(669), | ||
| 404 | - height: ScreenUtil().setWidth(84), | ||
| 405 | - decoration: BoxDecoration( | ||
| 406 | - border: Border.all( | ||
| 407 | - color: MyColours.color_199095), | ||
| 408 | - borderRadius: BorderRadius.circular( | ||
| 409 | - ScreenUtil().setWidth(10)), | 554 | + Offstage( |
| 555 | + offstage: detailEntity.status != "0", | ||
| 556 | + child: Container( | ||
| 557 | + margin: EdgeInsets.only( | ||
| 558 | + top: ScreenUtil().setHeight(30), | ||
| 559 | + bottom: ScreenUtil().setHeight(30)), | ||
| 560 | + child: Column( | ||
| 561 | + children: <Widget>[ | ||
| 562 | + CommonButton( | ||
| 563 | + content: "安排包间", | ||
| 564 | + width: 669, | ||
| 565 | + height: 84, | ||
| 566 | + fontSize: 34, | ||
| 567 | + onPress: () async { | ||
| 568 | + Map map = await NavigatorUtil | ||
| 569 | + .goSelectTablePage( | ||
| 570 | + context, | ||
| 571 | + widget.rid, | ||
| 572 | + int.parse( | ||
| 573 | + detailEntity.ddate) * | ||
| 574 | + 1000, | ||
| 575 | + detailEntity.ddate_solt); | ||
| 576 | + if (map != null && | ||
| 577 | + map['tid'] != null) { | ||
| 578 | + setReserveStatus("5", | ||
| 579 | + tid: map['tid']); | ||
| 580 | + } | ||
| 581 | + }, | ||
| 410 | ), | 582 | ), |
| 411 | - child: Row( | ||
| 412 | - crossAxisAlignment: | ||
| 413 | - CrossAxisAlignment.center, | ||
| 414 | - children: <Widget>[ | ||
| 415 | - Expanded( | ||
| 416 | - child: GestureDetector( | ||
| 417 | - child: Center( | ||
| 418 | - child: Text( | ||
| 419 | - "拒绝订单", | ||
| 420 | - style: TextStyle( | ||
| 421 | - color: | ||
| 422 | - MyColours.color_199095, | ||
| 423 | - fontSize: | ||
| 424 | - ScreenUtil().setSp(34)), | 583 | + VEmptyView(20), |
| 584 | + Container( | ||
| 585 | + width: ScreenUtil().setWidth(669), | ||
| 586 | + height: ScreenUtil().setWidth(84), | ||
| 587 | + decoration: BoxDecoration( | ||
| 588 | + border: Border.all( | ||
| 589 | + color: MyColours.color_199095), | ||
| 590 | + borderRadius: BorderRadius.circular( | ||
| 591 | + ScreenUtil().setWidth(10)), | ||
| 592 | + ), | ||
| 593 | + child: Row( | ||
| 594 | + crossAxisAlignment: | ||
| 595 | + CrossAxisAlignment.center, | ||
| 596 | + children: <Widget>[ | ||
| 597 | + Expanded( | ||
| 598 | + child: GestureDetector( | ||
| 599 | + child: Center( | ||
| 600 | + child: Text( | ||
| 601 | + "拒绝订单", | ||
| 602 | + style: TextStyle( | ||
| 603 | + color: MyColours | ||
| 604 | + .color_199095, | ||
| 605 | + fontSize: ScreenUtil() | ||
| 606 | + .setSp(34)), | ||
| 607 | + ), | ||
| 425 | ), | 608 | ), |
| 426 | - ), | ||
| 427 | - onTap: () { | ||
| 428 | - _showRefuseDialog(); | ||
| 429 | - }, | ||
| 430 | - )), | ||
| 431 | - Offstage( | ||
| 432 | - offstage: !isCallTel, | ||
| 433 | - child: SizedBox( | ||
| 434 | - width: ScreenUtil().setWidth(335), | ||
| 435 | - height: ScreenUtil().setWidth(84), | ||
| 436 | - child: Row( | ||
| 437 | - children: [ | ||
| 438 | - MyDivider( | ||
| 439 | - ScreenUtil().setWidth(2), | ||
| 440 | - ScreenUtil().setHeight(52), | ||
| 441 | - color: | ||
| 442 | - MyColours.color_199095, | ||
| 443 | - ), | ||
| 444 | - Expanded( | ||
| 445 | - child: GestureDetector( | ||
| 446 | - child: Center( | ||
| 447 | - child: Text( | ||
| 448 | - "联系顾客", | ||
| 449 | - style: TextStyle( | ||
| 450 | - color: MyColours | ||
| 451 | - .color_199095, | ||
| 452 | - fontSize: | ||
| 453 | - ScreenUtil() | ||
| 454 | - .setSp(34)), | ||
| 455 | - ), | 609 | + onTap: () { |
| 610 | + _showRefuseDialog2(); | ||
| 611 | + }, | ||
| 612 | + )), | ||
| 613 | + Offstage( | ||
| 614 | + offstage: !isCallTel, | ||
| 615 | + child: SizedBox( | ||
| 616 | + width: | ||
| 617 | + ScreenUtil().setWidth(335), | ||
| 618 | + height: | ||
| 619 | + ScreenUtil().setWidth(84), | ||
| 620 | + child: Row( | ||
| 621 | + children: [ | ||
| 622 | + MyDivider( | ||
| 623 | + ScreenUtil().setWidth(2), | ||
| 624 | + ScreenUtil() | ||
| 625 | + .setHeight(52), | ||
| 626 | + color: MyColours | ||
| 627 | + .color_199095, | ||
| 456 | ), | 628 | ), |
| 457 | - onTap: () { | ||
| 458 | - if (detailEntity.phone != | ||
| 459 | - null && | ||
| 460 | - detailEntity.phone | ||
| 461 | - .isNotEmpty) { | ||
| 462 | - Utils.goPhone( | ||
| 463 | - detailEntity.phone); | ||
| 464 | - } else { | ||
| 465 | - Utils.showToast( | ||
| 466 | - "没有客户电话!"); | ||
| 467 | - } | ||
| 468 | - }, | ||
| 469 | - )), | ||
| 470 | - ], | 629 | + Expanded( |
| 630 | + child: GestureDetector( | ||
| 631 | + child: Center( | ||
| 632 | + child: Text( | ||
| 633 | + "联系顾客", | ||
| 634 | + style: TextStyle( | ||
| 635 | + color: MyColours | ||
| 636 | + .color_199095, | ||
| 637 | + fontSize: | ||
| 638 | + ScreenUtil() | ||
| 639 | + .setSp( | ||
| 640 | + 34)), | ||
| 641 | + ), | ||
| 642 | + ), | ||
| 643 | + onTap: () { | ||
| 644 | + if (detailEntity | ||
| 645 | + .phone != | ||
| 646 | + null && | ||
| 647 | + detailEntity.phone | ||
| 648 | + .isNotEmpty) { | ||
| 649 | + Utils.goPhone( | ||
| 650 | + detailEntity | ||
| 651 | + .phone); | ||
| 652 | + } else { | ||
| 653 | + Utils.showToast( | ||
| 654 | + "没有客户电话!"); | ||
| 655 | + } | ||
| 656 | + }, | ||
| 657 | + )), | ||
| 658 | + ], | ||
| 659 | + ), | ||
| 471 | ), | 660 | ), |
| 472 | - ), | ||
| 473 | - ) | ||
| 474 | - ], | ||
| 475 | - ), | ||
| 476 | - ) | ||
| 477 | - ], | 661 | + ) |
| 662 | + ], | ||
| 663 | + ), | ||
| 664 | + ) | ||
| 665 | + ], | ||
| 666 | + ), | ||
| 478 | ), | 667 | ), |
| 479 | ) | 668 | ) |
| 480 | ], | 669 | ], |
| @@ -56,6 +56,8 @@ class HomePageState extends State<HomePage> with WidgetsBindingObserver { | @@ -56,6 +56,8 @@ class HomePageState extends State<HomePage> with WidgetsBindingObserver { | ||
| 56 | 56 | ||
| 57 | int xgCount = 1; //注册信鸽次数,最多5次 | 57 | int xgCount = 1; //注册信鸽次数,最多5次 |
| 58 | 58 | ||
| 59 | + DateTime lastBack; | ||
| 60 | + | ||
| 59 | @override | 61 | @override |
| 60 | void initState() { | 62 | void initState() { |
| 61 | // TODO: implement initState | 63 | // TODO: implement initState |
| @@ -302,31 +304,32 @@ class HomePageState extends State<HomePage> with WidgetsBindingObserver { | @@ -302,31 +304,32 @@ class HomePageState extends State<HomePage> with WidgetsBindingObserver { | ||
| 302 | @override | 304 | @override |
| 303 | Widget build(BuildContext context) { | 305 | Widget build(BuildContext context) { |
| 304 | // TODO: implement build | 306 | // TODO: implement build |
| 305 | - return new Scaffold( | ||
| 306 | - bottomNavigationBar: BottomNavigationBar( | ||
| 307 | - iconSize: ScreenUtil().setWidth(48), | ||
| 308 | - unselectedFontSize: ScreenUtil().setSp(22), | ||
| 309 | - selectedFontSize: ScreenUtil().setSp(22), | ||
| 310 | - backgroundColor: MyColours.color_ffffff, | ||
| 311 | - items: [ | ||
| 312 | - BottomNavigationBarItem( | ||
| 313 | - icon: Image( | ||
| 314 | - image: AssetImage("assets/message_default.png"), | ||
| 315 | - width: ScreenUtil().setWidth(48), | ||
| 316 | - height: ScreenUtil().setWidth(48), | ||
| 317 | - ), | ||
| 318 | - activeIcon: Image( | ||
| 319 | - image: AssetImage("assets/message_selected.png"), | ||
| 320 | - width: ScreenUtil().setWidth(48), | ||
| 321 | - height: ScreenUtil().setWidth(48), | ||
| 322 | - ), | ||
| 323 | - title: Text( | ||
| 324 | - "消息中心", | ||
| 325 | - style: TextStyle( | ||
| 326 | - color: _currIndex == 0 ? _activeColor : _defaultColor, | ||
| 327 | - fontSize: ScreenUtil().setSp(22)), | 307 | + return new WillPopScope( |
| 308 | + child: Scaffold( | ||
| 309 | + bottomNavigationBar: BottomNavigationBar( | ||
| 310 | + iconSize: ScreenUtil().setWidth(48), | ||
| 311 | + unselectedFontSize: ScreenUtil().setSp(22), | ||
| 312 | + selectedFontSize: ScreenUtil().setSp(22), | ||
| 313 | + backgroundColor: MyColours.color_ffffff, | ||
| 314 | + items: [ | ||
| 315 | + BottomNavigationBarItem( | ||
| 316 | + icon: Image( | ||
| 317 | + image: AssetImage("assets/message_default.png"), | ||
| 318 | + width: ScreenUtil().setWidth(48), | ||
| 319 | + height: ScreenUtil().setWidth(48), | ||
| 320 | + ), | ||
| 321 | + activeIcon: Image( | ||
| 322 | + image: AssetImage("assets/message_selected.png"), | ||
| 323 | + width: ScreenUtil().setWidth(48), | ||
| 324 | + height: ScreenUtil().setWidth(48), | ||
| 325 | + ), | ||
| 326 | + title: Text( | ||
| 327 | + "消息中心", | ||
| 328 | + style: TextStyle( | ||
| 329 | + color: _currIndex == 0 ? _activeColor : _defaultColor, | ||
| 330 | + fontSize: ScreenUtil().setSp(22)), | ||
| 331 | + ), | ||
| 328 | ), | 332 | ), |
| 329 | - ), | ||
| 330 | // BottomNavigationBarItem( | 333 | // BottomNavigationBarItem( |
| 331 | // icon: Image( | 334 | // icon: Image( |
| 332 | // image: AssetImage("assets/message_default.png"), | 335 | // image: AssetImage("assets/message_default.png"), |
| @@ -345,150 +348,162 @@ class HomePageState extends State<HomePage> with WidgetsBindingObserver { | @@ -345,150 +348,162 @@ class HomePageState extends State<HomePage> with WidgetsBindingObserver { | ||
| 345 | // fontSize: ScreenUtil().setSp(22)), | 348 | // fontSize: ScreenUtil().setSp(22)), |
| 346 | // ), | 349 | // ), |
| 347 | // ), | 350 | // ), |
| 348 | - BottomNavigationBarItem( | ||
| 349 | - icon: Image( | ||
| 350 | - image: AssetImage("assets/notebook_default.png"), | ||
| 351 | - width: ScreenUtil().setWidth(48), | ||
| 352 | - height: ScreenUtil().setWidth(48), | ||
| 353 | - ), | ||
| 354 | - activeIcon: Image( | ||
| 355 | - image: AssetImage("assets/notebook_selected.png"), | ||
| 356 | - width: ScreenUtil().setWidth(48), | ||
| 357 | - height: ScreenUtil().setWidth(48), | ||
| 358 | - ), | ||
| 359 | - title: Text( | ||
| 360 | - "已预订", | ||
| 361 | - style: TextStyle( | ||
| 362 | - color: _currIndex == 1 ? _activeColor : _defaultColor, | ||
| 363 | - fontSize: ScreenUtil().setSp(22)), | ||
| 364 | - ), | ||
| 365 | - ), | ||
| 366 | - BottomNavigationBarItem( | ||
| 367 | - icon: Image( | ||
| 368 | - image: AssetImage("assets/tablemanage_default.png"), | ||
| 369 | - width: ScreenUtil().setWidth(48), | ||
| 370 | - height: ScreenUtil().setWidth(48), | 351 | + BottomNavigationBarItem( |
| 352 | + icon: Image( | ||
| 353 | + image: AssetImage("assets/notebook_default.png"), | ||
| 354 | + width: ScreenUtil().setWidth(48), | ||
| 355 | + height: ScreenUtil().setWidth(48), | ||
| 356 | + ), | ||
| 357 | + activeIcon: Image( | ||
| 358 | + image: AssetImage("assets/notebook_selected.png"), | ||
| 359 | + width: ScreenUtil().setWidth(48), | ||
| 360 | + height: ScreenUtil().setWidth(48), | ||
| 361 | + ), | ||
| 362 | + title: Text( | ||
| 363 | + "已预订", | ||
| 364 | + style: TextStyle( | ||
| 365 | + color: _currIndex == 1 ? _activeColor : _defaultColor, | ||
| 366 | + fontSize: ScreenUtil().setSp(22)), | ||
| 367 | + ), | ||
| 371 | ), | 368 | ), |
| 372 | - activeIcon: Image( | ||
| 373 | - image: AssetImage("assets/tablemanage_selected.png"), | ||
| 374 | - width: ScreenUtil().setWidth(48), | ||
| 375 | - height: ScreenUtil().setWidth(48), | 369 | + BottomNavigationBarItem( |
| 370 | + icon: Image( | ||
| 371 | + image: AssetImage("assets/tablemanage_default.png"), | ||
| 372 | + width: ScreenUtil().setWidth(48), | ||
| 373 | + height: ScreenUtil().setWidth(48), | ||
| 374 | + ), | ||
| 375 | + activeIcon: Image( | ||
| 376 | + image: AssetImage("assets/tablemanage_selected.png"), | ||
| 377 | + width: ScreenUtil().setWidth(48), | ||
| 378 | + height: ScreenUtil().setWidth(48), | ||
| 379 | + ), | ||
| 380 | + title: Text( | ||
| 381 | + "桌位", | ||
| 382 | + style: TextStyle( | ||
| 383 | + color: _currIndex == 2 ? _activeColor : _defaultColor, | ||
| 384 | + fontSize: ScreenUtil().setSp(22)), | ||
| 385 | + ), | ||
| 376 | ), | 386 | ), |
| 377 | - title: Text( | ||
| 378 | - "桌位", | ||
| 379 | - style: TextStyle( | ||
| 380 | - color: _currIndex == 2? _activeColor : _defaultColor, | ||
| 381 | - fontSize: ScreenUtil().setSp(22)), | 387 | + BottomNavigationBarItem( |
| 388 | + icon: Image( | ||
| 389 | + image: AssetImage("assets/my_default.png"), | ||
| 390 | + width: ScreenUtil().setWidth(48), | ||
| 391 | + height: ScreenUtil().setWidth(48), | ||
| 392 | + ), | ||
| 393 | + activeIcon: Image( | ||
| 394 | + image: AssetImage("assets/my_selected.png"), | ||
| 395 | + width: ScreenUtil().setWidth(48), | ||
| 396 | + height: ScreenUtil().setWidth(48), | ||
| 397 | + ), | ||
| 398 | + title: Text( | ||
| 399 | + "我的", | ||
| 400 | + style: TextStyle( | ||
| 401 | + color: _currIndex == 3 ? _activeColor : _defaultColor, | ||
| 402 | + fontSize: ScreenUtil().setSp(22)), | ||
| 403 | + ), | ||
| 382 | ), | 404 | ), |
| 383 | - ), | ||
| 384 | - BottomNavigationBarItem( | ||
| 385 | - icon: Image( | ||
| 386 | - image: AssetImage("assets/my_default.png"), | ||
| 387 | - width: ScreenUtil().setWidth(48), | ||
| 388 | - height: ScreenUtil().setWidth(48), | ||
| 389 | - ), | ||
| 390 | - activeIcon: Image( | ||
| 391 | - image: AssetImage("assets/my_selected.png"), | ||
| 392 | - width: ScreenUtil().setWidth(48), | ||
| 393 | - height: ScreenUtil().setWidth(48), | ||
| 394 | - ), | ||
| 395 | - title: Text( | ||
| 396 | - "我的", | ||
| 397 | - style: TextStyle( | ||
| 398 | - color: _currIndex == 3 ? _activeColor : _defaultColor, | ||
| 399 | - fontSize: ScreenUtil().setSp(22)), | ||
| 400 | - ), | ||
| 401 | - ), | ||
| 402 | - ], | ||
| 403 | - type: BottomNavigationBarType.fixed, | ||
| 404 | - currentIndex: _currIndex, | ||
| 405 | - onTap: (int index) { | ||
| 406 | - if (_currIndex != index) { | ||
| 407 | - setState(() { | ||
| 408 | - _currIndex = index; | ||
| 409 | - }); | ||
| 410 | - if (_currIndex == 3) { | ||
| 411 | - Utils.changeStatusColor(color: MyColours.color_199095); | ||
| 412 | - } else { | ||
| 413 | - Utils.changeStatusColor(color: MyColours.color_ffffff); | 405 | + ], |
| 406 | + type: BottomNavigationBarType.fixed, | ||
| 407 | + currentIndex: _currIndex, | ||
| 408 | + onTap: (int index) { | ||
| 409 | + if (_currIndex != index) { | ||
| 410 | + setState(() { | ||
| 411 | + _currIndex = index; | ||
| 412 | + }); | ||
| 413 | + if (_currIndex == 3) { | ||
| 414 | + Utils.changeStatusColor(color: MyColours.color_199095); | ||
| 415 | + } else { | ||
| 416 | + Utils.changeStatusColor(color: MyColours.color_ffffff); | ||
| 417 | + } | ||
| 414 | } | 418 | } |
| 415 | - } | ||
| 416 | - }, | 419 | + }, |
| 420 | + ), | ||
| 421 | + // bottomNavigationBar: BottomAppBar( | ||
| 422 | + // shape: CircularNotchedRectangle(), | ||
| 423 | + // child: Container( | ||
| 424 | + // height: ScreenUtil().setWidth(98), | ||
| 425 | + // // padding: EdgeInsets.fromLTRB(0, 12, 0, 8), | ||
| 426 | + // child: Row( | ||
| 427 | + // mainAxisSize: MainAxisSize.max, | ||
| 428 | + // mainAxisAlignment: MainAxisAlignment.spaceAround, | ||
| 429 | + // crossAxisAlignment: CrossAxisAlignment.center, | ||
| 430 | + // children: <Widget>[ | ||
| 431 | + // GestureDetector( | ||
| 432 | + // onTap: () { | ||
| 433 | + // // onTap(0); | ||
| 434 | + // }, | ||
| 435 | + // child: Column( | ||
| 436 | + // mainAxisSize: MainAxisSize.min, | ||
| 437 | + // children: <Widget>[ | ||
| 438 | + // Image( | ||
| 439 | + // image: AssetImage("assets/my_selected.png"), | ||
| 440 | + // width: ScreenUtil().setWidth(44), | ||
| 441 | + // height: ScreenUtil().setWidth(44), | ||
| 442 | + // ), | ||
| 443 | + // Text( | ||
| 444 | + // "我的", | ||
| 445 | + // style: TextStyle( | ||
| 446 | + // color: _currIndex == 2 | ||
| 447 | + // ? _activeColor | ||
| 448 | + // : _defaultColor, | ||
| 449 | + // fontSize: ScreenUtil().setSp(22)), | ||
| 450 | + // ) | ||
| 451 | + // ], | ||
| 452 | + // )), | ||
| 453 | + // GestureDetector( | ||
| 454 | + // onTap: () { | ||
| 455 | + // // onTap(1); | ||
| 456 | + // }, | ||
| 457 | + // child: Column( | ||
| 458 | + // mainAxisSize: MainAxisSize.min, | ||
| 459 | + // children: <Widget>[ | ||
| 460 | + // Image( | ||
| 461 | + // image: AssetImage("assets/my_selected.png"), | ||
| 462 | + // width: ScreenUtil().setWidth(44), | ||
| 463 | + // height: ScreenUtil().setWidth(44), | ||
| 464 | + // ), | ||
| 465 | + // Text( | ||
| 466 | + // "我的", | ||
| 467 | + // style: TextStyle( | ||
| 468 | + // color: _currIndex == 2 | ||
| 469 | + // ? _activeColor | ||
| 470 | + // : _defaultColor, | ||
| 471 | + // fontSize: ScreenUtil().setSp(22)), | ||
| 472 | + // ) | ||
| 473 | + // ], | ||
| 474 | + // )), | ||
| 475 | + // Column( | ||
| 476 | + // mainAxisSize: MainAxisSize.min, | ||
| 477 | + // children: <Widget>[ | ||
| 478 | + // Image( | ||
| 479 | + // image: AssetImage("assets/my_selected.png"), | ||
| 480 | + // width: ScreenUtil().setWidth(44), | ||
| 481 | + // height: ScreenUtil().setWidth(44), | ||
| 482 | + // ), | ||
| 483 | + // Text( | ||
| 484 | + // "我的", | ||
| 485 | + // style: TextStyle( | ||
| 486 | + // color: | ||
| 487 | + // _currIndex == 2 ? _activeColor : _defaultColor, | ||
| 488 | + // fontSize: ScreenUtil().setSp(22)), | ||
| 489 | + // ) | ||
| 490 | + // ], | ||
| 491 | + // ) | ||
| 492 | + // ])), | ||
| 493 | + // ), | ||
| 494 | + body: pages[_currIndex], | ||
| 417 | ), | 495 | ), |
| 418 | - // bottomNavigationBar: BottomAppBar( | ||
| 419 | - // shape: CircularNotchedRectangle(), | ||
| 420 | - // child: Container( | ||
| 421 | - // height: ScreenUtil().setWidth(98), | ||
| 422 | - // // padding: EdgeInsets.fromLTRB(0, 12, 0, 8), | ||
| 423 | - // child: Row( | ||
| 424 | - // mainAxisSize: MainAxisSize.max, | ||
| 425 | - // mainAxisAlignment: MainAxisAlignment.spaceAround, | ||
| 426 | - // crossAxisAlignment: CrossAxisAlignment.center, | ||
| 427 | - // children: <Widget>[ | ||
| 428 | - // GestureDetector( | ||
| 429 | - // onTap: () { | ||
| 430 | - // // onTap(0); | ||
| 431 | - // }, | ||
| 432 | - // child: Column( | ||
| 433 | - // mainAxisSize: MainAxisSize.min, | ||
| 434 | - // children: <Widget>[ | ||
| 435 | - // Image( | ||
| 436 | - // image: AssetImage("assets/my_selected.png"), | ||
| 437 | - // width: ScreenUtil().setWidth(44), | ||
| 438 | - // height: ScreenUtil().setWidth(44), | ||
| 439 | - // ), | ||
| 440 | - // Text( | ||
| 441 | - // "我的", | ||
| 442 | - // style: TextStyle( | ||
| 443 | - // color: _currIndex == 2 | ||
| 444 | - // ? _activeColor | ||
| 445 | - // : _defaultColor, | ||
| 446 | - // fontSize: ScreenUtil().setSp(22)), | ||
| 447 | - // ) | ||
| 448 | - // ], | ||
| 449 | - // )), | ||
| 450 | - // GestureDetector( | ||
| 451 | - // onTap: () { | ||
| 452 | - // // onTap(1); | ||
| 453 | - // }, | ||
| 454 | - // child: Column( | ||
| 455 | - // mainAxisSize: MainAxisSize.min, | ||
| 456 | - // children: <Widget>[ | ||
| 457 | - // Image( | ||
| 458 | - // image: AssetImage("assets/my_selected.png"), | ||
| 459 | - // width: ScreenUtil().setWidth(44), | ||
| 460 | - // height: ScreenUtil().setWidth(44), | ||
| 461 | - // ), | ||
| 462 | - // Text( | ||
| 463 | - // "我的", | ||
| 464 | - // style: TextStyle( | ||
| 465 | - // color: _currIndex == 2 | ||
| 466 | - // ? _activeColor | ||
| 467 | - // : _defaultColor, | ||
| 468 | - // fontSize: ScreenUtil().setSp(22)), | ||
| 469 | - // ) | ||
| 470 | - // ], | ||
| 471 | - // )), | ||
| 472 | - // Column( | ||
| 473 | - // mainAxisSize: MainAxisSize.min, | ||
| 474 | - // children: <Widget>[ | ||
| 475 | - // Image( | ||
| 476 | - // image: AssetImage("assets/my_selected.png"), | ||
| 477 | - // width: ScreenUtil().setWidth(44), | ||
| 478 | - // height: ScreenUtil().setWidth(44), | ||
| 479 | - // ), | ||
| 480 | - // Text( | ||
| 481 | - // "我的", | ||
| 482 | - // style: TextStyle( | ||
| 483 | - // color: | ||
| 484 | - // _currIndex == 2 ? _activeColor : _defaultColor, | ||
| 485 | - // fontSize: ScreenUtil().setSp(22)), | ||
| 486 | - // ) | ||
| 487 | - // ], | ||
| 488 | - // ) | ||
| 489 | - // ])), | ||
| 490 | - // ), | ||
| 491 | - body: pages[_currIndex], | 496 | + onWillPop: () async { |
| 497 | + if (lastBack != null && | ||
| 498 | + DateTime.now().millisecondsSinceEpoch - | ||
| 499 | + lastBack.millisecondsSinceEpoch <= | ||
| 500 | + 3000) { | ||
| 501 | + return true; | ||
| 502 | + } | ||
| 503 | + lastBack = DateTime.now(); | ||
| 504 | + Utils.showToast("再次返回退出一键订"); | ||
| 505 | + return false; | ||
| 506 | + }, | ||
| 492 | ); | 507 | ); |
| 493 | } | 508 | } |
| 494 | 509 |
| @@ -24,32 +24,58 @@ class MyPage extends StatefulWidget { | @@ -24,32 +24,58 @@ class MyPage extends StatefulWidget { | ||
| 24 | } | 24 | } |
| 25 | } | 25 | } |
| 26 | 26 | ||
| 27 | -class MyPageState extends State<MyPage> { | 27 | +class MyPageState extends State<MyPage> with WidgetsBindingObserver { |
| 28 | String cur_version = ""; | 28 | String cur_version = ""; |
| 29 | bool newVersion = false; | 29 | bool newVersion = false; |
| 30 | - String smsInfo = ""; | 30 | + MyModel myModel; |
| 31 | 31 | ||
| 32 | @override | 32 | @override |
| 33 | void initState() { | 33 | void initState() { |
| 34 | // TODO: implement initState | 34 | // TODO: implement initState |
| 35 | super.initState(); | 35 | super.initState(); |
| 36 | + WidgetsBinding.instance.addObserver(this); | ||
| 36 | Utils.getCurrVersion().then((version) { | 37 | Utils.getCurrVersion().then((version) { |
| 37 | setState(() { | 38 | setState(() { |
| 38 | cur_version = "v" + version; | 39 | cur_version = "v" + version; |
| 39 | }); | 40 | }); |
| 40 | }); | 41 | }); |
| 42 | + WidgetsBinding.instance.addPostFrameCallback((_) async { | ||
| 43 | + ///获取短信余量 | ||
| 44 | + _getSmsInfo(context); | ||
| 45 | + }); | ||
| 46 | + } | ||
| 41 | 47 | ||
| 42 | - ///获取短信余量 | ||
| 43 | - _getSmsInfo(); | 48 | + @override |
| 49 | + void didChangeAppLifecycleState(AppLifecycleState state) async { | ||
| 50 | + // TODO: implement didChangeAppLifecycleState | ||
| 51 | + super.didChangeAppLifecycleState(state); | ||
| 52 | + switch (state) { | ||
| 53 | + case AppLifecycleState.resumed: //应用前台可见 | ||
| 54 | + _getSmsInfo(context); | ||
| 55 | + break; | ||
| 56 | + case AppLifecycleState.inactive: | ||
| 57 | + print('inactive'); | ||
| 58 | + break; | ||
| 59 | + case AppLifecycleState.paused: | ||
| 60 | + print('paused'); | ||
| 61 | + break; | ||
| 62 | + case AppLifecycleState.detached: | ||
| 63 | + print('detached'); | ||
| 64 | + break; | ||
| 65 | + | ||
| 66 | + default: | ||
| 67 | + break; | ||
| 68 | + } | ||
| 44 | } | 69 | } |
| 45 | 70 | ||
| 46 | ///获取短信余量 | 71 | ///获取短信余量 |
| 47 | - _getSmsInfo() async { | ||
| 48 | - MyModel myModel = Provider.of<MyModel>(context, listen: false); | ||
| 49 | - SmsInfoData smsInfoData = await myModel.getSmsInfo(context); | ||
| 50 | - setState(() { | ||
| 51 | - smsInfo = smsInfoData?.lastNum; | ||
| 52 | - }); | 72 | + _getSmsInfo(context) async { |
| 73 | + await myModel.getSmsInfo(context); | ||
| 74 | + // setState(() { | ||
| 75 | + // if (smsInfoData != null) { | ||
| 76 | + // smsInfo = smsInfoData?.lastNum; | ||
| 77 | + // } | ||
| 78 | + // }); | ||
| 53 | } | 79 | } |
| 54 | 80 | ||
| 55 | //检查版本更新 | 81 | //检查版本更新 |
| @@ -60,6 +86,7 @@ class MyPageState extends State<MyPage> { | @@ -60,6 +86,7 @@ class MyPageState extends State<MyPage> { | ||
| 60 | 86 | ||
| 61 | @override | 87 | @override |
| 62 | Widget build(BuildContext context) { | 88 | Widget build(BuildContext context) { |
| 89 | + myModel = Provider.of<MyModel>(context, listen: true); | ||
| 63 | return Stack( | 90 | return Stack( |
| 64 | children: <Widget>[ | 91 | children: <Widget>[ |
| 65 | Padding( | 92 | Padding( |
| @@ -69,9 +96,10 @@ class MyPageState extends State<MyPage> { | @@ -69,9 +96,10 @@ class MyPageState extends State<MyPage> { | ||
| 69 | VEmptyView(40), | 96 | VEmptyView(40), |
| 70 | MyItem( | 97 | MyItem( |
| 71 | title: "短信管理", | 98 | title: "短信管理", |
| 72 | - content: smsInfo.isNotEmpty ? '剩余${smsInfo}条' : '', | 99 | + content: |
| 100 | + myModel.smsInfo.isNotEmpty ? '剩余${myModel.smsInfo}条' : '', | ||
| 73 | callback: () { | 101 | callback: () { |
| 74 | - Utils.goMiniProgramZm(context); | 102 | + Utils.goMiniProgramZm(context, "setting/sms"); |
| 75 | }, | 103 | }, |
| 76 | ), | 104 | ), |
| 77 | MyDivider( | 105 | MyDivider( |
| @@ -83,7 +111,7 @@ class MyPageState extends State<MyPage> { | @@ -83,7 +111,7 @@ class MyPageState extends State<MyPage> { | ||
| 83 | title: "包间类型置满管理", | 111 | title: "包间类型置满管理", |
| 84 | content: "", | 112 | content: "", |
| 85 | callback: () { | 113 | callback: () { |
| 86 | - Utils.goMiniProgramZm(context); | 114 | + Utils.goMiniProgramZm(context, "roomtype/roomtype"); |
| 87 | }, | 115 | }, |
| 88 | ), | 116 | ), |
| 89 | VEmptyView(40), | 117 | VEmptyView(40), |
| @@ -11,6 +11,8 @@ import 'package:one_key/utils/utils.dart'; | @@ -11,6 +11,8 @@ import 'package:one_key/utils/utils.dart'; | ||
| 11 | import 'package:provider/provider.dart'; | 11 | import 'package:provider/provider.dart'; |
| 12 | 12 | ||
| 13 | class MyModel extends ChangeNotifier { | 13 | class MyModel extends ChangeNotifier { |
| 14 | + String smsInfo = ''; | ||
| 15 | + | ||
| 14 | /// 短信余量查询及套餐查询接口 | 16 | /// 短信余量查询及套餐查询接口 |
| 15 | Future<SmsInfoData> getSmsInfo(BuildContext context) async { | 17 | Future<SmsInfoData> getSmsInfo(BuildContext context) async { |
| 16 | UserModel userModel = Provider.of<UserModel>(context, listen: false); | 18 | UserModel userModel = Provider.of<UserModel>(context, listen: false); |
| @@ -31,8 +33,10 @@ class MyModel extends ChangeNotifier { | @@ -31,8 +33,10 @@ class MyModel extends ChangeNotifier { | ||
| 31 | Utils.showToast(smsInfo.msg); | 33 | Utils.showToast(smsInfo.msg); |
| 32 | } | 34 | } |
| 33 | } else { | 35 | } else { |
| 34 | - Utils.showToast('查询失败'); | 36 | + print('查询失败'); |
| 35 | } | 37 | } |
| 38 | + smsInfo = data.lastNum; | ||
| 39 | + notifyListeners(); | ||
| 36 | return data; | 40 | return data; |
| 37 | } catch (error) { | 41 | } catch (error) { |
| 38 | if (error is MyError) { | 42 | if (error is MyError) { |
| @@ -80,12 +80,12 @@ class Utils { | @@ -80,12 +80,12 @@ class Utils { | ||
| 80 | } | 80 | } |
| 81 | 81 | ||
| 82 | //跳转小程序包间类型置满管理 | 82 | //跳转小程序包间类型置满管理 |
| 83 | - static goMiniProgramZm(BuildContext context) { | 83 | + static goMiniProgramZm(BuildContext context, String subPath) { |
| 84 | UserModel model = Provider.of<UserModel>(context, listen: false); | 84 | UserModel model = Provider.of<UserModel>(context, listen: false); |
| 85 | launchWeChatMiniProgram( | 85 | launchWeChatMiniProgram( |
| 86 | username: "gh_487873d353b3", | 86 | username: "gh_487873d353b3", |
| 87 | path: | 87 | path: |
| 88 | - "pack-book/pages/book/b_index?seller_id=${model.user.sellerid}&seller_openid=oGefL4qKBWIh5xwyg3LVfkMbDumA&manager_id=''&goPath=roomtype/roomtype", | 88 | + "pack-book/pages/book/b_index?seller_id=${model.user.sellerid}&seller_openid=seller_openid&manager_id=&goPath=${subPath}", |
| 89 | miniProgramType: WXMiniProgramType.RELEASE); | 89 | miniProgramType: WXMiniProgramType.RELEASE); |
| 90 | } | 90 | } |
| 91 | 91 |
-
Please register or login to post a comment