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