Commit 06e16d8d8d8b005036984e1b9e31e615009573dc

Authored by wdn
1 parent 755b1927

合并

1 -  
2 import 'package:dio/dio.dart'; 1 import 'package:dio/dio.dart';
3 import 'package:fluro/fluro.dart'; 2 import 'package:fluro/fluro.dart';
4 import 'package:flutter/material.dart'; 3 import 'package:flutter/material.dart';
@@ -38,11 +37,11 @@ Future<void> main() async { @@ -38,11 +37,11 @@ Future<void> main() async {
38 ), 37 ),
39 ChangeNotifierProvider<MessageDialogModel>( 38 ChangeNotifierProvider<MessageDialogModel>(
40 create: (_) => MessageDialogModel()..init(), 39 create: (_) => MessageDialogModel()..init(),
41 - ) 40 + ),
42 ], 41 ],
43 child: MyApp(), 42 child: MyApp(),
44 )); 43 ));
45 - FlutterBugly.init(androidAppId: "f71a313f42",iOSAppId: "3089e4587e"); 44 + FlutterBugly.init(androidAppId: "f71a313f42", iOSAppId: "3089e4587e");
46 }); 45 });
47 } 46 }
48 47
@@ -54,8 +53,7 @@ class MyApp extends StatefulWidget { @@ -54,8 +53,7 @@ class MyApp extends StatefulWidget {
54 } 53 }
55 } 54 }
56 55
57 -class MyAppState extends State<MyApp>{  
58 - 56 +class MyAppState extends State<MyApp> {
59 @override 57 @override
60 void initState() { 58 void initState() {
61 // TODO: implement initState 59 // TODO: implement initState
@@ -73,11 +71,11 @@ class MyAppState extends State<MyApp>{ @@ -73,11 +71,11 @@ class MyAppState extends State<MyApp>{
73 await registerWxApi( 71 await registerWxApi(
74 appId: "wx85aa3cdd0f791e65", 72 appId: "wx85aa3cdd0f791e65",
75 doOnAndroid: true, 73 doOnAndroid: true,
76 - doOnIOS: true,  
77 - universalLink: "https://xt04.colorcun.com/link/OneKey/");  
78 - var result = await isWeChatInstalled;  
79 - LogUtil.v("is installed $result");  
80 -} 74 + doOnIOS: true,
  75 + universalLink: "https://xt04.colorcun.com/link/OneKey/");
  76 + var result = await isWeChatInstalled;
  77 + LogUtil.v("is installed $result");
  78 + }
81 79
82 initDio() { 80 initDio() {
83 DioUtil.openDebug(); 81 DioUtil.openDebug();
@@ -88,7 +86,6 @@ class MyAppState extends State<MyApp>{ @@ -88,7 +86,6 @@ class MyAppState extends State<MyApp>{
88 DioUtil().setConfig(config); 86 DioUtil().setConfig(config);
89 } 87 }
90 88
91 -  
92 @override 89 @override
93 Widget build(BuildContext context) { 90 Widget build(BuildContext context) {
94 // TODO: implement build 91 // TODO: implement build
@@ -100,7 +97,8 @@ class MyAppState extends State<MyApp>{ @@ -100,7 +97,8 @@ class MyAppState extends State<MyApp>{
100 brightness: Brightness.light, 97 brightness: Brightness.light,
101 primaryColor: Colors.white, 98 primaryColor: Colors.white,
102 splashColor: Colors.transparent, 99 splashColor: Colors.transparent,
103 - textTheme: TextTheme(overline: TextStyle(decoration: TextDecoration.none)), 100 + textTheme:
  101 + TextTheme(overline: TextStyle(decoration: TextDecoration.none)),
104 tooltipTheme: TooltipThemeData(verticalOffset: -100000)), 102 tooltipTheme: TooltipThemeData(verticalOffset: -100000)),
105 home: LoginPage(), 103 home: LoginPage(),
106 onGenerateRoute: App.router.generator, 104 onGenerateRoute: App.router.generator,
@@ -9,7 +9,7 @@ part of 'message.dart'; @@ -9,7 +9,7 @@ part of 'message.dart';
9 Message _$MessageFromJson(Map<String, dynamic> json) { 9 Message _$MessageFromJson(Map<String, dynamic> json) {
10 return Message() 10 return Message()
11 ..id = json['id'] as String 11 ..id = json['id'] as String
12 - ..message_type = json['message_type'] as dynamic 12 + ..message_type = json['message_type']
13 ..handle_time = json['handle_time'] as String 13 ..handle_time = json['handle_time'] as String
14 ..read_time = json['read_time'] as String 14 ..read_time = json['read_time'] as String
15 ..is_read = json['is_read'] as String 15 ..is_read = json['is_read'] as String
  1 +import 'package:json_annotation/json_annotation.dart';
  2 +
  3 +part 'seller_info.g.dart';
  4 +
  5 +@JsonSerializable()
  6 +class SellerInfoModel extends Object {
  7 + @JsonKey(name: 'ret')
  8 + int ret;
  9 +
  10 + @JsonKey(name: 'data')
  11 + SunSellerInfoModel data;
  12 +
  13 + @JsonKey(name: 'msg')
  14 + String msg;
  15 +
  16 + SellerInfoModel(
  17 + this.ret,
  18 + this.data,
  19 + this.msg,
  20 + );
  21 +
  22 + factory SellerInfoModel.fromJson(Map<String, dynamic> srcJson) =>
  23 + _$SellerInfoModelFromJson(srcJson);
  24 +
  25 + Map<String, dynamic> toJson() => _$SellerInfoModelToJson(this);
  26 +}
  27 +
  28 +@JsonSerializable()
  29 +class SunSellerInfoModel extends Object {
  30 + @JsonKey(name: 'seller')
  31 + Seller seller;
  32 +
  33 + @JsonKey(name: 'manager')
  34 + List<Manager> manager;
  35 +
  36 + @JsonKey(name: 'seller_user')
  37 + SellerUser sellerUser;
  38 +
  39 + @JsonKey(name: 'daily')
  40 + Daily daily;
  41 +
  42 + @JsonKey(name: 'config')
  43 + List<dynamic> config;
  44 +
  45 + @JsonKey(name: 'setting')
  46 + Setting setting;
  47 +
  48 + @JsonKey(name: 'scatter')
  49 + int scatter;
  50 +
  51 + @JsonKey(name: 'room')
  52 + int room;
  53 +
  54 + @JsonKey(name: 'cassette')
  55 + int cassette;
  56 +
  57 + SunSellerInfoModel(
  58 + this.seller,
  59 + this.manager,
  60 + this.sellerUser,
  61 + this.daily,
  62 + this.config,
  63 + this.setting,
  64 + this.scatter,
  65 + this.room,
  66 + this.cassette,
  67 + );
  68 +
  69 + factory SunSellerInfoModel.fromJson(Map<String, dynamic> srcJson) =>
  70 + _$SunSellerInfoModelFromJson(srcJson);
  71 +
  72 + Map<String, dynamic> toJson() => _$SunSellerInfoModelToJson(this);
  73 +}
  74 +
  75 +@JsonSerializable()
  76 +class Seller extends Object {
  77 + @JsonKey(name: 'id')
  78 + String id;
  79 +
  80 + @JsonKey(name: 'sellername')
  81 + String sellername;
  82 +
  83 + @JsonKey(name: 'selleralias')
  84 + String selleralias;
  85 +
  86 + @JsonKey(name: 'seller_image')
  87 + String sellerImage;
  88 +
  89 + @JsonKey(name: 'map_address')
  90 + String mapAddress;
  91 +
  92 + @JsonKey(name: 'is_call_tel')
  93 + String isCallTel;
  94 +
  95 + @JsonKey(name: 'daily')
  96 + String daily;
  97 +
  98 + @JsonKey(name: 'lat')
  99 + String lat;
  100 +
  101 + @JsonKey(name: 'long')
  102 + String long;
  103 +
  104 + @JsonKey(name: 'is_sms')
  105 + String isSms;
  106 +
  107 + @JsonKey(name: 'is_open_order')
  108 + String isOpenOrder;
  109 +
  110 + @JsonKey(name: 'is_open_wine')
  111 + String isOpenWine;
  112 +
  113 + Seller(
  114 + this.id,
  115 + this.sellername,
  116 + this.selleralias,
  117 + this.sellerImage,
  118 + this.mapAddress,
  119 + this.isCallTel,
  120 + this.daily,
  121 + this.lat,
  122 + this.long,
  123 + this.isSms,
  124 + this.isOpenOrder,
  125 + this.isOpenWine,
  126 + );
  127 +
  128 + factory Seller.fromJson(Map<String, dynamic> srcJson) =>
  129 + _$SellerFromJson(srcJson);
  130 +
  131 + Map<String, dynamic> toJson() => _$SellerToJson(this);
  132 +}
  133 +
  134 +@JsonSerializable()
  135 +class Manager extends Object {
  136 + @JsonKey(name: 'role_name')
  137 + String roleName;
  138 +
  139 + @JsonKey(name: 'id')
  140 + dynamic id;
  141 +
  142 + @JsonKey(name: 'sellerid')
  143 + dynamic sellerid;
  144 +
  145 + @JsonKey(name: 'openid')
  146 + String openid;
  147 +
  148 + @JsonKey(name: 'receipt_code')
  149 + String receiptCode;
  150 +
  151 + @JsonKey(name: 'user_name')
  152 + String userName;
  153 +
  154 + @JsonKey(name: 'cdate')
  155 + String cdate;
  156 +
  157 + @JsonKey(name: 'status')
  158 + dynamic status;
  159 +
  160 + @JsonKey(name: 'is_first')
  161 + dynamic isFirst;
  162 +
  163 + @JsonKey(name: 'disting')
  164 + dynamic disting;
  165 +
  166 + @JsonKey(name: 'code')
  167 + dynamic code;
  168 +
  169 + @JsonKey(name: 'uid')
  170 + dynamic uid;
  171 +
  172 + @JsonKey(name: 'nick_name')
  173 + String nickName;
  174 +
  175 + Manager(
  176 + this.roleName,
  177 + this.id,
  178 + this.sellerid,
  179 + this.openid,
  180 + this.receiptCode,
  181 + this.userName,
  182 + this.cdate,
  183 + this.status,
  184 + this.isFirst,
  185 + this.disting,
  186 + this.code,
  187 + this.uid,
  188 + this.nickName,
  189 + );
  190 +
  191 + factory Manager.fromJson(Map<String, dynamic> srcJson) =>
  192 + _$ManagerFromJson(srcJson);
  193 +
  194 + Map<String, dynamic> toJson() => _$ManagerToJson(this);
  195 +}
  196 +
  197 +@JsonSerializable()
  198 +class SellerUser extends Object {
  199 + SellerUser();
  200 +
  201 + factory SellerUser.fromJson(Map<String, dynamic> srcJson) =>
  202 + _$SellerUserFromJson(srcJson);
  203 +
  204 + Map<String, dynamic> toJson() => _$SellerUserToJson(this);
  205 +}
  206 +
  207 +@JsonSerializable()
  208 +class Daily extends Object {
  209 + @JsonKey(name: 'morning')
  210 + String morning;
  211 +
  212 + @JsonKey(name: 'noon')
  213 + String noon;
  214 +
  215 + @JsonKey(name: 'night')
  216 + String night;
  217 +
  218 + Daily(
  219 + this.morning,
  220 + this.noon,
  221 + this.night,
  222 + );
  223 +
  224 + factory Daily.fromJson(Map<String, dynamic> srcJson) =>
  225 + _$DailyFromJson(srcJson);
  226 +
  227 + Map<String, dynamic> toJson() => _$DailyToJson(this);
  228 +}
  229 +
  230 +@JsonSerializable()
  231 +class Setting extends Object {
  232 + @JsonKey(name: 'template_code')
  233 + String templateCode;
  234 +
  235 + Setting(
  236 + this.templateCode,
  237 + );
  238 +
  239 + factory Setting.fromJson(Map<String, dynamic> srcJson) =>
  240 + _$SettingFromJson(srcJson);
  241 +
  242 + Map<String, dynamic> toJson() => _$SettingToJson(this);
  243 +}
  1 +// GENERATED CODE - DO NOT MODIFY BY HAND
  2 +
  3 +part of 'seller_info.dart';
  4 +
  5 +// **************************************************************************
  6 +// JsonSerializableGenerator
  7 +// **************************************************************************
  8 +
  9 +SellerInfoModel _$SellerInfoModelFromJson(Map<String, dynamic> json) {
  10 + return SellerInfoModel(
  11 + json['ret'] as int,
  12 + json['data'] == null
  13 + ? null
  14 + : SunSellerInfoModel.fromJson(json['data'] as Map<String, dynamic>),
  15 + json['msg'] as String);
  16 +}
  17 +
  18 +Map<String, dynamic> _$SellerInfoModelToJson(SellerInfoModel instance) =>
  19 + <String, dynamic>{
  20 + 'ret': instance.ret,
  21 + 'data': instance.data,
  22 + 'msg': instance.msg
  23 + };
  24 +
  25 +SunSellerInfoModel _$SunSellerInfoModelFromJson(Map<String, dynamic> json) {
  26 + return SunSellerInfoModel(
  27 + json['seller'] == null
  28 + ? null
  29 + : Seller.fromJson(json['seller'] as Map<String, dynamic>),
  30 + (json['manager'] as List)
  31 + ?.map((e) =>
  32 + e == null ? null : Manager.fromJson(e as Map<String, dynamic>))
  33 + ?.toList(),
  34 + json['seller_user'] == null
  35 + ? null
  36 + : SellerUser.fromJson(json['seller_user'] as Map<String, dynamic>),
  37 + json['daily'] == null
  38 + ? null
  39 + : Daily.fromJson(json['daily'] as Map<String, dynamic>),
  40 + json['config'] as List,
  41 + json['setting'] == null
  42 + ? null
  43 + : Setting.fromJson(json['setting'] as Map<String, dynamic>),
  44 + json['scatter'] as int,
  45 + json['room'] as int,
  46 + json['cassette'] as int);
  47 +}
  48 +
  49 +Map<String, dynamic> _$SunSellerInfoModelToJson(SunSellerInfoModel instance) =>
  50 + <String, dynamic>{
  51 + 'seller': instance.seller,
  52 + 'manager': instance.manager,
  53 + 'seller_user': instance.sellerUser,
  54 + 'daily': instance.daily,
  55 + 'config': instance.config,
  56 + 'setting': instance.setting,
  57 + 'scatter': instance.scatter,
  58 + 'room': instance.room,
  59 + 'cassette': instance.cassette
  60 + };
  61 +
  62 +Seller _$SellerFromJson(Map<String, dynamic> json) {
  63 + return Seller(
  64 + json['id'] as String,
  65 + json['sellername'] as String,
  66 + json['selleralias'] as String,
  67 + json['seller_image'] as String,
  68 + json['map_address'] as String,
  69 + json['is_call_tel'] as String,
  70 + json['daily'] as String,
  71 + json['lat'] as String,
  72 + json['long'] as String,
  73 + json['is_sms'] as String,
  74 + json['is_open_order'] as String,
  75 + json['is_open_wine'] as String);
  76 +}
  77 +
  78 +Map<String, dynamic> _$SellerToJson(Seller instance) => <String, dynamic>{
  79 + 'id': instance.id,
  80 + 'sellername': instance.sellername,
  81 + 'selleralias': instance.selleralias,
  82 + 'seller_image': instance.sellerImage,
  83 + 'map_address': instance.mapAddress,
  84 + 'is_call_tel': instance.isCallTel,
  85 + 'daily': instance.daily,
  86 + 'lat': instance.lat,
  87 + 'long': instance.long,
  88 + 'is_sms': instance.isSms,
  89 + 'is_open_order': instance.isOpenOrder,
  90 + 'is_open_wine': instance.isOpenWine
  91 + };
  92 +
  93 +Manager _$ManagerFromJson(Map<String, dynamic> json) {
  94 + return Manager(
  95 + json['role_name'] as String,
  96 + json['id'],
  97 + json['sellerid'],
  98 + json['openid'] as String,
  99 + json['receipt_code'] as String,
  100 + json['user_name'] as String,
  101 + json['cdate'] as String,
  102 + json['status'],
  103 + json['is_first'],
  104 + json['disting'],
  105 + json['code'],
  106 + json['uid'],
  107 + json['nick_name'] as String);
  108 +}
  109 +
  110 +Map<String, dynamic> _$ManagerToJson(Manager instance) => <String, dynamic>{
  111 + 'role_name': instance.roleName,
  112 + 'id': instance.id,
  113 + 'sellerid': instance.sellerid,
  114 + 'openid': instance.openid,
  115 + 'receipt_code': instance.receiptCode,
  116 + 'user_name': instance.userName,
  117 + 'cdate': instance.cdate,
  118 + 'status': instance.status,
  119 + 'is_first': instance.isFirst,
  120 + 'disting': instance.disting,
  121 + 'code': instance.code,
  122 + 'uid': instance.uid,
  123 + 'nick_name': instance.nickName
  124 + };
  125 +
  126 +SellerUser _$SellerUserFromJson(Map<String, dynamic> json) {
  127 + return SellerUser();
  128 +}
  129 +
  130 +Map<String, dynamic> _$SellerUserToJson(SellerUser instance) =>
  131 + <String, dynamic>{};
  132 +
  133 +Daily _$DailyFromJson(Map<String, dynamic> json) {
  134 + return Daily(json['morning'] as String, json['noon'] as String,
  135 + json['night'] as String);
  136 +}
  137 +
  138 +Map<String, dynamic> _$DailyToJson(Daily instance) => <String, dynamic>{
  139 + 'morning': instance.morning,
  140 + 'noon': instance.noon,
  141 + 'night': instance.night
  142 + };
  143 +
  144 +Setting _$SettingFromJson(Map<String, dynamic> json) {
  145 + return Setting(json['template_code'] as String);
  146 +}
  147 +
  148 +Map<String, dynamic> _$SettingToJson(Setting instance) =>
  149 + <String, dynamic>{'template_code': instance.templateCode};
@@ -22,10 +22,10 @@ Table _$TableFromJson(Map<String, dynamic> json) { @@ -22,10 +22,10 @@ Table _$TableFromJson(Map<String, dynamic> json) {
22 ..rname = json['rname'] as String 22 ..rname = json['rname'] as String
23 ..max = json['max'] as String 23 ..max = json['max'] as String
24 ..low = json['low'] as String 24 ..low = json['low'] as String
25 - ..sign=json['sign'] as String  
26 - ..reserver=json['reserver'] as String  
27 - ..notebookId=json['notebookId'] as String  
28 - ..selected=json["selected"] as bool; 25 + ..sign = json['sign'] as String
  26 + ..reserver = json['reserver'] as String
  27 + ..notebookId = json['notebookId'] as String
  28 + ..selected = json['selected'] as bool;
29 } 29 }
30 30
31 Map<String, dynamic> _$TableToJson(Table instance) => <String, dynamic>{ 31 Map<String, dynamic> _$TableToJson(Table instance) => <String, dynamic>{
@@ -43,9 +43,8 @@ Map<String, dynamic> _$TableToJson(Table instance) => <String, dynamic>{ @@ -43,9 +43,8 @@ Map<String, dynamic> _$TableToJson(Table instance) => <String, dynamic>{
43 'rname': instance.rname, 43 'rname': instance.rname,
44 'max': instance.max, 44 'max': instance.max,
45 'low': instance.low, 45 'low': instance.low,
46 - 'sign':instance.sign,  
47 - 'reserver':instance.reserver,  
48 - 'notebookId':instance.notebookId,  
49 - 'selected':instance.selected 46 + 'sign': instance.sign,
  47 + 'reserver': instance.reserver,
  48 + 'notebookId': instance.notebookId,
  49 + 'selected': instance.selected
50 }; 50 };
51 -  
  1 +import 'package:json_annotation/json_annotation.dart';
  2 +
  3 +part 'table_list.g.dart';
  4 +
  5 +@JsonSerializable()
  6 +class TableListModel extends Object {
  7 + @JsonKey(name: 'ret')
  8 + int ret;
  9 +
  10 + @JsonKey(name: 'data')
  11 + List<TableListSunModel> data;
  12 +
  13 + @JsonKey(name: 'msg')
  14 + String msg;
  15 +
  16 + TableListModel(
  17 + this.ret,
  18 + this.data,
  19 + this.msg,
  20 + );
  21 +
  22 + factory TableListModel.fromJson(Map<String, dynamic> srcJson) =>
  23 + _$TableListModelFromJson(srcJson);
  24 +
  25 + Map<String, dynamic> toJson() => _$TableListModelToJson(this);
  26 +}
  27 +
  28 +@JsonSerializable()
  29 +class TableListSunModel extends Object {
  30 + @JsonKey(name: 'name')
  31 + String name;
  32 +
  33 + @JsonKey(name: 'list')
  34 + List<TableList> list;
  35 +
  36 + TableListSunModel(
  37 + this.name,
  38 + this.list,
  39 + );
  40 +
  41 + factory TableListSunModel.fromJson(Map<String, dynamic> srcJson) =>
  42 + _$TableListSunModelFromJson(srcJson);
  43 +
  44 + Map<String, dynamic> toJson() => _$TableListSunModelToJson(this);
  45 +}
  46 +
  47 +@JsonSerializable()
  48 +class TableList extends Object {
  49 + @JsonKey(name: 'id')
  50 + String id;
  51 +
  52 + @JsonKey(name: 'rid')
  53 + String rid;
  54 +
  55 + @JsonKey(name: 'sellerid')
  56 + String sellerid;
  57 +
  58 + @JsonKey(name: 'name')
  59 + String name;
  60 +
  61 + @JsonKey(name: 'qrcode')
  62 + String qrcode;
  63 +
  64 + @JsonKey(name: 'table_pnum')
  65 + String tablePnum;
  66 +
  67 + @JsonKey(name: 'most_pnum')
  68 + String mostPnum;
  69 +
  70 + @JsonKey(name: 'tid')
  71 + String tid;
  72 +
  73 + @JsonKey(name: 'hot')
  74 + String hot;
  75 +
  76 + @JsonKey(name: 'order_o')
  77 + String orderO;
  78 +
  79 + @JsonKey(name: 'status')
  80 + String status;
  81 +
  82 + @JsonKey(name: 'enable')
  83 + String enable;
  84 +
  85 + @JsonKey(name: 'spell')
  86 + String spell;
  87 +
  88 + @JsonKey(name: 'cdate')
  89 + String cdate;
  90 +
  91 + @JsonKey(name: 'rname')
  92 + String rname;
  93 + String table_pnum; //桌位最少可做人数
  94 + String most_pnum; //桌位最多可做人数
  95 + String low; //最低消费
  96 +
  97 + //获取桌位类型
  98 + String get tidStr {
  99 + switch (tid) {
  100 + case "1":
  101 + return "散座";
  102 + case "2":
  103 + return "包间";
  104 + case "3":
  105 + return "卡座";
  106 + }
  107 + }
  108 +
  109 + String reserver; //订餐人
  110 + String notebookId; //桌位对应的预订id
  111 + bool selected = false; //是否选中
  112 + String max; //最多可做人数
  113 + String sign; //标签 桌位状态 0:待确认,1:已定座,2:确认到店,3:用餐完成,4:取消预订,5:安排包间,6拒绝订单
  114 +
  115 + String get maxText {
  116 + if (max == null || max == "0" || max == "null") {
  117 + return "";
  118 + } else {
  119 + return "最多可坐" + max + "人";
  120 + }
  121 + }
  122 +
  123 + //获取桌位可坐人数
  124 + String get tableNum {
  125 + if (table_pnum == null || table_pnum.isEmpty || table_pnum == "0") {
  126 + return "";
  127 + } else if (most_pnum != null &&
  128 + most_pnum.isNotEmpty &&
  129 + most_pnum != "0" &&
  130 + most_pnum != "null") {
  131 + if (table_pnum == most_pnum) {
  132 + return "$table_pnum人";
  133 + } else {
  134 + return "$table_pnum-$most_pnum人";
  135 + }
  136 + } else {
  137 + return "$table_pnum人";
  138 + }
  139 + }
  140 +
  141 + //获取最低消费
  142 + String get lowStr {
  143 + return (low == null || low.isEmpty || low == "0") ? "" : "最低消费\n$low元";
  144 + }
  145 +
  146 + String get signStr {
  147 + if (enable == "0") return "已停用";
  148 + if (sign != null) {
  149 + switch (sign) {
  150 + case "1": //已预订
  151 + case "5": //已安排包间
  152 + return "已预订";
  153 + case "2": //用餐中
  154 + return "用餐中";
  155 + default:
  156 + return "";
  157 + }
  158 + }
  159 + return "";
  160 + }
  161 +
  162 + TableList(
  163 + this.id,
  164 + this.rid,
  165 + this.sellerid,
  166 + this.name,
  167 + this.qrcode,
  168 + this.tablePnum,
  169 + this.mostPnum,
  170 + this.tid,
  171 + this.hot,
  172 + this.orderO,
  173 + this.status,
  174 + this.enable,
  175 + this.spell,
  176 + this.cdate,
  177 + this.rname);
  178 +
  179 + factory TableList.fromJson(Map<String, dynamic> srcJson) =>
  180 + _$TableListFromJson(srcJson);
  181 +
  182 + Map<String, dynamic> toJson() => _$TableListToJson(this);
  183 +}
  1 +// GENERATED CODE - DO NOT MODIFY BY HAND
  2 +
  3 +part of 'table_list.dart';
  4 +
  5 +// **************************************************************************
  6 +// JsonSerializableGenerator
  7 +// **************************************************************************
  8 +
  9 +TableListModel _$TableListModelFromJson(Map<String, dynamic> json) {
  10 + return TableListModel(
  11 + json['ret'] as int,
  12 + (json['data'] as List)
  13 + ?.map((e) => e == null
  14 + ? null
  15 + : TableListSunModel.fromJson(e as Map<String, dynamic>))
  16 + ?.toList(),
  17 + json['msg'] as String);
  18 +}
  19 +
  20 +Map<String, dynamic> _$TableListModelToJson(TableListModel instance) =>
  21 + <String, dynamic>{
  22 + 'ret': instance.ret,
  23 + 'data': instance.data,
  24 + 'msg': instance.msg
  25 + };
  26 +
  27 +TableListSunModel _$TableListSunModelFromJson(Map<String, dynamic> json) {
  28 + return TableListSunModel(
  29 + json['name'] as String,
  30 + (json['list'] as List)
  31 + ?.map((e) =>
  32 + e == null ? null : TableList.fromJson(e as Map<String, dynamic>))
  33 + ?.toList());
  34 +}
  35 +
  36 +Map<String, dynamic> _$TableListSunModelToJson(TableListSunModel instance) =>
  37 + <String, dynamic>{'name': instance.name, 'list': instance.list};
  38 +
  39 +TableList _$TableListFromJson(Map<String, dynamic> json) {
  40 + return TableList(
  41 + json['id'] as String,
  42 + json['rid'] as String,
  43 + json['sellerid'] as String,
  44 + json['name'] as String,
  45 + json['qrcode'] as String,
  46 + json['table_pnum'] as String,
  47 + json['most_pnum'] as String,
  48 + json['tid'] as String,
  49 + json['hot'] as String,
  50 + json['order_o'] as String,
  51 + json['status'] as String,
  52 + json['enable'] as String,
  53 + json['spell'] as String,
  54 + json['cdate'] as String,
  55 + json['rname'] as String);
  56 +}
  57 +
  58 +Map<String, dynamic> _$TableListToJson(TableList instance) => <String, dynamic>{
  59 + 'id': instance.id,
  60 + 'rid': instance.rid,
  61 + 'sellerid': instance.sellerid,
  62 + 'name': instance.name,
  63 + 'qrcode': instance.qrcode,
  64 + 'table_pnum': instance.tablePnum,
  65 + 'most_pnum': instance.mostPnum,
  66 + 'tid': instance.tid,
  67 + 'hot': instance.hot,
  68 + 'order_o': instance.orderO,
  69 + 'status': instance.status,
  70 + 'enable': instance.enable,
  71 + 'spell': instance.spell,
  72 + 'cdate': instance.cdate,
  73 + 'rname': instance.rname
  74 + };
@@ -6,8 +6,9 @@ class BaseResp<T> { @@ -6,8 +6,9 @@ class BaseResp<T> {
6 int code; 6 int code;
7 String msg; 7 String msg;
8 T data; 8 T data;
  9 + Map responseData;
9 10
10 - BaseResp(this.status, this.code, this.msg, this.data); 11 + BaseResp(this.status, this.code, this.msg, this.data,this.responseData);
11 12
12 @override 13 @override
13 String toString() { 14 String toString() {
@@ -9,7 +9,6 @@ import 'package:one_key/widgets/loading.dart'; @@ -9,7 +9,6 @@ import 'package:one_key/widgets/loading.dart';
9 9
10 import 'base_resp.dart'; 10 import 'base_resp.dart';
11 11
12 -  
13 /** 12 /**
14 * @Author: thl 13 * @Author: thl
15 * @GitHub: https://github.com/Sky24n 14 * @GitHub: https://github.com/Sky24n
@@ -167,15 +166,19 @@ class DioUtil { @@ -167,15 +166,19 @@ class DioUtil {
167 /// [data] The request data 166 /// [data] The request data
168 /// [options] The request options. 167 /// [options] The request options.
169 /// <BaseResp<T> 返回 status code msg data . 168 /// <BaseResp<T> 返回 status code msg data .
170 - Future<BaseResp<T>> request<T>(BuildContext context,String method, String path,  
171 - {data, Options options, CancelToken cancelToken,bool showLoading=true}) async {  
172 - bool connectivity=await Utils.checkConnectiviy(); 169 + Future<BaseResp<T>> request<T>(
  170 + BuildContext context, String method, String path,
  171 + {data,
  172 + Options options,
  173 + CancelToken cancelToken,
  174 + bool showLoading = true}) async {
  175 + bool connectivity = await Utils.checkConnectiviy();
173 // if(!connectivity){ 176 // if(!connectivity){
174 // Utils.showToast("网络错误,请稍后重试"); 177 // Utils.showToast("网络错误,请稍后重试");
175 // return new Future.error("网络错误,请稍后重试"); 178 // return new Future.error("网络错误,请稍后重试");
176 // } 179 // }
177 - if(showLoading)Loading.showLoading(context);  
178 - try{ 180 + if (showLoading) Loading.showLoading(context);
  181 + try {
179 Response response = await _dio.request(path, 182 Response response = await _dio.request(path,
180 data: data, 183 data: data,
181 options: _checkOptions(method, options), 184 options: _checkOptions(method, options),
@@ -185,6 +188,7 @@ class DioUtil { @@ -185,6 +188,7 @@ class DioUtil {
185 int _code; 188 int _code;
186 String _msg; 189 String _msg;
187 T _data; 190 T _data;
  191 + Map _responseData;
188 if (response.statusCode == HttpStatus.ok || 192 if (response.statusCode == HttpStatus.ok ||
189 response.statusCode == HttpStatus.created) { 193 response.statusCode == HttpStatus.created) {
190 try { 194 try {
@@ -197,6 +201,7 @@ class DioUtil { @@ -197,6 +201,7 @@ class DioUtil {
197 : response.data[_codeKey]; 201 : response.data[_codeKey];
198 _msg = response.data[_msgKey]; 202 _msg = response.data[_msgKey];
199 _data = response.data[_dataKey]; 203 _data = response.data[_dataKey];
  204 + _responseData = response.data;
200 } else { 205 } else {
201 Map<String, dynamic> _dataMap = _decodeData(response); 206 Map<String, dynamic> _dataMap = _decodeData(response);
202 _status = (_dataMap[_statusKey] is int) 207 _status = (_dataMap[_statusKey] is int)
@@ -207,9 +212,10 @@ class DioUtil { @@ -207,9 +212,10 @@ class DioUtil {
207 : _dataMap[_codeKey]; 212 : _dataMap[_codeKey];
208 _msg = _dataMap[_msgKey]; 213 _msg = _dataMap[_msgKey];
209 _data = _dataMap[_dataKey]; 214 _data = _dataMap[_dataKey];
  215 + _responseData = _dataMap;
210 } 216 }
211 Loading.hideLoading(context); 217 Loading.hideLoading(context);
212 - return new BaseResp(_status, _code, _msg, _data); 218 + return new BaseResp(_status, _code, _msg, _data, _responseData);
213 } catch (e) { 219 } catch (e) {
214 Loading.hideLoading(context); 220 Loading.hideLoading(context);
215 return new Future.error(new DioError( 221 return new Future.error(new DioError(
@@ -225,11 +231,11 @@ class DioUtil { @@ -225,11 +231,11 @@ class DioUtil {
225 message: "statusCode: $response.statusCode, service error", 231 message: "statusCode: $response.statusCode, service error",
226 type: DioErrorType.RESPONSE, 232 type: DioErrorType.RESPONSE,
227 )); 233 ));
228 - }on DioError catch(error){  
229 - if(showLoading){ 234 + } on DioError catch (error) {
  235 + if (showLoading) {
230 Loading.hideLoading(context); 236 Loading.hideLoading(context);
231 } 237 }
232 - if(error is DioError &&error.type==DioErrorType.CONNECT_TIMEOUT){ 238 + if (error is DioError && error.type == DioErrorType.CONNECT_TIMEOUT) {
233 Utils.showToast("网络链接超时,请稍后重试"); 239 Utils.showToast("网络链接超时,请稍后重试");
234 } 240 }
235 throw error; 241 throw error;
1 -class HttpUrl{  
2 - static const String server_address = "https://xt04.colorcun.com/";//服务端请求地址  
3 - static const String app_user_login="?service=Android.User.AppUserLogin";//登录地址  
4 - static const String user_token_init="?service=Android.User.UserTokenInit";//初始化推送token  
5 - static const String sellerinfo="?service=Android.Reserve.SellerInfo";//获取商家信息  
6 - static const String login_out="?service=Android.User.AppLoginOut";//退出登录  
7 - static const String get_message_list="?service=Android.Reserve.GetMessageList";//获取消息列表  
8 - static const String get_reserve_list="?service=Android.Reserve.NewGetReserveList";//获取已预订列表  
9 - static const String reserve_count_day="?service=Android.Reserve.NewReservesCountDay";//获取一天订单统计数目  
10 - static const String reserve_detail="?service=Android.Reserve.Detail";//订单详情  
11 - static const String set_reserve_cusman="?service=Android.Reserve.SetReserveCusman";//设置客户经理  
12 - static const String table_list="?service=Android.Tables.GetTableListsBySellerId";//桌位列表  
13 - static const String set_reserve_status="?service=Android.Customer.SetReserveStatus";//设置订单状态  
14 - static const String set_message_status="?service=Android.Advance.SetMessageStatus";//设置消息状态  
15 - static const String get_sms_content="?service=App.SendSMS.GetSmsContent";//获取短信内容  
16 - static const String send_sms="?service=App.SendSMS.NewMessage";//发送短信  
17 - static const String check_update="http://xt03.colorcun.com/admin/api/compareversion?flat=3";  
18 - static const String upload_contact="?service=App.Seller.SaveCallRecord";//上传通讯录 1 +class HttpUrl {
  2 + static const String server_address = "https://xt04.colorcun.com/"; //服务端请求地址
  3 + static const String app_user_login =
  4 + "?service=Android.User.AppUserLogin"; //登录地址
  5 + static const String user_token_init =
  6 + "?service=Android.User.UserTokenInit"; //初始化推送token
  7 + static const String sellerinfo =
  8 + "?service=Android.Reserve.SellerInfo"; //获取商家信息
  9 + static const String login_out = "?service=Android.User.AppLoginOut"; //退出登录
  10 + static const String get_message_list =
  11 + "?service=Android.Reserve.GetMessageList"; //获取消息列表
  12 + static const String get_reserve_list =
  13 + "?service=Android.Reserve.NewGetReserveList"; //获取已预订列表
  14 + static const String reserve_count_day =
  15 + "?service=Android.Reserve.NewReservesCountDay"; //获取一天订单统计数目
  16 + static const String reserve_detail = "?service=Android.Reserve.Detail"; //订单详情
  17 + static const String set_reserve_cusman =
  18 + "?service=Android.Reserve.SetReserveCusman"; //设置客户经理
  19 + static const String table_list =
  20 + "?service=Android.Tables.GetTableListsBySellerId"; //桌位列表
  21 + static const String set_reserve_status =
  22 + "?service=Android.Customer.SetReserveStatus"; //设置订单状态
  23 + static const String set_message_status =
  24 + "?service=Android.Advance.SetMessageStatus"; //设置消息状态
  25 + static const String get_sms_content =
  26 + "?service=App.SendSMS.GetSmsContent"; //获取短信内容
  27 + static const String send_sms = "?service=App.SendSMS.NewMessage"; //发送短信
  28 + static const String check_update =
  29 + "http://xt03.colorcun.com/admin/api/compareversion?flat=3";
  30 + static const String upload_contact =
  31 + "?service=App.Seller.SaveCallRecord"; //上传通讯录
  32 + static const String get_table_list =
  33 + "?service=Android.Reserve.NewGetTableList"; //根据商家ID 获取桌位信息列表: 1:散座 2:包间 默认:获取所有数据
19 } 34 }
@@ -22,10 +22,9 @@ import 'package:provider/provider.dart'; @@ -22,10 +22,9 @@ import 'package:provider/provider.dart';
22 import 'package:one_key/utils/event_bus.dart'; 22 import 'package:one_key/utils/event_bus.dart';
23 23
24 class HandleOnlinePage extends StatefulWidget { 24 class HandleOnlinePage extends StatefulWidget {
25 -  
26 final String rid; 25 final String rid;
27 final String mid; 26 final String mid;
28 - HandleOnlinePage(this.rid,this.mid); 27 + HandleOnlinePage(this.rid, this.mid);
29 28
30 @override 29 @override
31 State<StatefulWidget> createState() { 30 State<StatefulWidget> createState() {
@@ -34,110 +33,128 @@ class HandleOnlinePage extends StatefulWidget { @@ -34,110 +33,128 @@ class HandleOnlinePage extends StatefulWidget {
34 } 33 }
35 } 34 }
36 35
37 -  
38 class HandleOnlinePageState extends State<HandleOnlinePage> { 36 class HandleOnlinePageState extends State<HandleOnlinePage> {
39 -  
40 - NotebookDetailModel detailModel= NotebookDetailModel(); 37 + NotebookDetailModel detailModel = NotebookDetailModel();
41 38
42 NotebookDetail detailEntity; 39 NotebookDetail detailEntity;
43 40
44 - String cusmanText=""; 41 + String cusmanText = "";
45 42
46 - List<Manager> managers=[];//客户经理 43 + List<Manager> managers = []; //客户经理
47 44
48 - Manager manager=Manager(); 45 + Manager manager = Manager();
49 46
50 @override 47 @override
51 void initState() { 48 void initState() {
52 // TODO: implement initState 49 // TODO: implement initState
53 super.initState(); 50 super.initState();
54 WidgetsBinding.instance.addPostFrameCallback((_) async { 51 WidgetsBinding.instance.addPostFrameCallback((_) async {
55 - detailEntity=await detailModel.getReserveDetail(context, {  
56 - "rid":widget.rid, 52 + detailEntity = await detailModel.getReserveDetail(context, {
  53 + "rid": widget.rid,
57 }); 54 });
58 - setState(() {//未处理  
59 - cusmanText=detailEntity.cusman.isEmpty?"请选择":detailEntity.cusman; 55 + setState(() {
  56 + //未处理
  57 + cusmanText = detailEntity.cusman.isEmpty ? "请选择" : detailEntity.cusman;
60 }); 58 });
61 - if(detailEntity.status!="0"){//已处理  
62 - Future.delayed(Duration(milliseconds: 200),(){  
63 - NavigatorUtil.goNotebookDetailPage(context, detailEntity.id,replace: true); 59 + if (detailEntity.status != "0") {
  60 + //已处理
  61 + Future.delayed(Duration(milliseconds: 200), () {
  62 + NavigatorUtil.goNotebookDetailPage(context, detailEntity.id,
  63 + replace: true);
64 }); 64 });
65 setMessageStatus(); 65 setMessageStatus();
66 - }else{  
67 - managers=await detailModel.getManagers(context); 66 + } else {
  67 + managers = await detailModel.getManagers(context);
68 } 68 }
69 }); 69 });
70 } 70 }
71 71
72 //设置当前客户经理 72 //设置当前客户经理
73 - _setCurrManager(){  
74 - manager=managers.firstWhere((manager)=>manager.userName==cusmanText,orElse: ()=>Manager());  
75 - if(manager.id==null||manager.id.toString().isEmpty)return;  
76 - Map<String,String> params={  
77 - "rid":detailEntity.id,  
78 - "cusman_id":manager.id.toString(),  
79 - "cusman":manager.userName 73 + _setCurrManager() {
  74 + manager = managers.firstWhere((manager) => manager.userName == cusmanText,
  75 + orElse: () => Manager());
  76 + if (manager.id == null || manager.id.toString().isEmpty) return;
  77 + Map<String, String> params = {
  78 + "rid": detailEntity.id,
  79 + "cusman_id": manager.id.toString(),
  80 + "cusman": manager.userName
80 }; 81 };
81 detailModel.setReserveCusmnan(context, params); 82 detailModel.setReserveCusmnan(context, params);
82 } 83 }
83 84
84 //拒绝订单弹框 85 //拒绝订单弹框
85 - _showRefuseDialog(){  
86 - showDialog(context: context,builder: (context){  
87 - return AlertDialog(  
88 - title: Text("确定拒绝订单吗?\n拒绝后无法联系客户"),  
89 - titleTextStyle: TextStyle(color: MyColours.color_353535,fontSize: ScreenUtil().setSp(32)),  
90 - content: Text("如果包间类型订满,请及时停用"),  
91 - contentTextStyle:TextStyle(color: MyColours.color_828282,fontSize: ScreenUtil().setSp(28)),  
92 - actions: <Widget>[  
93 - FlatButton(  
94 - child: Text("拒绝订单",style: TextStyle(fontSize: ScreenUtil().setSp(32)),),  
95 - onPressed: (){  
96 - Navigator.of(context).pop();  
97 - setReserveStatus("6");  
98 - },  
99 - ),  
100 - FlatButton(  
101 - child: Text("去安排",style: TextStyle(fontSize: ScreenUtil().setSp(32)),),  
102 - onPressed: () async {  
103 - Navigator.of(context).pop();  
104 - String tid=await NavigatorUtil.goSelectTablePage(context,widget.rid,int.parse(detailEntity.ddate)*1000,detailEntity.ddate_solt);  
105 - if(tid!=null){  
106 - setReserveStatus("5",tid:tid);  
107 - }  
108 - },  
109 - )  
110 - ],  
111 - );  
112 - }); 86 + _showRefuseDialog() {
  87 + showDialog(
  88 + context: context,
  89 + builder: (context) {
  90 + return AlertDialog(
  91 + title: Text("确定拒绝订单吗?\n拒绝后无法联系客户"),
  92 + titleTextStyle: TextStyle(
  93 + color: MyColours.color_353535,
  94 + fontSize: ScreenUtil().setSp(32)),
  95 + content: Text("如果包间类型订满,请及时停用"),
  96 + contentTextStyle: TextStyle(
  97 + color: MyColours.color_828282,
  98 + fontSize: ScreenUtil().setSp(28)),
  99 + actions: <Widget>[
  100 + FlatButton(
  101 + child: Text(
  102 + "拒绝订单",
  103 + style: TextStyle(fontSize: ScreenUtil().setSp(32)),
  104 + ),
  105 + onPressed: () {
  106 + Navigator.of(context).pop();
  107 + setReserveStatus("6");
  108 + },
  109 + ),
  110 + FlatButton(
  111 + child: Text(
  112 + "去安排",
  113 + style: TextStyle(fontSize: ScreenUtil().setSp(32)),
  114 + ),
  115 + onPressed: () async {
  116 + Navigator.of(context).pop();
  117 + String tid = await NavigatorUtil.goSelectTablePage(
  118 + context,
  119 + widget.rid,
  120 + int.parse(detailEntity.ddate) * 1000,
  121 + detailEntity.ddate_solt);
  122 + if (tid != null) {
  123 + setReserveStatus("5", tid: tid);
  124 + }
  125 + },
  126 + )
  127 + ],
  128 + );
  129 + });
113 } 130 }
114 131
115 //处理在线预订 132 //处理在线预订
116 - setReserveStatus(String status,{String tid=""}){  
117 - bus.emit("remove_untreated_message",widget.mid);  
118 - UserModel userModel=Provider.of<UserModel>(context,listen: false);  
119 - Map<String,String> causeMap={  
120 - "uid":userModel.user.openid,  
121 - "uname":userModel.user.account,  
122 - "desc":"", 133 + setReserveStatus(String status, {String tid = ""}) {
  134 + bus.emit("remove_untreated_message", widget.mid);
  135 + UserModel userModel = Provider.of<UserModel>(context, listen: false);
  136 + Map<String, String> causeMap = {
  137 + "uid": userModel.user.openid,
  138 + "uname": userModel.user.account,
  139 + "desc": "",
123 }; 140 };
124 - Map<String,String> params={  
125 - "rid":widget.rid,  
126 - "status":status,//5安排包间 6 拒绝订单  
127 - "tid":tid,  
128 - "mid":widget.mid,  
129 - "cause":json.encode(causeMap) 141 + Map<String, String> params = {
  142 + "rid": widget.rid,
  143 + "status": status, //5安排包间 6 拒绝订单
  144 + "tid": tid,
  145 + "mid": widget.mid,
  146 + "cause": json.encode(causeMap)
130 }; 147 };
131 detailModel.setReserveStatus(context, params); 148 detailModel.setReserveStatus(context, params);
132 } 149 }
133 150
134 //处理在线预订 151 //处理在线预订
135 - setMessageStatus(){  
136 - bus.emit("remove_untreated_message",widget.mid);  
137 - Map<String,String> params={  
138 - "sid":Provider.of<UserModel>(context,listen: false).user.sellerid,  
139 - "id":widget.mid,  
140 - "status":"is_handle" 152 + setMessageStatus() {
  153 + bus.emit("remove_untreated_message", widget.mid);
  154 + Map<String, String> params = {
  155 + "sid": Provider.of<UserModel>(context, listen: false).user.sellerid,
  156 + "id": widget.mid,
  157 + "status": "is_handle"
141 }; 158 };
142 detailModel.setMessageStatus(context, params); 159 detailModel.setMessageStatus(context, params);
143 } 160 }
@@ -146,186 +163,251 @@ class HandleOnlinePageState extends State<HandleOnlinePage> { @@ -146,186 +163,251 @@ class HandleOnlinePageState extends State<HandleOnlinePage> {
146 Widget build(BuildContext context) { 163 Widget build(BuildContext context) {
147 // TODO: implement build 164 // TODO: implement build
148 return SafeArea( 165 return SafeArea(
149 - child: detailEntity==null?Container(  
150 - width: double.infinity,  
151 - height: double.infinity,  
152 - color: MyColours.color_ffffff,  
153 - ):Column(  
154 - children: <Widget>[  
155 - MyAppBar(  
156 - "在线预订详情",  
157 - showBack: true,  
158 - ),  
159 - Expanded(  
160 - child: DefaultTextStyle(style: TextStyle(decoration: TextDecoration.none), child: Container( 166 + child: detailEntity == null
  167 + ? Container(
  168 + width: double.infinity,
  169 + height: double.infinity,
161 color: MyColours.color_ffffff, 170 color: MyColours.color_ffffff,
162 - child: Column(  
163 - children: <Widget>[  
164 - SingleChildScrollView(  
165 - child: Container(  
166 - color: MyColours.color_ffffff,  
167 - padding:  
168 - EdgeInsets.symmetric(horizontal: ScreenUtil().setWidth(43)),  
169 - child: Column(  
170 - children: <Widget>[  
171 - RowMultiText("用餐时段", detailEntity.ddateMd),  
172 - Stack(  
173 - alignment: Alignment.center,  
174 - children: <Widget>[  
175 - Column( 171 + )
  172 + : Column(
  173 + children: <Widget>[
  174 + MyAppBar(
  175 + "在线预订详情",
  176 + showBack: true,
  177 + ),
  178 + Expanded(
  179 + child: DefaultTextStyle(
  180 + style: TextStyle(decoration: TextDecoration.none),
  181 + child: Container(
  182 + color: MyColours.color_ffffff,
  183 + child: Column(
  184 + children: <Widget>[
  185 + SingleChildScrollView(
  186 + child: Container(
  187 + color: MyColours.color_ffffff,
  188 + padding: EdgeInsets.symmetric(
  189 + horizontal: ScreenUtil().setWidth(43)),
  190 + child: Column(
  191 + children: <Widget>[
  192 + RowMultiText(
  193 + "用餐时段", detailEntity.ddateMd),
  194 + Stack(
  195 + alignment: Alignment.center,
  196 + children: <Widget>[
  197 + Column(
  198 + children: <Widget>[
  199 + RowMultiText("用餐时间",
  200 + detailEntity.ddateHm),
  201 + Offstage(
  202 + offstage:
  203 + detailEntity.type == "0"
  204 + ? false
  205 + : true,
  206 + child: RowMultiText("用餐人数",
  207 + detailEntity.pnum),
  208 + )
  209 + ],
  210 + ),
  211 + Image.asset(
  212 + detailEntity.statuImgAssets,
  213 + width: ScreenUtil().setWidth(100),
  214 + height: ScreenUtil().setWidth(30),
  215 + )
  216 + ],
  217 + ),
  218 + RowMultiText(
  219 + "包间需求",
  220 + (detailEntity.demands.length
  221 + .toString() +
  222 + "个") ??
  223 + ""),
  224 + Align(
  225 + alignment: Alignment.centerRight,
  226 + child: Offstage(
  227 + offstage:
  228 + detailEntity.demands.length >
  229 + 0
  230 + ? false
  231 + : true,
  232 + child: Container(
  233 + height:
  234 + ScreenUtil().setHeight(210),
  235 + child: ListView.builder(
  236 + itemBuilder:
  237 + (BuildContext contxt,
  238 + int index) {
  239 + return NeedItem(detailEntity
  240 + .demands[index]);
  241 + },
  242 + itemCount: detailEntity
  243 + .demands.length,
  244 + shrinkWrap: true,
  245 + scrollDirection:
  246 + Axis.horizontal,
  247 + ),
  248 + ),
  249 + )),
  250 + RowMultiText(
  251 + "客户姓名", detailEntity.rnameStr),
  252 + RowMultiText(
  253 + "客户电话", detailEntity.phone),
  254 + RowMultiText(
  255 + "备注信息", detailEntity.cusdem ?? ""),
  256 + MyDivider(double.infinity,
  257 + ScreenUtil().setHeight(1)),
  258 + Container(
  259 + color: MyColours.color_ffffff,
  260 + width: double.infinity,
  261 + height: ScreenUtil().setHeight(80),
  262 + alignment: Alignment.center,
  263 + child: Stack(
  264 + alignment: Alignment.center,
  265 + children: <Widget>[
  266 + Positioned(
  267 + left: 0,
  268 + child: Text(
  269 + "客户经理",
  270 + style: TextStyle(
  271 + color: MyColours
  272 + .color_828282,
  273 + fontSize: ScreenUtil()
  274 + .setSp(30)),
  275 + ),
  276 + ),
  277 + Positioned(
  278 + right: 0,
  279 + child: GestureDetector(
  280 + onTap: () async {
  281 + List<String> list = [];
  282 + for (Manager manager
  283 + in managers) {
  284 + list.add(
  285 + manager.roleUserName);
  286 + }
  287 + DialogUtil
  288 + .showSelectCusmanDialog(
  289 + context, list)
  290 + .then((value) {
  291 + setState(() {
  292 + cusmanText = managers[
  293 + value.first]
  294 + .userName;
  295 + });
  296 + _setCurrManager();
  297 + });
  298 + },
  299 + child: Text(
  300 + cusmanText,
  301 + style: TextStyle(
  302 + color: MyColours
  303 + .color_353535,
  304 + fontSize: ScreenUtil()
  305 + .setSp(30),
  306 + decoration: TextDecoration
  307 + .underline,
  308 + ),
  309 + ),
  310 + ),
  311 + )
  312 + ],
  313 + ),
  314 + ),
  315 + ],
  316 + )),
  317 + ),
  318 + Container(
  319 + margin: EdgeInsets.only(
  320 + top: ScreenUtil().setHeight(30),
  321 + bottom: ScreenUtil().setHeight(30)),
  322 + child: Column(
176 children: <Widget>[ 323 children: <Widget>[
177 - RowMultiText("用餐时间", detailEntity.ddateHm),  
178 - Offstage(  
179 - offstage: detailEntity.type=="0"?false:true,  
180 - child: RowMultiText("用餐人数", detailEntity.pnum),  
181 - )  
182 - ],  
183 - ),  
184 - Image.asset(detailEntity.statuImgAssets,width: ScreenUtil().setWidth(100),height: ScreenUtil().setWidth(30),)  
185 - ],  
186 - ),  
187 - RowMultiText("包间需求", (detailEntity.demands.length.toString()+"个")??""),  
188 - Align(  
189 - alignment: Alignment.centerRight,  
190 - child: Offstage(  
191 - offstage: detailEntity.demands.length>0?false:true,  
192 - child: Container(  
193 - height: ScreenUtil().setHeight(210),  
194 - child: ListView.builder(itemBuilder: (BuildContext contxt,int index){  
195 - return NeedItem(detailEntity.demands[index]);  
196 - },itemCount: detailEntity.demands.length,shrinkWrap: true,scrollDirection: Axis.horizontal,),  
197 - ),  
198 - )  
199 - ),  
200 - RowMultiText("客户姓名", detailEntity.rnameStr),  
201 - RowMultiText("客户电话", detailEntity.phone),  
202 - RowMultiText("备注信息",detailEntity.cusdem??""),  
203 - MyDivider(double.infinity, ScreenUtil().setHeight(1)),  
204 - Container(  
205 - color: MyColours.color_ffffff,  
206 - width: double.infinity,  
207 - height: ScreenUtil().setHeight(80),  
208 - alignment: Alignment.center,  
209 - child: Stack(  
210 - alignment: Alignment.center,  
211 - children: <Widget>[  
212 - Positioned(  
213 - left: 0,  
214 - child: Text(  
215 - "客户经理",  
216 - style: TextStyle(  
217 - color: MyColours.color_828282,  
218 - fontSize: ScreenUtil().setSp(30)),  
219 - ),  
220 - ),  
221 - Positioned(  
222 - right: 0,  
223 - child: GestureDetector(  
224 - onTap: () async {  
225 - List<String> list=[];  
226 - for(Manager manager in managers){  
227 - list.add(manager.roleUserName); 324 + CommonButton(
  325 + content: "安排包间",
  326 + width: 669,
  327 + height: 76,
  328 + fontSize: 34,
  329 + onPress: () async {
  330 + String tid = await NavigatorUtil
  331 + .goSelectTablePage(
  332 + context,
  333 + widget.rid,
  334 + int.parse(detailEntity.ddate) *
  335 + 1000,
  336 + detailEntity.ddate_solt);
  337 + if (tid != null) {
  338 + setReserveStatus("5", tid: tid);
228 } 339 }
229 - DialogUtil.showSelectCusmanDialog(context,list).then((value){  
230 - setState(() {  
231 - cusmanText=managers[value.first].userName;  
232 - });  
233 - _setCurrManager();  
234 - });  
235 }, 340 },
236 - child: Text(  
237 - cusmanText,  
238 - style: TextStyle(  
239 - color: MyColours.color_353535,  
240 - fontSize: ScreenUtil().setSp(30),  
241 - decoration: TextDecoration.underline,  
242 - ),  
243 - ),  
244 ), 341 ),
245 - )  
246 - ],  
247 - ),  
248 - ),  
249 - ],  
250 - )),  
251 - ),  
252 - Container(  
253 - margin: EdgeInsets.only(top: ScreenUtil().setHeight(30),bottom: ScreenUtil().setHeight(30)),  
254 - child: Column(  
255 - children: <Widget>[  
256 - CommonButton(  
257 - content: "安排包间",  
258 - width: 669,  
259 - height: 76,  
260 - fontSize: 34,  
261 - onPress: () async {  
262 - String tid=await NavigatorUtil.goSelectTablePage(context,widget.rid,int.parse(detailEntity.ddate)*1000,detailEntity.ddate_solt);  
263 - if(tid!=null){  
264 - setReserveStatus("5",tid:tid);  
265 - }  
266 - },  
267 - ),  
268 - VEmptyView(20),  
269 - Container(  
270 - width: ScreenUtil().setWidth(669),  
271 - height: ScreenUtil().setHeight(76),  
272 - decoration: BoxDecoration(  
273 - border: Border.all(color: MyColours.color_199095),  
274 - borderRadius: BorderRadius.circular(  
275 - ScreenUtil().setWidth(5)),  
276 - ),  
277 - child: Row(  
278 - crossAxisAlignment: CrossAxisAlignment.center,  
279 - children: <Widget>[  
280 - Expanded(  
281 - child: GestureDetector(  
282 - child: Center(  
283 - child: Text(  
284 - "拒绝订单",  
285 - style: TextStyle(  
286 - color: MyColours.color_199095,  
287 - fontSize: ScreenUtil().setSp(34)), 342 + VEmptyView(20),
  343 + Container(
  344 + width: ScreenUtil().setWidth(669),
  345 + height: ScreenUtil().setHeight(76),
  346 + decoration: BoxDecoration(
  347 + border: Border.all(
  348 + color: MyColours.color_199095),
  349 + borderRadius: BorderRadius.circular(
  350 + ScreenUtil().setWidth(5)),
288 ), 351 ),
289 - ),  
290 - onTap: () {  
291 - _showRefuseDialog();  
292 - },  
293 - )),  
294 - MyDivider(  
295 - ScreenUtil().setWidth(2),  
296 - ScreenUtil().setHeight(52),  
297 - color: MyColours.color_199095,  
298 - ),  
299 - Expanded(  
300 - child: GestureDetector(  
301 - child: Center(  
302 - child: Text(  
303 - "联系顾客",  
304 - style: TextStyle( 352 + child: Row(
  353 + crossAxisAlignment:
  354 + CrossAxisAlignment.center,
  355 + children: <Widget>[
  356 + Expanded(
  357 + child: GestureDetector(
  358 + child: Center(
  359 + child: Text(
  360 + "拒绝订单",
  361 + style: TextStyle(
  362 + color:
  363 + MyColours.color_199095,
  364 + fontSize:
  365 + ScreenUtil().setSp(34)),
  366 + ),
  367 + ),
  368 + onTap: () {
  369 + _showRefuseDialog();
  370 + },
  371 + )),
  372 + MyDivider(
  373 + ScreenUtil().setWidth(2),
  374 + ScreenUtil().setHeight(52),
305 color: MyColours.color_199095, 375 color: MyColours.color_199095,
306 - fontSize: ScreenUtil().setSp(34)), 376 + ),
  377 + Expanded(
  378 + child: GestureDetector(
  379 + child: Center(
  380 + child: Text(
  381 + "联系顾客",
  382 + style: TextStyle(
  383 + color:
  384 + MyColours.color_199095,
  385 + fontSize:
  386 + ScreenUtil().setSp(34)),
  387 + ),
  388 + ),
  389 + onTap: () {
  390 + if (detailEntity.phone != null &&
  391 + detailEntity
  392 + .phone.isNotEmpty) {
  393 + Utils.goPhone(
  394 + detailEntity.phone);
  395 + } else {
  396 + Utils.showToast("没有客户电话!");
  397 + }
  398 + },
  399 + )),
  400 + ],
307 ), 401 ),
308 - ),  
309 - onTap: () {  
310 - if(detailEntity.phone!=null&&detailEntity.phone.isNotEmpty){  
311 - Utils.goPhone(detailEntity.phone);  
312 - }else{  
313 - Utils.showToast("没有客户电话!");  
314 - }  
315 - },  
316 - )), 402 + )
  403 + ],
  404 + ),
  405 + )
317 ], 406 ],
318 - ),  
319 - )  
320 - ],  
321 - ),  
322 - )  
323 - ],  
324 - )  
325 - )),  
326 - )  
327 - ],  
328 - ), 407 + ))),
  408 + )
  409 + ],
  410 + ),
329 ); 411 );
330 } 412 }
331 } 413 }
  1 +import 'dart:ui';
  2 +
  3 +import 'package:common_utils/common_utils.dart';
1 import 'package:flutter/material.dart'; 4 import 'package:flutter/material.dart';
  5 +import 'package:flutter/services.dart';
2 import 'package:flutter_screenutil/screenutil.dart'; 6 import 'package:flutter_screenutil/screenutil.dart';
  7 +import 'package:one_key/models/notebook_detail.dart';
  8 +import 'package:one_key/provider/notebook_detail_change_model.dart';
3 import 'package:one_key/res/colors.dart'; 9 import 'package:one_key/res/colors.dart';
4 -import 'package:one_key/utils/utils.dart'; 10 +import 'package:one_key/utils/dialog_util.dart';
  11 +import 'package:one_key/utils/navigator_util.dart';
  12 +import 'package:one_key/widgets/MyDivider.dart';
5 import 'package:one_key/widgets/app_bar.dart'; 13 import 'package:one_key/widgets/app_bar.dart';
  14 +import 'package:one_key/widgets/common_button.dart';
6 import 'package:one_key/widgets/h_empty_view.dart'; 15 import 'package:one_key/widgets/h_empty_view.dart';
7 -import 'package:one_key/widgets/round_button.dart'; 16 +import 'package:one_key/widgets/new_table_item.dart';
  17 +import 'package:one_key/widgets/table_item.dart';
  18 +import 'package:one_key/widgets/v_empty_view.dart';
  19 +import 'package:provider/provider.dart';
  20 +
  21 +typedef clickCallback = void Function(String value);
8 22
9 class NoteBookChangePage extends StatefulWidget { 23 class NoteBookChangePage extends StatefulWidget {
  24 + final NotebookDetail detailEntity;
  25 + final String rid;
  26 +
  27 + const NoteBookChangePage({Key key, this.detailEntity, this.rid})
  28 + : super(key: key);
10 @override 29 @override
11 _NoteBookChangePageState createState() => _NoteBookChangePageState(); 30 _NoteBookChangePageState createState() => _NoteBookChangePageState();
12 } 31 }
13 32
14 class _NoteBookChangePageState extends State<NoteBookChangePage> { 33 class _NoteBookChangePageState extends State<NoteBookChangePage> {
15 - String dateText = ""; //当前显示日期时间  
16 - int currTimeIndex = 1; //当前选中时间段  
17 - String morning; //早市时间段  
18 - String noon; //午市时间段  
19 - String night; //晚市时间段 34 + // String dateText = ""; //当前显示日期时间
  35 + // int currTimeIndex = 1; //当前选中时间段
  36 + // String morning; //早市时间段
  37 + // String noon; //午市时间段
  38 + // String night; //晚市时间段
20 39
21 DateTime dateTime; //当前日期 40 DateTime dateTime; //当前日期
  41 + NotebookDetailChangeModel _notebookDetailChangeModel;
  42 + FocusNode _phoneNode = FocusNode();
  43 + FocusNode _nameNode = FocusNode();
  44 + FocusNode _needNode = FocusNode();
22 45
23 - //生成日期文本  
24 - _createDateText(DateTime day) {  
25 - if (Utils.isOneDay(day, dateTime)) return; //日期没变  
26 - setState(() {  
27 - DateTime dateNow = DateTime.now();  
28 - if (Utils.isOneDay(day, dateNow)) {  
29 - dateText = Utils.addZeroNumber(dateNow.month) +  
30 - "-" +  
31 - Utils.addZeroNumber(dateNow.day) +  
32 - " 今天";  
33 - } else {  
34 - dateText =  
35 - Utils.addZeroNumber(day.month) + "-" + Utils.addZeroNumber(day.day);  
36 - }  
37 - dateTime = day;  
38 - });  
39 - // _getReserveList();  
40 - // _reserveCountDay();  
41 - } 46 + // //生成日期文本
  47 + // _createDateText(DateTime day) {
  48 + // if (Utils.isOneDay(day, dateTime)) return; //日期没变
  49 + // setState(() {
  50 + // DateTime dateNow = DateTime.now();
  51 + // if (Utils.isOneDay(day, dateNow)) {
  52 + // dateText = Utils.addZeroNumber(dateNow.month) +
  53 + // "-" +
  54 + // Utils.addZeroNumber(dateNow.day) +
  55 + // " 今天";
  56 + // } else {
  57 + // dateText =
  58 + // Utils.addZeroNumber(day.month) + "-" + Utils.addZeroNumber(day.day);
  59 + // }
  60 + // dateTime = day;
  61 + // });
  62 + // // _getReserveList();
  63 + // // _reserveCountDay();
  64 + // }
42 65
43 //初始化时间 66 //初始化时间
44 _initTime() { 67 _initTime() {
45 - dateTime = DateTime.now();  
46 - dateText = Utils.addZeroNumber(dateTime.month) +  
47 - "-" +  
48 - Utils.addZeroNumber(dateTime.day); 68 + _notebookDetailChangeModel =
  69 + Provider.of<NotebookDetailChangeModel>(context, listen: false);
  70 + //今天
  71 + DateTime dateTime = DateTime.now();
  72 + int dateTimeMill = dateTime.millisecondsSinceEpoch;
  73 + String dateText = DateUtil.formatDateMs(dateTimeMill, format: 'MM-dd');
  74 + _notebookDetailChangeModel.dateList.add({
  75 + 'title': dateText,
  76 + 'select': false,
  77 + 'fontSize': 34.0,
  78 + 'dayText': ' 今天',
  79 + 'isImage': false
  80 + });
  81 + //明天
  82 + int tomorrowMill = dateTimeMill + 24 * 60 * 60 * 1000;
  83 + String dateTextTomorrow =
  84 + DateUtil.formatDateMs(tomorrowMill, format: 'MM-dd');
  85 + _notebookDetailChangeModel.dateList.add({
  86 + 'title': dateTextTomorrow,
  87 + 'select': false,
  88 + 'fontSize': 34.0,
  89 + 'dayText': ' 明天',
  90 + 'isImage': false
  91 + });
  92 + //第三个
  93 + _notebookDetailChangeModel.dateList.add({
  94 + 'title': '其他',
  95 + 'select': true,
  96 + 'fontSize': 30.0,
  97 + 'dayText': '',
  98 + 'isImage': true
  99 + });
  100 +
  101 + print(widget.detailEntity);
  102 + // dateList.add(value)
49 // morning = 103 // morning =
50 // userModel.user.morning.isEmpty ? "00:00-00:00" : userModel.user.morning; 104 // userModel.user.morning.isEmpty ? "00:00-00:00" : userModel.user.morning;
51 // noon = userModel.user.noon.isEmpty ? "00:00-00:00" : userModel.user.noon; 105 // noon = userModel.user.noon.isEmpty ? "00:00-00:00" : userModel.user.noon;
@@ -105,74 +159,628 @@ class _NoteBookChangePageState extends State<NoteBookChangePage> { @@ -105,74 +159,628 @@ class _NoteBookChangePageState extends State<NoteBookChangePage> {
105 @override 159 @override
106 void initState() { 160 void initState() {
107 super.initState(); 161 super.initState();
108 - _initTime(); 162 + dateTime = DateTime.now();
  163 +
  164 + _notebookDetailChangeModel =
  165 + Provider.of<NotebookDetailChangeModel>(context, listen: false);
  166 + _notebookDetailChangeModel.initDateHourMinuteList(context);
  167 + _notebookDetailChangeModel.getNewTableList(context);
  168 + _initData();
  169 +
  170 + // _initTime();
109 } 171 }
110 172
111 - @override  
112 - Widget build(BuildContext context) {  
113 - return Scaffold(  
114 - backgroundColor: Colors.white,  
115 - body: SingleChildScrollView(  
116 - child: Column(children: <Widget>[  
117 - SizedBox(height: ScreenUtil.statusBarHeight),  
118 - MyAppBar(  
119 - "在线预订详情",  
120 - showBack: true,  
121 - ),  
122 - //第一行  
123 - Container(  
124 - padding: EdgeInsets.all(ScreenUtil().setWidth(40)),  
125 - child: Row( 173 + _initData() {
  174 + print(widget.detailEntity);
  175 + for (var item in widget.detailEntity.tables) {
  176 + item.selected = true;
  177 + }
  178 + }
  179 +
  180 + _topWidget() {
  181 + return Container(
  182 + padding: EdgeInsets.all(ScreenUtil().setWidth(40)),
  183 + child: Column(
  184 + children: [
  185 + //第一行 日期选择
  186 + Row(
126 mainAxisAlignment: MainAxisAlignment.spaceBetween, 187 mainAxisAlignment: MainAxisAlignment.spaceBetween,
127 - children: [  
128 - CustomButton(  
129 - dateText: dateText,  
130 - dayText: ' 今天',  
131 - isSelect: true,  
132 - ),  
133 - CustomButton(  
134 - dateText: dateText,  
135 - dayText: ' 明天',  
136 - isSelect: false, 188 + children: _notebookDetailChangeModel.dateList.map((value) {
  189 + return CustomButton(
  190 + dateText: value['title'],
  191 + fontSize: value['fontSize'],
  192 + dayText: value['dayText'],
  193 + isImage: value['isImage'],
  194 + isSelect: value['select'],
  195 + onTap: () {
  196 + for (int j = 0;
  197 + j < _notebookDetailChangeModel.dateList.length;
  198 + j++) {
  199 + _notebookDetailChangeModel.dateList[j]['select'] = false;
  200 +
  201 + if (_notebookDetailChangeModel.dateList[j]['title'] ==
  202 + value['title']) {
  203 + _notebookDetailChangeModel.dateList[j]['select'] = true;
  204 + if (j == 0 || j == 1) {
  205 + _notebookDetailChangeModel.dateList[2]['title'] =
  206 + '其他';
  207 + }
  208 + if (j ==
  209 + _notebookDetailChangeModel.dateList.length - 1) {
  210 + String selectStr =
  211 + _notebookDetailChangeModel.dateList[2]['title'];
  212 + String timeNow = DateUtil.formatDate(
  213 + DateTime.now(),
  214 + );
  215 + String selectDate =
  216 + timeNow.replaceRange(5, 10, selectStr);
  217 + DialogUtil.showCalendarDialog(
  218 + context, DateUtil.getDateTime(selectDate))
  219 + .then((day) {
  220 + if (day != null) {
  221 + // _createDateText(day);
  222 + dateTime = day;
  223 + int dateTimeMill = day.millisecondsSinceEpoch;
  224 + String dateText = DateUtil.formatDateMs(
  225 + dateTimeMill,
  226 + format: 'MM-dd');
  227 + bool isThird = true;
  228 + for (int i = 0;
  229 + i <
  230 + _notebookDetailChangeModel
  231 + .dateList.length;
  232 + i++) {
  233 + _notebookDetailChangeModel.dateList[i]
  234 + ['select'] = false;
  235 +
  236 + if (_notebookDetailChangeModel.dateList[i]
  237 + ['title'] ==
  238 + dateText) {
  239 + _notebookDetailChangeModel.dateList[i]
  240 + ['select'] = true;
  241 + isThird = false;
  242 + }
  243 + }
  244 + if (isThird) {
  245 + _notebookDetailChangeModel.dateList[2]
  246 + ['select'] = true;
  247 + _notebookDetailChangeModel.dateList[2]
  248 + ['title'] = dateText;
  249 + } else {
  250 + _notebookDetailChangeModel.dateList[2]
  251 + ['title'] = '其他';
  252 + }
  253 + }
  254 + _notebookDetailChangeModel.notifyListeners();
  255 + });
  256 + }
  257 + }
  258 + }
  259 + _notebookDetailChangeModel.notifyListeners();
  260 + },
  261 + );
  262 + }).toList()),
  263 +
  264 + VEmptyView(60),
  265 + //早市、午市、晚市
  266 + Row(
  267 + // mainAxisAlignment: MainAxisAlignment.spaceBetween,
  268 + children: _notebookDetailChangeModel.sunDateList.map((value) {
  269 + return Container(
  270 + margin: _notebookDetailChangeModel.sunDateList.length == 3 &&
  271 + value['ddateSolt'] == 3
  272 + ? EdgeInsets.only(right: 0)
  273 + : EdgeInsets.only(right: ScreenUtil().setWidth(20)),
  274 + child: CustomButton(
  275 + onTap: () {
  276 + for (var item in _notebookDetailChangeModel.sunDateList) {
  277 + item['isSelect'] = false;
  278 + if (item['dateText'] == value['dateText']) {
  279 + item['isSelect'] = true;
  280 + String key = '';
  281 +
  282 + if (item['ddateSolt'] == 1) {
  283 + //早市
  284 + key = 'morning';
  285 + } else if (item['ddateSolt'] == 2) {
  286 + //午市
  287 + key = 'noon';
  288 + } else if (item['ddateSolt'] == 3) {
  289 + //晚市
  290 + key = 'night';
  291 + }
  292 + if (key != '') {
  293 + for (var sunitem
  294 + in _notebookDetailChangeModel.dailyMap[key]) {
  295 + if (sunitem['select'] == true) {
  296 + _notebookDetailChangeModel.ddateStr =
  297 + sunitem['title'];
  298 + }
  299 + }
  300 + }
  301 + }
  302 + }
  303 + _notebookDetailChangeModel.notifyListeners();
  304 + },
  305 + dateText: value['dateText'],
  306 + dayText: '',
  307 + isSelect: value['isSelect'],
  308 + ),
  309 + );
  310 + }).toList()),
  311 + VEmptyView(60),
  312 +
  313 + ///人数选择
  314 + Row(
  315 + mainAxisAlignment: MainAxisAlignment.spaceBetween,
  316 + children: _notebookDetailChangeModel.personNumList.map((value) {
  317 + return CustomButton(
  318 + onTap: () {
  319 + for (int j = 0;
  320 + j < _notebookDetailChangeModel.personNumList.length;
  321 + j++) {
  322 + _notebookDetailChangeModel.personNumList[j]['isSelect'] =
  323 + false;
  324 +
  325 + if (_notebookDetailChangeModel.personNumList[j]
  326 + ['dateText'] ==
  327 + value['dateText']) {
  328 + _notebookDetailChangeModel.personNumList[j]['isSelect'] =
  329 + true;
  330 + _notebookDetailChangeModel.numController.text =
  331 + value['dateText'];
  332 + // if (j < 5) {
  333 + // _notebookDetailChangeModel.personNumList[5]
  334 + // ['dateText'] = '更多';
  335 + // }
  336 + }
  337 + }
  338 + _notebookDetailChangeModel.notifyListeners();
  339 + },
  340 + dateText: value['dateText'],
  341 + fontSize: value['fontSize'],
  342 + dayText: '',
  343 + width: value['width'],
  344 + isImage: value['isImage'],
  345 + isSelect: value['isSelect'],
  346 + isTextFiled: value['isTextFiled'],
  347 + model: _notebookDetailChangeModel,
  348 + );
  349 + }).toList(),
  350 + )
  351 + ],
  352 + ),
  353 + );
  354 + }
  355 +
  356 + /// 可订桌位
  357 + _middleWidget() {
  358 + return Container(
  359 + padding: EdgeInsets.all(ScreenUtil().setWidth(40)),
  360 + color: MyColours.color_f5f5f5,
  361 + child: Column(
  362 + children: [
  363 + Row(
  364 + mainAxisAlignment: MainAxisAlignment.spaceBetween,
  365 + crossAxisAlignment: CrossAxisAlignment.end,
  366 + children: [
  367 + Text(
  368 + '可订桌位',
  369 + style: TextStyle(
  370 + color: MyColours.color_353535,
  371 + fontSize: ScreenUtil().setSp(30)),
  372 + ),
  373 + InkWell(
  374 + onTap: () async {
  375 + String tid = await NavigatorUtil.goSelectTablePage(
  376 + context,
  377 + widget.rid,
  378 + int.parse(widget.detailEntity.ddate) * 1000,
  379 + widget.detailEntity.ddate_solt);
  380 + if (tid != null) {
  381 + // setReserveStatus("5", tid: tid);
  382 + }
  383 + },
  384 + child: Row(
  385 + children: [
  386 + Text('更多',
  387 + style: TextStyle(
  388 + color: MyColours.color_353535,
  389 + fontSize: ScreenUtil().setSp(26))),
  390 + HEmptyView(20),
  391 + Image.asset(
  392 + 'assets/arr_right_gray.png',
  393 + width: ScreenUtil().setWidth(12),
  394 + height: ScreenUtil().setWidth(22),
  395 + )
  396 + ],
137 ), 397 ),
138 - CustomButton(  
139 - dateText: '其他',  
140 - fontSize: 30,  
141 - dayText: '',  
142 - isImage: true,  
143 - isSelect: false,  
144 - )  
145 - ],  
146 - ), 398 + )
  399 + ],
147 ), 400 ),
148 - //第二行  
149 - Container(  
150 - padding: EdgeInsets.all(ScreenUtil().setWidth(40)),  
151 - child: Row(  
152 - mainAxisAlignment: MainAxisAlignment.spaceBetween,  
153 - children: [  
154 - CustomButton(  
155 - dateText: '早市',  
156 - dayText: '',  
157 - isSelect: true, 401 + VEmptyView(32),
  402 + Align(
  403 + alignment: Alignment.centerRight,
  404 + child: Offstage(
  405 + offstage: _notebookDetailChangeModel.tableList.length > 0
  406 + ? false
  407 + : true,
  408 + child: Container(
  409 + // height: ScreenUtil().setHeight(178),
  410 + height: ScreenUtil().setHeight(210),
  411 + child: ListView.builder(
  412 + physics: const NeverScrollableScrollPhysics(),
  413 + itemBuilder: (BuildContext contxt, int index) {
  414 + return NewTableItem(
  415 + _notebookDetailChangeModel.tableList[index],
  416 + height: 160,
  417 + );
  418 + },
  419 + itemCount: _notebookDetailChangeModel.tableList.length > 3
  420 + ? 3
  421 + : _notebookDetailChangeModel.tableList.length,
  422 + shrinkWrap: true,
  423 + scrollDirection: Axis.horizontal,
  424 + ),
158 ), 425 ),
159 - CustomButton(  
160 - dateText: '午市',  
161 - dayText: '',  
162 - isSelect: false, 426 + )),
  427 + ],
  428 + ),
  429 + );
  430 + }
  431 +
  432 + _bottomWidget() {
  433 + return Container(
  434 + padding: EdgeInsets.symmetric(
  435 + horizontal: ScreenUtil().setWidth(40),
  436 + ),
  437 + margin: EdgeInsets.only(top: ScreenUtil().setWidth(72)),
  438 + child: Column(
  439 + children: [
  440 + Row(
  441 + mainAxisAlignment: MainAxisAlignment.spaceBetween,
  442 + crossAxisAlignment: CrossAxisAlignment.center,
  443 + children: [
  444 + Expanded(
  445 + child: TextField(
  446 + maxLines: 1,
  447 + //输入文本的样式
  448 + style: TextStyle(
  449 + fontSize: ScreenUtil().setSp(34),
  450 + color: MyColours.color_353535),
  451 + controller: _notebookDetailChangeModel.phoneController,
  452 + focusNode: _phoneNode,
  453 + // textAlignVertical: TextAlignVertical.top,
  454 + decoration: InputDecoration(
  455 + hintText: "客户电话",
  456 + hintStyle: TextStyle(
  457 + color: MyColours.color_999999,
  458 + fontSize: ScreenUtil().setSp(34),
  459 + ),
  460 + // contentPadding:
  461 + // EdgeInsets.only(bottom: ScreenUtil().setWidth(17)),
  462 + border: InputBorder.none,
  463 + ),
  464 + onChanged: (value) {},
  465 + onEditingComplete: () {
  466 + print('fff');
  467 + _phoneNode.unfocus();
  468 + },
  469 + keyboardType: TextInputType.number,
  470 + ),
  471 + ),
  472 + HEmptyView(40),
  473 + InkWell(
  474 + onTap: () {
  475 + _showDateChooseWidget(context);
  476 + },
  477 + child: Text(
  478 + int.parse(widget.detailEntity.is_set_ddate) == 0
  479 + ? '未设置到店时间'
  480 + : _notebookDetailChangeModel.ddateStr,
  481 + style: TextStyle(
  482 + color: int.parse(widget.detailEntity.is_set_ddate) == 0
  483 + ? MyColours.color_999999
  484 + : MyColours.color_199095,
  485 + fontSize: ScreenUtil().setSp(34),
  486 + ),
163 ), 487 ),
164 - CustomButton(  
165 - dateText: '晚市',  
166 - dayText: '',  
167 - isSelect: false,  
168 - )  
169 - ], 488 + ),
  489 + ],
  490 + ),
  491 + VEmptyView(40),
  492 + MyDivider(ScreenUtil().setWidth(335 * 2), ScreenUtil().setWidth(2),
  493 + color: MyColours.color_F1F0F4),
  494 + VEmptyView(72),
  495 + Row(
  496 + mainAxisAlignment: MainAxisAlignment.spaceBetween,
  497 + crossAxisAlignment: CrossAxisAlignment.center,
  498 + children: [
  499 + Expanded(
  500 + child: TextField(
  501 + maxLines: 1,
  502 + //输入文本的样式
  503 + style: TextStyle(
  504 + fontSize: ScreenUtil().setSp(34),
  505 + color: MyColours.color_353535),
  506 + controller: _notebookDetailChangeModel.nameController,
  507 + focusNode: _nameNode,
  508 + // textAlignVertical: TextAlignVertical.top,
  509 + decoration: InputDecoration(
  510 + hintText: "客户姓名(必填)",
  511 + hintStyle: TextStyle(
  512 + color: MyColours.color_999999,
  513 + fontSize: ScreenUtil().setSp(34),
  514 + ),
  515 + // contentPadding:
  516 + // EdgeInsets.only(bottom: ScreenUtil().setWidth(17)),
  517 + border: InputBorder.none,
  518 + ),
  519 + onChanged: (value) {},
  520 + onEditingComplete: () {
  521 + print('fff');
  522 + _nameNode.unfocus();
  523 + },
  524 + // keyboardType: TextInputType.number,
  525 + ),
  526 + ),
  527 + HEmptyView(40),
  528 + Row(
  529 + children: _notebookDetailChangeModel.sexList.map((value) {
  530 + return _callButton(
  531 + onPress: () {
  532 + for (var item in _notebookDetailChangeModel.sexList) {
  533 + item['select'] = false;
  534 + if (item['title'] == value['title']) {
  535 + item['select'] = true;
  536 + }
  537 + }
  538 + _notebookDetailChangeModel.notifyListeners();
  539 + },
  540 + content: value['title'],
  541 + hasLeftBorder: value['hasLeftBorder'],
  542 + isSelect: value['select']);
  543 + }).toList()),
  544 + ],
  545 + ),
  546 + VEmptyView(40),
  547 + MyDivider(ScreenUtil().setWidth(335 * 2), ScreenUtil().setWidth(2),
  548 + color: MyColours.color_F1F0F4),
  549 + VEmptyView(72),
  550 + TextField(
  551 + maxLines: 1,
  552 + //输入文本的样式
  553 + style: TextStyle(
  554 + fontSize: ScreenUtil().setSp(34),
  555 + color: MyColours.color_353535),
  556 + controller: _notebookDetailChangeModel.customController,
  557 + focusNode: _needNode,
  558 + // textAlignVertical: TextAlignVertical.top,
  559 + decoration: InputDecoration(
  560 + hintText: "客户要求(25字以内,选填)",
  561 + hintStyle: TextStyle(
  562 + color: MyColours.color_999999,
  563 + fontSize: ScreenUtil().setSp(34),
  564 + ),
  565 + // contentPadding:
  566 + // EdgeInsets.only(bottom: ScreenUtil().setWidth(17)),
  567 + border: InputBorder.none,
170 ), 568 ),
  569 + onChanged: (value) {},
  570 + onEditingComplete: () {
  571 + print('fff');
  572 + _needNode.unfocus();
  573 + },
  574 + // keyboardType: TextInputType.number,
  575 + ),
  576 + VEmptyView(40),
  577 + MyDivider(ScreenUtil().setWidth(335 * 2), ScreenUtil().setWidth(2),
  578 + color: MyColours.color_F1F0F4),
  579 + // VEmptyView(72),
  580 + // VEmptyView(62),
  581 + ],
  582 + ),
  583 + );
  584 + }
  585 +
  586 + ///底部弹框,设置时间30分钟间隔布局
  587 + _showDateChooseWidget(BuildContext context) async {
  588 + List tempMndList = [];
  589 +
  590 + String title = '早市';
  591 + String key;
  592 + for (var item in _notebookDetailChangeModel.sunDateList) {
  593 + if (item['isSelect'] == true) {
  594 + title = item['dateText'];
  595 + key = item['key'];
  596 + tempMndList = _notebookDetailChangeModel.dailyMap[key];
  597 + }
  598 + }
  599 + //计算行数
  600 +
  601 + int line = 0;
  602 + int count = tempMndList.length;
  603 + if (count % 3 == 0) {
  604 + line = int.parse('${count / 3}');
  605 + } else {
  606 + line = (count / 3).ceil();
  607 + }
  608 + int height = 85 + 40 + 36 * line + (line - 1) * 15;
  609 + final option = await showModalBottomSheet(
  610 + context: context,
  611 + backgroundColor: Colors.white,
  612 + builder: (context) {
  613 + return StatefulBuilder(builder: (context, state) {
  614 + return SafeArea(
  615 + child: Container(
  616 + decoration: BoxDecoration(
  617 + borderRadius:
  618 + BorderRadius.circular(ScreenUtil().setWidth(10))),
  619 + height: ScreenUtil().setWidth(height * 2),
  620 + child: Column(
  621 + children: [
  622 + InkWell(
  623 + onTap: () {
  624 + Navigator.pop(context);
  625 + },
  626 + child: Align(
  627 + alignment: Alignment.centerRight,
  628 + child: Container(
  629 + padding: EdgeInsets.fromLTRB(
  630 + ScreenUtil().setWidth(40),
  631 + ScreenUtil().setWidth(40),
  632 + ScreenUtil().setWidth(40),
  633 + ScreenUtil().setWidth(10)),
  634 + child: Image.asset(
  635 + 'assets/icon_exist.png',
  636 + width: ScreenUtil().setWidth(32),
  637 + ),
  638 + ),
  639 + ),
  640 + ),
  641 + Center(
  642 + child: Text(title,
  643 + style: TextStyle(
  644 + fontSize: ScreenUtil().setSp(34),
  645 + fontWeight: FontWeight.bold,
  646 + color: MyColours.color_353535)),
  647 + ),
  648 + VEmptyView(40),
  649 + Padding(
  650 + padding: EdgeInsets.symmetric(
  651 + horizontal: ScreenUtil().setWidth(60)),
  652 + child: GridView.builder(
  653 + padding:
  654 + EdgeInsets.only(top: ScreenUtil().setWidth(20)),
  655 + shrinkWrap: true,
  656 + cacheExtent: ScreenUtil().setWidth(0),
  657 + itemCount: tempMndList.length,
  658 + gridDelegate:
  659 + SliverGridDelegateWithFixedCrossAxisCount(
  660 + crossAxisCount: 3,
  661 + childAspectRatio: 80 / 36,
  662 + mainAxisSpacing:
  663 + ScreenUtil().setWidth(15 * 2),
  664 + crossAxisSpacing:
  665 + ScreenUtil().setWidth(38 * 2)),
  666 + itemBuilder: (BuildContext context, int index) {
  667 + // locationState = state;
  668 + return CustomButton(
  669 + onTap: () {
  670 + // state(() {
  671 + for (var item in tempMndList) {
  672 + item['select'] = false;
  673 + if (item['title'] ==
  674 + tempMndList[index]['title']) {
  675 + item['select'] = true;
  676 + widget.detailEntity.is_set_ddate = '1';
  677 + _notebookDetailChangeModel.ddateStr =
  678 + item['title'];
  679 + }
  680 + }
  681 + // });
  682 +
  683 + _notebookDetailChangeModel.notifyListeners();
  684 + Navigator.pop(context);
  685 + },
  686 + width: 80,
  687 + height: 36,
  688 + dateText: tempMndList[index]['title'].toString(),
  689 + dayText: '',
  690 + isSelect: tempMndList[index]['select'],
  691 + );
  692 + }))
  693 + ],
  694 + ),
  695 + ));
  696 + });
  697 + });
  698 + }
  699 +
  700 + Widget _callButton(
  701 + {GestureTapCallback onPress,
  702 + content,
  703 + hasLeftBorder = true,
  704 + isSelect = false}) {
  705 + return InkWell(
  706 + onTap: onPress,
  707 + child: Container(
  708 + width: ScreenUtil().setWidth(84),
  709 + height: ScreenUtil().setHeight(48),
  710 + decoration: BoxDecoration(
  711 + color: isSelect ? MyColours.color_199095 : MyColours.color_fefefe,
  712 + border: Border(
  713 + bottom: BorderSide(
  714 + color: MyColours.color_6AB6B9,
  715 + width: ScreenUtil().setWidth(2)),
  716 + top: BorderSide(
  717 + color: MyColours.color_6AB6B9,
  718 + width: ScreenUtil().setWidth(1)),
  719 + left: hasLeftBorder
  720 + ? BorderSide(
  721 + color: MyColours.color_6AB6B9,
  722 + width: ScreenUtil().setWidth(2))
  723 + : BorderSide.none,
  724 + right: BorderSide(
  725 + color: MyColours.color_6AB6B9,
  726 + width: ScreenUtil().setWidth(2)))),
  727 + child: Align(
  728 + alignment: Alignment.center,
  729 + child: Text(
  730 + content,
  731 + style: TextStyle(
  732 + color: isSelect ? Colors.white : MyColours.color_353535,
  733 + fontSize: ScreenUtil().setSp(28)),
171 ), 734 ),
172 - ]), 735 + ),
173 ), 736 ),
174 ); 737 );
175 } 738 }
  739 +
  740 + @override
  741 + Widget build(BuildContext context) {
  742 + _notebookDetailChangeModel =
  743 + Provider.of<NotebookDetailChangeModel>(context, listen: true);
  744 + return GestureDetector(
  745 + behavior: HitTestBehavior.translucent,
  746 + onTap: () {
  747 + FocusScope.of(context).requestFocus(FocusNode()); //点击空白处隐藏键盘
  748 + },
  749 + child: Scaffold(
  750 + backgroundColor: Colors.white,
  751 + body: Column(children: <Widget>[
  752 + SizedBox(height: ScreenUtil.statusBarHeight),
  753 + MyAppBar(
  754 + "变更预订",
  755 + showBack: true,
  756 + ),
  757 + Expanded(
  758 + child: SingleChildScrollView(
  759 + child: Column(
  760 + children: [_topWidget(), _middleWidget(), _bottomWidget()],
  761 + ))),
  762 + Container(
  763 + padding: EdgeInsets.symmetric(
  764 + horizontal: ScreenUtil().setWidth(40),
  765 + vertical: ScreenUtil().setWidth(60),
  766 + ),
  767 + child: CommonButton(
  768 + width: double.infinity,
  769 + height: 84,
  770 + fontSize: 34,
  771 + content: "确定修改",
  772 + state: 2,
  773 + onPress: () {
  774 + _notebookDetailChangeModel.setReserveInfo(context);
  775 + // messageDialogModel.removeMessage(message.id);
  776 + // NavigatorUtil.goHandleOnlinePage(
  777 + // context, message.rid.toString(), message.id,
  778 + // replace: messageDialogModel.messages.isEmpty);
  779 + },
  780 + ))
  781 + ]),
  782 + ));
  783 + }
176 } 784 }
177 785
178 class CustomButton extends StatefulWidget { 786 class CustomButton extends StatefulWidget {
@@ -181,55 +789,134 @@ class CustomButton extends StatefulWidget { @@ -181,55 +789,134 @@ class CustomButton extends StatefulWidget {
181 final bool isSelect; 789 final bool isSelect;
182 final double fontSize; 790 final double fontSize;
183 final bool isImage; 791 final bool isImage;
  792 + final double width;
  793 + final GestureTapCallback onTap;
  794 + final bool isTextFiled;
  795 + final NotebookDetailChangeModel model;
  796 + final double height;
184 797
185 - const CustomButton(  
186 - {Key key,  
187 - this.dateText,  
188 - this.dayText,  
189 - this.isSelect,  
190 - this.fontSize = 34,  
191 - this.isImage = false})  
192 - : super(key: key); 798 + const CustomButton({
  799 + Key key,
  800 + this.dateText,
  801 + this.dayText,
  802 + this.isSelect,
  803 + this.fontSize = 34,
  804 + this.isImage = false,
  805 + this.width = 105,
  806 + this.onTap,
  807 + this.isTextFiled = false,
  808 + this.model,
  809 + this.height = 25,
  810 + }) : super(key: key);
193 @override 811 @override
194 _ButtonState createState() => _ButtonState(); 812 _ButtonState createState() => _ButtonState();
195 } 813 }
196 814
197 class _ButtonState extends State<CustomButton> { 815 class _ButtonState extends State<CustomButton> {
  816 + FocusNode _cancelNode = FocusNode();
198 @override 817 @override
199 Widget build(BuildContext context) { 818 Widget build(BuildContext context) {
200 - return Container(  
201 - width: ScreenUtil().setWidth(105 * 2),  
202 - height: ScreenUtil().setWidth(25 * 2),  
203 - decoration: BoxDecoration(  
204 - color: widget.isSelect ? MyColours.color_199095 : Colors.white,  
205 - borderRadius: BorderRadius.circular(ScreenUtil().setWidth(10)),  
206 - border: Border.all(  
207 - color: MyColours.color_199095, width: ScreenUtil().setWidth(2))),  
208 - child: Row(  
209 - mainAxisAlignment: MainAxisAlignment.center,  
210 - children: [  
211 - Text(widget.dateText,  
212 - style: TextStyle(  
213 - fontWeight: FontWeight.bold,  
214 - color: widget.isSelect  
215 - ? MyColours.color_fefefe  
216 - : MyColours.color_199095,  
217 - fontSize: ScreenUtil().setSp(widget.fontSize))),  
218 - widget.isImage ? HEmptyView(20) : Container(),  
219 - widget.isImage  
220 - ? Image.asset(  
221 - widget.isSelect  
222 - ? 'assets/message_selected.png'  
223 - : 'assets/message_default.png',  
224 - width: ScreenUtil().setWidth(36))  
225 - : Text(widget.dayText,  
226 - style: TextStyle(  
227 - fontWeight: FontWeight.bold,  
228 - color: widget.isSelect  
229 - ? MyColours.color_fefefe 819 + return InkWell(
  820 + onTap: widget.onTap,
  821 + child: Container(
  822 + width: ScreenUtil().setWidth(widget.width * 2),
  823 + height: ScreenUtil().setWidth(widget.height * 2),
  824 + decoration: BoxDecoration(
  825 + color: widget.isSelect ? MyColours.color_199095 : Colors.white,
  826 + borderRadius: BorderRadius.circular(ScreenUtil().setWidth(10)),
  827 + border: Border.all(
  828 + color: MyColours.color_199095,
  829 + width: ScreenUtil().setWidth(2))),
  830 + child: Row(
  831 + mainAxisAlignment: MainAxisAlignment.center,
  832 + children: [
  833 + widget.isTextFiled
  834 + ? Container(
  835 + width: ScreenUtil().setWidth(70),
  836 + height: ScreenUtil().setWidth(50),
  837 + child: TextField(
  838 + controller: widget.model.numController,
  839 + maxLines: 1,
  840 + inputFormatters: [LengthLimitingTextInputFormatter(3)],
  841 + //光标颜色
  842 + cursorColor: widget.isSelect
  843 + ? Colors.white
230 : MyColours.color_199095, 844 : MyColours.color_199095,
231 - fontSize: ScreenUtil().setSp(30)))  
232 - ], 845 + //输入文本的样式
  846 + style: TextStyle(
  847 + fontSize: ScreenUtil().setSp(30),
  848 + color: widget.isSelect
  849 + ? Colors.white
  850 + : MyColours.color_199095),
  851 + // controller: _cancelController,
  852 + focusNode: _cancelNode,
  853 + textAlignVertical: TextAlignVertical.bottom,
  854 + decoration: InputDecoration(
  855 + // fillColor: Colors.lightGreenAccent,
  856 + // filled: true,
  857 + border: OutlineInputBorder(borderSide: BorderSide.none),
  858 + hintText: "更多",
  859 + hintStyle: TextStyle(
  860 + color: widget.isSelect
  861 + ? Colors.white
  862 + : MyColours.color_199095,
  863 + fontSize: ScreenUtil().setSp(30),
  864 + ),
  865 + // contentPadding: EdgeInsets.only(
  866 + // bottom: ScreenUtil().setWidth(30)), //ios 17
  867 + // border: InputBorder.none,
  868 + ),
  869 + onChanged: (value) {
  870 + bool isThird = true;
  871 + for (int i = 0;
  872 + i < widget.model.personNumList.length;
  873 + i++) {
  874 + widget.model.personNumList[i]['isSelect'] = false;
  875 +
  876 + if (widget.model.personNumList[i]['dateText'] ==
  877 + value) {
  878 + widget.model.personNumList[i]['isSelect'] = true;
  879 + isThird = false;
  880 + }
  881 + }
  882 + if (isThird) {
  883 + widget.model.personNumList[5]['isSelect'] = true;
  884 + widget.model.personNumList[5]['dateText'] = value;
  885 + } else {
  886 + widget.model.personNumList[5]['dateText'] = '更多';
  887 + }
  888 + widget.model.notifyListeners();
  889 + },
  890 + onEditingComplete: () {
  891 + print('fff');
  892 + _cancelNode.unfocus();
  893 + },
  894 + keyboardType: TextInputType.number,
  895 + ),
  896 + )
  897 + : Text(widget.dateText,
  898 + style: TextStyle(
  899 + fontWeight: FontWeight.bold,
  900 + color: widget.isSelect
  901 + ? MyColours.color_fefefe
  902 + : MyColours.color_199095,
  903 + fontSize: ScreenUtil().setSp(widget.fontSize))),
  904 + widget.isImage ? HEmptyView(20) : Container(),
  905 + widget.isImage
  906 + ? Image.asset(
  907 + widget.isSelect
  908 + ? 'assets/message_selected.png'
  909 + : 'assets/message_default.png',
  910 + width: ScreenUtil().setWidth(36))
  911 + : Text(widget.dayText,
  912 + style: TextStyle(
  913 + fontWeight: FontWeight.bold,
  914 + color: widget.isSelect
  915 + ? MyColours.color_fefefe
  916 + : MyColours.color_199095,
  917 + fontSize: ScreenUtil().setSp(30)))
  918 + ],
  919 + ),
233 ), 920 ),
234 ); 921 );
235 } 922 }
@@ -615,7 +615,8 @@ class NotebookDetailPageState extends State<NotebookDetailPage> { @@ -615,7 +615,8 @@ class NotebookDetailPageState extends State<NotebookDetailPage> {
615 Expanded( 615 Expanded(
616 child: _cancelAndChangeBtn(() { 616 child: _cancelAndChangeBtn(() {
617 print('点击变更预订'); 617 print('点击变更预订');
618 - NavigatorUtil.goNoteBookChangePage(context); 618 + NavigatorUtil.goNoteBookChangePage(
  619 + context, detailEntity, widget.rid);
619 }, '变更预订')), 620 }, '变更预订')),
620 MyDivider( 621 MyDivider(
621 ScreenUtil().setWidth(2), 622 ScreenUtil().setWidth(2),
@@ -278,10 +278,11 @@ class NoteBookPageState extends State<NoteBookPage> { @@ -278,10 +278,11 @@ class NoteBookPageState extends State<NoteBookPage> {
278 child: Center( 278 child: Center(
279 child: GestureDetector( 279 child: GestureDetector(
280 onTap: () { 280 onTap: () {
281 - DialogUtil.showCalendarDialog(context,dateTime).then((day) {  
282 - if(day!=null){  
283 - _createDateText(day);  
284 - } 281 + DialogUtil.showCalendarDialog(context, dateTime)
  282 + .then((day) {
  283 + if (day != null) {
  284 + _createDateText(day);
  285 + }
285 }); 286 });
286 }, 287 },
287 child: Text( 288 child: Text(
@@ -322,6 +323,7 @@ class NoteBookPageState extends State<NoteBookPage> { @@ -322,6 +323,7 @@ class NoteBookPageState extends State<NoteBookPage> {
322 width: ScreenUtil().setWidth(180), 323 width: ScreenUtil().setWidth(180),
323 height: ScreenUtil().setHeight(100), 324 height: ScreenUtil().setHeight(100),
324 fontSize: 32, 325 fontSize: 32,
  326 + onPress: () {},
325 )), 327 )),
326 ), 328 ),
327 ), 329 ),
@@ -344,6 +346,7 @@ class NoteBookPageState extends State<NoteBookPage> { @@ -344,6 +346,7 @@ class NoteBookPageState extends State<NoteBookPage> {
344 width: ScreenUtil().setWidth(180), 346 width: ScreenUtil().setWidth(180),
345 height: ScreenUtil().setHeight(100), 347 height: ScreenUtil().setHeight(100),
346 fontSize: 32, 348 fontSize: 32,
  349 + onPress: () {},
347 )), 350 )),
348 )), 351 )),
349 Offstage( 352 Offstage(
@@ -365,6 +368,7 @@ class NoteBookPageState extends State<NoteBookPage> { @@ -365,6 +368,7 @@ class NoteBookPageState extends State<NoteBookPage> {
365 width: ScreenUtil().setWidth(180), 368 width: ScreenUtil().setWidth(180),
366 height: ScreenUtil().setHeight(100), 369 height: ScreenUtil().setHeight(100),
367 fontSize: 32, 370 fontSize: 32,
  371 + onPress: () {},
368 )), 372 )),
369 )), 373 )),
370 ], 374 ],
@@ -392,34 +396,35 @@ class NoteBookPageState extends State<NoteBookPage> { @@ -392,34 +396,35 @@ class NoteBookPageState extends State<NoteBookPage> {
392 }, 396 },
393 ), 397 ),
394 _buildListTitle(), 398 _buildListTitle(),
395 - Expanded(  
396 - child: Consumer<NoteBookModel>(  
397 - builder: (context,model,_){  
398 - if(model.connect_timeout){  
399 - return Center(  
400 - child: ErrorPage(callback: (){  
401 - _getReserveList();  
402 - },),  
403 - );  
404 - }else{  
405 - return EasyRefresh.custom(  
406 - controller: _controller,  
407 - slivers: [  
408 - SliverFixedExtentList(  
409 - delegate: SliverChildBuilderDelegate(  
410 - (BuildContext context, int index) {  
411 - return NoteBookItem(model.notebooks[index], index);  
412 - }, childCount: model.notebooks.length),  
413 - itemExtent: ScreenUtil().setHeight(112),  
414 - )  
415 - ],  
416 - onRefresh: () async {  
417 - _getReserveList();  
418 - },  
419 - );  
420 - }  
421 - },  
422 - )) 399 + Expanded(child: Consumer<NoteBookModel>(
  400 + builder: (context, model, _) {
  401 + if (model.connect_timeout) {
  402 + return Center(
  403 + child: ErrorPage(
  404 + callback: () {
  405 + _getReserveList();
  406 + },
  407 + ),
  408 + );
  409 + } else {
  410 + return EasyRefresh.custom(
  411 + controller: _controller,
  412 + slivers: [
  413 + SliverFixedExtentList(
  414 + delegate: SliverChildBuilderDelegate(
  415 + (BuildContext context, int index) {
  416 + return NoteBookItem(model.notebooks[index], index);
  417 + }, childCount: model.notebooks.length),
  418 + itemExtent: ScreenUtil().setHeight(112),
  419 + )
  420 + ],
  421 + onRefresh: () async {
  422 + _getReserveList();
  423 + },
  424 + );
  425 + }
  426 + },
  427 + ))
423 ], 428 ],
424 ), 429 ),
425 ); 430 );
@@ -222,4 +222,4 @@ class SelectTablePageState extends State<SelectTablePage>{ @@ -222,4 +222,4 @@ class SelectTablePageState extends State<SelectTablePage>{
222 ), 222 ),
223 ); 223 );
224 } 224 }
225 -}  
  225 +}
  1 +import 'package:common_utils/common_utils.dart';
  2 +import 'package:flutter/material.dart';
  3 +import 'package:one_key/constant/constant.dart';
  4 +import 'package:one_key/models/notebook_detail.dart';
  5 +import 'package:one_key/models/seller_info.dart';
  6 +import 'package:one_key/models/table_list.dart';
  7 +import 'package:one_key/net/base_resp.dart';
  8 +import 'package:one_key/net/dio_util.dart';
  9 +import 'package:one_key/net/http_url.dart';
  10 +import 'package:one_key/provider/notebook_detail_model.dart';
  11 +import 'package:one_key/provider/user_model.dart';
  12 +import 'package:one_key/utils/utils.dart';
  13 +import 'package:provider/provider.dart';
  14 +
  15 +class NotebookDetailChangeModel with ChangeNotifier {
  16 + List dateList = []; //日期选择 月-日 某天
  17 + List sunDateList = []; // 早市、午市、晚市
  18 + List personNumList = []; // 人数
  19 + TextEditingController numController = TextEditingController(); //人数
  20 + TextEditingController phoneController = TextEditingController(); //电话
  21 + TextEditingController nameController = TextEditingController(); //客户姓名
  22 + TextEditingController customController = TextEditingController(); //客户要求
  23 + List sexList = []; // 先生、女士、公司
  24 + Map dailyMap = {}; // 早市对应半点钟,午市对应半点钟、晚市对应半点钟
  25 + String ddateStr = ''; //16:30
  26 + NotebookDetail detailEntity;
  27 + List<TableList> tableList = [];
  28 + //构造函数,初始化
  29 + NotebookDetailChangeModel(this.detailEntity) {
  30 + print(detailEntity);
  31 + if (detailEntity.phone != '0') {
  32 + phoneController.text = detailEntity.phone;
  33 + }
  34 + if (detailEntity.rnameStr != '') {
  35 + nameController.text = detailEntity.rnameStr;
  36 + }
  37 + if (detailEntity.cusdem != '') {
  38 + customController.text = detailEntity.cusdem;
  39 + }
  40 +
  41 + _initDateList();
  42 + _initPersonNumList();
  43 + _initSexList();
  44 + }
  45 +
  46 + ///初始化 日期选择 月-日 某天
  47 + _initDateList() {
  48 + String createtime = detailEntity.ddate.toString() + '000';
  49 + DateTime createTime =
  50 + DateTime.fromMillisecondsSinceEpoch(int.parse(createtime));
  51 + ddateStr = DateUtil.formatDate(createTime, format: DateFormats.h_m);
  52 + String dateTimeSelect = DateUtil.formatDateMs(
  53 + createTime.millisecondsSinceEpoch,
  54 + format: 'MM-dd');
  55 + //今天
  56 + DateTime dateTime = DateTime.now();
  57 + int dateTimeMill = dateTime.millisecondsSinceEpoch;
  58 + String dateText = DateUtil.formatDateMs(dateTimeMill, format: 'MM-dd');
  59 + dateList.add({
  60 + 'title': dateText,
  61 + 'select': dateTimeSelect == dateText ? true : false,
  62 + 'fontSize': 34.0,
  63 + 'dayText': ' 今天',
  64 + 'isImage': false
  65 + });
  66 + //明天
  67 + int tomorrowMill = dateTimeMill + 24 * 60 * 60 * 1000;
  68 + String dateTextTomorrow =
  69 + DateUtil.formatDateMs(tomorrowMill, format: 'MM-dd');
  70 + dateList.add({
  71 + 'title': dateTextTomorrow,
  72 + 'select': dateTimeSelect == dateTextTomorrow ? true : false,
  73 + 'fontSize': 34.0,
  74 + 'dayText': ' 明天',
  75 + 'isImage': false
  76 + });
  77 + //第三个
  78 + dateList.add({
  79 + 'title': dateTimeSelect != dateText && dateTimeSelect != dateTextTomorrow
  80 + ? dateTimeSelect
  81 + : '其他',
  82 + 'select': dateTimeSelect != dateText && dateTimeSelect != dateTextTomorrow
  83 + ? true
  84 + : false,
  85 + 'fontSize': 30.0,
  86 + 'dayText': '',
  87 + 'isImage': true
  88 + });
  89 + }
  90 +
  91 + /// 初始化 早市、午市、晚市
  92 + _initSunDateList(morning, noon, night) {
  93 + String ddateSolt = detailEntity.ddate_solt;
  94 + if (morning != '') {
  95 + sunDateList.add({
  96 + 'dateText': '早市',
  97 + 'dayText': '',
  98 + 'ddateSolt': 1,
  99 + 'key': 'morning',
  100 + 'isSelect': ddateSolt == '1' ? true : false
  101 + });
  102 + }
  103 + if (noon != '') {
  104 + sunDateList.add({
  105 + 'dateText': '午市',
  106 + 'dayText': '',
  107 + 'ddateSolt': 2,
  108 + 'key': 'noon',
  109 + 'isSelect': ddateSolt == '2' ? true : false
  110 + });
  111 + }
  112 + if (noon != '') {
  113 + sunDateList.add({
  114 + 'dateText': '晚市',
  115 + 'dayText': '',
  116 + 'ddateSolt': 3,
  117 + 'key': 'night',
  118 + 'isSelect': ddateSolt == '3' ? true : false
  119 + });
  120 + }
  121 + notifyListeners();
  122 + }
  123 +
  124 +//人数
  125 + _initPersonNumList() {
  126 + String pnum = detailEntity.pnum;
  127 + if (int.parse(pnum) < 6 || int.parse(pnum) > 10) {
  128 + numController.text = pnum;
  129 + }
  130 + personNumList = [
  131 + {
  132 + 'dateText': '6',
  133 + 'width': 30.0,
  134 + 'fontSize': 34.0,
  135 + 'isImage': false,
  136 + 'isSelect': pnum == '6' ? true : false,
  137 + 'isTextFiled': false
  138 + },
  139 + {
  140 + 'dateText': '7',
  141 + 'width': 30.0,
  142 + 'fontSize': 34.0,
  143 + 'isImage': false,
  144 + 'isSelect': pnum == '7' ? true : false,
  145 + 'isTextFiled': false
  146 + },
  147 + {
  148 + 'dateText': '8',
  149 + 'width': 30.0,
  150 + 'fontSize': 34.0,
  151 + 'isImage': false,
  152 + 'isSelect': pnum == '8' ? true : false,
  153 + 'isTextFiled': false
  154 + },
  155 + {
  156 + 'dateText': '9',
  157 + 'width': 30.0,
  158 + 'fontSize': 34.0,
  159 + 'isImage': false,
  160 + 'isSelect': pnum == '9' ? true : false,
  161 + 'isTextFiled': false
  162 + },
  163 + {
  164 + 'dateText': '10',
  165 + 'width': 30.0,
  166 + 'fontSize': 34.0,
  167 + 'isImage': false,
  168 + 'isSelect': pnum == '10' ? true : false,
  169 + 'isTextFiled': false
  170 + },
  171 + {
  172 + 'dateText': numController.text.length > 0 ? numController.text : '更多',
  173 + 'width': 105.0,
  174 + 'fontSize': 30.0,
  175 + 'isImage': true,
  176 + 'isSelect': int.parse(pnum) < 6 || int.parse(pnum) > 10 ? true : false,
  177 + 'isTextFiled': true
  178 + }
  179 + ];
  180 + }
  181 +
  182 + ///称谓
  183 + _initSexList() {
  184 + String sexStr = detailEntity.sex;
  185 + sexList = [
  186 + {
  187 + 'title': '先生',
  188 + 'select': sexStr == '1' ? true : false,
  189 + 'code': '1',
  190 + 'hasLeftBorder': true
  191 + },
  192 + {
  193 + 'title': '女士',
  194 + 'select': sexStr == '2' ? true : false,
  195 + 'code': '2',
  196 + 'hasLeftBorder': false
  197 + },
  198 + {
  199 + 'title': '公司',
  200 + 'select': sexStr == '3' ? true : false,
  201 + 'code': '3',
  202 + 'hasLeftBorder': false
  203 + }
  204 + ];
  205 + }
  206 +
  207 + /// 早市、午市、晚市对应的半个小时间隔时间段
  208 + initDateHourMinuteList(BuildContext context) async {
  209 + SunSellerInfoModel model = await getManagersInfo(context);
  210 + model.daily.morning == ''
  211 + ? dailyMap.putIfAbsent('morning', () => '')
  212 + : dailyMap.putIfAbsent(
  213 + 'morning', () => _getHourAndMinute(model.daily.morning, 1, model));
  214 + model.daily.noon == ''
  215 + ? dailyMap.putIfAbsent('noon', () => '')
  216 + : dailyMap.putIfAbsent(
  217 + 'noon', () => _getHourAndMinute(model.daily.noon, 2, model));
  218 + model.daily.night == ''
  219 + ? dailyMap.putIfAbsent('night', () => '')
  220 + : dailyMap.putIfAbsent(
  221 + 'night', () => _getHourAndMinute(model.daily.night, 3, model));
  222 + _initSunDateList(model.daily.morning, model.daily.noon, model.daily.night);
  223 + }
  224 +
  225 +//根据获取时间 11:00-12:30 获取30分钟间隔组装的数组
  226 + _getHourAndMinute(
  227 + String hourAndMinuteStr, int mnd, SunSellerInfoModel model) {
  228 + List tempDate = hourAndMinuteStr.split("-");
  229 + String beginDate = tempDate[0];
  230 + String endDate = tempDate[1];
  231 + List tempHour = beginDate.split(':');
  232 + String isSetDate = detailEntity.is_set_ddate;
  233 + String ddateSolt = detailEntity.ddate_solt;
  234 + /*获取开始小时*/
  235 + int beginHour = int.parse(tempHour[0]);
  236 + /*获取开始分钟*/
  237 + int beginMinute = int.parse(tempHour[1]);
  238 + List res = [];
  239 + bool tempLimit = true;
  240 + while (tempLimit) {
  241 + String temp = _dealTime(beginHour, beginMinute);
  242 + bool tempSelect = false;
  243 + if (int.parse(isSetDate) == 1) //设置预订时间
  244 + {
  245 + if (temp == ddateStr) {
  246 + tempSelect = true;
  247 + }
  248 + } else {
  249 + if (mnd == 1) {
  250 + if (temp == '08:00') {
  251 + tempSelect = true;
  252 + }
  253 + } else if (mnd == 2) {
  254 + if (temp == '12:00') {
  255 + tempSelect = true;
  256 + }
  257 + } else if (mnd == 3) {
  258 + if (temp == '16:30') {
  259 + tempSelect = true;
  260 + }
  261 + }
  262 + }
  263 +
  264 + Map tempMap = {'title': temp, 'select': tempSelect};
  265 + res.add(tempMap);
  266 + if (temp == endDate) {
  267 + tempLimit = false;
  268 + break;
  269 + }
  270 + if (beginMinute == 30) {
  271 + beginHour++;
  272 + if (beginHour >= 24) {
  273 + beginHour = 0;
  274 + }
  275 + }
  276 + beginMinute = (beginMinute + 30) % 60;
  277 + }
  278 + return res;
  279 + }
  280 +
  281 + /// 根据时间和分钟组装 格式:11:00
  282 + _dealTime(int begin, int mm) {
  283 + String sb = '';
  284 + if (begin < 10) {
  285 + sb = '0$begin';
  286 + } else {
  287 + sb = '$begin';
  288 + }
  289 + sb = '$sb:';
  290 + if (mm < 10) {
  291 + sb = '${sb}0${mm}';
  292 + } else {
  293 + sb = '${sb}${mm}';
  294 + }
  295 + return sb;
  296 + }
  297 +
  298 + ///获取某个商家下所有服务员信息 **** 取得某个商家的早市、午市、晚市营业时间
  299 + Future<SunSellerInfoModel> getManagersInfo(BuildContext context) async {
  300 + UserModel userModel = Provider.of<UserModel>(context, listen: false);
  301 + Map<String, String> params = {
  302 + "seller_id": userModel.user.sellerid,
  303 + "seller_openid": userModel.user.openid
  304 + };
  305 + BaseResp<Map<String, dynamic>> baseResp = await DioUtil()
  306 + .request<Map<String, dynamic>>(context, Method.get, HttpUrl.sellerinfo,
  307 + data: params)
  308 + .catchError((error) {
  309 + print(error.toString());
  310 + });
  311 + SunSellerInfoModel itemModel;
  312 + if (baseResp == null) return itemModel;
  313 + if (baseResp.code == Constant.status_success) {
  314 + if (int.parse(baseResp.status) != Constant.status_success) {
  315 + Utils.showToast(baseResp.msg ?? "");
  316 + return itemModel;
  317 + }
  318 + if (baseResp.responseData['data'] != null) {
  319 + itemModel = SellerInfoModel.fromJson(baseResp.responseData).data;
  320 + } else {
  321 + Utils.showToast(baseResp.msg ?? "");
  322 + }
  323 + return itemModel;
  324 + }
  325 + }
  326 +
  327 + ///根据商家ID 获取桌位信息列表: 1:散座 2:包间 默认:获取所有数据
  328 + 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");
  333 + UserModel userModel = Provider.of<UserModel>(context, listen: false);
  334 + Map<String, String> params = {
  335 + "sid": userModel.user.sellerid,
  336 + "rid": detailEntity.id,
  337 + "rdate": _getRdate(),
  338 + 'ddate_solt': detailEntity.ddate_solt
  339 + };
  340 + BaseResp<dynamic> baseResp = await DioUtil()
  341 + .request<dynamic>(context, Method.get, HttpUrl.get_table_list,
  342 + data: params)
  343 + .catchError((error) {
  344 + print(error.toString());
  345 + });
  346 + List<TableListSunModel> itemModelList;
  347 + if (baseResp == null) return itemModelList;
  348 + if (baseResp.code == Constant.status_success) {
  349 + if (int.parse(baseResp.status) != Constant.status_success) {
  350 + Utils.showToast(baseResp.msg ?? "");
  351 + return itemModelList;
  352 + }
  353 + if (baseResp.responseData['data'] != null) {
  354 + itemModelList = TableListModel.fromJson(baseResp.responseData).data;
  355 + } else {
  356 + Utils.showToast(baseResp.msg ?? "");
  357 + }
  358 + for (TableListSunModel item in itemModelList) {
  359 + for (var item in item.list) {
  360 + for (var table in detailEntity.tables) {
  361 + if (item.id == table.id) {
  362 + item.selected = true;
  363 + tableList.add(item);
  364 + }
  365 + }
  366 + }
  367 + }
  368 + notifyListeners();
  369 + return itemModelList;
  370 + }
  371 + }
  372 +
  373 + ///录入顾客订座相关信息,同时更新商家桌位状态
  374 + Future<SunSellerInfoModel> setReserveInfo(BuildContext context) async {
  375 + UserModel userModel = Provider.of<UserModel>(context, listen: false);
  376 + String pnum = '6';
  377 + for (var item in personNumList) {
  378 + if (item['isSelect']) {
  379 + pnum = item['dateText'];
  380 + }
  381 + }
  382 + String sex = '1';
  383 + for (var item in sexList) {
  384 + if (item['select']) {
  385 + sex = item['code'];
  386 + }
  387 + }
  388 + String tempDdate = _getRdate() + ' ' + ddateStr + ':00';
  389 + int ddate = DateUtil.getDateMsByTimeStr(tempDdate);
  390 + String tableSelectInfo = '';
  391 + for (TableList item in tableList) {
  392 + if (item.selected) {
  393 + tableSelectInfo += ',${item.id}';
  394 + }
  395 + }
  396 + print(tableSelectInfo);
  397 + if (tableSelectInfo.startsWith(',')) {
  398 + tableSelectInfo = tableSelectInfo.substring(1);
  399 + }
  400 + print(tableSelectInfo);
  401 + String rdate = '';
  402 + for (var item in sunDateList) {
  403 + if (item['isSelect'] == true) {
  404 + if (item['ddateSolt'] == 1) {
  405 + //早市
  406 + List morning = dailyMap['morning'];
  407 + String start = ddateStr;
  408 + String end = morning.last;
  409 + } else if (item['ddateSolt'] == 2) {
  410 + //午市
  411 + List noon = dailyMap['noon'];
  412 + } else if (item['ddateSolt'] == 3) {
  413 + //晚市
  414 + List night = dailyMap['night'];
  415 + }
  416 + }
  417 + }
  418 + Map<String, String> params = {
  419 + "rid": detailEntity.id, //变更订单必传预定ID
  420 + "sid": userModel.user.sellerid, //商家ID
  421 + "tid": tableSelectInfo, //桌子ID: 格式 2,3,4
  422 + "pnum": pnum, //预定用餐人数
  423 + "rname": nameController.text, //预订人姓名
  424 + "sex": sex, //预订人姓名:1:男 2:女
  425 + "phone": phoneController.text, //预订人电话
  426 + "cusdem": customController.text, //预订人需求:25汉字
  427 + "rdate": _getRdate(), //预定用餐时间范围:时间戳 开始时间戳(time)-结束时间戳(time)
  428 + "ddate": '${ddate / 1000}', //到店时间
  429 + };
  430 + 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;
  460 + }
  461 +}
@@ -40,4 +40,7 @@ class MyColours { @@ -40,4 +40,7 @@ class MyColours {
40 static const Color color_83734d = Color(0xff83734d); 40 static const Color color_83734d = Color(0xff83734d);
41 static const Color color_dfdfdf = Color(0xffdfdfdf); 41 static const Color color_dfdfdf = Color(0xffdfdfdf);
42 static const Color color_333333 = Color(0xff333333); 42 static const Color color_333333 = Color(0xff333333);
  43 + static const Color color_F1F0F4 = Color(0xffF1F0F4);
  44 + static const Color color_6AB6B9 = Color(0xff6AB6B9);
  45 + static const Color color_74BBBE = Color(0xff74BBBE);
43 } 46 }
  1 +import 'dart:convert';
  2 +
1 import 'package:fluro/fluro.dart'; 3 import 'package:fluro/fluro.dart';
2 import 'package:flutter/material.dart'; 4 import 'package:flutter/material.dart';
3 import 'package:one_key/models/notebook.dart'; 5 import 'package:one_key/models/notebook.dart';
  6 +import 'package:one_key/models/notebook_detail.dart';
4 import 'package:one_key/pages/detail/notebook_detail_change_page.dart'; 7 import 'package:one_key/pages/detail/notebook_detail_change_page.dart';
5 import 'package:one_key/pages/home/home_page.dart'; 8 import 'package:one_key/pages/home/home_page.dart';
6 import 'package:one_key/pages/invicate/invitation_page.dart'; 9 import 'package:one_key/pages/invicate/invitation_page.dart';
@@ -10,75 +13,85 @@ import 'package:one_key/pages/detail/notebook_detail_page.dart'; @@ -10,75 +13,85 @@ import 'package:one_key/pages/detail/notebook_detail_page.dart';
10 import 'package:one_key/pages/sms/sms_page.dart'; 13 import 'package:one_key/pages/sms/sms_page.dart';
11 import 'package:one_key/pages/table/select_table_page.dart'; 14 import 'package:one_key/pages/table/select_table_page.dart';
12 import 'package:one_key/pages/webview/webview_page.dart'; 15 import 'package:one_key/pages/webview/webview_page.dart';
  16 +import 'package:one_key/provider/notebook_detail_change_model.dart';
13 import 'package:one_key/utils/fluro_convert_utils.dart'; 17 import 'package:one_key/utils/fluro_convert_utils.dart';
14 import 'package:one_key/utils/log_util.dart'; 18 import 'package:one_key/utils/log_util.dart';
15 - 19 +import 'package:provider/provider.dart';
16 20
17 // 登录页 21 // 登录页
18 var loginHandler = new Handler( 22 var loginHandler = new Handler(
19 handlerFunc: (BuildContext context, Map<String, List<Object>> params) { 23 handlerFunc: (BuildContext context, Map<String, List<Object>> params) {
20 - return LoginPage();  
21 - }); 24 + return LoginPage();
  25 +});
22 26
23 // 跳转到主页 27 // 跳转到主页
24 var homeHandler = new Handler( 28 var homeHandler = new Handler(
25 handlerFunc: (BuildContext context, Map<String, List<Object>> params) { 29 handlerFunc: (BuildContext context, Map<String, List<Object>> params) {
26 - String initialIndex=params["initialIndex"].first;  
27 - return HomePage(initialIndex: int.parse(initialIndex),);  
28 - }); 30 + String initialIndex = params["initialIndex"].first;
  31 + return HomePage(
  32 + initialIndex: int.parse(initialIndex),
  33 + );
  34 +});
29 35
30 // 跳转到处理在线预订 36 // 跳转到处理在线预订
31 var reserveDetailHandler = new Handler( 37 var reserveDetailHandler = new Handler(
32 handlerFunc: (BuildContext context, Map<String, List<Object>> params) { 38 handlerFunc: (BuildContext context, Map<String, List<Object>> params) {
33 - String rid=params['rid'].first;  
34 - return NotebookDetailPage(rid);  
35 - }); 39 + String rid = params['rid'].first;
  40 + return NotebookDetailPage(rid);
  41 +});
36 42
37 // 跳转到处理在线预订 43 // 跳转到处理在线预订
38 var handleOnlineHandler = new Handler( 44 var handleOnlineHandler = new Handler(
39 handlerFunc: (BuildContext context, Map<String, List<Object>> params) { 45 handlerFunc: (BuildContext context, Map<String, List<Object>> params) {
40 - String rid=params['rid'].first;  
41 - String mid=params["mid"].first;  
42 - return HandleOnlinePage(rid,mid);  
43 - }); 46 + String rid = params['rid'].first;
  47 + String mid = params["mid"].first;
  48 + return HandleOnlinePage(rid, mid);
  49 +});
44 50
45 // 跳转到选择桌位 51 // 跳转到选择桌位
46 var handleSelectTableHandler = new Handler( 52 var handleSelectTableHandler = new Handler(
47 handlerFunc: (BuildContext context, Map<String, List<Object>> params) { 53 handlerFunc: (BuildContext context, Map<String, List<Object>> params) {
48 - String rid=params['rid'].first;  
49 - DateTime dateTime=DateTime.fromMillisecondsSinceEpoch(int.parse(params["dateTime"].first));  
50 - String ddate_slot=params["ddate_slot"].first;  
51 - return SelectTablePage(rid,dateTime,ddate_slot);  
52 - }); 54 + String rid = params['rid'].first;
  55 + DateTime dateTime =
  56 + DateTime.fromMillisecondsSinceEpoch(int.parse(params["dateTime"].first));
  57 + String ddate_slot = params["ddate_slot"].first;
  58 + return SelectTablePage(rid, dateTime, ddate_slot);
  59 +});
53 60
54 // 跳转到邀请函页面 61 // 跳转到邀请函页面
55 var handleInvicationHandler = new Handler( 62 var handleInvicationHandler = new Handler(
56 handlerFunc: (BuildContext context, Map<String, List<Object>> params) { 63 handlerFunc: (BuildContext context, Map<String, List<Object>> params) {
57 - String rid=params["rid"].first;  
58 - String tableInfo=FluroConvertUtils.fluroCnParamsDecode(params["tableInfo"].first);  
59 - String ddate=params["ddate"].first;  
60 - String ddateStr=FluroConvertUtils.fluroCnParamsDecode(params["ddateStr"].first);  
61 - return InvicationPage(rid,tableInfo,ddate,ddateStr);  
62 - }); 64 + String rid = params["rid"].first;
  65 + String tableInfo =
  66 + FluroConvertUtils.fluroCnParamsDecode(params["tableInfo"].first);
  67 + String ddate = params["ddate"].first;
  68 + String ddateStr =
  69 + FluroConvertUtils.fluroCnParamsDecode(params["ddateStr"].first);
  70 + return InvicationPage(rid, tableInfo, ddate, ddateStr);
  71 +});
63 72
64 // 发短信 73 // 发短信
65 var handleSmsHandler = new Handler( 74 var handleSmsHandler = new Handler(
66 handlerFunc: (BuildContext context, Map<String, List<Object>> params) { 75 handlerFunc: (BuildContext context, Map<String, List<Object>> params) {
67 - String rid=params["rid"].first;  
68 - return SmsPage(rid);  
69 - }); 76 + String rid = params["rid"].first;
  77 + return SmsPage(rid);
  78 +});
70 79
71 // 浏览网页 80 // 浏览网页
72 var handleWebviewHandler = new Handler( 81 var handleWebviewHandler = new Handler(
73 handlerFunc: (BuildContext context, Map<String, List<Object>> params) { 82 handlerFunc: (BuildContext context, Map<String, List<Object>> params) {
74 - return WebViewPage();  
75 - }); 83 + return WebViewPage();
  84 +});
76 85
77 - // 跳转到变更预订 86 +// 跳转到变更预订
78 var handleChangeDetailHandler = new Handler( 87 var handleChangeDetailHandler = new Handler(
79 handlerFunc: (BuildContext context, Map<String, List<Object>> params) { 88 handlerFunc: (BuildContext context, Map<String, List<Object>> params) {
80 - // String rid=params['rid'].first;  
81 - // String mid=params["mid"].first;  
82 - return NoteBookChangePage();  
83 - });  
84 - 89 + // String rid=params['rid'].first;
  90 + // NotebookDetail detailEntity = params["detailEntity"].first;
  91 + NotebookDetail detailEntity = NotebookDetail.fromJson(json
  92 + .decode(FluroConvertUtils.fluroCnParamsDecode(params["detail"].first)));
  93 + String rid = params['rid'].first;
  94 + return ChangeNotifierProvider<NotebookDetailChangeModel>(
  95 + create: (_) => NotebookDetailChangeModel(detailEntity),
  96 + child: NoteBookChangePage(detailEntity: detailEntity,rid: rid));
  97 +});
1 import 'package:fluro/fluro.dart'; 1 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/res/colors.dart'; 5 import 'package:one_key/res/colors.dart';
5 import 'package:one_key/route/routes.dart'; 6 import 'package:one_key/route/routes.dart';
6 import 'package:one_key/utils/fluro_convert_utils.dart'; 7 import 'package:one_key/utils/fluro_convert_utils.dart';
@@ -65,7 +66,7 @@ class NavigatorUtil { @@ -65,7 +66,7 @@ class NavigatorUtil {
65 } 66 }
66 67
67 /// 变更预订 68 /// 变更预订
68 - static void goNoteBookChangePage(BuildContext context,{replace=false}) {  
69 - _navigateTo(context,"${Routes.change_detail}",replace: replace); 69 + static void goNoteBookChangePage(BuildContext context,NotebookDetail detailEntity,String rid,{replace=false}) {
  70 + _navigateTo(context,"${Routes.change_detail}?detail=${FluroConvertUtils.object2string(detailEntity)}&rid=$rid",replace: replace);
70 } 71 }
71 } 72 }
@@ -3,7 +3,6 @@ import 'package:flutter_screenutil/flutter_screenutil.dart'; @@ -3,7 +3,6 @@ import 'package:flutter_screenutil/flutter_screenutil.dart';
3 import 'package:one_key/res/colors.dart'; 3 import 'package:one_key/res/colors.dart';
4 4
5 class CommonButton extends StatelessWidget { 5 class CommonButton extends StatelessWidget {
6 -  
7 final VoidCallback onPress; 6 final VoidCallback onPress;
8 final String content; 7 final String content;
9 final double width; 8 final double width;
@@ -30,14 +29,15 @@ class CommonButton extends StatelessWidget { @@ -30,14 +29,15 @@ class CommonButton extends StatelessWidget {
30 color: MyColours.color_d8d8d8, 29 color: MyColours.color_d8d8d8,
31 borderRadius: BorderRadius.circular(ScreenUtil().setWidth(5)), 30 borderRadius: BorderRadius.circular(ScreenUtil().setWidth(5)),
32 ); 31 );
33 - fontColor=MyColours.color_ffffff; 32 + fontColor = MyColours.color_ffffff;
34 break; 33 break;
35 case 0: 34 case 0:
36 boxDecoration = BoxDecoration( 35 boxDecoration = BoxDecoration(
37 - border: Border.all(color: MyColours.color_199095,width: ScreenUtil().setWidth(2)), 36 + border: Border.all(
  37 + color: MyColours.color_199095, width: ScreenUtil().setWidth(2)),
38 borderRadius: BorderRadius.circular(ScreenUtil().setWidth(5)), 38 borderRadius: BorderRadius.circular(ScreenUtil().setWidth(5)),
39 ); 39 );
40 - fontColor=MyColours.color_199095; 40 + fontColor = MyColours.color_199095;
41 break; 41 break;
42 case 1: 42 case 1:
43 boxDecoration = BoxDecoration( 43 boxDecoration = BoxDecoration(
@@ -47,14 +47,28 @@ class CommonButton extends StatelessWidget { @@ -47,14 +47,28 @@ class CommonButton extends StatelessWidget {
47 end: Alignment.bottomCenter), 47 end: Alignment.bottomCenter),
48 borderRadius: BorderRadius.circular(ScreenUtil().setWidth(5)), 48 borderRadius: BorderRadius.circular(ScreenUtil().setWidth(5)),
49 ); 49 );
50 - fontColor=MyColours.color_fefefe; 50 + fontColor = MyColours.color_fefefe;
  51 + break;
  52 + case 2:
  53 + boxDecoration = BoxDecoration(
  54 + color: MyColours.color_199095,
  55 + borderRadius: BorderRadius.circular(ScreenUtil().setWidth(5)),
  56 + );
  57 + fontColor = MyColours.color_fefefe;
  58 + break;
  59 + case -2:
  60 + boxDecoration = BoxDecoration(
  61 + color: MyColours.color_74BBBE,
  62 + borderRadius: BorderRadius.circular(ScreenUtil().setWidth(5)),
  63 + );
  64 + fontColor = MyColours.color_fefefe;
51 break; 65 break;
52 default: 66 default:
53 boxDecoration = BoxDecoration( 67 boxDecoration = BoxDecoration(
54 border: Border.all(color: MyColours.color_199095), 68 border: Border.all(color: MyColours.color_199095),
55 borderRadius: BorderRadius.circular(ScreenUtil().setWidth(5)), 69 borderRadius: BorderRadius.circular(ScreenUtil().setWidth(5)),
56 ); 70 );
57 - fontColor=MyColours.color_fefefe; 71 + fontColor = MyColours.color_fefefe;
58 break; 72 break;
59 break; 73 break;
60 } 74 }
@@ -65,11 +79,14 @@ class CommonButton extends StatelessWidget { @@ -65,11 +79,14 @@ class CommonButton extends StatelessWidget {
65 child: Container( 79 child: Container(
66 width: ScreenUtil().setWidth(width), 80 width: ScreenUtil().setWidth(width),
67 height: ScreenUtil().setHeight(height), 81 height: ScreenUtil().setHeight(height),
68 - decoration:boxDecoration, 82 + decoration: boxDecoration,
69 child: Align( 83 child: Align(
70 alignment: Alignment.center, 84 alignment: Alignment.center,
71 - child: Text(content, style: TextStyle(color: fontColor,  
72 - fontSize: ScreenUtil().setSp(fontSize)),), 85 + child: Text(
  86 + content,
  87 + style: TextStyle(
  88 + color: fontColor, fontSize: ScreenUtil().setSp(fontSize)),
  89 + ),
73 ), 90 ),
74 ), 91 ),
75 ), 92 ),
  1 +import 'package:flutter/material.dart';
  2 +import 'package:flutter_screenutil/flutter_screenutil.dart';
  3 +import 'package:one_key/res/colors.dart';
  4 +
  5 +import 'package:one_key/models/table_list.dart' as t;
  6 +import 'package:one_key/widgets/v_empty_view.dart';
  7 +
  8 +class NewTableItem extends StatefulWidget{
  9 +
  10 + final t.TableList table;
  11 + final bool canSelected;//是否能选中
  12 + final ValueChanged onSelected;
  13 +
  14 + final int height;//高度
  15 +
  16 + NewTableItem(this.table,{this.onSelected,this.canSelected=false,this.height=183});
  17 +
  18 + @override
  19 + State<StatefulWidget> createState() {
  20 + // TODO: implement createState
  21 + return new NewTableItemState();
  22 + }
  23 +}
  24 +
  25 +class NewTableItemState extends State<NewTableItem>{
  26 +
  27 + @override
  28 + Widget build(BuildContext context) {
  29 + // TODO: implement build
  30 +
  31 + t.TableList table=widget.table;
  32 +
  33 + return GestureDetector(
  34 + onTap: (){
  35 + if(widget.canSelected&&table.signStr.isEmpty){
  36 + setState(() {
  37 + table.selected=!(table.selected??false);
  38 + });
  39 + widget.onSelected(table);
  40 + }
  41 + },
  42 + child: Stack(
  43 + children: <Widget>[
  44 + Container(
  45 + width: ScreenUtil().setWidth(150),
  46 + height: ScreenUtil().setWidth(widget.height),
  47 + margin:EdgeInsets.all( ScreenUtil().setWidth(9)),
  48 + decoration: BoxDecoration(
  49 + color: MyColours.color_a8e2e4,
  50 + borderRadius: BorderRadius.all(Radius.circular(ScreenUtil().setWidth(8)))
  51 + ),
  52 + child: Stack(
  53 + alignment: Alignment.center,
  54 + children: <Widget>[
  55 + Positioned(
  56 + left: 0,
  57 + 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 + ),
  68 + ),
  69 + Container(
  70 + alignment: Alignment.centerLeft,
  71 + margin: EdgeInsets.only(left: ScreenUtil().setWidth(20)),
  72 + child: Column(
  73 + mainAxisSize: MainAxisSize.min,
  74 + crossAxisAlignment: CrossAxisAlignment.start,
  75 + children: <Widget>[
  76 + 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,),
  78 + 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,),
  80 + 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,)
  82 + ],
  83 + ),
  84 + ),
  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 + ),
  100 + ],
  101 + ),
  102 + ),
  103 + Positioned(
  104 + top: 3,
  105 + right: 5,
  106 + child: !(table.selected??false)?Container():Image.asset("assets/icon_selected.png",width: ScreenUtil().setWidth(40),height: ScreenUtil().setWidth(40),)
  107 + )
  108 + ],
  109 + ),
  110 + );
  111 + }
  112 +}
@@ -109,4 +109,4 @@ class TableItemState extends State<TableItem>{ @@ -109,4 +109,4 @@ class TableItemState extends State<TableItem>{
109 ), 109 ),
110 ); 110 );
111 } 111 }
112 -}  
  112 +}
@@ -245,7 +245,7 @@ packages: @@ -245,7 +245,7 @@ packages:
245 name: device_info_platform_interface 245 name: device_info_platform_interface
246 url: "https://pub.flutter-io.cn" 246 url: "https://pub.flutter-io.cn"
247 source: hosted 247 source: hosted
248 - version: "1.0.0" 248 + version: "1.0.1"
249 dio: 249 dio:
250 dependency: "direct main" 250 dependency: "direct main"
251 description: 251 description:
@@ -372,7 +372,7 @@ packages: @@ -372,7 +372,7 @@ packages:
372 name: fluwx 372 name: fluwx
373 url: "https://pub.flutter-io.cn" 373 url: "https://pub.flutter-io.cn"
374 source: hosted 374 source: hosted
375 - version: "2.3.0" 375 + version: "2.1.0"
376 front_end: 376 front_end:
377 dependency: transitive 377 dependency: transitive
378 description: 378 description:
@@ -673,7 +673,7 @@ packages: @@ -673,7 +673,7 @@ packages:
673 name: provider 673 name: provider
674 url: "https://pub.flutter-io.cn" 674 url: "https://pub.flutter-io.cn"
675 source: hosted 675 source: hosted
676 - version: "4.3.2+1" 676 + version: "4.3.2+2"
677 pub_semver: 677 pub_semver:
678 dependency: transitive 678 dependency: transitive
679 description: 679 description:
@@ -874,7 +874,7 @@ packages: @@ -874,7 +874,7 @@ packages:
874 name: url_launcher 874 name: url_launcher
875 url: "https://pub.flutter-io.cn" 875 url: "https://pub.flutter-io.cn"
876 source: hosted 876 source: hosted
877 - version: "5.5.2" 877 + version: "5.5.3"
878 url_launcher_linux: 878 url_launcher_linux:
879 dependency: transitive 879 dependency: transitive
880 description: 880 description:
@@ -902,7 +902,7 @@ packages: @@ -902,7 +902,7 @@ packages:
902 name: url_launcher_web 902 name: url_launcher_web
903 url: "https://pub.flutter-io.cn" 903 url: "https://pub.flutter-io.cn"
904 source: hosted 904 source: hosted
905 - version: "0.1.3+1" 905 + version: "0.1.3+2"
906 uuid: 906 uuid:
907 dependency: transitive 907 dependency: transitive
908 description: 908 description:
@@ -64,7 +64,7 @@ dependencies: @@ -64,7 +64,7 @@ dependencies:
64 # 日历 64 # 日历
65 table_calendar: ^2.2.1 65 table_calendar: ^2.2.1
66 # 微信SDK 66 # 微信SDK
67 - fluwx: ^2.1.0 67 + fluwx: 2.1.0
68 #网页,短信,电话 68 #网页,短信,电话
69 url_launcher: ^5.4.2 69 url_launcher: ^5.4.2
70 # 滚轮选择器 70 # 滚轮选择器