Showing
28 changed files
with
1085 additions
and
403 deletions
| @@ -24,6 +24,13 @@ | @@ -24,6 +24,13 @@ | ||
| 24 | android:windowSoftInputMode="adjustResize" | 24 | android:windowSoftInputMode="adjustResize" |
| 25 | android:exported="true" | 25 | android:exported="true" |
| 26 | > | 26 | > |
| 27 | + <meta-data | ||
| 28 | + android:name="io.flutter.app.android.SplashScreenUntilFirstFrame" | ||
| 29 | + android:value="true" /> | ||
| 30 | + | ||
| 31 | + <meta-data | ||
| 32 | + android:name="io.flutter.embedding.android.SplashScreenDrawable" | ||
| 33 | + android:resource="@drawable/launch_background" /> | ||
| 27 | <intent-filter> | 34 | <intent-filter> |
| 28 | <action android:name="android.intent.action.MAIN"/> | 35 | <action android:name="android.intent.action.MAIN"/> |
| 29 | <category android:name="android.intent.category.LAUNCHER"/> | 36 | <category android:name="android.intent.category.LAUNCHER"/> |
assets/calender_narmol.png
0 → 100644
1.41 KB
assets/calender_select.png
0 → 100644
1.11 KB
assets/close.png
0 → 100644
1.07 KB
assets/more_narmol.png
0 → 100644
1.03 KB
assets/more_select.png
0 → 100644
734 Bytes
assets/select.png
0 → 100644
1.84 KB
assets/unselect.png
0 → 100644
2.07 KB
| @@ -24,6 +24,7 @@ import 'package:flutter/services.dart'; | @@ -24,6 +24,7 @@ import 'package:flutter/services.dart'; | ||
| 24 | 24 | ||
| 25 | Future<void> main() async { | 25 | Future<void> main() async { |
| 26 | FlutterBugly.postCatchedException(() async { | 26 | FlutterBugly.postCatchedException(() async { |
| 27 | + WidgetsFlutterBinding.ensureInitialized(); | ||
| 27 | Router router = Router(); | 28 | Router router = Router(); |
| 28 | Routes.configureRoutes(router); | 29 | Routes.configureRoutes(router); |
| 29 | App.router = router; | 30 | App.router = router; |
| @@ -31,17 +32,22 @@ Future<void> main() async { | @@ -31,17 +32,22 @@ Future<void> main() async { | ||
| 31 | LogUtil.init(isDebug: true, tag: 'ONE_KEY'); | 32 | LogUtil.init(isDebug: true, tag: 'ONE_KEY'); |
| 32 | Provider.debugCheckInvalidValueType = null; | 33 | Provider.debugCheckInvalidValueType = null; |
| 33 | await initializeDateFormatting(); | 34 | await initializeDateFormatting(); |
| 34 | - runApp(MultiProvider( | ||
| 35 | - providers: [ | ||
| 36 | - ChangeNotifierProvider<UserModel>( | ||
| 37 | - create: (_) => UserModel(), | ||
| 38 | - ), | ||
| 39 | - ChangeNotifierProvider<MessageDialogModel>( | ||
| 40 | - create: (_) => MessageDialogModel()..init(), | ||
| 41 | - ), | ||
| 42 | - ], | ||
| 43 | - child: MyApp(), | ||
| 44 | - )); | 35 | + SystemChrome.setPreferredOrientations( |
| 36 | + [DeviceOrientation.portraitUp, DeviceOrientation.portraitDown]) | ||
| 37 | + .then((_) { | ||
| 38 | + runApp(MultiProvider( | ||
| 39 | + providers: [ | ||
| 40 | + ChangeNotifierProvider<UserModel>( | ||
| 41 | + create: (_) => UserModel(), | ||
| 42 | + ), | ||
| 43 | + ChangeNotifierProvider<MessageDialogModel>( | ||
| 44 | + create: (_) => MessageDialogModel()..init(), | ||
| 45 | + ), | ||
| 46 | + ], | ||
| 47 | + child: MyApp(), | ||
| 48 | + )); | ||
| 49 | + }); | ||
| 50 | + | ||
| 45 | FlutterBugly.init(androidAppId: "f71a313f42", iOSAppId: "3089e4587e"); | 51 | FlutterBugly.init(androidAppId: "f71a313f42", iOSAppId: "3089e4587e"); |
| 46 | }); | 52 | }); |
| 47 | } | 53 | } |
lib/models/reserve_info_model.dart
0 → 100644
| 1 | +import 'package:json_annotation/json_annotation.dart'; | ||
| 2 | + | ||
| 3 | +part 'reserve_info_model.g.dart'; | ||
| 4 | + | ||
| 5 | + | ||
| 6 | +@JsonSerializable() | ||
| 7 | + class ReserveInfoModel extends Object { | ||
| 8 | + | ||
| 9 | + @JsonKey(name: 'ret') | ||
| 10 | + int ret; | ||
| 11 | + | ||
| 12 | + @JsonKey(name: 'data') | ||
| 13 | + SunReserveInfoModel data; | ||
| 14 | + | ||
| 15 | + @JsonKey(name: 'msg') | ||
| 16 | + String msg; | ||
| 17 | + | ||
| 18 | + ReserveInfoModel(this.ret,this.data,this.msg,); | ||
| 19 | + | ||
| 20 | + factory ReserveInfoModel.fromJson(Map<String, dynamic> srcJson) => _$ReserveInfoModelFromJson(srcJson); | ||
| 21 | + | ||
| 22 | + Map<String, dynamic> toJson() => _$ReserveInfoModelToJson(this); | ||
| 23 | + | ||
| 24 | +} | ||
| 25 | + | ||
| 26 | + | ||
| 27 | +@JsonSerializable() | ||
| 28 | + class SunReserveInfoModel extends Object { | ||
| 29 | + | ||
| 30 | + @JsonKey(name: 'row') | ||
| 31 | + RowModel row; | ||
| 32 | + | ||
| 33 | + @JsonKey(name: 'list') | ||
| 34 | + List<dynamic> list; | ||
| 35 | + | ||
| 36 | + @JsonKey(name: 'table') | ||
| 37 | + List<dynamic> table; | ||
| 38 | + | ||
| 39 | + SunReserveInfoModel(this.row,this.list,this.table,); | ||
| 40 | + | ||
| 41 | + factory SunReserveInfoModel.fromJson(Map<String, dynamic> srcJson) => _$SunReserveInfoModelFromJson(srcJson); | ||
| 42 | + | ||
| 43 | + Map<String, dynamic> toJson() => _$SunReserveInfoModelToJson(this); | ||
| 44 | + | ||
| 45 | +} | ||
| 46 | + | ||
| 47 | + | ||
| 48 | +@JsonSerializable() | ||
| 49 | + class RowModel extends Object { | ||
| 50 | + | ||
| 51 | + @JsonKey(name: 'id') | ||
| 52 | + String id; | ||
| 53 | + | ||
| 54 | + @JsonKey(name: 'tableinfo') | ||
| 55 | + String tableinfo; | ||
| 56 | + | ||
| 57 | + @JsonKey(name: 'tid') | ||
| 58 | + String tid; | ||
| 59 | + | ||
| 60 | + @JsonKey(name: 'rname') | ||
| 61 | + String rname; | ||
| 62 | + | ||
| 63 | + @JsonKey(name: 'sex') | ||
| 64 | + String sex; | ||
| 65 | + | ||
| 66 | + @JsonKey(name: 'phone') | ||
| 67 | + String phone; | ||
| 68 | + | ||
| 69 | + @JsonKey(name: 'cusman') | ||
| 70 | + String cusman; | ||
| 71 | + | ||
| 72 | + @JsonKey(name: 'ddate') | ||
| 73 | + String ddate; | ||
| 74 | + | ||
| 75 | + @JsonKey(name: 'cdate') | ||
| 76 | + String cdate; | ||
| 77 | + | ||
| 78 | + @JsonKey(name: 'cusdem') | ||
| 79 | + String cusdem; | ||
| 80 | + | ||
| 81 | + @JsonKey(name: 'status') | ||
| 82 | + String status; | ||
| 83 | + | ||
| 84 | + @JsonKey(name: 'action') | ||
| 85 | + String action; | ||
| 86 | + | ||
| 87 | + @JsonKey(name: 'is_set_ddate') | ||
| 88 | + String isSetDdate; | ||
| 89 | + | ||
| 90 | + @JsonKey(name: 'ddate_solt') | ||
| 91 | + String ddateSolt; | ||
| 92 | + | ||
| 93 | + @JsonKey(name: 'type') | ||
| 94 | + String type; | ||
| 95 | + | ||
| 96 | + @JsonKey(name: 'name') | ||
| 97 | + String name; | ||
| 98 | + | ||
| 99 | + RowModel(this.id,this.tableinfo,this.tid,this.rname,this.sex,this.phone,this.cusman,this.ddate,this.cdate,this.cusdem,this.status,this.action,this.isSetDdate,this.ddateSolt,this.type,this.name,); | ||
| 100 | + | ||
| 101 | + factory RowModel.fromJson(Map<String, dynamic> srcJson) => _$RowModelFromJson(srcJson); | ||
| 102 | + | ||
| 103 | + Map<String, dynamic> toJson() => _$RowModelToJson(this); | ||
| 104 | + | ||
| 105 | +} | ||
| 106 | + | ||
| 107 | + |
lib/models/reserve_info_model.g.dart
0 → 100644
| 1 | +// GENERATED CODE - DO NOT MODIFY BY HAND | ||
| 2 | + | ||
| 3 | +part of 'reserve_info_model.dart'; | ||
| 4 | + | ||
| 5 | +// ************************************************************************** | ||
| 6 | +// JsonSerializableGenerator | ||
| 7 | +// ************************************************************************** | ||
| 8 | + | ||
| 9 | +ReserveInfoModel _$ReserveInfoModelFromJson(Map<String, dynamic> json) { | ||
| 10 | + return ReserveInfoModel( | ||
| 11 | + json['ret'] as int, | ||
| 12 | + json['data'] == null | ||
| 13 | + ? null | ||
| 14 | + : SunReserveInfoModel.fromJson(json['data'] as Map<String, dynamic>), | ||
| 15 | + json['msg'] as String); | ||
| 16 | +} | ||
| 17 | + | ||
| 18 | +Map<String, dynamic> _$ReserveInfoModelToJson(ReserveInfoModel instance) => | ||
| 19 | + <String, dynamic>{ | ||
| 20 | + 'ret': instance.ret, | ||
| 21 | + 'data': instance.data, | ||
| 22 | + 'msg': instance.msg | ||
| 23 | + }; | ||
| 24 | + | ||
| 25 | +SunReserveInfoModel _$SunReserveInfoModelFromJson(Map<String, dynamic> json) { | ||
| 26 | + return SunReserveInfoModel( | ||
| 27 | + json['row'] == null | ||
| 28 | + ? null | ||
| 29 | + : RowModel.fromJson(json['row'] as Map<String, dynamic>), | ||
| 30 | + json['list'] as List, | ||
| 31 | + json['table'] as List); | ||
| 32 | +} | ||
| 33 | + | ||
| 34 | +Map<String, dynamic> _$SunReserveInfoModelToJson( | ||
| 35 | + SunReserveInfoModel instance) => | ||
| 36 | + <String, dynamic>{ | ||
| 37 | + 'row': instance.row, | ||
| 38 | + 'list': instance.list, | ||
| 39 | + 'table': instance.table | ||
| 40 | + }; | ||
| 41 | + | ||
| 42 | +RowModel _$RowModelFromJson(Map<String, dynamic> json) { | ||
| 43 | + return RowModel( | ||
| 44 | + json['id'] as String, | ||
| 45 | + json['tableinfo'] as String, | ||
| 46 | + json['tid'] as String, | ||
| 47 | + json['rname'] as String, | ||
| 48 | + json['sex'] as String, | ||
| 49 | + json['phone'] as String, | ||
| 50 | + json['cusman'] as String, | ||
| 51 | + json['ddate'] as String, | ||
| 52 | + json['cdate'] as String, | ||
| 53 | + json['cusdem'] as String, | ||
| 54 | + json['status'] as String, | ||
| 55 | + json['action'] as String, | ||
| 56 | + json['is_set_ddate'] as String, | ||
| 57 | + json['ddate_solt'] as String, | ||
| 58 | + json['type'] as String, | ||
| 59 | + json['name'] as String); | ||
| 60 | +} | ||
| 61 | + | ||
| 62 | +Map<String, dynamic> _$RowModelToJson(RowModel instance) => <String, dynamic>{ | ||
| 63 | + 'id': instance.id, | ||
| 64 | + 'tableinfo': instance.tableinfo, | ||
| 65 | + 'tid': instance.tid, | ||
| 66 | + 'rname': instance.rname, | ||
| 67 | + 'sex': instance.sex, | ||
| 68 | + 'phone': instance.phone, | ||
| 69 | + 'cusman': instance.cusman, | ||
| 70 | + 'ddate': instance.ddate, | ||
| 71 | + 'cdate': instance.cdate, | ||
| 72 | + 'cusdem': instance.cusdem, | ||
| 73 | + 'status': instance.status, | ||
| 74 | + 'action': instance.action, | ||
| 75 | + 'is_set_ddate': instance.isSetDdate, | ||
| 76 | + 'ddate_solt': instance.ddateSolt, | ||
| 77 | + 'type': instance.type, | ||
| 78 | + 'name': instance.name | ||
| 79 | + }; |
| @@ -5,92 +5,92 @@ part 'table.g.dart'; | @@ -5,92 +5,92 @@ part 'table.g.dart'; | ||
| 5 | 5 | ||
| 6 | @JsonSerializable() | 6 | @JsonSerializable() |
| 7 | class Table { | 7 | class Table { |
| 8 | + Table(); | ||
| 8 | 9 | ||
| 9 | - Table(); | 10 | + String id; //主键id |
| 11 | + String rid; //关联区域id | ||
| 12 | + String tid; //桌位类型 1散座 2包间 3卡座 | ||
| 13 | + String name; //桌位名称 | ||
| 14 | + String table_pnum; //桌位最少可做人数 | ||
| 15 | + String most_pnum; //桌位最多可做人数 | ||
| 16 | + String order_o; //桌位排序编号 | ||
| 17 | + String status; //桌位状态 0未使用 1使用中 2已删除 | ||
| 18 | + String tablestatus; //桌位状态 0未使用 1使用中 2已删除 | ||
| 19 | + String enable; //0禁用 1启用 | ||
| 20 | + String spell; //1拼桌 | ||
| 21 | + String rname; //关联区域名称 | ||
| 22 | + String max; //最多可做人数 | ||
| 23 | + String low; //最低消费 | ||
| 24 | + String sign; //标签 桌位状态 0:待确认,1:已定座,2:确认到店,3:用餐完成,4:取消预订,5:安排包间,6拒绝订单 | ||
| 25 | + String reserver; //订餐人 | ||
| 26 | + String notebookId; //桌位对应的预订id | ||
| 27 | + bool selected; //是否选中 | ||
| 10 | 28 | ||
| 11 | - String id;//主键id | ||
| 12 | - String rid;//关联区域id | ||
| 13 | - String tid;//桌位类型 1散座 2包间 3卡座 | ||
| 14 | - String name;//桌位名称 | ||
| 15 | - String table_pnum;//桌位最少可做人数 | ||
| 16 | - String most_pnum;//桌位最多可做人数 | ||
| 17 | - String order_o;//桌位排序编号 | ||
| 18 | - String status;//桌位状态 0未使用 1使用中 2已删除 | ||
| 19 | - String tablestatus;//桌位状态 0未使用 1使用中 2已删除 | ||
| 20 | - String enable;//0禁用 1启用 | ||
| 21 | - String spell;//1拼桌 | ||
| 22 | - String rname;//关联区域名称 | ||
| 23 | - String max;//最多可做人数 | ||
| 24 | - String low;//最低消费 | ||
| 25 | - String sign;//标签 桌位状态 0:待确认,1:已定座,2:确认到店,3:用餐完成,4:取消预订,5:安排包间,6拒绝订单 | ||
| 26 | - String reserver;//订餐人 | ||
| 27 | - String notebookId;//桌位对应的预订id | ||
| 28 | - bool selected;//是否选中 | ||
| 29 | - | ||
| 30 | - //获取桌位类型 | ||
| 31 | - String get tidStr{ | ||
| 32 | - switch(tid){ | ||
| 33 | - case "1": | ||
| 34 | - return "散座"; | ||
| 35 | - case "2": | ||
| 36 | - return "包间"; | ||
| 37 | - case "3": | ||
| 38 | - return "卡座"; | ||
| 39 | - } | 29 | + //获取桌位类型 |
| 30 | + String get tidStr { | ||
| 31 | + switch (tid) { | ||
| 32 | + case "1": | ||
| 33 | + return "散座"; | ||
| 34 | + case "2": | ||
| 35 | + return "包间"; | ||
| 36 | + case "3": | ||
| 37 | + return "卡座"; | ||
| 40 | } | 38 | } |
| 39 | + } | ||
| 41 | 40 | ||
| 42 | - String get maxText{ | ||
| 43 | - if(max==null||max=="0"||max=="null"){ | ||
| 44 | - return ""; | ||
| 45 | - }else{ | ||
| 46 | - return "最多可坐"+max+"人"; | ||
| 47 | - } | 41 | + String get maxText { |
| 42 | + if (max == null || max == "0" || max == "null") { | ||
| 43 | + return ""; | ||
| 44 | + } else { | ||
| 45 | + return "最多可坐" + max + "人"; | ||
| 48 | } | 46 | } |
| 47 | + } | ||
| 49 | 48 | ||
| 50 | - //获取桌位可坐人数 | ||
| 51 | - String get tableNum{ | ||
| 52 | - if(table_pnum==null||table_pnum.isEmpty||table_pnum=="0"){ | ||
| 53 | - return ""; | ||
| 54 | - }else if(most_pnum!=null&&most_pnum.isNotEmpty&&most_pnum!="0"&&most_pnum!="null"){ | ||
| 55 | - if(table_pnum==most_pnum){ | ||
| 56 | - return "$table_pnum人"; | ||
| 57 | - }else{ | ||
| 58 | - return "$table_pnum-$most_pnum人"; | ||
| 59 | - } | ||
| 60 | - }else{ | ||
| 61 | - return "$table_pnum人"; | ||
| 62 | - } | 49 | + //获取桌位可坐人数 |
| 50 | + String get tableNum { | ||
| 51 | + if (table_pnum == null || table_pnum.isEmpty || table_pnum == "0") { | ||
| 52 | + return ""; | ||
| 53 | + } else if (most_pnum != null && | ||
| 54 | + most_pnum.isNotEmpty && | ||
| 55 | + most_pnum != "0" && | ||
| 56 | + most_pnum != "null") { | ||
| 57 | + if (table_pnum == most_pnum) { | ||
| 58 | + return "$table_pnum人"; | ||
| 59 | + } else { | ||
| 60 | + return "$table_pnum-$most_pnum人"; | ||
| 61 | + } | ||
| 62 | + } else { | ||
| 63 | + return "$table_pnum人"; | ||
| 63 | } | 64 | } |
| 65 | + } | ||
| 64 | 66 | ||
| 65 | - //获取最低消费 | ||
| 66 | - String get lowStr{ | ||
| 67 | - return (low==null||low.isEmpty||low=="0")?"":"最低消费\n$low元"; | ||
| 68 | - } | 67 | + //获取最低消费 |
| 68 | + String get lowStr { | ||
| 69 | + return (low == null || low.isEmpty || low == "0") ? "" : "最低消费\n$low元"; | ||
| 70 | + } | ||
| 69 | 71 | ||
| 70 | - String get signStr{ | ||
| 71 | - if(enable=="0")return "已停用"; | ||
| 72 | - if(sign!=null){ | ||
| 73 | - switch(sign){ | ||
| 74 | - case "1"://已预订 | ||
| 75 | - case "5"://已安排包间 | ||
| 76 | - return "已预订"; | ||
| 77 | - case "2"://用餐中 | ||
| 78 | - return "用餐中"; | ||
| 79 | - default: | ||
| 80 | - return ""; | ||
| 81 | - } | ||
| 82 | - } | ||
| 83 | - return ""; | 72 | + String get signStr { |
| 73 | + if (enable == "0") return "已停用"; | ||
| 74 | + if (sign != null) { | ||
| 75 | + switch (sign) { | ||
| 76 | + case "1": //已预订 | ||
| 77 | + case "5": //已安排包间 | ||
| 78 | + return "已预订"; | ||
| 79 | + case "2": //用餐中 | ||
| 80 | + return "用餐中"; | ||
| 81 | + default: | ||
| 82 | + return ""; | ||
| 83 | + } | ||
| 84 | } | 84 | } |
| 85 | + return ""; | ||
| 86 | + } | ||
| 85 | 87 | ||
| 86 | - | ||
| 87 | - factory Table.fromJson(Map<String,dynamic> json) => _$TableFromJson(json); | ||
| 88 | - Map<String, dynamic> toJson() => _$TableToJson(this); | 88 | + factory Table.fromJson(Map<String, dynamic> json) => _$TableFromJson(json); |
| 89 | + Map<String, dynamic> toJson() => _$TableToJson(this); | ||
| 89 | 90 | ||
| 90 | - @override | ||
| 91 | - String toString() { | ||
| 92 | - return 'Table{id: $id, rid: $rid, tid: $tid, name: $name, table_pnum: $table_pnum, most_pnum: $most_pnum, order_o: $order_o, status: $status, tablestatus: $tablestatus, enable: $enable, spell: $spell, rname: $rname, max: $max, low: $low}'; | ||
| 93 | - } | 91 | + @override |
| 92 | + String toString() { | ||
| 93 | + return 'Table{id: $id, rid: $rid, tid: $tid, name: $name, table_pnum: $table_pnum, most_pnum: $most_pnum, order_o: $order_o, status: $status, tablestatus: $tablestatus, enable: $enable, spell: $spell, rname: $rname, max: $max, low: $low}'; | ||
| 94 | + } | ||
| 94 | 95 | ||
| 95 | } | 96 | } |
| 96 | - |
| @@ -90,6 +90,10 @@ class TableList extends Object { | @@ -90,6 +90,10 @@ class TableList extends Object { | ||
| 90 | 90 | ||
| 91 | @JsonKey(name: 'rname') | 91 | @JsonKey(name: 'rname') |
| 92 | String rname; | 92 | String rname; |
| 93 | + | ||
| 94 | + @JsonKey(name: 'region_name') | ||
| 95 | + String regionName; | ||
| 96 | + | ||
| 93 | String table_pnum; //桌位最少可做人数 | 97 | String table_pnum; //桌位最少可做人数 |
| 94 | String most_pnum; //桌位最多可做人数 | 98 | String most_pnum; //桌位最多可做人数 |
| 95 | String low; //最低消费 | 99 | String low; //最低消费 |
| @@ -107,18 +111,18 @@ class TableList extends Object { | @@ -107,18 +111,18 @@ class TableList extends Object { | ||
| 107 | } | 111 | } |
| 108 | 112 | ||
| 109 | String reserver; //订餐人 | 113 | String reserver; //订餐人 |
| 110 | - String notebookId; //桌位对应的预订id | 114 | + // String notebookId; //桌位对应的预订id |
| 111 | bool selected = false; //是否选中 | 115 | bool selected = false; //是否选中 |
| 112 | - String max; //最多可做人数 | 116 | + // String max; //最多可做人数 |
| 113 | String sign; //标签 桌位状态 0:待确认,1:已定座,2:确认到店,3:用餐完成,4:取消预订,5:安排包间,6拒绝订单 | 117 | String sign; //标签 桌位状态 0:待确认,1:已定座,2:确认到店,3:用餐完成,4:取消预订,5:安排包间,6拒绝订单 |
| 114 | 118 | ||
| 115 | - String get maxText { | ||
| 116 | - if (max == null || max == "0" || max == "null") { | ||
| 117 | - return ""; | ||
| 118 | - } else { | ||
| 119 | - return "最多可坐" + max + "人"; | ||
| 120 | - } | ||
| 121 | - } | 119 | + // String get maxText { |
| 120 | + // if (max == null || max == "0" || max == "null") { | ||
| 121 | + // return ""; | ||
| 122 | + // } else { | ||
| 123 | + // return "最多可坐" + max + "人"; | ||
| 124 | + // } | ||
| 125 | + // } | ||
| 122 | 126 | ||
| 123 | //获取桌位可坐人数 | 127 | //获取桌位可坐人数 |
| 124 | String get tableNum { | 128 | String get tableNum { |
| @@ -174,7 +178,7 @@ class TableList extends Object { | @@ -174,7 +178,7 @@ class TableList extends Object { | ||
| 174 | this.enable, | 178 | this.enable, |
| 175 | this.spell, | 179 | this.spell, |
| 176 | this.cdate, | 180 | this.cdate, |
| 177 | - this.rname); | 181 | + this.rname,this.regionName); |
| 178 | 182 | ||
| 179 | factory TableList.fromJson(Map<String, dynamic> srcJson) => | 183 | factory TableList.fromJson(Map<String, dynamic> srcJson) => |
| 180 | _$TableListFromJson(srcJson); | 184 | _$TableListFromJson(srcJson); |
| @@ -52,7 +52,8 @@ TableList _$TableListFromJson(Map<String, dynamic> json) { | @@ -52,7 +52,8 @@ TableList _$TableListFromJson(Map<String, dynamic> json) { | ||
| 52 | json['enable'] as String, | 52 | json['enable'] as String, |
| 53 | json['spell'] as String, | 53 | json['spell'] as String, |
| 54 | json['cdate'] as String, | 54 | json['cdate'] as String, |
| 55 | - json['rname'] as String); | 55 | + json['rname'] as String, |
| 56 | + json['region_name'] as String); | ||
| 56 | } | 57 | } |
| 57 | 58 | ||
| 58 | Map<String, dynamic> _$TableListToJson(TableList instance) => <String, dynamic>{ | 59 | Map<String, dynamic> _$TableListToJson(TableList instance) => <String, dynamic>{ |
| @@ -70,5 +71,6 @@ Map<String, dynamic> _$TableListToJson(TableList instance) => <String, dynamic>{ | @@ -70,5 +71,6 @@ Map<String, dynamic> _$TableListToJson(TableList instance) => <String, dynamic>{ | ||
| 70 | 'enable': instance.enable, | 71 | 'enable': instance.enable, |
| 71 | 'spell': instance.spell, | 72 | 'spell': instance.spell, |
| 72 | 'cdate': instance.cdate, | 73 | 'cdate': instance.cdate, |
| 73 | - 'rname': instance.rname | 74 | + 'rname': instance.rname, |
| 75 | + 'region_name': instance.regionName | ||
| 74 | }; | 76 | }; |
| @@ -31,4 +31,6 @@ class HttpUrl { | @@ -31,4 +31,6 @@ class HttpUrl { | ||
| 31 | "?service=App.Seller.SaveCallRecord"; //上传通讯录 | 31 | "?service=App.Seller.SaveCallRecord"; //上传通讯录 |
| 32 | static const String get_table_list = | 32 | static const String get_table_list = |
| 33 | "?service=Android.Reserve.NewGetTableList"; //根据商家ID 获取桌位信息列表: 1:散座 2:包间 默认:获取所有数据 | 33 | "?service=Android.Reserve.NewGetTableList"; //根据商家ID 获取桌位信息列表: 1:散座 2:包间 默认:获取所有数据 |
| 34 | + static const String set_reserve_info = | ||
| 35 | + "?service=Android.Customer.SetReserveInfo"; //录入顾客订座相关信息,同时更新商家桌位状态 | ||
| 34 | } | 36 | } |
| @@ -64,7 +64,7 @@ class HandleOnlinePageState extends State<HandleOnlinePage> { | @@ -64,7 +64,7 @@ class HandleOnlinePageState extends State<HandleOnlinePage> { | ||
| 64 | }); | 64 | }); |
| 65 | setMessageStatus(); | 65 | setMessageStatus(); |
| 66 | } else { | 66 | } else { |
| 67 | - managers = await detailModel.getManagers(context); | 67 | + managers = await detailModel.getManagers(context); |
| 68 | } | 68 | } |
| 69 | }); | 69 | }); |
| 70 | } | 70 | } |
| @@ -114,13 +114,13 @@ class HandleOnlinePageState extends State<HandleOnlinePage> { | @@ -114,13 +114,13 @@ class HandleOnlinePageState extends State<HandleOnlinePage> { | ||
| 114 | ), | 114 | ), |
| 115 | onPressed: () async { | 115 | onPressed: () async { |
| 116 | Navigator.of(context).pop(); | 116 | Navigator.of(context).pop(); |
| 117 | - String tid = await NavigatorUtil.goSelectTablePage( | 117 | + Map temp = await NavigatorUtil.goSelectTablePage( |
| 118 | context, | 118 | context, |
| 119 | widget.rid, | 119 | widget.rid, |
| 120 | int.parse(detailEntity.ddate) * 1000, | 120 | int.parse(detailEntity.ddate) * 1000, |
| 121 | detailEntity.ddate_solt); | 121 | detailEntity.ddate_solt); |
| 122 | - if (tid != null) { | ||
| 123 | - setReserveStatus("5", tid: tid); | 122 | + if (temp['tid'] != null) { |
| 123 | + setReserveStatus("5", tid: temp['tid']); | ||
| 124 | } | 124 | } |
| 125 | }, | 125 | }, |
| 126 | ) | 126 | ) |
| 1 | +import 'dart:convert'; | ||
| 1 | import 'dart:ui'; | 2 | import 'dart:ui'; |
| 2 | 3 | ||
| 3 | import 'package:common_utils/common_utils.dart'; | 4 | import 'package:common_utils/common_utils.dart'; |
| @@ -5,10 +6,15 @@ import 'package:flutter/material.dart'; | @@ -5,10 +6,15 @@ import 'package:flutter/material.dart'; | ||
| 5 | import 'package:flutter/services.dart'; | 6 | import 'package:flutter/services.dart'; |
| 6 | import 'package:flutter_screenutil/screenutil.dart'; | 7 | import 'package:flutter_screenutil/screenutil.dart'; |
| 7 | import 'package:one_key/models/notebook_detail.dart'; | 8 | import 'package:one_key/models/notebook_detail.dart'; |
| 9 | +import 'package:one_key/models/reserve_info_model.dart'; | ||
| 8 | import 'package:one_key/provider/notebook_detail_change_model.dart'; | 10 | import 'package:one_key/provider/notebook_detail_change_model.dart'; |
| 11 | +import 'package:one_key/provider/notebook_detail_model.dart'; | ||
| 12 | +import 'package:one_key/provider/user_model.dart'; | ||
| 9 | import 'package:one_key/res/colors.dart'; | 13 | import 'package:one_key/res/colors.dart'; |
| 10 | import 'package:one_key/utils/dialog_util.dart'; | 14 | import 'package:one_key/utils/dialog_util.dart'; |
| 15 | +import 'package:one_key/utils/event_bus.dart'; | ||
| 11 | import 'package:one_key/utils/navigator_util.dart'; | 16 | import 'package:one_key/utils/navigator_util.dart'; |
| 17 | +import 'package:one_key/utils/utils.dart'; | ||
| 12 | import 'package:one_key/widgets/MyDivider.dart'; | 18 | import 'package:one_key/widgets/MyDivider.dart'; |
| 13 | import 'package:one_key/widgets/app_bar.dart'; | 19 | import 'package:one_key/widgets/app_bar.dart'; |
| 14 | import 'package:one_key/widgets/common_button.dart'; | 20 | import 'package:one_key/widgets/common_button.dart'; |
| @@ -17,6 +23,7 @@ import 'package:one_key/widgets/new_table_item.dart'; | @@ -17,6 +23,7 @@ import 'package:one_key/widgets/new_table_item.dart'; | ||
| 17 | import 'package:one_key/widgets/table_item.dart'; | 23 | import 'package:one_key/widgets/table_item.dart'; |
| 18 | import 'package:one_key/widgets/v_empty_view.dart'; | 24 | import 'package:one_key/widgets/v_empty_view.dart'; |
| 19 | import 'package:provider/provider.dart'; | 25 | import 'package:provider/provider.dart'; |
| 26 | +import 'package:one_key/models/table_list.dart' as t; | ||
| 20 | 27 | ||
| 21 | typedef clickCallback = void Function(String value); | 28 | typedef clickCallback = void Function(String value); |
| 22 | 29 | ||
| @@ -42,6 +49,7 @@ class _NoteBookChangePageState extends State<NoteBookChangePage> { | @@ -42,6 +49,7 @@ class _NoteBookChangePageState extends State<NoteBookChangePage> { | ||
| 42 | FocusNode _phoneNode = FocusNode(); | 49 | FocusNode _phoneNode = FocusNode(); |
| 43 | FocusNode _nameNode = FocusNode(); | 50 | FocusNode _nameNode = FocusNode(); |
| 44 | FocusNode _needNode = FocusNode(); | 51 | FocusNode _needNode = FocusNode(); |
| 52 | + NotebookDetailModel detailModel = NotebookDetailModel(); | ||
| 45 | 53 | ||
| 46 | // //生成日期文本 | 54 | // //生成日期文本 |
| 47 | // _createDateText(DateTime day) { | 55 | // _createDateText(DateTime day) { |
| @@ -177,6 +185,30 @@ class _NoteBookChangePageState extends State<NoteBookChangePage> { | @@ -177,6 +185,30 @@ class _NoteBookChangePageState extends State<NoteBookChangePage> { | ||
| 177 | } | 185 | } |
| 178 | } | 186 | } |
| 179 | 187 | ||
| 188 | + //处理在线预订 | ||
| 189 | + setReserveStatus(String status, {String tid = ""}) async { | ||
| 190 | + // bus.emit("remove_untreated_message", widget.mid); | ||
| 191 | + UserModel userModel = Provider.of<UserModel>(context, listen: false); | ||
| 192 | + Map<String, String> causeMap = { | ||
| 193 | + "uid": userModel.user.openid, | ||
| 194 | + "uname": userModel.user.account, | ||
| 195 | + "desc": "", | ||
| 196 | + }; | ||
| 197 | + Map<String, String> params = { | ||
| 198 | + "rid": widget.rid, | ||
| 199 | + "status": status, //5安排包间 6 拒绝订单 | ||
| 200 | + "tid": tid, | ||
| 201 | + // "mid": widget.mid, | ||
| 202 | + "cause": json.encode(causeMap) | ||
| 203 | + }; | ||
| 204 | + // detailModel.setReserveStatus(context, params); | ||
| 205 | + bool success = | ||
| 206 | + await detailModel.setReserveStatus(context, params, ifPush: false); | ||
| 207 | + if (success) { | ||
| 208 | + _notebookDetailChangeModel.getNewTableList(context); | ||
| 209 | + } | ||
| 210 | + } | ||
| 211 | + | ||
| 180 | _topWidget() { | 212 | _topWidget() { |
| 181 | return Container( | 213 | return Container( |
| 182 | padding: EdgeInsets.all(ScreenUtil().setWidth(40)), | 214 | padding: EdgeInsets.all(ScreenUtil().setWidth(40)), |
| @@ -372,14 +404,18 @@ class _NoteBookChangePageState extends State<NoteBookChangePage> { | @@ -372,14 +404,18 @@ class _NoteBookChangePageState extends State<NoteBookChangePage> { | ||
| 372 | ), | 404 | ), |
| 373 | InkWell( | 405 | InkWell( |
| 374 | onTap: () async { | 406 | onTap: () async { |
| 375 | - String tid = await NavigatorUtil.goSelectTablePage( | 407 | + Map temp = await NavigatorUtil.goSelectTablePage( |
| 376 | context, | 408 | context, |
| 377 | widget.rid, | 409 | widget.rid, |
| 378 | int.parse(widget.detailEntity.ddate) * 1000, | 410 | int.parse(widget.detailEntity.ddate) * 1000, |
| 379 | - widget.detailEntity.ddate_solt); | ||
| 380 | - if (tid != null) { | ||
| 381 | - // setReserveStatus("5", tid: tid); | 411 | + widget.detailEntity.ddate_solt, |
| 412 | + canChoose: true, | ||
| 413 | + object: {'object': _notebookDetailChangeModel.tableList}); | ||
| 414 | + if (temp['tid'] != null) { | ||
| 415 | + setReserveStatus("5", tid: temp['tid']); | ||
| 382 | } | 416 | } |
| 417 | + _notebookDetailChangeModel.tableList = temp['object']; | ||
| 418 | + _notebookDetailChangeModel.notifyListeners(); | ||
| 383 | }, | 419 | }, |
| 384 | child: Row( | 420 | child: Row( |
| 385 | children: [ | 421 | children: [ |
| @@ -413,7 +449,16 @@ class _NoteBookChangePageState extends State<NoteBookChangePage> { | @@ -413,7 +449,16 @@ class _NoteBookChangePageState extends State<NoteBookChangePage> { | ||
| 413 | itemBuilder: (BuildContext contxt, int index) { | 449 | itemBuilder: (BuildContext contxt, int index) { |
| 414 | return NewTableItem( | 450 | return NewTableItem( |
| 415 | _notebookDetailChangeModel.tableList[index], | 451 | _notebookDetailChangeModel.tableList[index], |
| 416 | - height: 160, | 452 | + isRegionName: true, |
| 453 | + canSelected: true, | ||
| 454 | + onSelected: (table) { | ||
| 455 | + if ((table as t.TableList).selected) { | ||
| 456 | + _notebookDetailChangeModel.tableList.add(table); | ||
| 457 | + } else { | ||
| 458 | + _notebookDetailChangeModel.tableList | ||
| 459 | + .removeWhere((t) => t.id == table.id); | ||
| 460 | + } | ||
| 461 | + }, | ||
| 417 | ); | 462 | ); |
| 418 | }, | 463 | }, |
| 419 | itemCount: _notebookDetailChangeModel.tableList.length > 3 | 464 | itemCount: _notebookDetailChangeModel.tableList.length > 3 |
| @@ -674,6 +719,7 @@ class _NoteBookChangePageState extends State<NoteBookChangePage> { | @@ -674,6 +719,7 @@ class _NoteBookChangePageState extends State<NoteBookChangePage> { | ||
| 674 | tempMndList[index]['title']) { | 719 | tempMndList[index]['title']) { |
| 675 | item['select'] = true; | 720 | item['select'] = true; |
| 676 | widget.detailEntity.is_set_ddate = '1'; | 721 | widget.detailEntity.is_set_ddate = '1'; |
| 722 | + _notebookDetailChangeModel.isSetDate = "1"; | ||
| 677 | _notebookDetailChangeModel.ddateStr = | 723 | _notebookDetailChangeModel.ddateStr = |
| 678 | item['title']; | 724 | item['title']; |
| 679 | } | 725 | } |
| @@ -770,8 +816,36 @@ class _NoteBookChangePageState extends State<NoteBookChangePage> { | @@ -770,8 +816,36 @@ class _NoteBookChangePageState extends State<NoteBookChangePage> { | ||
| 770 | fontSize: 34, | 816 | fontSize: 34, |
| 771 | content: "确定修改", | 817 | content: "确定修改", |
| 772 | state: 2, | 818 | state: 2, |
| 773 | - onPress: () { | ||
| 774 | - _notebookDetailChangeModel.setReserveInfo(context); | 819 | + onPress: () async { |
| 820 | + String name = | ||
| 821 | + _notebookDetailChangeModel.nameController.text.trim(); | ||
| 822 | + if (ObjectUtil.isEmpty(name)) { | ||
| 823 | + Utils.showToast("请填写客户姓名"); | ||
| 824 | + return; | ||
| 825 | + } | ||
| 826 | + SunReserveInfoModel _model = | ||
| 827 | + await _notebookDetailChangeModel | ||
| 828 | + .setReserveInfo(context); | ||
| 829 | + if (ObjectUtil.isNotEmpty(_model.row) || | ||
| 830 | + ObjectUtil.isNotEmpty(_model.row.id)) { | ||
| 831 | + print('变更成功'); | ||
| 832 | + // _notebookDetailChangeModel.clearData(); | ||
| 833 | + bus.emit("refresh_detail"); | ||
| 834 | + String ddate_solt = ''; | ||
| 835 | + if (_model.row.ddateSolt == '1') { | ||
| 836 | + ddate_solt = '早餐'; | ||
| 837 | + } else if (_model.row.ddateSolt == '2') { | ||
| 838 | + ddate_solt = '午餐'; | ||
| 839 | + } else if (_model.row.ddateSolt == '3') { | ||
| 840 | + ddate_solt = '晚餐'; | ||
| 841 | + } | ||
| 842 | + NavigatorUtil.goInvicationPage(context, _model.row.id, | ||
| 843 | + _model.row.name, _model.row.ddate, ddate_solt, | ||
| 844 | + replace: true); | ||
| 845 | + } else { | ||
| 846 | + Utils.showToast("变更预订订单失败,请重试!"); | ||
| 847 | + } | ||
| 848 | + | ||
| 775 | // messageDialogModel.removeMessage(message.id); | 849 | // messageDialogModel.removeMessage(message.id); |
| 776 | // NavigatorUtil.goHandleOnlinePage( | 850 | // NavigatorUtil.goHandleOnlinePage( |
| 777 | // context, message.rid.toString(), message.id, | 851 | // context, message.rid.toString(), message.id, |
| @@ -832,8 +906,11 @@ class _ButtonState extends State<CustomButton> { | @@ -832,8 +906,11 @@ class _ButtonState extends State<CustomButton> { | ||
| 832 | children: [ | 906 | children: [ |
| 833 | widget.isTextFiled | 907 | widget.isTextFiled |
| 834 | ? Container( | 908 | ? Container( |
| 835 | - width: ScreenUtil().setWidth(70), | 909 | + alignment: Alignment.center, |
| 910 | + // color: Colors.red, | ||
| 911 | + width: ScreenUtil().setWidth(110), | ||
| 836 | height: ScreenUtil().setWidth(50), | 912 | height: ScreenUtil().setWidth(50), |
| 913 | + // padding: EdgeInsets.zero, | ||
| 837 | child: TextField( | 914 | child: TextField( |
| 838 | controller: widget.model.numController, | 915 | controller: widget.model.numController, |
| 839 | maxLines: 1, | 916 | maxLines: 1, |
| @@ -901,12 +978,14 @@ class _ButtonState extends State<CustomButton> { | @@ -901,12 +978,14 @@ class _ButtonState extends State<CustomButton> { | ||
| 901 | ? MyColours.color_fefefe | 978 | ? MyColours.color_fefefe |
| 902 | : MyColours.color_199095, | 979 | : MyColours.color_199095, |
| 903 | fontSize: ScreenUtil().setSp(widget.fontSize))), | 980 | fontSize: ScreenUtil().setSp(widget.fontSize))), |
| 904 | - widget.isImage ? HEmptyView(20) : Container(), | 981 | + widget.isImage && !widget.isTextFiled |
| 982 | + ? HEmptyView(20) | ||
| 983 | + : Container(), | ||
| 905 | widget.isImage | 984 | widget.isImage |
| 906 | ? Image.asset( | 985 | ? Image.asset( |
| 907 | widget.isSelect | 986 | widget.isSelect |
| 908 | - ? 'assets/message_selected.png' | ||
| 909 | - : 'assets/message_default.png', | 987 | + ? 'assets/calender_select.png' |
| 988 | + : 'assets/calender_narmol.png', | ||
| 910 | width: ScreenUtil().setWidth(36)) | 989 | width: ScreenUtil().setWidth(36)) |
| 911 | : Text(widget.dayText, | 990 | : Text(widget.dayText, |
| 912 | style: TextStyle( | 991 | style: TextStyle( |
| @@ -9,6 +9,7 @@ import 'package:one_key/provider/notebook_detail_model.dart'; | @@ -9,6 +9,7 @@ import 'package:one_key/provider/notebook_detail_model.dart'; | ||
| 9 | import 'package:one_key/provider/user_model.dart'; | 9 | import 'package:one_key/provider/user_model.dart'; |
| 10 | import 'package:one_key/res/colors.dart'; | 10 | import 'package:one_key/res/colors.dart'; |
| 11 | import 'package:one_key/utils/dialog_util.dart'; | 11 | import 'package:one_key/utils/dialog_util.dart'; |
| 12 | +import 'package:one_key/utils/event_bus.dart'; | ||
| 12 | import 'package:one_key/utils/log_util.dart'; | 13 | import 'package:one_key/utils/log_util.dart'; |
| 13 | import 'package:one_key/utils/navigator_util.dart'; | 14 | import 'package:one_key/utils/navigator_util.dart'; |
| 14 | import 'package:one_key/utils/utils.dart'; | 15 | import 'package:one_key/utils/utils.dart'; |
| @@ -69,16 +70,24 @@ class NotebookDetailPageState extends State<NotebookDetailPage> { | @@ -69,16 +70,24 @@ class NotebookDetailPageState extends State<NotebookDetailPage> { | ||
| 69 | _cancelNode.addListener(() { | 70 | _cancelNode.addListener(() { |
| 70 | if (_cancelNode.hasFocus) { | 71 | if (_cancelNode.hasFocus) { |
| 71 | print('得到焦点'); | 72 | print('得到焦点'); |
| 72 | - paddingTop = 125; | 73 | + paddingTop = 80; |
| 73 | } else { | 74 | } else { |
| 74 | print('失去焦点'); | 75 | print('失去焦点'); |
| 75 | paddingTop = 138; | 76 | paddingTop = 138; |
| 76 | } | 77 | } |
| 77 | _cancelState(() {}); | 78 | _cancelState(() {}); |
| 78 | }); | 79 | }); |
| 80 | + bus.on("refresh_detail", (args) { | ||
| 81 | + _getReserveDetail(); | ||
| 82 | + }); | ||
| 79 | }); | 83 | }); |
| 80 | } | 84 | } |
| 81 | 85 | ||
| 86 | + @override | ||
| 87 | + void dispose() { | ||
| 88 | + bus.off("refresh_detail"); | ||
| 89 | + } | ||
| 90 | + | ||
| 82 | _getReserveDetail() async { | 91 | _getReserveDetail() async { |
| 83 | detailEntity = await detailModel.getReserveDetail(context, { | 92 | detailEntity = await detailModel.getReserveDetail(context, { |
| 84 | "rid": widget.rid, | 93 | "rid": widget.rid, |
| @@ -206,8 +215,7 @@ class NotebookDetailPageState extends State<NotebookDetailPage> { | @@ -206,8 +215,7 @@ class NotebookDetailPageState extends State<NotebookDetailPage> { | ||
| 206 | _initCancel(); | 215 | _initCancel(); |
| 207 | Navigator.of(context).pop(); | 216 | Navigator.of(context).pop(); |
| 208 | }, | 217 | }, |
| 209 | - child: Image.asset( | ||
| 210 | - 'assets/message_selected.png', | 218 | + child: Image.asset('assets/close.png', |
| 211 | width: ScreenUtil().setWidth(32)), | 219 | width: ScreenUtil().setWidth(32)), |
| 212 | )) | 220 | )) |
| 213 | ], | 221 | ], |
| @@ -236,8 +244,8 @@ class NotebookDetailPageState extends State<NotebookDetailPage> { | @@ -236,8 +244,8 @@ class NotebookDetailPageState extends State<NotebookDetailPage> { | ||
| 236 | children: [ | 244 | children: [ |
| 237 | Image.asset( | 245 | Image.asset( |
| 238 | value['select'] | 246 | value['select'] |
| 239 | - ? 'assets/message_selected.png' | ||
| 240 | - : 'assets/message_default.png', | 247 | + ? 'assets/select.png' |
| 248 | + : 'assets/unselect.png', | ||
| 241 | width: ScreenUtil().setWidth(44)), | 249 | width: ScreenUtil().setWidth(44)), |
| 242 | HEmptyView(30), | 250 | HEmptyView(30), |
| 243 | Text(value['title'], | 251 | Text(value['title'], |
| @@ -331,7 +339,9 @@ class NotebookDetailPageState extends State<NotebookDetailPage> { | @@ -331,7 +339,9 @@ class NotebookDetailPageState extends State<NotebookDetailPage> { | ||
| 331 | 339 | ||
| 332 | @override | 340 | @override |
| 333 | Widget build(BuildContext context) { | 341 | Widget build(BuildContext context) { |
| 334 | - // TODO: implement build | 342 | + if (MediaQuery.of(context).viewInsets.bottom == 0) { |
| 343 | + _cancelNode.unfocus(); | ||
| 344 | + } | ||
| 335 | return detailEntity == null | 345 | return detailEntity == null |
| 336 | ? Container( | 346 | ? Container( |
| 337 | width: double.infinity, | 347 | width: double.infinity, |
| 1 | +import 'dart:ffi'; | ||
| 2 | + | ||
| 1 | import 'package:flutter/material.dart'; | 3 | import 'package:flutter/material.dart'; |
| 2 | import 'package:flutter_screenutil/flutter_screenutil.dart'; | 4 | import 'package:flutter_screenutil/flutter_screenutil.dart'; |
| 3 | import 'package:one_key/models/area.dart'; | 5 | import 'package:one_key/models/area.dart'; |
| 4 | import 'package:one_key/models/notebook.dart'; | 6 | import 'package:one_key/models/notebook.dart'; |
| 5 | import 'package:one_key/models/tableOuter.dart'; | 7 | import 'package:one_key/models/tableOuter.dart'; |
| 8 | +import 'package:one_key/models/table_list.dart'; | ||
| 9 | +import 'package:one_key/provider/choose_table_model.dart'; | ||
| 10 | +import 'package:one_key/provider/notebook_detail_change_model.dart'; | ||
| 6 | import 'package:one_key/provider/notebook_model.dart'; | 11 | import 'package:one_key/provider/notebook_model.dart'; |
| 7 | import 'package:one_key/provider/select_table_model.dart'; | 12 | import 'package:one_key/provider/select_table_model.dart'; |
| 8 | import 'package:one_key/provider/user_model.dart'; | 13 | import 'package:one_key/provider/user_model.dart'; |
| @@ -14,14 +19,17 @@ import 'package:one_key/widgets/common_button.dart'; | @@ -14,14 +19,17 @@ import 'package:one_key/widgets/common_button.dart'; | ||
| 14 | import 'package:one_key/widgets/table_item.dart'; | 19 | import 'package:one_key/widgets/table_item.dart'; |
| 15 | import 'package:one_key/models/table.dart' as t; | 20 | import 'package:one_key/models/table.dart' as t; |
| 16 | import 'package:provider/provider.dart'; | 21 | import 'package:provider/provider.dart'; |
| 22 | +import 'dart:convert' as convert; | ||
| 17 | 23 | ||
| 18 | -class SelectTablePage extends StatefulWidget{ | ||
| 19 | - | ||
| 20 | - final String rid;//预订id | ||
| 21 | - final DateTime dateTime;//日期 | ||
| 22 | - final String ddate_slot;//时段 | 24 | +class SelectTablePage extends StatefulWidget { |
| 25 | + final String rid; //预订id | ||
| 26 | + final DateTime dateTime; //日期 | ||
| 27 | + final String ddate_slot; //时段 | ||
| 28 | + final bool canChoose; //变更预订可以取消原来已预订的选中状态 | ||
| 29 | + final List<TableList> tableList; | ||
| 23 | 30 | ||
| 24 | - SelectTablePage(this.rid,this.dateTime,this.ddate_slot); | 31 | + SelectTablePage(this.rid, this.dateTime, this.ddate_slot, |
| 32 | + {this.canChoose = false, this.tableList}); | ||
| 25 | 33 | ||
| 26 | @override | 34 | @override |
| 27 | State<StatefulWidget> createState() { | 35 | State<StatefulWidget> createState() { |
| @@ -30,37 +38,51 @@ class SelectTablePage extends StatefulWidget{ | @@ -30,37 +38,51 @@ class SelectTablePage extends StatefulWidget{ | ||
| 30 | } | 38 | } |
| 31 | } | 39 | } |
| 32 | 40 | ||
| 33 | -class SelectTablePageState extends State<SelectTablePage>{ | 41 | +class SelectTablePageState extends State<SelectTablePage> { |
| 42 | + List<Area> areas = []; //区域列表 | ||
| 43 | + List<t.Table> selectTables = []; //选择的桌位 | ||
| 34 | 44 | ||
| 35 | - List<Area> areas=[];//区域列表 | ||
| 36 | - List<t.Table> selectTables=[];//选择的桌位 | 45 | + List<TableOuter> tableOuterList = []; //区域-桌位列表 |
| 37 | 46 | ||
| 38 | - List<TableOuter> tableOuterList=[];//区域-桌位列表 | 47 | + Map<String, List<t.Table>> areaTableMap = {}; //区域-桌位Map |
| 39 | 48 | ||
| 40 | - Map<String,List<t.Table>> areaTableMap={};//区域-桌位Map | 49 | + SelectTableModel selectTableModel = new SelectTableModel(); |
| 41 | 50 | ||
| 42 | - SelectTableModel selectTableModel=new SelectTableModel(); | 51 | + ChooseTableModel _chooseTableModel; |
| 43 | 52 | ||
| 44 | - Map<String,Notebook> tableMap={};//记录已预订桌位对应的订单 | 53 | + Map<String, Notebook> tableMap = {}; //记录已预订桌位对应的订单 |
| 45 | 54 | ||
| 46 | - String currentArea;//当前选中区域 | 55 | + String currentArea; //当前选中区域 |
| 47 | 56 | ||
| 48 | @override | 57 | @override |
| 49 | void initState() { | 58 | void initState() { |
| 50 | // TODO: implement initState | 59 | // TODO: implement initState |
| 51 | super.initState(); | 60 | super.initState(); |
| 52 | - WidgetsBinding.instance.addPostFrameCallback((_){ | 61 | + WidgetsBinding.instance.addPostFrameCallback((_) { |
| 53 | getTableList(); | 62 | getTableList(); |
| 54 | }); | 63 | }); |
| 55 | } | 64 | } |
| 56 | 65 | ||
| 57 | //获取桌位列表 | 66 | //获取桌位列表 |
| 58 | getTableList() async { | 67 | getTableList() async { |
| 59 | - UserModel userModel=Provider.of<UserModel>(context,listen:false); | ||
| 60 | - Map<String,String> params={ | ||
| 61 | - "sellerid":userModel.user.sellerid | ||
| 62 | - }; | ||
| 63 | - tableOuterList= await selectTableModel.getTableList(context, params); | 68 | + UserModel userModel = Provider.of<UserModel>(context, listen: false); |
| 69 | + Map<String, String> params = {"sellerid": userModel.user.sellerid}; | ||
| 70 | + tableOuterList = await selectTableModel.getTableList(context, params); | ||
| 71 | + for (TableOuter item in tableOuterList) { | ||
| 72 | + // if (item.name == "推荐") { | ||
| 73 | + // itemModelList.remove(item); | ||
| 74 | + // } | ||
| 75 | + for (var item in item.list) { | ||
| 76 | + for (var table in widget.tableList) { | ||
| 77 | + if (item.id == table.id) { | ||
| 78 | + item.selected = true; | ||
| 79 | + // if (!tableList.contains(item)) { | ||
| 80 | + // tableList.add(item); | ||
| 81 | + // } | ||
| 82 | + } | ||
| 83 | + } | ||
| 84 | + } | ||
| 85 | + } | ||
| 64 | _getReserveList(userModel.user.sellerid); | 86 | _getReserveList(userModel.user.sellerid); |
| 65 | } | 87 | } |
| 66 | 88 | ||
| @@ -76,150 +98,208 @@ class SelectTablePageState extends State<SelectTablePage>{ | @@ -76,150 +98,208 @@ class SelectTablePageState extends State<SelectTablePage>{ | ||
| 76 | "keywords": "", | 98 | "keywords": "", |
| 77 | "sort": "1" | 99 | "sort": "1" |
| 78 | }; | 100 | }; |
| 79 | - List<Notebook> noteBooks=await model.getReserveList(context, params); | ||
| 80 | - for(Notebook notebook in noteBooks){ | ||
| 81 | - if(notebook.tid.isEmpty)continue; | ||
| 82 | - if(notebook.status=="1"||notebook.status=="2"||notebook.status=="5"){//已预订,用餐中,已安排 | ||
| 83 | - List<String> tids=notebook.tid.split(","); | ||
| 84 | - for(String tid in tids){ | ||
| 85 | - tableMap["$tid"]=notebook; | 101 | + List<Notebook> noteBooks = await model.getReserveList(context, params); |
| 102 | + for (Notebook notebook in noteBooks) { | ||
| 103 | + if (notebook.tid.isEmpty) continue; | ||
| 104 | + if (notebook.status == "1" || | ||
| 105 | + notebook.status == "2" || | ||
| 106 | + notebook.status == "5") { | ||
| 107 | + //已预订,用餐中,已安排 | ||
| 108 | + List<String> tids = notebook.tid.split(","); | ||
| 109 | + for (String tid in tids) { | ||
| 110 | + tableMap["$tid"] = notebook; | ||
| 86 | } | 111 | } |
| 87 | - } | 112 | + } |
| 88 | } | 113 | } |
| 89 | initData(); | 114 | initData(); |
| 90 | } | 115 | } |
| 91 | 116 | ||
| 92 | //初始桌位数据 | 117 | //初始桌位数据 |
| 93 | - initData(){ | ||
| 94 | - for(TableOuter outer in tableOuterList){ | ||
| 95 | - int count=0; | ||
| 96 | - for(t.Table table in outer.list){ | ||
| 97 | - if(table.tablestatus=="0"){//没有用餐中 | ||
| 98 | - if(tableMap["${table.id}"]!=null){ | ||
| 99 | - Notebook notebook=tableMap["${table.id}"]; | ||
| 100 | - table.sign=notebook.status; | ||
| 101 | - table.notebookId=notebook.id; | ||
| 102 | - table.reserver=notebook.rnameStr; | ||
| 103 | - }else{ | ||
| 104 | - table.sign=""; | ||
| 105 | - table.notebookId=""; | ||
| 106 | - if(table.enable=="1"){ | 118 | + initData() { |
| 119 | + for (TableOuter outer in tableOuterList) { | ||
| 120 | + int count = 0; | ||
| 121 | + for (t.Table table in outer.list) { | ||
| 122 | + if (table.tablestatus == "0") { | ||
| 123 | + //没有用餐中 | ||
| 124 | + if (tableMap["${table.id}"] != null) { | ||
| 125 | + Notebook notebook = tableMap["${table.id}"]; | ||
| 126 | + table.sign = notebook.status; | ||
| 127 | + table.notebookId = notebook.id; | ||
| 128 | + table.reserver = notebook.rnameStr; | ||
| 129 | + } else { | ||
| 130 | + table.sign = ""; | ||
| 131 | + table.notebookId = ""; | ||
| 132 | + if (table.enable == "1") { | ||
| 107 | count++; | 133 | count++; |
| 108 | } | 134 | } |
| 109 | } | 135 | } |
| 110 | - }else{ | ||
| 111 | - table.sign="2"; | ||
| 112 | - table.notebookId=""; | 136 | + } else { |
| 137 | + table.sign = "2"; | ||
| 138 | + table.notebookId = ""; | ||
| 113 | } | 139 | } |
| 114 | } | 140 | } |
| 115 | - areaTableMap["${outer.name}"]=outer.list; | ||
| 116 | - Area area=Area(); | ||
| 117 | - area.name=outer.name; | ||
| 118 | - area.count=count; | 141 | + areaTableMap["${outer.name}"] = outer.list; |
| 142 | + Area area = Area(); | ||
| 143 | + area.name = outer.name; | ||
| 144 | + area.count = count; | ||
| 119 | areas.add(area); | 145 | areas.add(area); |
| 120 | } | 146 | } |
| 121 | - currentArea=areaTableMap.keys.first; | ||
| 122 | - setState(() { | ||
| 123 | - }); | 147 | + currentArea = areaTableMap.keys.first; |
| 148 | + setState(() {}); | ||
| 124 | } | 149 | } |
| 125 | 150 | ||
| 126 | //获取一天开始-结束时间字符串 | 151 | //获取一天开始-结束时间字符串 |
| 127 | String _getRdate() { | 152 | String _getRdate() { |
| 128 | //一天开始时间 | 153 | //一天开始时间 |
| 129 | double startDay = (DateTime.parse((widget.dateTime.year.toString() + | 154 | double startDay = (DateTime.parse((widget.dateTime.year.toString() + |
| 130 | - "-" + | ||
| 131 | - Utils.addZeroNumber(widget.dateTime.month) + | ||
| 132 | - "-" + | ||
| 133 | - Utils.addZeroNumber(widget.dateTime.day) + | ||
| 134 | - " 00:00:00")) | ||
| 135 | - .millisecondsSinceEpoch) / | 155 | + "-" + |
| 156 | + Utils.addZeroNumber(widget.dateTime.month) + | ||
| 157 | + "-" + | ||
| 158 | + Utils.addZeroNumber(widget.dateTime.day) + | ||
| 159 | + " 00:00:00")) | ||
| 160 | + .millisecondsSinceEpoch) / | ||
| 136 | 1000; | 161 | 1000; |
| 137 | //一天结束时间 | 162 | //一天结束时间 |
| 138 | double endDay = (DateTime.parse((widget.dateTime.year.toString() + | 163 | double endDay = (DateTime.parse((widget.dateTime.year.toString() + |
| 139 | - "-" + | ||
| 140 | - Utils.addZeroNumber(widget.dateTime.month) + | ||
| 141 | - "-" + | ||
| 142 | - Utils.addZeroNumber(widget.dateTime.day) + | ||
| 143 | - " 23:59:59")) | ||
| 144 | - .millisecondsSinceEpoch) / | 164 | + "-" + |
| 165 | + Utils.addZeroNumber(widget.dateTime.month) + | ||
| 166 | + "-" + | ||
| 167 | + Utils.addZeroNumber(widget.dateTime.day) + | ||
| 168 | + " 23:59:59")) | ||
| 169 | + .millisecondsSinceEpoch) / | ||
| 145 | 1000; | 170 | 1000; |
| 146 | return startDay.floor().toString() + "-" + endDay.floor().toString(); | 171 | return startDay.floor().toString() + "-" + endDay.floor().toString(); |
| 147 | } | 172 | } |
| 148 | 173 | ||
| 149 | @override | 174 | @override |
| 150 | Widget build(BuildContext context) { | 175 | Widget build(BuildContext context) { |
| 151 | - // TODO: implement build | 176 | + _chooseTableModel = Provider.of<ChooseTableModel>(context); |
| 152 | return SafeArea( | 177 | return SafeArea( |
| 153 | - child: areaTableMap.isEmpty?Container( | ||
| 154 | - width: double.infinity, | ||
| 155 | - height: double.infinity, | ||
| 156 | - color: MyColours.color_ffffff, | ||
| 157 | - ):Column( | ||
| 158 | - children: <Widget>[ | ||
| 159 | - MyAppBar( | ||
| 160 | - "选择桌位", | ||
| 161 | - showBack: true, | ||
| 162 | - ), | ||
| 163 | - Expanded( | ||
| 164 | - child: Container( | 178 | + child: areaTableMap.isEmpty |
| 179 | + ? Container( | ||
| 180 | + width: double.infinity, | ||
| 181 | + height: double.infinity, | ||
| 165 | color: MyColours.color_ffffff, | 182 | color: MyColours.color_ffffff, |
| 166 | - child: Row( | ||
| 167 | - children: <Widget>[ | ||
| 168 | - Container( | ||
| 169 | - width: ScreenUtil().setWidth(189), | ||
| 170 | - height: double.infinity, | ||
| 171 | - color: MyColours.color_f1f1f1, | ||
| 172 | - child: ListView.builder(itemBuilder: (context,index){ | ||
| 173 | - return AreaItem(areas[index],currentArea,(area){ | ||
| 174 | - setState(() { | ||
| 175 | - currentArea=(area as Area).name; | ||
| 176 | - }); | ||
| 177 | - }); | ||
| 178 | - },itemExtent: ScreenUtil().setHeight(207),itemCount: areas.length,), | 183 | + ) |
| 184 | + : Column( | ||
| 185 | + children: <Widget>[ | ||
| 186 | + MyAppBar( | ||
| 187 | + "选择桌位", | ||
| 188 | + showBack: true, | ||
| 189 | + ), | ||
| 190 | + Expanded( | ||
| 191 | + child: Container( | ||
| 192 | + color: MyColours.color_ffffff, | ||
| 193 | + child: Row( | ||
| 194 | + children: <Widget>[ | ||
| 195 | + Container( | ||
| 196 | + width: ScreenUtil().setWidth(189), | ||
| 197 | + height: double.infinity, | ||
| 198 | + color: MyColours.color_f1f1f1, | ||
| 199 | + child: ListView.builder( | ||
| 200 | + itemBuilder: (context, index) { | ||
| 201 | + return AreaItem(areas[index], currentArea, | ||
| 202 | + (area) { | ||
| 203 | + setState(() { | ||
| 204 | + currentArea = (area as Area).name; | ||
| 205 | + }); | ||
| 206 | + }); | ||
| 207 | + }, | ||
| 208 | + itemExtent: ScreenUtil().setHeight(207), | ||
| 209 | + itemCount: areas.length, | ||
| 210 | + ), | ||
| 211 | + ), | ||
| 212 | + Expanded( | ||
| 213 | + child: Padding( | ||
| 214 | + padding: EdgeInsets.symmetric( | ||
| 215 | + vertical: ScreenUtil().setHeight(10), | ||
| 216 | + horizontal: ScreenUtil().setWidth(9)), | ||
| 217 | + child: GridView.builder( | ||
| 218 | + gridDelegate: | ||
| 219 | + SliverGridDelegateWithFixedCrossAxisCount( | ||
| 220 | + crossAxisCount: 3, childAspectRatio: 0.8), | ||
| 221 | + itemBuilder: (context, index) { | ||
| 222 | + return TableItem( | ||
| 223 | + areaTableMap[currentArea][index], | ||
| 224 | + onSelected: (table) { | ||
| 225 | + if ((table as t.Table).selected) { | ||
| 226 | + selectTables.add(table); | ||
| 227 | + Map<String, dynamic> temp = | ||
| 228 | + modelToJson(table); | ||
| 229 | + TableList tableList = | ||
| 230 | + TableList.fromJson(temp); | ||
| 231 | + widget.tableList.add(tableList); | ||
| 232 | + } else { | ||
| 233 | + widget.tableList | ||
| 234 | + .removeWhere((t) => t.id == table.id); | ||
| 235 | + selectTables | ||
| 236 | + .removeWhere((t) => t.id == table.id); | ||
| 237 | + } | ||
| 238 | + }, | ||
| 239 | + canSelected: true, | ||
| 240 | + canChoose: widget.canChoose, | ||
| 241 | + ); | ||
| 242 | + }, | ||
| 243 | + itemCount: areaTableMap[currentArea].length, | ||
| 244 | + ), | ||
| 245 | + ), | ||
| 246 | + ) | ||
| 247 | + ], | ||
| 248 | + ), | ||
| 179 | ), | 249 | ), |
| 180 | - Expanded( | ||
| 181 | - child: Padding(padding: EdgeInsets.symmetric(vertical: ScreenUtil().setHeight(10),horizontal: ScreenUtil().setWidth(9)),child: GridView.builder(gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: 3,childAspectRatio: 0.8),itemBuilder: (context,index){ | ||
| 182 | - return TableItem(areaTableMap[currentArea][index],onSelected:(table){ | ||
| 183 | - if((table as t.Table).selected){ | ||
| 184 | - selectTables.add(table); | ||
| 185 | - }else{ | ||
| 186 | - selectTables.removeWhere((t)=>t.id==table.id); | 250 | + ), |
| 251 | + Container( | ||
| 252 | + width: double.infinity, | ||
| 253 | + height: ScreenUtil().setHeight(100), | ||
| 254 | + alignment: Alignment.center, | ||
| 255 | + decoration: BoxDecoration( | ||
| 256 | + color: MyColours.color_ffffff, | ||
| 257 | + border: Border( | ||
| 258 | + top: BorderSide( | ||
| 259 | + color: MyColours.color_bfbfbf, | ||
| 260 | + width: ScreenUtil().setHeight(1)))), | ||
| 261 | + child: CommonButton( | ||
| 262 | + content: "确定", | ||
| 263 | + width: 600, | ||
| 264 | + height: 76, | ||
| 265 | + fontSize: 34, | ||
| 266 | + state: 1, | ||
| 267 | + onPress: () { | ||
| 268 | + if (selectTables.length > 0) { | ||
| 269 | + String tid = ""; | ||
| 270 | + for (t.Table table in selectTables) { | ||
| 271 | + tid += table.id + ","; | ||
| 272 | + } | ||
| 273 | + tid = tid.substring(0, tid.length - 1); | ||
| 274 | + Map temp = {'object': widget.tableList, 'tid': tid}; | ||
| 275 | + Navigator.of(context).pop(temp); | ||
| 187 | } | 276 | } |
| 188 | - },canSelected: true,); | ||
| 189 | - },itemCount: areaTableMap[currentArea].length,),), | ||
| 190 | - ) | ||
| 191 | - ], | ||
| 192 | - ), | ||
| 193 | - ), | ||
| 194 | - ), | ||
| 195 | - Container( | ||
| 196 | - width: double.infinity, | ||
| 197 | - height: ScreenUtil().setHeight(100), | ||
| 198 | - alignment: Alignment.center, | ||
| 199 | - decoration: BoxDecoration( | ||
| 200 | - color: MyColours.color_ffffff, | ||
| 201 | - border: Border(top: BorderSide(color: MyColours.color_bfbfbf,width: ScreenUtil().setHeight(1))) | 277 | + }, |
| 278 | + )) | ||
| 279 | + ], | ||
| 202 | ), | 280 | ), |
| 203 | - child: CommonButton( | ||
| 204 | - content: "确定", | ||
| 205 | - width: 600, | ||
| 206 | - height: 76, | ||
| 207 | - fontSize: 34, | ||
| 208 | - state: 1, | ||
| 209 | - onPress: (){ | ||
| 210 | - if(selectTables.length>0){ | ||
| 211 | - String tid=""; | ||
| 212 | - for(t.Table table in selectTables){ | ||
| 213 | - tid+=table.id+","; | ||
| 214 | - } | ||
| 215 | - tid=tid.substring(0,tid.length-1); | ||
| 216 | - Navigator.of(context).pop(tid); | ||
| 217 | - } | ||
| 218 | - }, | ||
| 219 | - ) | ||
| 220 | - ) | ||
| 221 | - ], | ||
| 222 | - ), | ||
| 223 | ); | 281 | ); |
| 224 | } | 282 | } |
| 283 | + | ||
| 284 | + modelToJson(t.Table table) { | ||
| 285 | + Map res = { | ||
| 286 | + 'id': table.id, | ||
| 287 | + 'rid': table.rid, | ||
| 288 | + 'tid': table.tid, | ||
| 289 | + 'name': table.name, | ||
| 290 | + 'tablePnum': table.table_pnum, | ||
| 291 | + 'sellerid': null, | ||
| 292 | + 'qrcode': null, | ||
| 293 | + 'mostPnum': table.most_pnum, | ||
| 294 | + 'hot': null, | ||
| 295 | + 'orderO': table.order_o, | ||
| 296 | + 'status': table.status, | ||
| 297 | + 'enable': table.enable, | ||
| 298 | + 'spell': table.spell, | ||
| 299 | + 'cdate': null, | ||
| 300 | + 'rname': table.rname, | ||
| 301 | + 'regionName': null | ||
| 302 | + }; | ||
| 303 | + return res; | ||
| 304 | + } | ||
| 225 | } | 305 | } |
lib/provider/choose_table_model.dart
0 → 100644
| @@ -2,6 +2,7 @@ import 'package:common_utils/common_utils.dart'; | @@ -2,6 +2,7 @@ import 'package:common_utils/common_utils.dart'; | ||
| 2 | import 'package:flutter/material.dart'; | 2 | import 'package:flutter/material.dart'; |
| 3 | import 'package:one_key/constant/constant.dart'; | 3 | import 'package:one_key/constant/constant.dart'; |
| 4 | import 'package:one_key/models/notebook_detail.dart'; | 4 | import 'package:one_key/models/notebook_detail.dart'; |
| 5 | +import 'package:one_key/models/reserve_info_model.dart'; | ||
| 5 | import 'package:one_key/models/seller_info.dart'; | 6 | import 'package:one_key/models/seller_info.dart'; |
| 6 | import 'package:one_key/models/table_list.dart'; | 7 | import 'package:one_key/models/table_list.dart'; |
| 7 | import 'package:one_key/net/base_resp.dart'; | 8 | import 'package:one_key/net/base_resp.dart'; |
| @@ -25,14 +26,32 @@ class NotebookDetailChangeModel with ChangeNotifier { | @@ -25,14 +26,32 @@ class NotebookDetailChangeModel with ChangeNotifier { | ||
| 25 | String ddateStr = ''; //16:30 | 26 | String ddateStr = ''; //16:30 |
| 26 | NotebookDetail detailEntity; | 27 | NotebookDetail detailEntity; |
| 27 | List<TableList> tableList = []; | 28 | List<TableList> tableList = []; |
| 29 | + String isSetDate = '0'; | ||
| 30 | + | ||
| 31 | + clearData() { | ||
| 32 | + dateList = []; //日期选择 月-日 某天 | ||
| 33 | + sunDateList = []; // 早市、午市、晚市 | ||
| 34 | + personNumList = []; // 人数 | ||
| 35 | + numController = TextEditingController(); //人数 | ||
| 36 | + phoneController = TextEditingController(); //电话 | ||
| 37 | + nameController = TextEditingController(); //客户姓名 | ||
| 38 | + customController = TextEditingController(); //客户要求 | ||
| 39 | + sexList = []; // 先生、女士、公司 | ||
| 40 | + dailyMap = {}; // 早市对应半点钟,午市对应半点钟、晚市对应半点钟 | ||
| 41 | + ddateStr = ''; //16:30 | ||
| 42 | + tableList = []; | ||
| 43 | + isSetDate = '0'; | ||
| 44 | + } | ||
| 45 | + | ||
| 28 | //构造函数,初始化 | 46 | //构造函数,初始化 |
| 29 | NotebookDetailChangeModel(this.detailEntity) { | 47 | NotebookDetailChangeModel(this.detailEntity) { |
| 48 | + // clearData(); | ||
| 30 | print(detailEntity); | 49 | print(detailEntity); |
| 31 | if (detailEntity.phone != '0') { | 50 | if (detailEntity.phone != '0') { |
| 32 | phoneController.text = detailEntity.phone; | 51 | phoneController.text = detailEntity.phone; |
| 33 | } | 52 | } |
| 34 | if (detailEntity.rnameStr != '') { | 53 | if (detailEntity.rnameStr != '') { |
| 35 | - nameController.text = detailEntity.rnameStr; | 54 | + nameController.text = detailEntity.rname; |
| 36 | } | 55 | } |
| 37 | if (detailEntity.cusdem != '') { | 56 | if (detailEntity.cusdem != '') { |
| 38 | customController.text = detailEntity.cusdem; | 57 | customController.text = detailEntity.cusdem; |
| @@ -326,15 +345,15 @@ class NotebookDetailChangeModel with ChangeNotifier { | @@ -326,15 +345,15 @@ class NotebookDetailChangeModel with ChangeNotifier { | ||
| 326 | 345 | ||
| 327 | ///根据商家ID 获取桌位信息列表: 1:散座 2:包间 默认:获取所有数据 | 346 | ///根据商家ID 获取桌位信息列表: 1:散座 2:包间 默认:获取所有数据 |
| 328 | Future<List<TableListSunModel>> getNewTableList(BuildContext context) async { | 347 | Future<List<TableListSunModel>> getNewTableList(BuildContext context) async { |
| 329 | - // String createtime = detailEntity.ddate.toString() + '000'; | ||
| 330 | - // DateTime createTime = | ||
| 331 | - // DateTime.fromMillisecondsSinceEpoch(int.parse(createtime)); | ||
| 332 | - // String rdate = DateUtil.formatDate(createTime, format: "yyyyMMdd"); | 348 | + String createtime = detailEntity.ddate.toString() + '000'; |
| 349 | + DateTime createTime = | ||
| 350 | + DateTime.fromMillisecondsSinceEpoch(int.parse(createtime)); | ||
| 351 | + String rdate = DateUtil.formatDate(createTime, format: "yyyyMMdd"); | ||
| 333 | UserModel userModel = Provider.of<UserModel>(context, listen: false); | 352 | UserModel userModel = Provider.of<UserModel>(context, listen: false); |
| 334 | Map<String, String> params = { | 353 | Map<String, String> params = { |
| 335 | "sid": userModel.user.sellerid, | 354 | "sid": userModel.user.sellerid, |
| 336 | "rid": detailEntity.id, | 355 | "rid": detailEntity.id, |
| 337 | - "rdate": _getRdate(), | 356 | + "rdate": rdate, |
| 338 | 'ddate_solt': detailEntity.ddate_solt | 357 | 'ddate_solt': detailEntity.ddate_solt |
| 339 | }; | 358 | }; |
| 340 | BaseResp<dynamic> baseResp = await DioUtil() | 359 | BaseResp<dynamic> baseResp = await DioUtil() |
| @@ -355,23 +374,35 @@ class NotebookDetailChangeModel with ChangeNotifier { | @@ -355,23 +374,35 @@ class NotebookDetailChangeModel with ChangeNotifier { | ||
| 355 | } else { | 374 | } else { |
| 356 | Utils.showToast(baseResp.msg ?? ""); | 375 | Utils.showToast(baseResp.msg ?? ""); |
| 357 | } | 376 | } |
| 377 | + tableList = []; | ||
| 378 | + for (int i = 0; i < itemModelList.length; i++) { | ||
| 379 | + if (itemModelList[i].name == "推荐") { | ||
| 380 | + itemModelList.removeAt(i); | ||
| 381 | + } | ||
| 382 | + } | ||
| 358 | for (TableListSunModel item in itemModelList) { | 383 | for (TableListSunModel item in itemModelList) { |
| 384 | + if (item.name == "推荐") { | ||
| 385 | + itemModelList.remove(item); | ||
| 386 | + } | ||
| 359 | for (var item in item.list) { | 387 | for (var item in item.list) { |
| 360 | for (var table in detailEntity.tables) { | 388 | for (var table in detailEntity.tables) { |
| 361 | if (item.id == table.id) { | 389 | if (item.id == table.id) { |
| 362 | item.selected = true; | 390 | item.selected = true; |
| 363 | - tableList.add(item); | 391 | + if (!tableList.contains(item)) { |
| 392 | + tableList.add(item); | ||
| 393 | + } | ||
| 364 | } | 394 | } |
| 365 | } | 395 | } |
| 366 | } | 396 | } |
| 367 | } | 397 | } |
| 398 | + print(tableList); | ||
| 368 | notifyListeners(); | 399 | notifyListeners(); |
| 369 | return itemModelList; | 400 | return itemModelList; |
| 370 | } | 401 | } |
| 371 | } | 402 | } |
| 372 | 403 | ||
| 373 | ///录入顾客订座相关信息,同时更新商家桌位状态 | 404 | ///录入顾客订座相关信息,同时更新商家桌位状态 |
| 374 | - Future<SunSellerInfoModel> setReserveInfo(BuildContext context) async { | 405 | + Future<SunReserveInfoModel> setReserveInfo(BuildContext context) async { |
| 375 | UserModel userModel = Provider.of<UserModel>(context, listen: false); | 406 | UserModel userModel = Provider.of<UserModel>(context, listen: false); |
| 376 | String pnum = '6'; | 407 | String pnum = '6'; |
| 377 | for (var item in personNumList) { | 408 | for (var item in personNumList) { |
| @@ -385,8 +416,21 @@ class NotebookDetailChangeModel with ChangeNotifier { | @@ -385,8 +416,21 @@ class NotebookDetailChangeModel with ChangeNotifier { | ||
| 385 | sex = item['code']; | 416 | sex = item['code']; |
| 386 | } | 417 | } |
| 387 | } | 418 | } |
| 388 | - String tempDdate = _getRdate() + ' ' + ddateStr + ':00'; | ||
| 389 | - int ddate = DateUtil.getDateMsByTimeStr(tempDdate); | 419 | + //当前选中 月 日string |
| 420 | + String mdStr = ''; | ||
| 421 | + //今天 明天 其他天 | ||
| 422 | + for (var item in dateList) { | ||
| 423 | + if (item['select'] == true) { | ||
| 424 | + mdStr = item['title']; | ||
| 425 | + } | ||
| 426 | + } | ||
| 427 | + String timeNowYear = DateUtil.formatDate(DateTime.now(), format: 'yyyy'); | ||
| 428 | + String ymyStr = timeNowYear + '-' + mdStr; //年月日 | ||
| 429 | + String timeStr = ymyStr + ' ' + ddateStr + ':00'; | ||
| 430 | + // int start = DateUtil.getDateMsByTimeStr(timeStr); | ||
| 431 | + | ||
| 432 | + // String tempDdate = ymyStr + ' ' + ddateStr + ':00'; | ||
| 433 | + int ddate = DateUtil.getDateMsByTimeStr(timeStr); | ||
| 390 | String tableSelectInfo = ''; | 434 | String tableSelectInfo = ''; |
| 391 | for (TableList item in tableList) { | 435 | for (TableList item in tableList) { |
| 392 | if (item.selected) { | 436 | if (item.selected) { |
| @@ -399,23 +443,34 @@ class NotebookDetailChangeModel with ChangeNotifier { | @@ -399,23 +443,34 @@ class NotebookDetailChangeModel with ChangeNotifier { | ||
| 399 | } | 443 | } |
| 400 | print(tableSelectInfo); | 444 | print(tableSelectInfo); |
| 401 | String rdate = ''; | 445 | String rdate = ''; |
| 446 | + String ddateSolt = ''; | ||
| 447 | + print(sunDateList); | ||
| 402 | for (var item in sunDateList) { | 448 | for (var item in sunDateList) { |
| 403 | if (item['isSelect'] == true) { | 449 | if (item['isSelect'] == true) { |
| 450 | + String keys = ''; | ||
| 451 | + ddateSolt = '${item['ddateSolt']}'; | ||
| 404 | if (item['ddateSolt'] == 1) { | 452 | if (item['ddateSolt'] == 1) { |
| 405 | //早市 | 453 | //早市 |
| 406 | - List morning = dailyMap['morning']; | ||
| 407 | - String start = ddateStr; | ||
| 408 | - String end = morning.last; | 454 | + keys = 'morning'; |
| 409 | } else if (item['ddateSolt'] == 2) { | 455 | } else if (item['ddateSolt'] == 2) { |
| 410 | //午市 | 456 | //午市 |
| 411 | - List noon = dailyMap['noon']; | 457 | + keys = 'noon'; |
| 412 | } else if (item['ddateSolt'] == 3) { | 458 | } else if (item['ddateSolt'] == 3) { |
| 413 | //晚市 | 459 | //晚市 |
| 414 | - List night = dailyMap['night']; | 460 | + keys = 'night'; |
| 461 | + } | ||
| 462 | + if (keys != '') { | ||
| 463 | + String start = '${ddate}'.substring(0, 10); | ||
| 464 | + List temp = dailyMap[keys]; | ||
| 465 | + String timeStrEnd = ymyStr + ' ' + temp.last['title'] + ':00'; | ||
| 466 | + int endM = DateUtil.getDateMsByTimeStr(timeStrEnd); | ||
| 467 | + String end = '${endM}'.substring(0, 10); | ||
| 468 | + rdate = start + '-' + end; | ||
| 415 | } | 469 | } |
| 416 | } | 470 | } |
| 417 | } | 471 | } |
| 418 | Map<String, String> params = { | 472 | Map<String, String> params = { |
| 473 | + 'is_set_ddate': isSetDate, | ||
| 419 | "rid": detailEntity.id, //变更订单必传预定ID | 474 | "rid": detailEntity.id, //变更订单必传预定ID |
| 420 | "sid": userModel.user.sellerid, //商家ID | 475 | "sid": userModel.user.sellerid, //商家ID |
| 421 | "tid": tableSelectInfo, //桌子ID: 格式 2,3,4 | 476 | "tid": tableSelectInfo, //桌子ID: 格式 2,3,4 |
| @@ -424,38 +479,32 @@ class NotebookDetailChangeModel with ChangeNotifier { | @@ -424,38 +479,32 @@ class NotebookDetailChangeModel with ChangeNotifier { | ||
| 424 | "sex": sex, //预订人姓名:1:男 2:女 | 479 | "sex": sex, //预订人姓名:1:男 2:女 |
| 425 | "phone": phoneController.text, //预订人电话 | 480 | "phone": phoneController.text, //预订人电话 |
| 426 | "cusdem": customController.text, //预订人需求:25汉字 | 481 | "cusdem": customController.text, //预订人需求:25汉字 |
| 427 | - "rdate": _getRdate(), //预定用餐时间范围:时间戳 开始时间戳(time)-结束时间戳(time) | ||
| 428 | - "ddate": '${ddate / 1000}', //到店时间 | 482 | + "rdate": rdate, //预定用餐时间范围:时间戳 开始时间戳(time)-结束时间戳(time) |
| 483 | + "ddate": '${ddate}'.substring(0, 10), //到店时间 | ||
| 484 | + "ddate_solt": ddateSolt | ||
| 429 | }; | 485 | }; |
| 430 | print(params); | 486 | print(params); |
| 431 | - // BaseResp<Map<String, dynamic>> baseResp = await DioUtil() | ||
| 432 | - // .request<Map<String, dynamic>>(context, Method.get, HttpUrl.sellerinfo, | ||
| 433 | - // data: params) | ||
| 434 | - // .catchError((error) { | ||
| 435 | - // print(error.toString()); | ||
| 436 | - // }); | ||
| 437 | - // SunSellerInfoModel itemModel; | ||
| 438 | - // if (baseResp == null) return itemModel; | ||
| 439 | - // if (baseResp.code == Constant.status_success) { | ||
| 440 | - // if (int.parse(baseResp.status) != Constant.status_success) { | ||
| 441 | - // Utils.showToast(baseResp.msg ?? ""); | ||
| 442 | - // return itemModel; | ||
| 443 | - // } | ||
| 444 | - // if (baseResp.responseData['data'] != null) { | ||
| 445 | - // itemModel = SellerInfoModel.fromJson(baseResp.responseData).data; | ||
| 446 | - // } else { | ||
| 447 | - // Utils.showToast(baseResp.msg ?? ""); | ||
| 448 | - // } | ||
| 449 | - // return itemModel; | ||
| 450 | - // } | ||
| 451 | - } | ||
| 452 | - | ||
| 453 | -//rdate字段值获取 | ||
| 454 | - _getRdate() { | ||
| 455 | - String createtime = detailEntity.ddate.toString() + '000'; | ||
| 456 | - DateTime createTime = | ||
| 457 | - DateTime.fromMillisecondsSinceEpoch(int.parse(createtime)); | ||
| 458 | - String rdate = DateUtil.formatDate(createTime, format: "yyyyMMdd"); | ||
| 459 | - return rdate; | 487 | + BaseResp<Map<String, dynamic>> baseResp = await DioUtil() |
| 488 | + .request<Map<String, dynamic>>( | ||
| 489 | + context, Method.get, HttpUrl.set_reserve_info, | ||
| 490 | + data: params) | ||
| 491 | + .catchError((error) { | ||
| 492 | + print(error.toString()); | ||
| 493 | + }); | ||
| 494 | + SunReserveInfoModel itemModel; | ||
| 495 | + if (baseResp == null) return itemModel; | ||
| 496 | + if (baseResp.code == Constant.status_success) { | ||
| 497 | + if (int.parse(baseResp.status) != Constant.status_success) { | ||
| 498 | + Utils.showToast(baseResp.msg ?? ""); | ||
| 499 | + return itemModel; | ||
| 500 | + } | ||
| 501 | + if (baseResp.responseData['data'] != null && | ||
| 502 | + baseResp.responseData['data']['row'] != null) { | ||
| 503 | + itemModel = ReserveInfoModel.fromJson(baseResp.responseData).data; | ||
| 504 | + } else { | ||
| 505 | + Utils.showToast(baseResp.msg ?? "变更预订失败,请重试"); | ||
| 506 | + } | ||
| 507 | + return itemModel; | ||
| 508 | + } | ||
| 460 | } | 509 | } |
| 461 | } | 510 | } |
| @@ -4,6 +4,7 @@ import 'package:fluro/fluro.dart'; | @@ -4,6 +4,7 @@ import 'package:fluro/fluro.dart'; | ||
| 4 | import 'package:flutter/material.dart'; | 4 | import 'package:flutter/material.dart'; |
| 5 | import 'package:one_key/models/notebook.dart'; | 5 | import 'package:one_key/models/notebook.dart'; |
| 6 | import 'package:one_key/models/notebook_detail.dart'; | 6 | import 'package:one_key/models/notebook_detail.dart'; |
| 7 | +import 'package:one_key/models/table_list.dart'; | ||
| 7 | import 'package:one_key/pages/detail/notebook_detail_change_page.dart'; | 8 | import 'package:one_key/pages/detail/notebook_detail_change_page.dart'; |
| 8 | import 'package:one_key/pages/home/home_page.dart'; | 9 | import 'package:one_key/pages/home/home_page.dart'; |
| 9 | import 'package:one_key/pages/invicate/invitation_page.dart'; | 10 | import 'package:one_key/pages/invicate/invitation_page.dart'; |
| @@ -14,6 +15,7 @@ import 'package:one_key/pages/login/web_page.dart'; | @@ -14,6 +15,7 @@ import 'package:one_key/pages/login/web_page.dart'; | ||
| 14 | import 'package:one_key/pages/sms/sms_page.dart'; | 15 | import 'package:one_key/pages/sms/sms_page.dart'; |
| 15 | import 'package:one_key/pages/table/select_table_page.dart'; | 16 | import 'package:one_key/pages/table/select_table_page.dart'; |
| 16 | import 'package:one_key/pages/webview/webview_page.dart'; | 17 | import 'package:one_key/pages/webview/webview_page.dart'; |
| 18 | +import 'package:one_key/provider/choose_table_model.dart'; | ||
| 17 | import 'package:one_key/provider/notebook_detail_change_model.dart'; | 19 | import 'package:one_key/provider/notebook_detail_change_model.dart'; |
| 18 | import 'package:one_key/utils/fluro_convert_utils.dart'; | 20 | import 'package:one_key/utils/fluro_convert_utils.dart'; |
| 19 | import 'package:one_key/utils/log_util.dart'; | 21 | import 'package:one_key/utils/log_util.dart'; |
| @@ -56,7 +58,19 @@ var handleSelectTableHandler = new Handler( | @@ -56,7 +58,19 @@ var handleSelectTableHandler = new Handler( | ||
| 56 | DateTime dateTime = | 58 | DateTime dateTime = |
| 57 | DateTime.fromMillisecondsSinceEpoch(int.parse(params["dateTime"].first)); | 59 | DateTime.fromMillisecondsSinceEpoch(int.parse(params["dateTime"].first)); |
| 58 | String ddate_slot = params["ddate_slot"].first; | 60 | String ddate_slot = params["ddate_slot"].first; |
| 59 | - return SelectTablePage(rid, dateTime, ddate_slot); | 61 | + bool canChoose = params["canChoose"].first == "true" ? true : false; |
| 62 | + Map object = FluroConvertUtils.string2map(params["object"].first); | ||
| 63 | + List temp = object['object']; | ||
| 64 | + List<TableList> res = []; | ||
| 65 | + for (var item in temp) { | ||
| 66 | + res.add(TableList.fromJson(item)); | ||
| 67 | + } | ||
| 68 | + | ||
| 69 | + // return SelectTablePage(rid, dateTime, ddate_slot,canChoose: canChoose); | ||
| 70 | + return ChangeNotifierProvider<ChooseTableModel>( | ||
| 71 | + create: (_) => ChooseTableModel(), | ||
| 72 | + child: SelectTablePage(rid, dateTime, ddate_slot, | ||
| 73 | + canChoose: canChoose, tableList: res)); | ||
| 60 | }); | 74 | }); |
| 61 | 75 | ||
| 62 | // 跳转到邀请函页面 | 76 | // 跳转到邀请函页面 |
| @@ -102,5 +116,5 @@ var handleChangeDetailHandler = new Handler( | @@ -102,5 +116,5 @@ var handleChangeDetailHandler = new Handler( | ||
| 102 | String rid = params['rid'].first; | 116 | String rid = params['rid'].first; |
| 103 | return ChangeNotifierProvider<NotebookDetailChangeModel>( | 117 | return ChangeNotifierProvider<NotebookDetailChangeModel>( |
| 104 | create: (_) => NotebookDetailChangeModel(detailEntity), | 118 | create: (_) => NotebookDetailChangeModel(detailEntity), |
| 105 | - child: NoteBookChangePage(detailEntity: detailEntity,rid: rid)); | 119 | + child: NoteBookChangePage(detailEntity: detailEntity, rid: rid)); |
| 106 | }); | 120 | }); |
| 1 | import 'dart:convert'; | 1 | import 'dart:convert'; |
| 2 | 2 | ||
| 3 | +import 'package:one_key/models/table_list.dart'; | ||
| 4 | + | ||
| 3 | /// fluro 参数编码解码工具类 | 5 | /// fluro 参数编码解码工具类 |
| 4 | class FluroConvertUtils { | 6 | class FluroConvertUtils { |
| 5 | /// fluro 传递中文参数前,先转换,fluro 不支持中文传递 | 7 | /// fluro 传递中文参数前,先转换,fluro 不支持中文传递 |
| @@ -45,4 +47,9 @@ class FluroConvertUtils { | @@ -45,4 +47,9 @@ class FluroConvertUtils { | ||
| 45 | static Map<String, dynamic> string2map(String str) { | 47 | static Map<String, dynamic> string2map(String str) { |
| 46 | return json.decode(fluroCnParamsDecode(str)); | 48 | return json.decode(fluroCnParamsDecode(str)); |
| 47 | } | 49 | } |
| 50 | + | ||
| 51 | + /// string json 转为 map | ||
| 52 | + static Map<String, List<TableList>> string2mapTableList(String str) { | ||
| 53 | + return json.decode(fluroCnParamsDecode(str)); | ||
| 54 | + } | ||
| 48 | } | 55 | } |
| @@ -2,6 +2,7 @@ import 'package:fluro/fluro.dart'; | @@ -2,6 +2,7 @@ import 'package:fluro/fluro.dart'; | ||
| 2 | import 'package:flutter/material.dart'; | 2 | import 'package:flutter/material.dart'; |
| 3 | import 'package:one_key/models/notebook.dart'; | 3 | import 'package:one_key/models/notebook.dart'; |
| 4 | import 'package:one_key/models/notebook_detail.dart'; | 4 | import 'package:one_key/models/notebook_detail.dart'; |
| 5 | +import 'package:one_key/models/table_list.dart'; | ||
| 5 | import 'package:one_key/res/colors.dart'; | 6 | import 'package:one_key/res/colors.dart'; |
| 6 | import 'package:one_key/route/routes.dart'; | 7 | import 'package:one_key/route/routes.dart'; |
| 7 | import 'package:one_key/utils/fluro_convert_utils.dart'; | 8 | import 'package:one_key/utils/fluro_convert_utils.dart'; |
| @@ -31,40 +32,53 @@ class NavigatorUtil { | @@ -31,40 +32,53 @@ class NavigatorUtil { | ||
| 31 | } | 32 | } |
| 32 | 33 | ||
| 33 | /// 首页 | 34 | /// 首页 |
| 34 | - static void goHomePage(BuildContext context,{int initialIndex=1}) { | ||
| 35 | - _navigateTo(context, "${Routes.home}?initialIndex=$initialIndex", clearStack: true); | 35 | + static void goHomePage(BuildContext context, {int initialIndex = 1}) { |
| 36 | + _navigateTo(context, "${Routes.home}?initialIndex=$initialIndex", | ||
| 37 | + clearStack: true); | ||
| 36 | } | 38 | } |
| 37 | 39 | ||
| 38 | /// 订单详情 | 40 | /// 订单详情 |
| 39 | - static void goNotebookDetailPage(BuildContext context,String rid,{replace=false}) { | ||
| 40 | - _navigateTo(context,"${Routes.reserve_detail}?rid=$rid",replace: replace); | 41 | + static void goNotebookDetailPage(BuildContext context, String rid, |
| 42 | + {replace = false}) { | ||
| 43 | + _navigateTo(context, "${Routes.reserve_detail}?rid=$rid", replace: replace); | ||
| 41 | } | 44 | } |
| 42 | 45 | ||
| 43 | /// 处理在线预订 | 46 | /// 处理在线预订 |
| 44 | - static void goHandleOnlinePage(BuildContext context,String rid,String mid,{replace=false}) { | ||
| 45 | - _navigateTo(context,"${Routes.handle_online_page}?rid=$rid&mid=$mid",replace: replace); | 47 | + static void goHandleOnlinePage(BuildContext context, String rid, String mid, |
| 48 | + {replace = false}) { | ||
| 49 | + _navigateTo(context, "${Routes.handle_online_page}?rid=$rid&mid=$mid", | ||
| 50 | + replace: replace); | ||
| 46 | } | 51 | } |
| 47 | 52 | ||
| 48 | /// 选择桌位 | 53 | /// 选择桌位 |
| 49 | - static Future goSelectTablePage(BuildContext context,String rid,int dateTime,String ddate_slot) { | ||
| 50 | - return _navigateTo(context,"${Routes.select_table}?rid=$rid&dateTime=$dateTime&ddate_slot=$ddate_slot"); | 54 | + static Future goSelectTablePage( |
| 55 | + BuildContext context, String rid, int dateTime, String ddate_slot, | ||
| 56 | + {bool canChoose = false, Map object}) { | ||
| 57 | + return _navigateTo(context, | ||
| 58 | + "${Routes.select_table}?rid=$rid&dateTime=$dateTime&ddate_slot=$ddate_slot&canChoose=$canChoose&object=${FluroConvertUtils.object2string(object)}"); | ||
| 51 | } | 59 | } |
| 52 | 60 | ||
| 53 | /// 邀请函 | 61 | /// 邀请函 |
| 54 | - static void goInvicationPage(BuildContext context,String rid,String tableInfo,String ddate,String ddateStr) { | ||
| 55 | - _navigateTo(context,"${Routes.invication}?rid=$rid&tableInfo=${FluroConvertUtils.fluroCnParamsEncode(tableInfo)}&ddate=$ddate&ddateStr=${FluroConvertUtils.fluroCnParamsEncode(ddateStr)}"); | 62 | + static void goInvicationPage(BuildContext context, String rid, |
| 63 | + String tableInfo, String ddate, String ddateStr, | ||
| 64 | + {bool replace = false}) { | ||
| 65 | + _navigateTo(context, | ||
| 66 | + "${Routes.invication}?rid=$rid&tableInfo=${FluroConvertUtils.fluroCnParamsEncode(tableInfo)}&ddate=$ddate&ddateStr=${FluroConvertUtils.fluroCnParamsEncode(ddateStr)}", | ||
| 67 | + replace: replace); | ||
| 56 | } | 68 | } |
| 57 | 69 | ||
| 58 | /// 发短信 | 70 | /// 发短信 |
| 59 | - static void goSmsPage(BuildContext context,String rid) { | ||
| 60 | - _navigateTo(context,"${Routes.sms}?rid=$rid"); | 71 | + static void goSmsPage(BuildContext context, String rid) { |
| 72 | + _navigateTo(context, "${Routes.sms}?rid=$rid"); | ||
| 61 | } | 73 | } |
| 62 | 74 | ||
| 63 | /// 浏览器 | 75 | /// 浏览器 |
| 64 | static void goWebviewPage(BuildContext context) { | 76 | static void goWebviewPage(BuildContext context) { |
| 65 | - _navigateTo(context,"${Routes.webview}"); | 77 | + _navigateTo(context, "${Routes.webview}"); |
| 66 | } | 78 | } |
| 67 | 79 | ||
| 80 | + | ||
| 81 | + | ||
| 68 | ///协议 | 82 | ///协议 |
| 69 | static Future<dynamic> goWebPage( | 83 | static Future<dynamic> goWebPage( |
| 70 | BuildContext context, String title, String url) { | 84 | BuildContext context, String title, String url) { |
| @@ -73,8 +87,21 @@ class NavigatorUtil { | @@ -73,8 +87,21 @@ class NavigatorUtil { | ||
| 73 | "${Routes.web_page}?title=${Uri.encodeComponent(title)}&url=$url", | 87 | "${Routes.web_page}?title=${Uri.encodeComponent(title)}&url=$url", |
| 74 | ); | 88 | ); |
| 75 | } | 89 | } |
| 76 | - /// 变更预订 | ||
| 77 | - static void goNoteBookChangePage(BuildContext context,NotebookDetail detailEntity,String rid,{replace=false}) { | ||
| 78 | - _navigateTo(context,"${Routes.change_detail}?detail=${FluroConvertUtils.object2string(detailEntity)}&rid=$rid",replace: replace); | 90 | + |
| 91 | + /// 变更预订 | ||
| 92 | + static void goNoteBookChangePage( | ||
| 93 | + BuildContext context, NotebookDetail detailEntity, String rid, | ||
| 94 | + {replace = false}) { | ||
| 95 | + _navigateTo(context, | ||
| 96 | + "${Routes.change_detail}?detail=${FluroConvertUtils.object2string(detailEntity)}&rid=$rid", | ||
| 97 | + replace: replace); | ||
| 79 | } | 98 | } |
| 99 | + // /// 变更预订 | ||
| 100 | + // static void goNoteBookChangePage( | ||
| 101 | + // BuildContext context, NotebookDetail detailEntity, String rid, | ||
| 102 | + // {replace = false}) { | ||
| 103 | + // _navigateTo(context, | ||
| 104 | + // "${Routes.change_detail}?detail=${FluroConvertUtils.object2string(detailEntity)}&rid=$rid", | ||
| 105 | + // replace: replace); | ||
| 106 | + // } | ||
| 80 | } | 107 | } |
| @@ -5,15 +5,19 @@ import 'package:one_key/res/colors.dart'; | @@ -5,15 +5,19 @@ import 'package:one_key/res/colors.dart'; | ||
| 5 | import 'package:one_key/models/table_list.dart' as t; | 5 | import 'package:one_key/models/table_list.dart' as t; |
| 6 | import 'package:one_key/widgets/v_empty_view.dart'; | 6 | import 'package:one_key/widgets/v_empty_view.dart'; |
| 7 | 7 | ||
| 8 | -class NewTableItem extends StatefulWidget{ | ||
| 9 | - | 8 | +class NewTableItem extends StatefulWidget { |
| 10 | final t.TableList table; | 9 | final t.TableList table; |
| 11 | - final bool canSelected;//是否能选中 | 10 | + final bool canSelected; //是否能选中 |
| 12 | final ValueChanged onSelected; | 11 | final ValueChanged onSelected; |
| 13 | - | ||
| 14 | - final int height;//高度 | 12 | + final bool isRegionName; |
| 13 | + | ||
| 14 | + final int height; //高度 | ||
| 15 | 15 | ||
| 16 | - NewTableItem(this.table,{this.onSelected,this.canSelected=false,this.height=183}); | 16 | + NewTableItem(this.table, |
| 17 | + {this.onSelected, | ||
| 18 | + this.canSelected = false, | ||
| 19 | + this.height = 183, | ||
| 20 | + this.isRegionName = false}); | ||
| 17 | 21 | ||
| 18 | @override | 22 | @override |
| 19 | State<StatefulWidget> createState() { | 23 | State<StatefulWidget> createState() { |
| @@ -22,19 +26,18 @@ class NewTableItem extends StatefulWidget{ | @@ -22,19 +26,18 @@ class NewTableItem extends StatefulWidget{ | ||
| 22 | } | 26 | } |
| 23 | } | 27 | } |
| 24 | 28 | ||
| 25 | -class NewTableItemState extends State<NewTableItem>{ | ||
| 26 | - | 29 | +class NewTableItemState extends State<NewTableItem> { |
| 27 | @override | 30 | @override |
| 28 | Widget build(BuildContext context) { | 31 | Widget build(BuildContext context) { |
| 29 | // TODO: implement build | 32 | // TODO: implement build |
| 30 | 33 | ||
| 31 | - t.TableList table=widget.table; | 34 | + t.TableList table = widget.table; |
| 32 | 35 | ||
| 33 | return GestureDetector( | 36 | return GestureDetector( |
| 34 | - onTap: (){ | ||
| 35 | - if(widget.canSelected&&table.signStr.isEmpty){ | 37 | + onTap: () { |
| 38 | + if (widget.canSelected && table.signStr.isEmpty) { | ||
| 36 | setState(() { | 39 | setState(() { |
| 37 | - table.selected=!(table.selected??false); | 40 | + table.selected = !(table.selected ?? false); |
| 38 | }); | 41 | }); |
| 39 | widget.onSelected(table); | 42 | widget.onSelected(table); |
| 40 | } | 43 | } |
| @@ -44,27 +47,39 @@ class NewTableItemState extends State<NewTableItem>{ | @@ -44,27 +47,39 @@ class NewTableItemState extends State<NewTableItem>{ | ||
| 44 | Container( | 47 | Container( |
| 45 | width: ScreenUtil().setWidth(150), | 48 | width: ScreenUtil().setWidth(150), |
| 46 | height: ScreenUtil().setWidth(widget.height), | 49 | height: ScreenUtil().setWidth(widget.height), |
| 47 | - margin:EdgeInsets.all( ScreenUtil().setWidth(9)), | 50 | + margin: EdgeInsets.all(ScreenUtil().setWidth(9)), |
| 48 | decoration: BoxDecoration( | 51 | decoration: BoxDecoration( |
| 49 | color: MyColours.color_a8e2e4, | 52 | color: MyColours.color_a8e2e4, |
| 50 | - borderRadius: BorderRadius.all(Radius.circular(ScreenUtil().setWidth(8))) | ||
| 51 | - ), | 53 | + borderRadius: BorderRadius.all( |
| 54 | + Radius.circular(ScreenUtil().setWidth(8)))), | ||
| 52 | child: Stack( | 55 | child: Stack( |
| 53 | alignment: Alignment.center, | 56 | alignment: Alignment.center, |
| 54 | children: <Widget>[ | 57 | children: <Widget>[ |
| 55 | Positioned( | 58 | Positioned( |
| 56 | left: 0, | 59 | left: 0, |
| 57 | top: 0, | 60 | top: 0, |
| 58 | - child: table.tidStr==null?Container():Container( | ||
| 59 | - width: ScreenUtil().setWidth(70), | ||
| 60 | - height: ScreenUtil().setHeight(32), | ||
| 61 | - alignment: Alignment.center, | ||
| 62 | - decoration: BoxDecoration( | ||
| 63 | - color: MyColours.color_63a6d1, | ||
| 64 | - borderRadius: BorderRadius.only(topLeft: Radius.circular(ScreenUtil().setWidth(8)),topRight: Radius.circular(ScreenUtil().setWidth(8)),bottomRight: Radius.circular(ScreenUtil().setWidth(8))) | ||
| 65 | - ), | ||
| 66 | - child: Text(table.tidStr,style: TextStyle(color: MyColours.color_ffffff,fontSize: ScreenUtil().setSp(24),decoration: TextDecoration.none,fontWeight: FontWeight.normal)), | ||
| 67 | - ), | 61 | + child: table.tidStr == null |
| 62 | + ? Container() | ||
| 63 | + : Container( | ||
| 64 | + width: ScreenUtil().setWidth(70), | ||
| 65 | + height: ScreenUtil().setHeight(32), | ||
| 66 | + alignment: Alignment.center, | ||
| 67 | + decoration: BoxDecoration( | ||
| 68 | + color: MyColours.color_63a6d1, | ||
| 69 | + borderRadius: BorderRadius.only( | ||
| 70 | + topLeft: | ||
| 71 | + Radius.circular(ScreenUtil().setWidth(8)), | ||
| 72 | + topRight: | ||
| 73 | + Radius.circular(ScreenUtil().setWidth(8)), | ||
| 74 | + bottomRight: Radius.circular( | ||
| 75 | + ScreenUtil().setWidth(8)))), | ||
| 76 | + child: Text(table.tidStr, | ||
| 77 | + style: TextStyle( | ||
| 78 | + color: MyColours.color_ffffff, | ||
| 79 | + fontSize: ScreenUtil().setSp(24), | ||
| 80 | + decoration: TextDecoration.none, | ||
| 81 | + fontWeight: FontWeight.normal)), | ||
| 82 | + ), | ||
| 68 | ), | 83 | ), |
| 69 | Container( | 84 | Container( |
| 70 | alignment: Alignment.centerLeft, | 85 | alignment: Alignment.centerLeft, |
| @@ -74,37 +89,109 @@ class NewTableItemState extends State<NewTableItem>{ | @@ -74,37 +89,109 @@ class NewTableItemState extends State<NewTableItem>{ | ||
| 74 | crossAxisAlignment: CrossAxisAlignment.start, | 89 | crossAxisAlignment: CrossAxisAlignment.start, |
| 75 | children: <Widget>[ | 90 | children: <Widget>[ |
| 76 | VEmptyView(20), | 91 | VEmptyView(20), |
| 77 | - Text(table.name,style: TextStyle(color: MyColours.color_131313,fontSize: ScreenUtil().setSp(30),decoration: TextDecoration.none,fontWeight: FontWeight.normal),overflow: TextOverflow.ellipsis,), | 92 | + Text( |
| 93 | + table.name, | ||
| 94 | + style: TextStyle( | ||
| 95 | + color: MyColours.color_131313, | ||
| 96 | + fontSize: ScreenUtil().setSp(30), | ||
| 97 | + decoration: TextDecoration.none, | ||
| 98 | + fontWeight: FontWeight.normal), | ||
| 99 | + overflow: TextOverflow.ellipsis, | ||
| 100 | + ), | ||
| 78 | VEmptyView(5), | 101 | VEmptyView(5), |
| 79 | - Text((table.reserver==null||table.reserver.isEmpty)?table.tableNum:table.reserver,style: TextStyle(color: (table.reserver==null||table.reserver.isEmpty)?MyColours.color_777777:MyColours.color_2bb5b7,fontSize: ScreenUtil().setSp(26),decoration: TextDecoration.none,fontWeight: FontWeight.normal),overflow: TextOverflow.ellipsis,), | 102 | + Text( |
| 103 | + (table.reserver == null || table.reserver.isEmpty) | ||
| 104 | + ? '${table.tablePnum}人' | ||
| 105 | + : table.reserver, | ||
| 106 | + style: TextStyle( | ||
| 107 | + color: (table.reserver == null || | ||
| 108 | + table.reserver.isEmpty) | ||
| 109 | + ? MyColours.color_777777 | ||
| 110 | + : MyColours.color_2bb5b7, | ||
| 111 | + fontSize: ScreenUtil().setSp(26), | ||
| 112 | + decoration: TextDecoration.none, | ||
| 113 | + fontWeight: FontWeight.normal), | ||
| 114 | + overflow: TextOverflow.ellipsis, | ||
| 115 | + ), | ||
| 80 | VEmptyView(5), | 116 | VEmptyView(5), |
| 81 | - Text(table.lowStr,style: TextStyle(color: MyColours.color_777777,fontSize: ScreenUtil().setSp(26),decoration: TextDecoration.none,fontWeight: FontWeight.normal),overflow: TextOverflow.ellipsis,) | 117 | + Text( |
| 118 | + table.lowStr, | ||
| 119 | + style: TextStyle( | ||
| 120 | + color: MyColours.color_777777, | ||
| 121 | + fontSize: ScreenUtil().setSp(26), | ||
| 122 | + decoration: TextDecoration.none, | ||
| 123 | + fontWeight: FontWeight.normal), | ||
| 124 | + overflow: TextOverflow.ellipsis, | ||
| 125 | + ) | ||
| 82 | ], | 126 | ], |
| 83 | ), | 127 | ), |
| 84 | ), | 128 | ), |
| 85 | - Positioned( | ||
| 86 | - bottom: 0, | ||
| 87 | - left: 0, | ||
| 88 | - right: 0, | ||
| 89 | - child: table.signStr.isEmpty?Container():Container( | ||
| 90 | - width: ScreenUtil().setWidth(150), | ||
| 91 | - height: ScreenUtil().setHeight(40), | ||
| 92 | - alignment: Alignment.center, | ||
| 93 | - decoration: BoxDecoration( | ||
| 94 | - color:MyColours.color_89c0b7, | ||
| 95 | - borderRadius: BorderRadius.only(bottomLeft: Radius.circular(ScreenUtil().setWidth(8)),bottomRight: Radius.circular(ScreenUtil().setWidth(8))) | ||
| 96 | - ), | ||
| 97 | - child: Text(table.signStr,style: TextStyle(color:MyColours.color_ffffff,fontSize: ScreenUtil().setSp(24),decoration: TextDecoration.none,fontWeight: FontWeight.normal),), | ||
| 98 | - ), | ||
| 99 | - ), | 129 | + widget.isRegionName |
| 130 | + ? Positioned( | ||
| 131 | + bottom: 0, | ||
| 132 | + left: 0, | ||
| 133 | + right: 0, | ||
| 134 | + child: Container( | ||
| 135 | + width: ScreenUtil().setWidth(150), | ||
| 136 | + height: ScreenUtil().setHeight(40), | ||
| 137 | + alignment: Alignment.center, | ||
| 138 | + decoration: BoxDecoration( | ||
| 139 | + color: MyColours.color_89c0b7, | ||
| 140 | + borderRadius: BorderRadius.only( | ||
| 141 | + bottomLeft: | ||
| 142 | + Radius.circular(ScreenUtil().setWidth(8)), | ||
| 143 | + bottomRight: Radius.circular( | ||
| 144 | + ScreenUtil().setWidth(8)))), | ||
| 145 | + child: Text( | ||
| 146 | + table.regionName, | ||
| 147 | + style: TextStyle( | ||
| 148 | + color: MyColours.color_ffffff, | ||
| 149 | + fontSize: ScreenUtil().setSp(24), | ||
| 150 | + decoration: TextDecoration.none, | ||
| 151 | + fontWeight: FontWeight.normal), | ||
| 152 | + ), | ||
| 153 | + ), | ||
| 154 | + ) | ||
| 155 | + : Positioned( | ||
| 156 | + bottom: 0, | ||
| 157 | + left: 0, | ||
| 158 | + right: 0, | ||
| 159 | + child: table.signStr.isEmpty | ||
| 160 | + ? Container() | ||
| 161 | + : Container( | ||
| 162 | + width: ScreenUtil().setWidth(150), | ||
| 163 | + height: ScreenUtil().setHeight(40), | ||
| 164 | + alignment: Alignment.center, | ||
| 165 | + decoration: BoxDecoration( | ||
| 166 | + color: MyColours.color_89c0b7, | ||
| 167 | + borderRadius: BorderRadius.only( | ||
| 168 | + bottomLeft: Radius.circular( | ||
| 169 | + ScreenUtil().setWidth(8)), | ||
| 170 | + bottomRight: Radius.circular( | ||
| 171 | + ScreenUtil().setWidth(8)))), | ||
| 172 | + child: Text( | ||
| 173 | + table.signStr, | ||
| 174 | + style: TextStyle( | ||
| 175 | + color: MyColours.color_ffffff, | ||
| 176 | + fontSize: ScreenUtil().setSp(24), | ||
| 177 | + decoration: TextDecoration.none, | ||
| 178 | + fontWeight: FontWeight.normal), | ||
| 179 | + ), | ||
| 180 | + ), | ||
| 181 | + ), | ||
| 100 | ], | 182 | ], |
| 101 | ), | 183 | ), |
| 102 | ), | 184 | ), |
| 103 | Positioned( | 185 | Positioned( |
| 104 | top: 3, | 186 | top: 3, |
| 105 | right: 5, | 187 | right: 5, |
| 106 | - child: !(table.selected??false)?Container():Image.asset("assets/icon_selected.png",width: ScreenUtil().setWidth(40),height: ScreenUtil().setWidth(40),) | ||
| 107 | - ) | 188 | + child: !(table.selected ?? false) |
| 189 | + ? Container() | ||
| 190 | + : Image.asset( | ||
| 191 | + "assets/icon_selected.png", | ||
| 192 | + width: ScreenUtil().setWidth(40), | ||
| 193 | + height: ScreenUtil().setWidth(40), | ||
| 194 | + )) | ||
| 108 | ], | 195 | ], |
| 109 | ), | 196 | ), |
| 110 | ); | 197 | ); |
| @@ -5,15 +5,19 @@ import 'package:one_key/res/colors.dart'; | @@ -5,15 +5,19 @@ import 'package:one_key/res/colors.dart'; | ||
| 5 | import 'package:one_key/models/table.dart' as t; | 5 | import 'package:one_key/models/table.dart' as t; |
| 6 | import 'package:one_key/widgets/v_empty_view.dart'; | 6 | import 'package:one_key/widgets/v_empty_view.dart'; |
| 7 | 7 | ||
| 8 | -class TableItem extends StatefulWidget{ | ||
| 9 | - | 8 | +class TableItem extends StatefulWidget { |
| 10 | final t.Table table; | 9 | final t.Table table; |
| 11 | - final bool canSelected;//是否能选中 | 10 | + final bool canSelected; //是否能选中 |
| 12 | final ValueChanged onSelected; | 11 | final ValueChanged onSelected; |
| 13 | - | ||
| 14 | - final int height;//高度 | 12 | + final bool canChoose; |
| 13 | + | ||
| 14 | + final int height; //高度 | ||
| 15 | 15 | ||
| 16 | - TableItem(this.table,{this.onSelected,this.canSelected=false,this.height=183}); | 16 | + TableItem(this.table, |
| 17 | + {this.onSelected, | ||
| 18 | + this.canSelected = false, | ||
| 19 | + this.height = 183, | ||
| 20 | + this.canChoose = false}); | ||
| 17 | 21 | ||
| 18 | @override | 22 | @override |
| 19 | State<StatefulWidget> createState() { | 23 | State<StatefulWidget> createState() { |
| @@ -22,21 +26,29 @@ class TableItem extends StatefulWidget{ | @@ -22,21 +26,29 @@ class TableItem extends StatefulWidget{ | ||
| 22 | } | 26 | } |
| 23 | } | 27 | } |
| 24 | 28 | ||
| 25 | -class TableItemState extends State<TableItem>{ | ||
| 26 | - | 29 | +class TableItemState extends State<TableItem> { |
| 27 | @override | 30 | @override |
| 28 | Widget build(BuildContext context) { | 31 | Widget build(BuildContext context) { |
| 29 | // TODO: implement build | 32 | // TODO: implement build |
| 30 | 33 | ||
| 31 | - t.Table table=widget.table; | 34 | + t.Table table = widget.table; |
| 32 | 35 | ||
| 33 | return GestureDetector( | 36 | return GestureDetector( |
| 34 | - onTap: (){ | ||
| 35 | - if(widget.canSelected&&table.signStr.isEmpty){ | ||
| 36 | - setState(() { | ||
| 37 | - table.selected=!(table.selected??false); | ||
| 38 | - }); | ||
| 39 | - widget.onSelected(table); | 37 | + onTap: () { |
| 38 | + if (widget.canSelected && widget.canChoose) { | ||
| 39 | + if (table.sign == '5' || table.signStr.isEmpty) { | ||
| 40 | + setState(() { | ||
| 41 | + table.selected = !(table.selected ?? false); | ||
| 42 | + }); | ||
| 43 | + widget.onSelected(table); | ||
| 44 | + } | ||
| 45 | + } else { | ||
| 46 | + if (widget.canSelected && table.signStr.isEmpty) { | ||
| 47 | + setState(() { | ||
| 48 | + table.selected = !(table.selected ?? false); | ||
| 49 | + }); | ||
| 50 | + widget.onSelected(table); | ||
| 51 | + } | ||
| 40 | } | 52 | } |
| 41 | }, | 53 | }, |
| 42 | child: Stack( | 54 | child: Stack( |
| @@ -44,27 +56,39 @@ class TableItemState extends State<TableItem>{ | @@ -44,27 +56,39 @@ class TableItemState extends State<TableItem>{ | ||
| 44 | Container( | 56 | Container( |
| 45 | width: ScreenUtil().setWidth(150), | 57 | width: ScreenUtil().setWidth(150), |
| 46 | height: ScreenUtil().setWidth(widget.height), | 58 | height: ScreenUtil().setWidth(widget.height), |
| 47 | - margin:EdgeInsets.all( ScreenUtil().setWidth(9)), | 59 | + margin: EdgeInsets.all(ScreenUtil().setWidth(9)), |
| 48 | decoration: BoxDecoration( | 60 | decoration: BoxDecoration( |
| 49 | color: MyColours.color_a8e2e4, | 61 | color: MyColours.color_a8e2e4, |
| 50 | - borderRadius: BorderRadius.all(Radius.circular(ScreenUtil().setWidth(8))) | ||
| 51 | - ), | 62 | + borderRadius: BorderRadius.all( |
| 63 | + Radius.circular(ScreenUtil().setWidth(8)))), | ||
| 52 | child: Stack( | 64 | child: Stack( |
| 53 | alignment: Alignment.center, | 65 | alignment: Alignment.center, |
| 54 | children: <Widget>[ | 66 | children: <Widget>[ |
| 55 | Positioned( | 67 | Positioned( |
| 56 | left: 0, | 68 | left: 0, |
| 57 | top: 0, | 69 | top: 0, |
| 58 | - child: table.tidStr==null?Container():Container( | ||
| 59 | - width: ScreenUtil().setWidth(70), | ||
| 60 | - height: ScreenUtil().setHeight(32), | ||
| 61 | - alignment: Alignment.center, | ||
| 62 | - decoration: BoxDecoration( | ||
| 63 | - color: MyColours.color_63a6d1, | ||
| 64 | - borderRadius: BorderRadius.only(topLeft: Radius.circular(ScreenUtil().setWidth(8)),topRight: Radius.circular(ScreenUtil().setWidth(8)),bottomRight: Radius.circular(ScreenUtil().setWidth(8))) | ||
| 65 | - ), | ||
| 66 | - child: Text(table.tidStr,style: TextStyle(color: MyColours.color_ffffff,fontSize: ScreenUtil().setSp(24),decoration: TextDecoration.none,fontWeight: FontWeight.normal)), | ||
| 67 | - ), | 70 | + child: table.tidStr == null |
| 71 | + ? Container() | ||
| 72 | + : Container( | ||
| 73 | + width: ScreenUtil().setWidth(70), | ||
| 74 | + height: ScreenUtil().setHeight(32), | ||
| 75 | + alignment: Alignment.center, | ||
| 76 | + decoration: BoxDecoration( | ||
| 77 | + color: MyColours.color_63a6d1, | ||
| 78 | + borderRadius: BorderRadius.only( | ||
| 79 | + topLeft: | ||
| 80 | + Radius.circular(ScreenUtil().setWidth(8)), | ||
| 81 | + topRight: | ||
| 82 | + Radius.circular(ScreenUtil().setWidth(8)), | ||
| 83 | + bottomRight: Radius.circular( | ||
| 84 | + ScreenUtil().setWidth(8)))), | ||
| 85 | + child: Text(table.tidStr, | ||
| 86 | + style: TextStyle( | ||
| 87 | + color: MyColours.color_ffffff, | ||
| 88 | + fontSize: ScreenUtil().setSp(24), | ||
| 89 | + decoration: TextDecoration.none, | ||
| 90 | + fontWeight: FontWeight.normal)), | ||
| 91 | + ), | ||
| 68 | ), | 92 | ), |
| 69 | Container( | 93 | Container( |
| 70 | alignment: Alignment.centerLeft, | 94 | alignment: Alignment.centerLeft, |
| @@ -74,11 +98,40 @@ class TableItemState extends State<TableItem>{ | @@ -74,11 +98,40 @@ class TableItemState extends State<TableItem>{ | ||
| 74 | crossAxisAlignment: CrossAxisAlignment.start, | 98 | crossAxisAlignment: CrossAxisAlignment.start, |
| 75 | children: <Widget>[ | 99 | children: <Widget>[ |
| 76 | VEmptyView(20), | 100 | VEmptyView(20), |
| 77 | - Text(table.name,style: TextStyle(color: MyColours.color_131313,fontSize: ScreenUtil().setSp(30),decoration: TextDecoration.none,fontWeight: FontWeight.normal),overflow: TextOverflow.ellipsis,), | 101 | + Text( |
| 102 | + table.name, | ||
| 103 | + style: TextStyle( | ||
| 104 | + color: MyColours.color_131313, | ||
| 105 | + fontSize: ScreenUtil().setSp(30), | ||
| 106 | + decoration: TextDecoration.none, | ||
| 107 | + fontWeight: FontWeight.normal), | ||
| 108 | + overflow: TextOverflow.ellipsis, | ||
| 109 | + ), | ||
| 78 | VEmptyView(5), | 110 | VEmptyView(5), |
| 79 | - Text((table.reserver==null||table.reserver.isEmpty)?table.tableNum:table.reserver,style: TextStyle(color: (table.reserver==null||table.reserver.isEmpty)?MyColours.color_777777:MyColours.color_2bb5b7,fontSize: ScreenUtil().setSp(26),decoration: TextDecoration.none,fontWeight: FontWeight.normal),overflow: TextOverflow.ellipsis,), | 111 | + Text( |
| 112 | + (table.reserver == null || table.reserver.isEmpty) | ||
| 113 | + ? table.tableNum | ||
| 114 | + : table.reserver, | ||
| 115 | + style: TextStyle( | ||
| 116 | + color: (table.reserver == null || | ||
| 117 | + table.reserver.isEmpty) | ||
| 118 | + ? MyColours.color_777777 | ||
| 119 | + : MyColours.color_2bb5b7, | ||
| 120 | + fontSize: ScreenUtil().setSp(26), | ||
| 121 | + decoration: TextDecoration.none, | ||
| 122 | + fontWeight: FontWeight.normal), | ||
| 123 | + overflow: TextOverflow.ellipsis, | ||
| 124 | + ), | ||
| 80 | VEmptyView(5), | 125 | VEmptyView(5), |
| 81 | - Text(table.lowStr,style: TextStyle(color: MyColours.color_777777,fontSize: ScreenUtil().setSp(26),decoration: TextDecoration.none,fontWeight: FontWeight.normal),overflow: TextOverflow.ellipsis,) | 126 | + Text( |
| 127 | + table.lowStr, | ||
| 128 | + style: TextStyle( | ||
| 129 | + color: MyColours.color_777777, | ||
| 130 | + fontSize: ScreenUtil().setSp(26), | ||
| 131 | + decoration: TextDecoration.none, | ||
| 132 | + fontWeight: FontWeight.normal), | ||
| 133 | + overflow: TextOverflow.ellipsis, | ||
| 134 | + ) | ||
| 82 | ], | 135 | ], |
| 83 | ), | 136 | ), |
| 84 | ), | 137 | ), |
| @@ -86,16 +139,28 @@ class TableItemState extends State<TableItem>{ | @@ -86,16 +139,28 @@ class TableItemState extends State<TableItem>{ | ||
| 86 | bottom: 0, | 139 | bottom: 0, |
| 87 | left: 0, | 140 | left: 0, |
| 88 | right: 0, | 141 | right: 0, |
| 89 | - child: table.signStr.isEmpty?Container():Container( | ||
| 90 | - width: ScreenUtil().setWidth(150), | ||
| 91 | - height: ScreenUtil().setHeight(40), | ||
| 92 | - alignment: Alignment.center, | ||
| 93 | - decoration: BoxDecoration( | ||
| 94 | - color:MyColours.color_89c0b7, | ||
| 95 | - borderRadius: BorderRadius.only(bottomLeft: Radius.circular(ScreenUtil().setWidth(8)),bottomRight: Radius.circular(ScreenUtil().setWidth(8))) | ||
| 96 | - ), | ||
| 97 | - child: Text(table.signStr,style: TextStyle(color:MyColours.color_ffffff,fontSize: ScreenUtil().setSp(24),decoration: TextDecoration.none,fontWeight: FontWeight.normal),), | ||
| 98 | - ), | 142 | + child: table.signStr.isEmpty |
| 143 | + ? Container() | ||
| 144 | + : Container( | ||
| 145 | + width: ScreenUtil().setWidth(150), | ||
| 146 | + height: ScreenUtil().setHeight(40), | ||
| 147 | + alignment: Alignment.center, | ||
| 148 | + decoration: BoxDecoration( | ||
| 149 | + color: MyColours.color_89c0b7, | ||
| 150 | + borderRadius: BorderRadius.only( | ||
| 151 | + bottomLeft: | ||
| 152 | + Radius.circular(ScreenUtil().setWidth(8)), | ||
| 153 | + bottomRight: Radius.circular( | ||
| 154 | + ScreenUtil().setWidth(8)))), | ||
| 155 | + child: Text( | ||
| 156 | + table.signStr, | ||
| 157 | + style: TextStyle( | ||
| 158 | + color: MyColours.color_ffffff, | ||
| 159 | + fontSize: ScreenUtil().setSp(24), | ||
| 160 | + decoration: TextDecoration.none, | ||
| 161 | + fontWeight: FontWeight.normal), | ||
| 162 | + ), | ||
| 163 | + ), | ||
| 99 | ), | 164 | ), |
| 100 | ], | 165 | ], |
| 101 | ), | 166 | ), |
| @@ -103,8 +168,13 @@ class TableItemState extends State<TableItem>{ | @@ -103,8 +168,13 @@ class TableItemState extends State<TableItem>{ | ||
| 103 | Positioned( | 168 | Positioned( |
| 104 | top: 3, | 169 | top: 3, |
| 105 | right: 5, | 170 | right: 5, |
| 106 | - child: !(table.selected??false)?Container():Image.asset("assets/icon_selected.png",width: ScreenUtil().setWidth(40),height: ScreenUtil().setWidth(40),) | ||
| 107 | - ) | 171 | + child: !(table.selected ?? false) |
| 172 | + ? Container() | ||
| 173 | + : Image.asset( | ||
| 174 | + "assets/icon_selected.png", | ||
| 175 | + width: ScreenUtil().setWidth(40), | ||
| 176 | + height: ScreenUtil().setWidth(40), | ||
| 177 | + )) | ||
| 108 | ], | 178 | ], |
| 109 | ), | 179 | ), |
| 110 | ); | 180 | ); |
| @@ -855,7 +855,7 @@ packages: | @@ -855,7 +855,7 @@ packages: | ||
| 855 | name: url_launcher | 855 | name: url_launcher |
| 856 | url: "https://pub.flutter-io.cn" | 856 | url: "https://pub.flutter-io.cn" |
| 857 | source: hosted | 857 | source: hosted |
| 858 | - version: "5.5.3" | 858 | + version: "5.6.0" |
| 859 | url_launcher_linux: | 859 | url_launcher_linux: |
| 860 | dependency: transitive | 860 | dependency: transitive |
| 861 | description: | 861 | description: |
| @@ -884,6 +884,13 @@ packages: | @@ -884,6 +884,13 @@ packages: | ||
| 884 | url: "https://pub.flutter-io.cn" | 884 | url: "https://pub.flutter-io.cn" |
| 885 | source: hosted | 885 | source: hosted |
| 886 | version: "0.1.3+2" | 886 | version: "0.1.3+2" |
| 887 | + url_launcher_windows: | ||
| 888 | + dependency: transitive | ||
| 889 | + description: | ||
| 890 | + name: url_launcher_windows | ||
| 891 | + url: "https://pub.flutter-io.cn" | ||
| 892 | + source: hosted | ||
| 893 | + version: "0.0.1+1" | ||
| 887 | uuid: | 894 | uuid: |
| 888 | dependency: transitive | 895 | dependency: transitive |
| 889 | description: | 896 | description: |
| @@ -110,6 +110,45 @@ flutter: | @@ -110,6 +110,45 @@ flutter: | ||
| 110 | 110 | ||
| 111 | # To add assets to your application, add an assets section, like this: | 111 | # To add assets to your application, add an assets section, like this: |
| 112 | assets: | 112 | assets: |
| 113 | + - assets/ | ||
| 114 | + - assets/tts_online.mp3 | ||
| 115 | + # - assets/icon_sellercode.png | ||
| 116 | + # - assets/icon_account.png | ||
| 117 | + # - assets/icon_pwd.png | ||
| 118 | + # - assets/icon_pwd_show.png | ||
| 119 | + # - assets/icon_pwd_hide.png | ||
| 120 | + # - assets/icon_pwd_hide.png | ||
| 121 | + # - assets/message_default.png | ||
| 122 | + # - assets/message_selected.png | ||
| 123 | + # - assets/notebook_default.png | ||
| 124 | + # - assets/notebook_selected.png | ||
| 125 | + # - assets/my_default.png | ||
| 126 | + # - assets/my_selected.png | ||
| 127 | + # - assets/icon_close.png | ||
| 128 | + # - assets/logo.png | ||
| 129 | + # - assets/icon_back.png | ||
| 130 | + # - assets/icon_selected.png | ||
| 131 | + # - assets/statu_booked.png | ||
| 132 | + # - assets/statu_canceled.png | ||
| 133 | + # - assets/statu_eating.png | ||
| 134 | + # - assets/statu_finished.png | ||
| 135 | + # - assets/statu_reached.png | ||
| 136 | + # - assets/statu_refuse.png | ||
| 137 | + # - assets/status_undeal.png | ||
| 138 | + # - assets/icon_wechat.png | ||
| 139 | + # - assets/icon_sms.png | ||
| 140 | + # - assets/icon_phone.png | ||
| 141 | + # - assets/bg_invication.png | ||
| 142 | + # - assets/invication_line_left.png | ||
| 143 | + # - assets/invication_line_right.png | ||
| 144 | + # - assets/img_ydap.png | ||
| 145 | + # - assets/invication_map.png | ||
| 146 | + # - assets/invication_arrow_right.png | ||
| 147 | + # - assets/invication_back.png | ||
| 148 | + # - assets/icon_exist.png | ||
| 149 | + # - assets/my_logo.png | ||
| 150 | + # - assets/arr_right_gray.png | ||
| 151 | + # - assets/bg_error.png | ||
| 113 | - assets/tts_online.mp3 | 152 | - assets/tts_online.mp3 |
| 114 | - assets/tts_cancel.mp3 | 153 | - assets/tts_cancel.mp3 |
| 115 | - assets/tts_all.mp3 | 154 | - assets/tts_all.mp3 |
-
Please register or login to post a comment