Commit 3b27d23dc2947fff49ad2b57b34f651706fc9631

Authored by 蓋亞光
2 parents 4d1866fd 5316c2b8

测试v1.5.1

1 -<<<<<<< HEAD  
2 -c71e777004aab201609920eac28801f9  
3 -=======  
4 -7babc7873f8d177769b987ba4c6c2911  
5 ->>>>>>> 4ecf950986f1856303c83ccacadc2b15efeb20ac 1 +7babc7873f8d177769b987ba4c6c2911
@@ -152,4 +152,4 @@ SPEC CHECKSUMS: @@ -152,4 +152,4 @@ SPEC CHECKSUMS:
152 152
153 PODFILE CHECKSUM: a75497545d4391e2d394c3668e20cfb1c2bbd4aa 153 PODFILE CHECKSUM: a75497545d4391e2d394c3668e20cfb1c2bbd4aa
154 154
155 -COCOAPODS: 1.9.1 155 +COCOAPODS: 1.9.3
@@ -409,11 +409,7 @@ @@ -409,11 +409,7 @@
409 CODE_SIGN_IDENTITY = "iPhone Developer"; 409 CODE_SIGN_IDENTITY = "iPhone Developer";
410 "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 410 "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
411 CODE_SIGN_STYLE = Automatic; 411 CODE_SIGN_STYLE = Automatic;
412 -<<<<<<< HEAD  
413 CURRENT_PROJECT_VERSION = 145; 412 CURRENT_PROJECT_VERSION = 145;
414 -=======  
415 - CURRENT_PROJECT_VERSION = 146;  
416 ->>>>>>> 4ecf950986f1856303c83ccacadc2b15efeb20ac  
417 DEVELOPMENT_TEAM = 8J59HM8B82; 413 DEVELOPMENT_TEAM = 8J59HM8B82;
418 ENABLE_BITCODE = NO; 414 ENABLE_BITCODE = NO;
419 FRAMEWORK_SEARCH_PATHS = ( 415 FRAMEWORK_SEARCH_PATHS = (
@@ -426,11 +422,7 @@ @@ -426,11 +422,7 @@
426 "$(inherited)", 422 "$(inherited)",
427 "$(PROJECT_DIR)/Flutter", 423 "$(PROJECT_DIR)/Flutter",
428 ); 424 );
429 -<<<<<<< HEAD  
430 MARKETING_VERSION = 1.4.5; 425 MARKETING_VERSION = 1.4.5;
431 -=======  
432 - MARKETING_VERSION = 1.4.6;  
433 ->>>>>>> 4ecf950986f1856303c83ccacadc2b15efeb20ac  
434 PRODUCT_BUNDLE_IDENTIFIER = com.naji.reserveLine; 426 PRODUCT_BUNDLE_IDENTIFIER = com.naji.reserveLine;
435 PRODUCT_NAME = "一键订"; 427 PRODUCT_NAME = "一键订";
436 PROVISIONING_PROFILE_SPECIFIER = ""; 428 PROVISIONING_PROFILE_SPECIFIER = "";
@@ -559,11 +551,7 @@ @@ -559,11 +551,7 @@
559 CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; 551 CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
560 CODE_SIGN_IDENTITY = "iPhone Developer"; 552 CODE_SIGN_IDENTITY = "iPhone Developer";
561 CODE_SIGN_STYLE = Automatic; 553 CODE_SIGN_STYLE = Automatic;
562 -<<<<<<< HEAD  
563 CURRENT_PROJECT_VERSION = 145; 554 CURRENT_PROJECT_VERSION = 145;
564 -=======  
565 - CURRENT_PROJECT_VERSION = 146;  
566 ->>>>>>> 4ecf950986f1856303c83ccacadc2b15efeb20ac  
567 DEVELOPMENT_TEAM = 8J59HM8B82; 555 DEVELOPMENT_TEAM = 8J59HM8B82;
568 ENABLE_BITCODE = NO; 556 ENABLE_BITCODE = NO;
569 FRAMEWORK_SEARCH_PATHS = ( 557 FRAMEWORK_SEARCH_PATHS = (
@@ -576,11 +564,7 @@ @@ -576,11 +564,7 @@
576 "$(inherited)", 564 "$(inherited)",
577 "$(PROJECT_DIR)/Flutter", 565 "$(PROJECT_DIR)/Flutter",
578 ); 566 );
579 -<<<<<<< HEAD  
580 MARKETING_VERSION = 1.4.5; 567 MARKETING_VERSION = 1.4.5;
581 -=======  
582 - MARKETING_VERSION = 1.4.6;  
583 ->>>>>>> 4ecf950986f1856303c83ccacadc2b15efeb20ac  
584 PRODUCT_BUNDLE_IDENTIFIER = com.naji.reserveLine; 568 PRODUCT_BUNDLE_IDENTIFIER = com.naji.reserveLine;
585 PRODUCT_NAME = "一键订"; 569 PRODUCT_NAME = "一键订";
586 PROVISIONING_PROFILE_SPECIFIER = ""; 570 PROVISIONING_PROFILE_SPECIFIER = "";
@@ -600,11 +584,7 @@ @@ -600,11 +584,7 @@
600 CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; 584 CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
601 CODE_SIGN_IDENTITY = "iPhone Developer"; 585 CODE_SIGN_IDENTITY = "iPhone Developer";
602 CODE_SIGN_STYLE = Automatic; 586 CODE_SIGN_STYLE = Automatic;
603 -<<<<<<< HEAD  
604 CURRENT_PROJECT_VERSION = 145; 587 CURRENT_PROJECT_VERSION = 145;
605 -=======  
606 - CURRENT_PROJECT_VERSION = 146;  
607 ->>>>>>> 4ecf950986f1856303c83ccacadc2b15efeb20ac  
608 DEVELOPMENT_TEAM = 8J59HM8B82; 588 DEVELOPMENT_TEAM = 8J59HM8B82;
609 ENABLE_BITCODE = NO; 589 ENABLE_BITCODE = NO;
610 FRAMEWORK_SEARCH_PATHS = ( 590 FRAMEWORK_SEARCH_PATHS = (
@@ -617,11 +597,7 @@ @@ -617,11 +597,7 @@
617 "$(inherited)", 597 "$(inherited)",
618 "$(PROJECT_DIR)/Flutter", 598 "$(PROJECT_DIR)/Flutter",
619 ); 599 );
620 -<<<<<<< HEAD  
621 MARKETING_VERSION = 1.4.5; 600 MARKETING_VERSION = 1.4.5;
622 -=======  
623 - MARKETING_VERSION = 1.4.6;  
624 ->>>>>>> 4ecf950986f1856303c83ccacadc2b15efeb20ac  
625 PRODUCT_BUNDLE_IDENTIFIER = com.naji.reserveLine; 601 PRODUCT_BUNDLE_IDENTIFIER = com.naji.reserveLine;
626 PRODUCT_NAME = "一键订"; 602 PRODUCT_NAME = "一键订";
627 PROVISIONING_PROFILE_SPECIFIER = ""; 603 PROVISIONING_PROFILE_SPECIFIER = "";
@@ -37,6 +37,7 @@ Future<void> main() async { @@ -37,6 +37,7 @@ Future<void> main() async {
37 LogUtil.init(isDebug: false, tag: 'ONE_KEY'); 37 LogUtil.init(isDebug: false, tag: 'ONE_KEY');
38 Provider.debugCheckInvalidValueType = null; 38 Provider.debugCheckInvalidValueType = null;
39 await initializeDateFormatting(); 39 await initializeDateFormatting();
  40 + Utils.changeStatusColor();
40 SystemChrome.setPreferredOrientations( 41 SystemChrome.setPreferredOrientations(
41 [DeviceOrientation.portraitUp, DeviceOrientation.portraitDown]) 42 [DeviceOrientation.portraitUp, DeviceOrientation.portraitDown])
42 .then((_) { 43 .then((_) {
  1 +import 'package:json_annotation/json_annotation.dart';
  2 +
  3 +part 'get_seller_info_model.g.dart';
  4 +
  5 +@JsonSerializable()
  6 +class GetSellerInfoModel extends Object {
  7 + @JsonKey(name: 'ret')
  8 + int ret;
  9 +
  10 + @JsonKey(name: 'data')
  11 + GetSellerInfoSunModel data;
  12 +
  13 + @JsonKey(name: 'msg')
  14 + String msg;
  15 +
  16 + GetSellerInfoModel(
  17 + this.ret,
  18 + this.data,
  19 + this.msg,
  20 + );
  21 +
  22 + factory GetSellerInfoModel.fromJson(Map<String, dynamic> srcJson) =>
  23 + _$GetSellerInfoModelFromJson(srcJson);
  24 +
  25 + Map<String, dynamic> toJson() => _$GetSellerInfoModelToJson(this);
  26 +}
  27 +
  28 +@JsonSerializable()
  29 +class GetSellerInfoSunModel extends Object {
  30 + @JsonKey(name: 'data')
  31 + Data data;
  32 +
  33 + GetSellerInfoSunModel(
  34 + this.data,
  35 + );
  36 +
  37 + factory GetSellerInfoSunModel.fromJson(Map<String, dynamic> srcJson) =>
  38 + _$GetSellerInfoSunModelFromJson(srcJson);
  39 +
  40 + Map<String, dynamic> toJson() => _$GetSellerInfoSunModelToJson(this);
  41 +}
  42 +
  43 +@JsonSerializable()
  44 +class Data extends Object {
  45 + @JsonKey(name: 'id')
  46 + String id;
  47 +
  48 + @JsonKey(name: 'pid')
  49 + String pid;
  50 +
  51 + @JsonKey(name: 'openid')
  52 + String openid;
  53 +
  54 + @JsonKey(name: 'sellername')
  55 + String sellername;
  56 +
  57 + @JsonKey(name: 'selleralias')
  58 + String selleralias;
  59 +
  60 + @JsonKey(name: 'slogan')
  61 + String slogan;
  62 +
  63 + @JsonKey(name: 'sellerdesc')
  64 + String sellerdesc;
  65 +
  66 + @JsonKey(name: 'seller_logo')
  67 + String sellerLogo;
  68 +
  69 + @JsonKey(name: 'seller_image')
  70 + String sellerImage;
  71 +
  72 + @JsonKey(name: 'seller_tel')
  73 + String sellerTel;
  74 +
  75 + @JsonKey(name: 'phone')
  76 + String phone;
  77 +
  78 + @JsonKey(name: 'map_address')
  79 + String mapAddress;
  80 +
  81 + @JsonKey(name: 'long')
  82 + String long;
  83 +
  84 + @JsonKey(name: 'lat')
  85 + String lat;
  86 +
  87 + @JsonKey(name: 'discount_type')
  88 + String discountType;
  89 +
  90 + @JsonKey(name: 'last_num')
  91 + String lastNum;
  92 +
  93 + @JsonKey(name: 'ispass')
  94 + String ispass;
  95 +
  96 + @JsonKey(name: 'dis_ispass')
  97 + String disIspass;
  98 +
  99 + @JsonKey(name: 'account_money')
  100 + String accountMoney;
  101 +
  102 + @JsonKey(name: 'isopen_dc')
  103 + String isopenDc;
  104 +
  105 + @JsonKey(name: 'isopen_md')
  106 + String isopenMd;
  107 +
  108 + @JsonKey(name: 'dc_adduser_code')
  109 + String dcAdduserCode;
  110 +
  111 + @JsonKey(name: 'average')
  112 + String average;
  113 +
  114 + @JsonKey(name: 'is_online_reserve')
  115 + String isOnlineReserve;
  116 +
  117 + @JsonKey(name: 'is_tele')
  118 + String isTele;
  119 +
  120 + @JsonKey(name: 'daily')
  121 + String daily;
  122 +
  123 + @JsonKey(name: 'daily_time')
  124 + String dailyTime;
  125 +
  126 + @JsonKey(name: 'scale')
  127 + String scale;
  128 +
  129 + @JsonKey(name: 'score')
  130 + String score;
  131 +
  132 + @JsonKey(name: 'is_auth')
  133 + String isAuth;
  134 +
  135 + @JsonKey(name: 'is_call_tel')
  136 + String isCallTel;
  137 +
  138 + @JsonKey(name: 'rec_stime')
  139 + String recStime;
  140 +
  141 + @JsonKey(name: 'rec_etime')
  142 + String recEtime;
  143 +
  144 + @JsonKey(name: 'status')
  145 + String status;
  146 +
  147 + @JsonKey(name: 'cdate')
  148 + String cdate;
  149 +
  150 + @JsonKey(name: 'pro_code')
  151 + String proCode;
  152 +
  153 + @JsonKey(name: 'city_code')
  154 + String cityCode;
  155 +
  156 + @JsonKey(name: 'dis_code')
  157 + String disCode;
  158 +
  159 + @JsonKey(name: 'seller_code')
  160 + String sellerCode;
  161 +
  162 + Data(
  163 + this.id,
  164 + this.pid,
  165 + this.openid,
  166 + this.sellername,
  167 + this.selleralias,
  168 + this.slogan,
  169 + this.sellerdesc,
  170 + this.sellerLogo,
  171 + this.sellerImage,
  172 + this.sellerTel,
  173 + this.phone,
  174 + this.mapAddress,
  175 + this.long,
  176 + this.lat,
  177 + this.discountType,
  178 + this.lastNum,
  179 + this.ispass,
  180 + this.disIspass,
  181 + this.accountMoney,
  182 + this.isopenDc,
  183 + this.isopenMd,
  184 + this.dcAdduserCode,
  185 + this.average,
  186 + this.isOnlineReserve,
  187 + this.isTele,
  188 + this.daily,
  189 + this.dailyTime,
  190 + this.scale,
  191 + this.score,
  192 + this.isAuth,
  193 + this.isCallTel,
  194 + this.recStime,
  195 + this.recEtime,
  196 + this.status,
  197 + this.cdate,
  198 + this.proCode,
  199 + this.cityCode,
  200 + this.disCode,
  201 + this.sellerCode,
  202 + );
  203 +
  204 + factory Data.fromJson(Map<String, dynamic> srcJson) =>
  205 + _$DataFromJson(srcJson);
  206 +
  207 + Map<String, dynamic> toJson() => _$DataToJson(this);
  208 +}
  1 +// GENERATED CODE - DO NOT MODIFY BY HAND
  2 +
  3 +part of 'get_seller_info_model.dart';
  4 +
  5 +// **************************************************************************
  6 +// JsonSerializableGenerator
  7 +// **************************************************************************
  8 +
  9 +GetSellerInfoModel _$GetSellerInfoModelFromJson(Map<String, dynamic> json) {
  10 + return GetSellerInfoModel(
  11 + json['ret'] as int,
  12 + json['data'] == null
  13 + ? null
  14 + : GetSellerInfoSunModel.fromJson(
  15 + json['data'] as Map<String, dynamic>),
  16 + json['msg'] as String);
  17 +}
  18 +
  19 +Map<String, dynamic> _$GetSellerInfoModelToJson(GetSellerInfoModel instance) =>
  20 + <String, dynamic>{
  21 + 'ret': instance.ret,
  22 + 'data': instance.data,
  23 + 'msg': instance.msg
  24 + };
  25 +
  26 +GetSellerInfoSunModel _$GetSellerInfoSunModelFromJson(
  27 + Map<String, dynamic> json) {
  28 + return GetSellerInfoSunModel(json['data'] == null
  29 + ? null
  30 + : Data.fromJson(json['data'] as Map<String, dynamic>));
  31 +}
  32 +
  33 +Map<String, dynamic> _$GetSellerInfoSunModelToJson(
  34 + GetSellerInfoSunModel instance) =>
  35 + <String, dynamic>{'data': instance.data};
  36 +
  37 +Data _$DataFromJson(Map<String, dynamic> json) {
  38 + return Data(
  39 + json['id'] as String,
  40 + json['pid'] as String,
  41 + json['openid'] as String,
  42 + json['sellername'] as String,
  43 + json['selleralias'] as String,
  44 + json['slogan'] as String,
  45 + json['sellerdesc'] as String,
  46 + json['seller_logo'] as String,
  47 + json['seller_image'] as String,
  48 + json['seller_tel'] as String,
  49 + json['phone'] as String,
  50 + json['map_address'] as String,
  51 + json['long'] as String,
  52 + json['lat'] as String,
  53 + json['discount_type'] as String,
  54 + json['last_num'] as String,
  55 + json['ispass'] as String,
  56 + json['dis_ispass'] as String,
  57 + json['account_money'] as String,
  58 + json['isopen_dc'] as String,
  59 + json['isopen_md'] as String,
  60 + json['dc_adduser_code'] as String,
  61 + json['average'] as String,
  62 + json['is_online_reserve'] as String,
  63 + json['is_tele'] as String,
  64 + json['daily'] as String,
  65 + json['daily_time'] as String,
  66 + json['scale'] as String,
  67 + json['score'] as String,
  68 + json['is_auth'] as String,
  69 + json['is_call_tel'] as String,
  70 + json['rec_stime'] as String,
  71 + json['rec_etime'] as String,
  72 + json['status'] as String,
  73 + json['cdate'] as String,
  74 + json['pro_code'] as String,
  75 + json['city_code'] as String,
  76 + json['dis_code'] as String,
  77 + json['seller_code'] as String);
  78 +}
  79 +
  80 +Map<String, dynamic> _$DataToJson(Data instance) => <String, dynamic>{
  81 + 'id': instance.id,
  82 + 'pid': instance.pid,
  83 + 'openid': instance.openid,
  84 + 'sellername': instance.sellername,
  85 + 'selleralias': instance.selleralias,
  86 + 'slogan': instance.slogan,
  87 + 'sellerdesc': instance.sellerdesc,
  88 + 'seller_logo': instance.sellerLogo,
  89 + 'seller_image': instance.sellerImage,
  90 + 'seller_tel': instance.sellerTel,
  91 + 'phone': instance.phone,
  92 + 'map_address': instance.mapAddress,
  93 + 'long': instance.long,
  94 + 'lat': instance.lat,
  95 + 'discount_type': instance.discountType,
  96 + 'last_num': instance.lastNum,
  97 + 'ispass': instance.ispass,
  98 + 'dis_ispass': instance.disIspass,
  99 + 'account_money': instance.accountMoney,
  100 + 'isopen_dc': instance.isopenDc,
  101 + 'isopen_md': instance.isopenMd,
  102 + 'dc_adduser_code': instance.dcAdduserCode,
  103 + 'average': instance.average,
  104 + 'is_online_reserve': instance.isOnlineReserve,
  105 + 'is_tele': instance.isTele,
  106 + 'daily': instance.daily,
  107 + 'daily_time': instance.dailyTime,
  108 + 'scale': instance.scale,
  109 + 'score': instance.score,
  110 + 'is_auth': instance.isAuth,
  111 + 'is_call_tel': instance.isCallTel,
  112 + 'rec_stime': instance.recStime,
  113 + 'rec_etime': instance.recEtime,
  114 + 'status': instance.status,
  115 + 'cdate': instance.cdate,
  116 + 'pro_code': instance.proCode,
  117 + 'city_code': instance.cityCode,
  118 + 'dis_code': instance.disCode,
  119 + 'seller_code': instance.sellerCode
  120 + };
  1 +import 'package:json_annotation/json_annotation.dart';
  2 +
  3 +part 'set_seller_info_model.g.dart';
  4 +
  5 +
  6 +@JsonSerializable()
  7 + class SetSellerInfoModel extends Object {
  8 +
  9 + @JsonKey(name: 'ret')
  10 + int ret;
  11 +
  12 + @JsonKey(name: 'data')
  13 + SetSellerInfoSunModel data;
  14 +
  15 + @JsonKey(name: 'msg')
  16 + String msg;
  17 +
  18 + SetSellerInfoModel(this.ret,this.data,this.msg,);
  19 +
  20 + factory SetSellerInfoModel.fromJson(Map<String, dynamic> srcJson) => _$SetSellerInfoModelFromJson(srcJson);
  21 +
  22 + Map<String, dynamic> toJson() => _$SetSellerInfoModelToJson(this);
  23 +
  24 +}
  25 +
  26 +
  27 +@JsonSerializable()
  28 + class SetSellerInfoSunModel extends Object {
  29 +
  30 + @JsonKey(name: 'sellerid')
  31 + int sellerid;
  32 +
  33 + SetSellerInfoSunModel(this.sellerid,);
  34 +
  35 + factory SetSellerInfoSunModel.fromJson(Map<String, dynamic> srcJson) => _$DataFromJson(srcJson);
  36 +
  37 + Map<String, dynamic> toJson() => _$DataToJson(this);
  38 +
  39 +}
  40 +
  41 +
  1 +// GENERATED CODE - DO NOT MODIFY BY HAND
  2 +
  3 +part of 'set_seller_info_model.dart';
  4 +
  5 +// **************************************************************************
  6 +// JsonSerializableGenerator
  7 +// **************************************************************************
  8 +
  9 +SetSellerInfoModel _$SetSellerInfoModelFromJson(Map<String, dynamic> json) {
  10 + return SetSellerInfoModel(
  11 + json['ret'] as int,
  12 + json['data'] == null
  13 + ? null
  14 + : SetSellerInfoSunModel.fromJson(
  15 + json['data'] as Map<String, dynamic>),
  16 + json['msg'] as String);
  17 +}
  18 +
  19 +Map<String, dynamic> _$SetSellerInfoModelToJson(SetSellerInfoModel instance) =>
  20 + <String, dynamic>{
  21 + 'ret': instance.ret,
  22 + 'data': instance.data,
  23 + 'msg': instance.msg
  24 + };
  25 +
  26 +SetSellerInfoSunModel _$DataFromJson(Map<String, dynamic> json) {
  27 + return SetSellerInfoSunModel(json['sellerid'] as int);
  28 +}
  29 +
  30 +Map<String, dynamic> _$DataToJson(SetSellerInfoSunModel instance) =>
  31 + <String, dynamic>{'sellerid': instance.sellerid};
@@ -215,6 +215,7 @@ class DioUtil { @@ -215,6 +215,7 @@ class DioUtil {
215 _data = _dataMap[_dataKey]; 215 _data = _dataMap[_dataKey];
216 _responseData = _dataMap; 216 _responseData = _dataMap;
217 } 217 }
  218 +
218 Loading.hideLoading(context); 219 Loading.hideLoading(context);
219 return new BaseResp(_status, _code, _msg, _data, _responseData); 220 return new BaseResp(_status, _code, _msg, _data, _responseData);
220 } catch (e) { 221 } catch (e) {
@@ -38,4 +38,11 @@ class HttpUrl { @@ -38,4 +38,11 @@ class HttpUrl {
38 static const String set_switch_status = 38 static const String set_switch_status =
39 "?service=App.Reserve.SetSwitchStatus"; //启用/停用桌位 39 "?service=App.Reserve.SetSwitchStatus"; //启用/停用桌位
40 static const String sms_info = "?service=App.SendSMS.SmsInfo"; //短信余量查询及套餐查询接口 40 static const String sms_info = "?service=App.SendSMS.SmsInfo"; //短信余量查询及套餐查询接口
  41 + static const String set_seller_info =
  42 + "?service=App.Seller.SetSellerById"; // 根据商家ID设置商家信息
  43 + static const String get_seller_info =
  44 + "?service=App.Seller.GetSellerById"; // 根据商家ID获取商家信息
  45 + static const String set_order_time =
  46 + "?service=App.Seller.SetReOrderTime"; //在线预订配置-接单时间
  47 +
41 } 48 }
@@ -114,7 +114,9 @@ class _NoteBookChangePageState extends State<NoteBookChangePage> { @@ -114,7 +114,9 @@ class _NoteBookChangePageState extends State<NoteBookChangePage> {
114 mainAxisAlignment: MainAxisAlignment.spaceBetween, 114 mainAxisAlignment: MainAxisAlignment.spaceBetween,
115 children: _notebookDetailChangeModel.dateList.map((value) { 115 children: _notebookDetailChangeModel.dateList.map((value) {
116 return CustomButton( 116 return CustomButton(
117 - dateText: value['title'].toString().length<=5?value['title'].toString():value['title'].toString().substring(5), 117 + dateText: value['title'].toString().length <= 5
  118 + ? value['title'].toString()
  119 + : value['title'].toString().substring(5),
118 fontSize: value['fontSize'], 120 fontSize: value['fontSize'],
119 dayText: value['dayText'], 121 dayText: value['dayText'],
120 isImage: value['isImage'], 122 isImage: value['isImage'],
@@ -819,7 +821,11 @@ class _NoteBookChangePageState extends State<NoteBookChangePage> { @@ -819,7 +821,11 @@ class _NoteBookChangePageState extends State<NoteBookChangePage> {
819 if (permissionStatus == PermissionStatus.neverAskAgain) { 821 if (permissionStatus == PermissionStatus.neverAskAgain) {
820 //用户选择不在弹出权限提示框 822 //用户选择不在弹出权限提示框
821 print('never'); 823 print('never');
822 - DialogUtil.openAlertDialog(context); 824 + DialogUtil.openAlertDialog(
  825 + context, '未获得通讯录权限', "请在手机的权限管理里,将通讯录权限开启", '去设置',340.0, onTap: () {
  826 + openSetting();
  827 + Navigator.pop(context, '');
  828 + });
823 } else { 829 } else {
824 // 申请权限 830 // 申请权限
825 bool canContacts = await requestContactPermission(); 831 bool canContacts = await requestContactPermission();
@@ -827,7 +833,12 @@ class _NoteBookChangePageState extends State<NoteBookChangePage> { @@ -827,7 +833,12 @@ class _NoteBookChangePageState extends State<NoteBookChangePage> {
827 _getContactData(); 833 _getContactData();
828 } else { 834 } else {
829 //拒绝通讯录权限 , 苹果拒绝权限后,不再提示权限框,进入此处 835 //拒绝通讯录权限 , 苹果拒绝权限后,不再提示权限框,进入此处
830 - DialogUtil.openAlertDialog(context); 836 + DialogUtil.openAlertDialog(
  837 + context, '未获得通讯录权限', "请在手机的权限管理里,将通讯录权限开启。", '去设置', 340.0,
  838 + onTap: () {
  839 + openSetting();
  840 + Navigator.pop(context, '');
  841 + });
831 } 842 }
832 } 843 }
833 } else { 844 } else {
@@ -434,9 +434,9 @@ class HomePageState extends State<HomePage> with WidgetsBindingObserver { @@ -434,9 +434,9 @@ class HomePageState extends State<HomePage> with WidgetsBindingObserver {
434 _currIndex = index; 434 _currIndex = index;
435 }); 435 });
436 if (_currIndex == 3) { 436 if (_currIndex == 3) {
437 - Utils.changeStatusColor(color: MyColours.color_199095); 437 + Utils.changeStatusColor(color: Colors.transparent);
438 } else { 438 } else {
439 - Utils.changeStatusColor(color: MyColours.color_ffffff); 439 + Utils.changeStatusColor(color: Colors.white);
440 } 440 }
441 } 441 }
442 }, 442 },
1 import 'dart:async'; 1 import 'dart:async';
2 2
3 import 'package:flutter/material.dart'; 3 import 'package:flutter/material.dart';
  4 +import 'package:one_key/utils/event_bus.dart';
4 import 'package:one_key/widgets/system_app_bar.dart'; 5 import 'package:one_key/widgets/system_app_bar.dart';
5 import 'package:webview_flutter/webview_flutter.dart'; 6 import 'package:webview_flutter/webview_flutter.dart';
6 7
@@ -14,7 +15,9 @@ class WebPage extends StatelessWidget { @@ -14,7 +15,9 @@ class WebPage extends StatelessWidget {
14 final Completer<WebViewController> _controller = 15 final Completer<WebViewController> _controller =
15 Completer<WebViewController>(); 16 Completer<WebViewController>();
16 return Scaffold( 17 return Scaffold(
17 - appBar: SystemAppBar(title), 18 + appBar: SystemAppBar(title, onTap: () {
  19 + Navigator.of(context).pop();
  20 + }),
18 body: WebView( 21 body: WebView(
19 initialUrl: "http://colorcun.com/privacy1.html", 22 initialUrl: "http://colorcun.com/privacy1.html",
20 javascriptMode: JavascriptMode.unrestricted, 23 javascriptMode: JavascriptMode.unrestricted,
@@ -31,9 +34,7 @@ class WebPage extends StatelessWidget { @@ -31,9 +34,7 @@ class WebPage extends StatelessWidget {
31 } 34 }
32 return NavigationDecision.navigate; 35 return NavigationDecision.navigate;
33 }, 36 },
34 - onPageStarted: (String url) {  
35 -  
36 - }, 37 + onPageStarted: (String url) {},
37 onPageFinished: (String url) { 38 onPageFinished: (String url) {
38 // Loading.hideLoading(context); 39 // Loading.hideLoading(context);
39 }, 40 },
1 import 'package:common_utils/common_utils.dart'; 1 import 'package:common_utils/common_utils.dart';
  2 +import 'package:flutter/cupertino.dart';
2 import 'package:flutter/material.dart'; 3 import 'package:flutter/material.dart';
3 import 'package:flutter_screenutil/screenutil.dart'; 4 import 'package:flutter_screenutil/screenutil.dart';
  5 +import 'package:one_key/models/seller_info.dart';
  6 +import 'package:one_key/models/set_seller_info_model.dart';
4 import 'package:one_key/models/settime.dart'; 7 import 'package:one_key/models/settime.dart';
  8 +import 'package:one_key/provider/book_set_time_model.dart';
5 import 'package:one_key/res/colors.dart'; 9 import 'package:one_key/res/colors.dart';
6 import 'package:one_key/utils/dialog_util.dart'; 10 import 'package:one_key/utils/dialog_util.dart';
  11 +import 'package:one_key/utils/event_bus.dart';
7 import 'package:one_key/utils/utils.dart'; 12 import 'package:one_key/utils/utils.dart';
8 import 'package:one_key/widgets/MyDivider.dart'; 13 import 'package:one_key/widgets/MyDivider.dart';
9 -import 'package:one_key/widgets/app_bar.dart'; 14 +import 'package:one_key/widgets/common_button.dart';
10 import 'package:one_key/widgets/h_empty_view.dart'; 15 import 'package:one_key/widgets/h_empty_view.dart';
  16 +import 'package:one_key/widgets/set_time_widget.dart';
  17 +import 'package:one_key/widgets/system_app_bar.dart';
11 import 'package:one_key/widgets/v_empty_view.dart'; 18 import 'package:one_key/widgets/v_empty_view.dart';
  19 +import 'package:provider/provider.dart';
12 20
13 typedef BookTimeSetCallback = void Function(bool needChange); 21 typedef BookTimeSetCallback = void Function(bool needChange);
14 22
@@ -22,10 +30,10 @@ class BookTimeSetPage extends StatefulWidget { @@ -22,10 +30,10 @@ class BookTimeSetPage extends StatefulWidget {
22 class _BookTimeSetPageState extends State<BookTimeSetPage> { 30 class _BookTimeSetPageState extends State<BookTimeSetPage> {
23 List swichState; 31 List swichState;
24 final GlobalKey<ScaffoldState> _scaffoldKey = GlobalKey<ScaffoldState>(); 32 final GlobalKey<ScaffoldState> _scaffoldKey = GlobalKey<ScaffoldState>();
25 - List dateData;  
26 SetTime morning = SetTime(); 33 SetTime morning = SetTime();
27 SetTime noon = SetTime(); 34 SetTime noon = SetTime();
28 SetTime night = SetTime(); 35 SetTime night = SetTime();
  36 + BookSetTimeModel bookSetTimeModel;
29 37
30 @override 38 @override
31 void initState() { 39 void initState() {
@@ -36,95 +44,153 @@ class _BookTimeSetPageState extends State<BookTimeSetPage> { @@ -36,95 +44,153 @@ class _BookTimeSetPageState extends State<BookTimeSetPage> {
36 noon.end = '14:30'; 44 noon.end = '14:30';
37 night.start = '16:00'; 45 night.start = '16:00';
38 night.end = '21:00'; 46 night.end = '21:00';
39 - swichState = [  
40 - {  
41 - 'on': false,  
42 - },  
43 - {  
44 - 'on': true,  
45 - },  
46 - {  
47 - 'on': true,  
48 - }  
49 - ]; 47 + swichState = [false, true, true];
50 48
51 - dateData = [  
52 - {  
53 - '深夜00时': [00, 30]  
54 - },  
55 - {  
56 - '深夜01时': [00, 30]  
57 - },  
58 - {  
59 - '深夜02时': [00, 30]  
60 - },  
61 - {  
62 - '深夜03时': [00, 30]  
63 - },  
64 - {  
65 - '深夜04时': [00, 30]  
66 - },  
67 - {  
68 - '深夜05时': [00, 30]  
69 - },  
70 - {  
71 - '早上06时': [00, 30]  
72 - },  
73 - {  
74 - '早上07时': [00, 30]  
75 - },  
76 - {  
77 - '早上08时': [00, 30]  
78 - },  
79 - {  
80 - '早上09时': [00, 30]  
81 - },  
82 - {  
83 - '中午10时': [00, 30]  
84 - },  
85 - {  
86 - '中午11时': [00, 30]  
87 - },  
88 - {  
89 - '中午12时': [00, 30]  
90 - },  
91 - {  
92 - '中午13时': [00, 30]  
93 - },  
94 - {  
95 - '中午14时': [00, 30]  
96 - },  
97 - {  
98 - '下午15时': [00, 30]  
99 - },  
100 - {  
101 - '下午16时': [00, 30]  
102 - },  
103 - {  
104 - '下午17时': [00, 30]  
105 - },  
106 - {  
107 - '下午18时': [00, 30]  
108 - },  
109 - {  
110 - '晚上19时': [00, 30]  
111 - },  
112 - {  
113 - '晚上20时': [00, 30]  
114 - },  
115 - {  
116 - '晚上21时': [00, 30]  
117 - },  
118 - {  
119 - '晚上22时': [00, 30]  
120 - },  
121 - {  
122 - '晚上23时': [00, 30] 49 + WidgetsBinding.instance.addPostFrameCallback((_) {
  50 + _getDailyTime();
  51 + });
  52 + }
  53 +
  54 + /// 从接口获取可订时段信息 daily
  55 + _getDailyTime() async {
  56 + SunSellerInfoModel model = await bookSetTimeModel.getManagersInfo(context);
  57 + setState(() {
  58 + if (model.daily.morning.isNotEmpty) {
  59 + List temp = model.daily.morning.split('-');
  60 + morning.start = temp.length > 0 ? temp[0] : '07:00';
  61 + morning.end = temp.length > 1 ? temp[1] : '10:00';
  62 + swichState[0] = true;
  63 + } else {
  64 + swichState[0] = false;
  65 + }
  66 + if (model.daily.noon.isNotEmpty) {
  67 + List temp = model.daily.noon.split('-');
  68 + noon.start = temp.length > 0 ? temp[0] : '11:00';
  69 + noon.end = temp.length > 1 ? temp[1] : '14:30';
  70 + swichState[1] = true;
  71 + } else {
  72 + swichState[1] = false;
  73 + noon.start = '11:00';
  74 + noon.end = '14:30';
  75 + }
  76 + if (model.daily.night.isNotEmpty) {
  77 + List temp = model.daily.night.split('-');
  78 + night.start = temp.length > 0 ? temp[0] : '16:00';
  79 + night.end = temp.length > 1 ? temp[1] : '21:00';
  80 + swichState[2] = true;
  81 + } else {
  82 + swichState[2] = false;
  83 + night.start = '16:00';
  84 + night.end = '21:00';
  85 + }
  86 + if (swichState[0] == false) {
  87 + if (model.daily.noon.isNotEmpty) {
  88 + Utils.compareDateTime(noon.start, morning.end, (needChange) {
  89 + if (needChange) {
  90 + morning.end = noon.start;
  91 + } else {
  92 + morning.end = '10:00';
  93 + }
  94 + });
  95 + Utils.compareDateTime(noon.start, morning.start, (needChange) {
  96 + if (needChange) {
  97 + morning.start = noon.start;
  98 + } else {
  99 + morning.start = '07:00';
  100 + }
  101 + });
  102 + } else if (model.daily.night.isNotEmpty) {
  103 + Utils.compareDateTime(night.start, morning.end, (needChange) {
  104 + if (needChange) {
  105 + morning.end = night.start;
  106 + } else {
  107 + morning.end = '10:00';
  108 + }
  109 + });
  110 + Utils.compareDateTime(night.start, morning.start, (needChange) {
  111 + if (needChange) {
  112 + morning.start = night.start;
  113 + } else {
  114 + morning.start = '07:00';
  115 + }
  116 + });
  117 + }
  118 + }
  119 + if (swichState[1] == false) {
  120 + if (model.daily.morning.isNotEmpty) {
  121 + Utils.compareDateTime(noon.start, morning.end, (needChange) {
  122 + if (needChange) {
  123 + noon.start = morning.end;
  124 + } else {
  125 + noon.start = '11:00';
  126 + }
  127 + });
  128 + Utils.compareDateTime(noon.end, morning.end, (needChange) {
  129 + if (needChange) {
  130 + noon.end = morning.end;
  131 + } else {
  132 + Utils.compareDateTime(noon.end, night.start, (needChange) {
  133 + if (needChange) {
  134 + noon.end = '14:30';
  135 + } else {
  136 + noon.end = night.start;
  137 + }
  138 + });
  139 + }
  140 + });
  141 + }
  142 + if (model.daily.night.isNotEmpty) {
  143 + Utils.compareDateTime(noon.start, night.start, (needChange) {
  144 + if (!needChange) {
  145 + noon.start = night.start;
  146 + }
  147 + });
  148 + Utils.compareDateTime(noon.end, night.start, (needChange) {
  149 + if (!needChange) {
  150 + noon.end = night.start;
  151 + }
  152 + });
  153 + }
  154 + }
  155 + if (swichState[2] == false) {
  156 + if (model.daily.noon.isNotEmpty) {
  157 + Utils.compareDateTime(night.start, noon.end, (needChange) {
  158 + if (needChange) {
  159 + night.start = noon.end;
  160 + Utils.compareDateTime(night.end, noon.end, (needChange) {
  161 + if (needChange) {
  162 + night.end = noon.end;
  163 + }
  164 + });
  165 + }
  166 + });
  167 + Utils.compareDateTime(night.end, noon.start, (needChange) {
  168 + if (needChange) {
  169 + night.end = noon.start;
  170 + }
  171 + });
  172 + } else if (model.daily.morning.isNotEmpty) {
  173 + Utils.compareDateTime(night.start, morning.end, (needChange) {
  174 + if (needChange) {
  175 + night.start = morning.end;
  176 + Utils.compareDateTime(night.end, noon.end, (needChange) {
  177 + if (needChange) {
  178 + night.end = morning.end;
  179 + }
  180 + });
  181 + }
  182 + });
  183 + Utils.compareDateTime(night.start, morning.start, (needChange) {
  184 + if (needChange) {
  185 + night.start = morning.start;
  186 + }
  187 + });
  188 + }
123 } 189 }
124 - ]; 190 + });
125 } 191 }
126 192
127 - ///item 193 + ///item 早市,晚市,午时widhet
128 Widget _itemWidget(String title, String startTime, String endTime, int tag) { 194 Widget _itemWidget(String title, String startTime, String endTime, int tag) {
129 return Container( 195 return Container(
130 color: MyColours.color_ffffff, 196 color: MyColours.color_ffffff,
@@ -147,11 +213,11 @@ class _BookTimeSetPageState extends State<BookTimeSetPage> { @@ -147,11 +213,11 @@ class _BookTimeSetPageState extends State<BookTimeSetPage> {
147 InkWell( 213 InkWell(
148 onTap: () { 214 onTap: () {
149 setState(() { 215 setState(() {
150 - swichState[tag]["on"] = !swichState[tag]["on"]; 216 + swichState[tag] = !swichState[tag];
151 }); 217 });
152 }, 218 },
153 child: Image.asset( 219 child: Image.asset(
154 - swichState[tag]["on"] 220 + swichState[tag]
155 ? Utils.getImgPath('swich_on') 221 ? Utils.getImgPath('swich_on')
156 : Utils.getImgPath('swich_off'), 222 : Utils.getImgPath('swich_off'),
157 width: ScreenUtil().setWidth(122), 223 width: ScreenUtil().setWidth(122),
@@ -166,52 +232,97 @@ class _BookTimeSetPageState extends State<BookTimeSetPage> { @@ -166,52 +232,97 @@ class _BookTimeSetPageState extends State<BookTimeSetPage> {
166 ScreenUtil().setWidth(2), 232 ScreenUtil().setWidth(2),
167 color: MyColours.color_f3f3f3, 233 color: MyColours.color_f3f3f3,
168 ), 234 ),
169 - _timeWidget('开始时间', startTime, highted: swichState[tag]["on"],  
170 - onTap: () {  
171 - if (swichState[tag]["on"]) {  
172 - List data = dateData; 235 + timeWidget('开始时间', startTime, highted: swichState[tag], onTap: () {
  236 + if (swichState[tag]) {
  237 + List data = SetTimeWidget.dateData;
173 if (tag == 0) { 238 if (tag == 0) {
174 //早市 239 //早市
175 - data = dateData; 240 + data = SetTimeWidget.dateData;
176 } else if (tag == 1) { 241 } else if (tag == 1) {
177 //午市 242 //午市
178 - data = _getPickerData(morning.end); 243 + data =
  244 + Utils.getPickerData(morning.end, SetTimeWidget.dateData);
179 } else if (tag == 2) { 245 } else if (tag == 2) {
180 //晚市 246 //晚市
181 - data = _getPickerData(noon.end); 247 + data = Utils.getPickerData(noon.end, SetTimeWidget.dateData);
182 } 248 }
183 249
184 - DialogUtil.showSelectCusmanDialog(context, data, (value) { 250 + SetTimeWidget().showTimeSelector(context, data, startTime,
  251 + (value) {
185 if (value != null) { 252 if (value != null) {
186 - String temp;  
187 - if (value[1] == 0) {  
188 - temp = '00';  
189 - } else {  
190 - temp = '30';  
191 - } 253 + String tempMinute = _getMinuteStrFromPicker(data, value);
192 print(data[value[0]].keys.first); 254 print(data[value[0]].keys.first);
193 - String time = _getTimeString(  
194 - _getHourFromTitle(data[value[0]].keys.first), temp); 255 + String time = Utils.getTimeString(
  256 + Utils.getHourFromTitle(data[value[0]].keys.first),
  257 + tempMinute);
195 setState(() { 258 setState(() {
196 if (tag == 0) { 259 if (tag == 0) {
197 //早市 260 //早市
198 morning.start = time; 261 morning.start = time;
  262 + setState(() {
  263 + Utils.compareDateTime(morning.end, time,
  264 + (needChange) {
  265 + if (needChange) {
  266 + morning.end = time;
  267 + }
  268 + });
  269 + Utils.compareDateTime(noon.start, time, (needChange) {
  270 + if (needChange) {
  271 + noon.start = time;
  272 + }
  273 + });
  274 + Utils.compareDateTime(noon.end, time, (needChange) {
  275 + if (needChange) {
  276 + noon.end = time;
  277 + }
  278 + });
  279 + Utils.compareDateTime(night.start, time,
  280 + (needChange) {
  281 + if (needChange) {
  282 + night.start = time;
  283 + }
  284 + });
  285 + Utils.compareDateTime(night.end, time, (needChange) {
  286 + if (needChange) {
  287 + night.end = time;
  288 + }
  289 + });
  290 + });
199 } else if (tag == 1) { 291 } else if (tag == 1) {
200 //午市 292 //午市
201 noon.start = time; 293 noon.start = time;
  294 + setState(() {
  295 + Utils.compareDateTime(noon.end, time, (needChange) {
  296 + if (needChange) {
  297 + noon.end = time;
  298 + }
  299 + });
  300 + Utils.compareDateTime(night.start, time,
  301 + (needChange) {
  302 + if (needChange) {
  303 + night.start = time;
  304 + }
  305 + });
  306 + Utils.compareDateTime(night.end, time, (needChange) {
  307 + if (needChange) {
  308 + night.end = time;
  309 + }
  310 + });
  311 + });
202 } else if (tag == 2) { 312 } else if (tag == 2) {
203 //晚市 313 //晚市
204 night.start = time; 314 night.start = time;
  315 + setState(() {
  316 + Utils.compareDateTime(night.end, time, (needChange) {
  317 + if (needChange) {
  318 + night.end = time;
  319 + }
  320 + });
  321 + });
205 } 322 }
206 }); 323 });
207 print(value); 324 print(value);
208 - _compare(time);  
209 } 325 }
210 - }, selecteds: [  
211 - _getFirSelected(startTime, data),  
212 - _getSecSelected(startTime)  
213 - ]).then((value) {  
214 - print(value);  
215 }); 326 });
216 } 327 }
217 }), 328 }),
@@ -223,50 +334,79 @@ class _BookTimeSetPageState extends State<BookTimeSetPage> { @@ -223,50 +334,79 @@ class _BookTimeSetPageState extends State<BookTimeSetPage> {
223 ScreenUtil().setWidth(2), 334 ScreenUtil().setWidth(2),
224 color: MyColours.color_f3f3f3, 335 color: MyColours.color_f3f3f3,
225 )), 336 )),
226 - _timeWidget('结束时间', endTime, highted: swichState[tag]["on"],  
227 - onTap: () {  
228 - if (swichState[tag]["on"]) {  
229 - List data = dateData; 337 + timeWidget('结束时间', endTime, highted: swichState[tag], onTap: () {
  338 + if (swichState[tag]) {
  339 + List data = SetTimeWidget.dateData;
230 if (tag == 0) { 340 if (tag == 0) {
231 //早市 341 //早市
232 - data = _getPickerData(morning.start); 342 + data = Utils.getPickerData(
  343 + morning.start, SetTimeWidget.dateData);
233 } else if (tag == 1) { 344 } else if (tag == 1) {
234 //午市 345 //午市
235 - data = _getPickerData(noon.start); 346 + data =
  347 + Utils.getPickerData(noon.start, SetTimeWidget.dateData);
236 } else if (tag == 2) { 348 } else if (tag == 2) {
237 //晚市 349 //晚市
238 - data = _getPickerData(night.start); 350 + data =
  351 + Utils.getPickerData(night.start, SetTimeWidget.dateData);
239 } 352 }
240 - DialogUtil.showSelectCusmanDialog(context, data, (value) { 353 + SetTimeWidget().showTimeSelector(context, data, startTime,
  354 + (value) {
241 if (value != null) { 355 if (value != null) {
242 - String temp;  
243 - if (value[1] == 0) {  
244 - temp = '00';  
245 - } else {  
246 - temp = '30';  
247 - }  
248 - String time = _getTimeString(  
249 - _getHourFromTitle(data[value[0]].keys.first), temp); 356 + String tempMinute = _getMinuteStrFromPicker(data, value);
  357 + String time = Utils.getTimeString(
  358 + Utils.getHourFromTitle(data[value[0]].keys.first),
  359 + tempMinute);
250 setState(() { 360 setState(() {
251 if (tag == 0) { 361 if (tag == 0) {
252 //早市 362 //早市
253 morning.end = time; 363 morning.end = time;
  364 + setState(() {
  365 + Utils.compareDateTime(noon.start, time, (needChange) {
  366 + if (needChange) {
  367 + noon.start = time;
  368 + }
  369 + });
  370 + Utils.compareDateTime(noon.end, time, (needChange) {
  371 + if (needChange) {
  372 + noon.end = time;
  373 + }
  374 + });
  375 + Utils.compareDateTime(night.start, time,
  376 + (needChange) {
  377 + if (needChange) {
  378 + night.start = time;
  379 + }
  380 + });
  381 + Utils.compareDateTime(night.end, time, (needChange) {
  382 + if (needChange) {
  383 + night.end = time;
  384 + }
  385 + });
  386 + });
254 } else if (tag == 1) { 387 } else if (tag == 1) {
255 //午市 388 //午市
256 noon.end = time; 389 noon.end = time;
  390 + setState(() {
  391 + Utils.compareDateTime(night.start, time,
  392 + (needChange) {
  393 + if (needChange) {
  394 + night.start = time;
  395 + }
  396 + });
  397 + Utils.compareDateTime(night.end, time, (needChange) {
  398 + if (needChange) {
  399 + night.end = time;
  400 + }
  401 + });
  402 + });
257 } else if (tag == 2) { 403 } else if (tag == 2) {
258 //晚市 404 //晚市
259 night.end = time; 405 night.end = time;
260 } 406 }
261 }); 407 });
262 print(value); 408 print(value);
263 - _compare(time);  
264 } 409 }
265 - }, selecteds: [  
266 - _getFirSelected(endTime, data),  
267 - _getSecSelected(endTime)  
268 - ]).then((value) {  
269 - print(value);  
270 }); 410 });
271 } 411 }
272 }) 412 })
@@ -274,173 +414,180 @@ class _BookTimeSetPageState extends State<BookTimeSetPage> { @@ -274,173 +414,180 @@ class _BookTimeSetPageState extends State<BookTimeSetPage> {
274 )); 414 ));
275 } 415 }
276 416
277 - /// 开始时间和结束时间widget  
278 - _timeWidget(String title, String time,  
279 - {bool highted = true, GestureTapCallback onTap}) {  
280 - return InkWell(  
281 - onTap: onTap,  
282 - child: Padding(  
283 - padding:  
284 - EdgeInsets.symmetric(horizontal: ScreenUtil().setWidth(40)),  
285 - child: Container(  
286 - height: ScreenUtil().setWidth(124),  
287 - child: Row(  
288 - crossAxisAlignment: CrossAxisAlignment.center,  
289 - mainAxisAlignment: MainAxisAlignment.spaceBetween,  
290 - children: [  
291 - Text(title,  
292 - style: TextStyle(  
293 - color: highted  
294 - ? MyColours.color_353535  
295 - : MyColours.color_999999,  
296 - fontSize: ScreenUtil().setSp(30),  
297 - )),  
298 - Spacer(),  
299 - Text(time,  
300 - style: TextStyle(  
301 - color: highted  
302 - ? MyColours.color_353535  
303 - : MyColours.color_999999,  
304 - fontSize: ScreenUtil().setSp(30),  
305 - )),  
306 - HEmptyView(20),  
307 - Image.asset(  
308 - Utils.getImgPath('arrow_right_new'),  
309 - width: ScreenUtil().setWidth(16),  
310 - height: ScreenUtil().setWidth(28),  
311 - )  
312 - ],  
313 - ),  
314 - )));  
315 - }  
316 -  
317 - ///工具  
318 - /// 组装成07:00  
319 - _getTimeString(dynamic hour, String minute) {  
320 - return '${hour}:${minute}';  
321 - }  
322 -  
323 - /// 从07:00中获取07  
324 - _getHourFromhourAndMinute(String hourAndMinute) {  
325 - return hourAndMinute.substring(0, 2);  
326 - }  
327 -  
328 - ///从深夜00时中获取00  
329 - _getHourFromTitle(String title) {  
330 - return title.substring(2, 4);  
331 - }  
332 -  
333 - // 第一列当前选中第几个  
334 - _getFirSelected(String hourAndMinute, List data) {  
335 - String hour = _getHourFromhourAndMinute(hourAndMinute);  
336 - for (int i = 0; i < data.length; i++) {  
337 - Map map = data[i];  
338 - String key = map.keys.first;  
339 - if (key.contains(hour)) {  
340 - return i;  
341 - }  
342 - }  
343 - return 0;  
344 - }  
345 -  
346 - // 第二列当前选中第几个  
347 - _getSecSelected(String hourAndMinute) {  
348 - String minute = _getMinuteFromhourAndMinute(hourAndMinute);  
349 - if (minute == '00') {  
350 - return 0;  
351 - }  
352 - return 1;  
353 - }  
354 -  
355 - /// 0 还是 30  
356 - /// 从07:00中获取0 或者 30  
357 - _getMinuteFromhourAndMinute(String hourAndMinute) {  
358 - return hourAndMinute.substring(3, 5);  
359 - }  
360 -  
361 - ///获取选择器数据  
362 - _getPickerData(String lastTime) {  
363 - String hour = _getHourFromhourAndMinute(lastTime);  
364 - String minute = _getMinuteFromhourAndMinute(lastTime);  
365 - if (minute == '30') {  
366 - hour = '${int.parse(hour) + 1}';  
367 - }  
368 - List tempList = List();  
369 - tempList.addAll(dateData);  
370 - tempList.removeRange(0, int.parse(hour));  
371 - return tempList;  
372 - }  
373 -  
374 - ///判断时间大小  
375 - /// a > b  
376 - _compareDateTime(String a, String b, BookTimeSetCallback callback) {  
377 - String tempa = '${DateUtil.getNowDateStr().substring(0, 10)} ${a}:00';  
378 - String tempb = '${DateUtil.getNowDateStr().substring(0, 10)} ${b}:00';  
379 - int aMs = DateUtil.getDateMsByTimeStr(tempa);  
380 - int bMs = DateUtil.getDateMsByTimeStr(tempb);  
381 - if (aMs < bMs) {  
382 - a = b;  
383 - callback(true); 417 + ///从时间选择器中获取分钟数字符串 00 or 30
  418 + String _getMinuteStrFromPicker(List data, List value) {
  419 + if (data.length == 1) {
  420 + return '30';
384 } else { 421 } else {
385 - callback(false); 422 + if (value[1] == 0) {
  423 + return '00';
  424 + } else {
  425 + return '30';
  426 + }
386 } 427 }
387 } 428 }
388 429
389 - _compare(String time) {  
390 - setState(() {  
391 - _compareDateTime(morning.start, time, (needChange) {  
392 - if (needChange) {  
393 - morning.start = time;  
394 - }  
395 - });  
396 - _compareDateTime(morning.end, time, (needChange) {  
397 - if (needChange) {  
398 - morning.end = time;  
399 - }  
400 - });  
401 - _compareDateTime(noon.start, time, (needChange) {  
402 - if (needChange) {  
403 - noon.start = time;  
404 - }  
405 - });  
406 - _compareDateTime(noon.end, time, (needChange) {  
407 - if (needChange) {  
408 - noon.end = time;  
409 - }  
410 - });  
411 - _compareDateTime(night.start, time, (needChange) {  
412 - if (needChange) {  
413 - night.start = time;  
414 - }  
415 - });  
416 - _compareDateTime(night.end, time, (needChange) {  
417 - if (needChange) {  
418 - night.end = time;  
419 - }  
420 - });  
421 - }); 430 + ///底部widget
  431 + ///
  432 + _bottomWidget() {
  433 + return Container(
  434 + padding: EdgeInsets.fromLTRB(
  435 + ScreenUtil().setWidth(40),
  436 + ScreenUtil().setWidth(60),
  437 + ScreenUtil().setWidth(40),
  438 + ScreenUtil().setWidth(60),
  439 + ),
  440 + child: Column(
  441 + crossAxisAlignment: CrossAxisAlignment.start,
  442 + children: [
  443 + textWidget('温馨提示:'),
  444 + VEmptyView(10),
  445 + textWidget('1.时段停用,表示餐厅将不支持该时段的预订;'),
  446 + VEmptyView(10),
  447 + textWidget('2.修改起始时间后,为确保正常生效,建议重启话机。'),
  448 + ],
  449 + ),
  450 + );
422 } 451 }
423 452
424 @override 453 @override
425 Widget build(BuildContext context) { 454 Widget build(BuildContext context) {
426 - return Scaffold(  
427 - key: _scaffoldKey,  
428 - body: SafeArea(  
429 - child: SingleChildScrollView(  
430 - child: Column(  
431 - children: [  
432 - MyAppBar(  
433 - "可订时段",  
434 - showBack: true,  
435 - ),  
436 - _itemWidget('早市', morning.start, morning.end, 0),  
437 - VEmptyView(20),  
438 - _itemWidget('午市', noon.start, noon.end, 1),  
439 - VEmptyView(20),  
440 - _itemWidget('晚市', night.start, night.end, 2),  
441 - ], 455 + bookSetTimeModel = Provider.of<BookSetTimeModel>(context, listen: true);
  456 + return WillPopScope(
  457 + child: Scaffold(
  458 + key: _scaffoldKey,
  459 + backgroundColor: MyColours.color_f5f5f5,
  460 + appBar: SystemAppBar(
  461 + '可订时段',
  462 + onTap: () {
  463 + EventBus().emit('changeStatusColor');
  464 + Navigator.of(context).pop();
  465 + },
  466 + ),
  467 + body: SafeArea(
  468 + child: Column(
  469 + children: [
  470 + Expanded(
  471 + child: SingleChildScrollView(
  472 + child: Column(
  473 + children: [
  474 + _itemWidget('早市', morning.start, morning.end, 0),
  475 + VEmptyView(20),
  476 + _itemWidget('午市', noon.start, noon.end, 1),
  477 + VEmptyView(20),
  478 + _itemWidget('晚市', night.start, night.end, 2),
  479 + _bottomWidget()
  480 + ],
  481 + ),
  482 + )),
  483 + Padding(
  484 + padding: EdgeInsets.fromLTRB(
  485 + ScreenUtil().setWidth(40),
  486 + ScreenUtil().setWidth(0),
  487 + ScreenUtil().setWidth(40),
  488 + ScreenUtil().setWidth(60)),
  489 + child: CommonButton(
  490 + width: double.infinity,
  491 + height: 84,
  492 + fontSize: 34,
  493 + content: '保存',
  494 + state: 2,
  495 + onPress: () async {
  496 + String morningStr = '';
  497 + String noonStr = '';
  498 + String nightStr = '';
  499 + if (swichState[0]) {
  500 + morningStr = Utils.getTimelLongString(
  501 + morning.start, morning.end);
  502 + }
  503 + if (swichState[1]) {
  504 + noonStr =
  505 + Utils.getTimelLongString(noon.start, noon.end);
  506 + }
  507 + if (swichState[2]) {
  508 + nightStr =
  509 + Utils.getTimelLongString(night.start, night.end);
  510 + }
  511 +
  512 + DialogUtil.confirmTimeAlertDialog(
  513 + context, morningStr, noonStr, nightStr, () async {
  514 + ///接口
  515 + ///
  516 + SetSellerInfoSunModel sunModel = await bookSetTimeModel
  517 + .setSellerInfoById(context, {
  518 + 'morning': morningStr,
  519 + 'noon': noonStr,
  520 + 'night': nightStr
  521 + });
  522 + if (sunModel != null) {
  523 + //修改成功
  524 + Utils.showToast('保存成功');
  525 + EventBus().emit('changeStatusColor');
  526 + Navigator.pop(context);
  527 + } else {
  528 + // Utils.showToast('保存失败');
  529 + }
  530 + });
  531 + },
  532 + ))
  533 + ],
  534 + )),
442 ), 535 ),
443 - )),  
444 - ); 536 + onWillPop: () async {
  537 + EventBus().emit('changeStatusColor');
  538 + return true;
  539 + });
445 } 540 }
446 } 541 }
  542 +
  543 +/// 开始时间和结束时间widget
  544 +timeWidget(String title, String time,
  545 + {bool highted = true, GestureTapCallback onTap}) {
  546 + return InkWell(
  547 + onTap: onTap,
  548 + child: Padding(
  549 + padding: EdgeInsets.symmetric(horizontal: ScreenUtil().setWidth(40)),
  550 + child: Container(
  551 + height: ScreenUtil().setWidth(124),
  552 + child: Row(
  553 + crossAxisAlignment: CrossAxisAlignment.center,
  554 + mainAxisAlignment: MainAxisAlignment.spaceBetween,
  555 + children: [
  556 + Text(title,
  557 + style: TextStyle(
  558 + color: highted
  559 + ? MyColours.color_353535
  560 + : MyColours.color_999999,
  561 + fontSize: ScreenUtil().setSp(30),
  562 + )),
  563 + Spacer(),
  564 + Text(time,
  565 + style: TextStyle(
  566 + color: highted
  567 + ? MyColours.color_353535
  568 + : MyColours.color_999999,
  569 + fontSize: ScreenUtil().setSp(30),
  570 + )),
  571 + HEmptyView(20),
  572 + Image.asset(
  573 + Utils.getImgPath('arrow_right_new'),
  574 + width: ScreenUtil().setWidth(16),
  575 + height: ScreenUtil().setWidth(28),
  576 + )
  577 + ],
  578 + ),
  579 + )));
  580 +}
  581 +
  582 +///文本widget
  583 +///
  584 +textWidget(String title) {
  585 + return Container(
  586 + height: ScreenUtil().setWidth(40),
  587 + child: Text(
  588 + title,
  589 + style: TextStyle(
  590 + color: MyColours.color_353535, fontSize: ScreenUtil().setSp(28)),
  591 + ),
  592 + );
  593 +}
@@ -6,6 +6,7 @@ import 'package:one_key/provider/my_model.dart'; @@ -6,6 +6,7 @@ import 'package:one_key/provider/my_model.dart';
6 import 'package:one_key/provider/update_model.dart'; 6 import 'package:one_key/provider/update_model.dart';
7 import 'package:one_key/provider/user_model.dart'; 7 import 'package:one_key/provider/user_model.dart';
8 import 'package:one_key/res/colors.dart'; 8 import 'package:one_key/res/colors.dart';
  9 +import 'package:one_key/utils/event_bus.dart';
9 import 'package:one_key/utils/navigator_util.dart'; 10 import 'package:one_key/utils/navigator_util.dart';
10 import 'package:one_key/utils/utils.dart'; 11 import 'package:one_key/utils/utils.dart';
11 import 'package:one_key/widgets/MyDivider.dart'; 12 import 'package:one_key/widgets/MyDivider.dart';
@@ -35,6 +36,7 @@ class MyPageState extends State<MyPage> with WidgetsBindingObserver { @@ -35,6 +36,7 @@ class MyPageState extends State<MyPage> with WidgetsBindingObserver {
35 void initState() { 36 void initState() {
36 // TODO: implement initState 37 // TODO: implement initState
37 super.initState(); 38 super.initState();
  39 +
38 controller = ScrollController(initialScrollOffset: 0.0); 40 controller = ScrollController(initialScrollOffset: 0.0);
39 WidgetsBinding.instance.addObserver(this); 41 WidgetsBinding.instance.addObserver(this);
40 Utils.getCurrVersion().then((version) { 42 Utils.getCurrVersion().then((version) {
@@ -46,6 +48,16 @@ class MyPageState extends State<MyPage> with WidgetsBindingObserver { @@ -46,6 +48,16 @@ class MyPageState extends State<MyPage> with WidgetsBindingObserver {
46 ///获取短信余量 48 ///获取短信余量
47 _getSmsInfo(context); 49 _getSmsInfo(context);
48 }); 50 });
  51 + EventBus().on('changeStatusColor', (arg) {
  52 + Utils.changeStatusColor(color: Colors.transparent);
  53 + });
  54 + }
  55 +
  56 + @override
  57 + void dispose() {
  58 + // TODO: implement dispose
  59 + super.dispose();
  60 + EventBus().off('changeStatusColor');
49 } 61 }
50 62
51 @override 63 @override
@@ -73,6 +85,7 @@ class MyPageState extends State<MyPage> with WidgetsBindingObserver { @@ -73,6 +85,7 @@ class MyPageState extends State<MyPage> with WidgetsBindingObserver {
73 85
74 ///获取短信余量 86 ///获取短信余量
75 _getSmsInfo(context) async { 87 _getSmsInfo(context) async {
  88 + myModel = Provider.of<MyModel>(context, listen: false);
76 await myModel.getSmsInfo(context); 89 await myModel.getSmsInfo(context);
77 // setState(() { 90 // setState(() {
78 // if (smsInfoData != null) { 91 // if (smsInfoData != null) {
@@ -103,227 +116,209 @@ class MyPageState extends State<MyPage> with WidgetsBindingObserver { @@ -103,227 +116,209 @@ class MyPageState extends State<MyPage> with WidgetsBindingObserver {
103 fontWeight: FontWeight.normal, 116 fontWeight: FontWeight.normal,
104 decoration: TextDecoration.none), 117 decoration: TextDecoration.none),
105 )), 118 )),
106 - body: NestedScrollView(  
107 - controller: controller,  
108 - headerSliverBuilder:  
109 - (BuildContext context, bool innerBoxIsScrolled) {  
110 - return <Widget>[  
111 - SliverAppBar(  
112 - pinned: false,  
113 - floating: true,  
114 - expandedHeight: ScreenUtil().setWidth(242),  
115 - flexibleSpace: FlexibleSpaceBar(  
116 - collapseMode: CollapseMode.pin,  
117 - background: Container(  
118 - //头部整个背景颜色  
119 - // height: ScreenUtil().getAdapterSize(800),  
120 - child: Consumer<UserModel>(builder:  
121 - (BuildContext context, UserModel model,  
122 - Widget child) {  
123 - return Stack(  
124 - children: [  
125 - Container(  
126 - width: double.infinity,  
127 - height: ScreenUtil().setHeight(242 + 121),  
128 - alignment: Alignment.centerLeft,  
129 - color: MyColours.color_199095,  
130 - ),  
131 - Padding(  
132 - padding: EdgeInsets.only(  
133 - left: ScreenUtil().setWidth(40)),  
134 - child: Column(  
135 - crossAxisAlignment: CrossAxisAlignment.start,  
136 - children: [  
137 - VEmptyView(38),  
138 - Text(  
139 - model.user.sellername,  
140 - style: TextStyle(  
141 - color: MyColours.color_ffffff,  
142 - fontSize: ScreenUtil().setSp(36)),  
143 - ),  
144 - VEmptyView(38),  
145 - Text(  
146 - model.user.account +  
147 - " | " +  
148 - model.user.role_name,  
149 - style: TextStyle(  
150 - color: MyColours.color_ffffff,  
151 - fontSize: ScreenUtil().setSp(30)),  
152 - ),  
153 - ],  
154 - ))  
155 - ],  
156 - );  
157 - }))),  
158 - )  
159 - ];  
160 - },  
161 - body: Consumer<UserModel>(  
162 - builder: (BuildContext context, UserModel model, Widget child) {  
163 - return SingleChildScrollView(  
164 - physics: NeverScrollableScrollPhysics(), 119 + body: Consumer<UserModel>(
  120 + builder: (BuildContext context, UserModel model, Widget child) {
  121 + return MediaQuery.removePadding(
  122 + context: context,
  123 + child: SingleChildScrollView(
165 child: Column( 124 child: Column(
166 - children: <Widget>[  
167 - VEmptyView(40),  
168 - MyItem(  
169 - title: "短信管理",  
170 - content: myModel.smsInfo.isNotEmpty  
171 - ? '剩余${myModel.smsInfo}条'  
172 - : '',  
173 - callback: () {  
174 - Utils.goMiniProgramZm(context, "setting/sms");  
175 - },  
176 - ),  
177 - MyDivider(  
178 - double.infinity,  
179 - ScreenUtil().setHeight(1),  
180 - color: MyColours.color_f3f3f3,  
181 - ),  
182 - MyItem(  
183 - title: "包间类型置满管理",  
184 - content: "",  
185 - callback: () {  
186 - Utils.goMiniProgramZm(context, "roomtype/roomtype");  
187 - },  
188 - ),  
189 - MyDivider(  
190 - double.infinity,  
191 - ScreenUtil().setHeight(1),  
192 - color: MyColours.color_f3f3f3,  
193 - ),  
194 - MyItem(  
195 - title: "可订时段管理",  
196 - content: "",  
197 - callback: () {  
198 - NavigatorUtil.goBookTimeSetPage(context);  
199 - },  
200 - ),  
201 - MyDivider(  
202 - double.infinity,  
203 - ScreenUtil().setHeight(1),  
204 - color: MyColours.color_f3f3f3,  
205 - ),  
206 - MyItem(  
207 - title: "接单时间管理",  
208 - content: "",  
209 - callback: () {},  
210 - ),  
211 - VEmptyView(40),  
212 - MyItem(  
213 - title: "联系客服",  
214 - content: "09:00~21:00",  
215 - callback: () {  
216 - Utils.goPhone("400-000-9690");  
217 - },  
218 - ),  
219 - MyDivider(  
220 - double.infinity,  
221 - ScreenUtil().setHeight(1),  
222 - color: MyColours.color_f3f3f3,  
223 - ),  
224 - MyItem(  
225 - title: "帮助与反馈",  
226 - content: "",  
227 - callback: () {  
228 - Utils.goHelp(context);  
229 - }, 125 + children: <Widget>[
  126 + Stack(
  127 + children: [
  128 + Container(
  129 + width: double.infinity,
  130 + height: ScreenUtil().setHeight(200),
  131 + alignment: Alignment.centerLeft,
  132 + color: MyColours.color_199095,
230 ), 133 ),
231 - MyDivider(double.infinity, ScreenUtil().setHeight(1),  
232 - color: MyColours.color_f3f3f3),  
233 - GestureDetector(  
234 - onTap: checkUpdate,  
235 - child: Container(  
236 - width: double.infinity,  
237 - height: ScreenUtil().setHeight(122),  
238 - color: MyColours.color_ffffff,  
239 - padding: EdgeInsets.symmetric(  
240 - horizontal: ScreenUtil().setWidth(40)),  
241 - alignment: Alignment.center,  
242 - child: Row(  
243 - children: <Widget>[ 134 + Padding(
  135 + padding:
  136 + EdgeInsets.only(left: ScreenUtil().setWidth(40)),
  137 + child: Column(
  138 + crossAxisAlignment: CrossAxisAlignment.start,
  139 + children: [
  140 + VEmptyView(38),
244 Text( 141 Text(
245 - "版本更新", 142 + model.user.sellername,
246 style: TextStyle( 143 style: TextStyle(
247 - fontSize: ScreenUtil().setSp(30),  
248 - color: MyColours.color_353535), 144 + color: MyColours.color_ffffff,
  145 + fontSize: ScreenUtil().setSp(36)),
  146 + ),
  147 + VEmptyView(38),
  148 + Text(
  149 + model.user.account +
  150 + " | " +
  151 + model.user.role_name,
  152 + style: TextStyle(
  153 + color: MyColours.color_ffffff,
  154 + fontSize: ScreenUtil().setSp(30)),
249 ), 155 ),
250 - Spacer(),  
251 - newVersion  
252 - ? Container(  
253 - width: ScreenUtil().setWidth(120),  
254 - height: ScreenUtil().setWidth(34),  
255 - decoration: BoxDecoration(  
256 - color: MyColours.color_E14553,  
257 - borderRadius: BorderRadius.all(  
258 - Radius.circular(  
259 - ScreenUtil().setWidth(6))),  
260 - ),  
261 - child: Center(  
262 - child: Text(  
263 - "发现新版本",  
264 - style: TextStyle(  
265 - fontSize: ScreenUtil().setSp(24),  
266 - color: MyColours.color_ffffff),  
267 - ),  
268 - ),  
269 - )  
270 - : Text(  
271 - cur_version,  
272 - style: TextStyle(  
273 - fontSize: ScreenUtil().setSp(28),  
274 - color: MyColours.color_666666),  
275 - ),  
276 - HEmptyView(20),  
277 - Image.asset(  
278 - "assets/arr_right_gray.png",  
279 - width: ScreenUtil().setWidth(14),  
280 - height: ScreenUtil().setWidth(22),  
281 - )  
282 ], 156 ],
  157 + ))
  158 + ],
  159 + ),
  160 + VEmptyView(40),
  161 + MyItem(
  162 + title: "短信管理",
  163 + content: myModel.smsInfo.isNotEmpty
  164 + ? '剩余${myModel.smsInfo}条'
  165 + : '',
  166 + callback: () {
  167 + Utils.goMiniProgramZm(context, "setting/sms");
  168 + },
  169 + ),
  170 + MyDivider(
  171 + double.infinity,
  172 + ScreenUtil().setHeight(1),
  173 + color: MyColours.color_f3f3f3,
  174 + ),
  175 + MyItem(
  176 + title: "包间类型置满管理",
  177 + content: "",
  178 + callback: () {
  179 + Utils.goMiniProgramZm(context, "roomtype/roomtype");
  180 + },
  181 + ),
  182 + MyDivider(
  183 + double.infinity,
  184 + ScreenUtil().setHeight(1),
  185 + color: MyColours.color_f3f3f3,
  186 + ),
  187 + MyItem(
  188 + title: "可订时段管理",
  189 + content: "",
  190 + callback: () {
  191 + NavigatorUtil.goBookTimeSetPage(context);
  192 + },
  193 + ),
  194 + MyDivider(
  195 + double.infinity,
  196 + ScreenUtil().setHeight(1),
  197 + color: MyColours.color_f3f3f3,
  198 + ),
  199 + MyItem(
  200 + title: "接单时间管理",
  201 + content: "",
  202 + callback: () {
  203 + NavigatorUtil.goReceiveOrdersTimeSetPage(context);
  204 + },
  205 + ),
  206 + VEmptyView(40),
  207 + MyItem(
  208 + title: "联系客服",
  209 + content: "09:00~21:00",
  210 + callback: () {
  211 + Utils.goPhone("400-000-9690");
  212 + },
  213 + ),
  214 + MyDivider(
  215 + double.infinity,
  216 + ScreenUtil().setHeight(1),
  217 + color: MyColours.color_f3f3f3,
  218 + ),
  219 + MyItem(
  220 + title: "帮助与反馈",
  221 + content: "",
  222 + callback: () {
  223 + Utils.goHelp(context);
  224 + },
  225 + ),
  226 + MyDivider(double.infinity, ScreenUtil().setHeight(1),
  227 + color: MyColours.color_f3f3f3),
  228 + GestureDetector(
  229 + onTap: checkUpdate,
  230 + child: Container(
  231 + width: double.infinity,
  232 + height: ScreenUtil().setHeight(122),
  233 + color: MyColours.color_ffffff,
  234 + padding: EdgeInsets.symmetric(
  235 + horizontal: ScreenUtil().setWidth(40)),
  236 + alignment: Alignment.center,
  237 + child: Row(
  238 + children: <Widget>[
  239 + Text(
  240 + "版本更新",
  241 + style: TextStyle(
  242 + fontSize: ScreenUtil().setSp(30),
  243 + color: MyColours.color_353535),
283 ), 244 ),
284 - ),  
285 - ),  
286 - MyDivider(  
287 - double.infinity,  
288 - ScreenUtil().setHeight(1),  
289 - color: MyColours.color_f3f3f3,  
290 - ),  
291 - VEmptyView(40),  
292 - Consumer<UserModel>(  
293 - builder: (BuildContext context, UserModel model,  
294 - Widget child) {  
295 - return GestureDetector(  
296 - onTap: () {  
297 - model.showLoginOutDialog(context);  
298 - },  
299 - child: Container(  
300 - height: ScreenUtil().setHeight(122),  
301 - color: MyColours.color_ffffff,  
302 - child: Center(  
303 - child: Row(  
304 - mainAxisSize: MainAxisSize.min,  
305 - crossAxisAlignment: CrossAxisAlignment.center,  
306 - children: <Widget>[  
307 - Image.asset(  
308 - "assets/icon_exist.png",  
309 - width: ScreenUtil().setWidth(30),  
310 - height: ScreenUtil().setWidth(30), 245 + Spacer(),
  246 + newVersion
  247 + ? Container(
  248 + width: ScreenUtil().setWidth(120),
  249 + height: ScreenUtil().setWidth(34),
  250 + decoration: BoxDecoration(
  251 + color: MyColours.color_E14553,
  252 + borderRadius: BorderRadius.all(
  253 + Radius.circular(
  254 + ScreenUtil().setWidth(6))),
  255 + ),
  256 + child: Center(
  257 + child: Text(
  258 + "发现新版本",
  259 + style: TextStyle(
  260 + fontSize: ScreenUtil().setSp(24),
  261 + color: MyColours.color_ffffff),
311 ), 262 ),
312 - HEmptyView(18),  
313 - Text("退出登录",  
314 - style: TextStyle(  
315 - color: MyColours.color_199095,  
316 - fontSize: ScreenUtil().setSp(34),  
317 - ))  
318 - ], 263 + ),
  264 + )
  265 + : Text(
  266 + cur_version,
  267 + style: TextStyle(
  268 + fontSize: ScreenUtil().setSp(28),
  269 + color: MyColours.color_666666),
319 ), 270 ),
320 - ),  
321 - ),  
322 - ); 271 + HEmptyView(20),
  272 + Image.asset(
  273 + "assets/arr_right_gray.png",
  274 + width: ScreenUtil().setWidth(14),
  275 + height: ScreenUtil().setWidth(22),
  276 + )
  277 + ],
  278 + ),
  279 + ),
  280 + ),
  281 + MyDivider(
  282 + double.infinity,
  283 + ScreenUtil().setHeight(1),
  284 + color: MyColours.color_f3f3f3,
  285 + ),
  286 + VEmptyView(40),
  287 + Consumer<UserModel>(
  288 + builder:
  289 + (BuildContext context, UserModel model, Widget child) {
  290 + return GestureDetector(
  291 + onTap: () {
  292 + model.showLoginOutDialog(context);
323 }, 293 },
324 - )  
325 - ],  
326 - ));  
327 - }))); 294 + child: Container(
  295 + height: ScreenUtil().setHeight(122),
  296 + color: MyColours.color_ffffff,
  297 + child: Center(
  298 + child: Row(
  299 + mainAxisSize: MainAxisSize.min,
  300 + crossAxisAlignment: CrossAxisAlignment.center,
  301 + children: <Widget>[
  302 + Image.asset(
  303 + "assets/icon_exist.png",
  304 + width: ScreenUtil().setWidth(30),
  305 + height: ScreenUtil().setWidth(30),
  306 + ),
  307 + HEmptyView(18),
  308 + Text("退出登录",
  309 + style: TextStyle(
  310 + color: MyColours.color_199095,
  311 + fontSize: ScreenUtil().setSp(34),
  312 + ))
  313 + ],
  314 + ),
  315 + ),
  316 + ),
  317 + );
  318 + },
  319 + )
  320 + ],
  321 + )));
  322 + }));
328 } 323 }
329 } 324 }
  1 +import 'package:flutter/material.dart';
  2 +import 'package:flutter_screenutil/screenutil.dart';
  3 +import 'package:one_key/models/get_seller_info_model.dart';
  4 +import 'package:one_key/models/settime.dart';
  5 +import 'package:one_key/pages/my/book_time_set.dart';
  6 +import 'package:one_key/provider/book_set_time_model.dart';
  7 +import 'package:one_key/res/colors.dart';
  8 +import 'package:one_key/utils/dialog_util.dart';
  9 +import 'package:one_key/utils/event_bus.dart';
  10 +import 'package:one_key/utils/utils.dart';
  11 +import 'package:one_key/widgets/MyDivider.dart';
  12 +import 'package:one_key/widgets/common_button.dart';
  13 +import 'package:one_key/widgets/set_time_widget.dart';
  14 +import 'package:one_key/widgets/system_app_bar.dart';
  15 +import 'package:one_key/widgets/v_empty_view.dart';
  16 +import 'package:provider/provider.dart';
  17 +
  18 +class ReceiveOrdersTimeSetPage extends StatefulWidget {
  19 + ReceiveOrdersTimeSetPage({Key key}) : super(key: key);
  20 +
  21 + @override
  22 + _ReceiveOrdersTimeSetPageState createState() =>
  23 + _ReceiveOrdersTimeSetPageState();
  24 +}
  25 +
  26 +class _ReceiveOrdersTimeSetPageState extends State<ReceiveOrdersTimeSetPage> {
  27 + SetTime receiveOrdersTime = SetTime();
  28 + BookSetTimeModel bookSetTimeModel;
  29 +
  30 + @override
  31 + void initState() {
  32 + super.initState();
  33 + receiveOrdersTime.start = '08:00';
  34 + receiveOrdersTime.end = '23:00';
  35 + WidgetsBinding.instance.addPostFrameCallback((_) {
  36 + _getReceiveOrdersTime();
  37 + });
  38 + }
  39 +
  40 + ///获取接单时间接口
  41 + _getReceiveOrdersTime() async {
  42 + GetSellerInfoSunModel model = await bookSetTimeModel.getSellerById(context);
  43 + setState(() {
  44 + receiveOrdersTime.start = model.data.recStime;
  45 + receiveOrdersTime.end = model.data.recEtime;
  46 + });
  47 + }
  48 +
  49 + ///从时间选择器中获取分钟数字符串 00 or 30
  50 + String _getMinuteStrFromPicker(List value) {
  51 + if (value[1] == 0) {
  52 + return '00';
  53 + } else {
  54 + return '30';
  55 + }
  56 + }
  57 +
  58 + @override
  59 + Widget build(BuildContext context) {
  60 + bookSetTimeModel = Provider.of<BookSetTimeModel>(context, listen: true);
  61 + return WillPopScope(
  62 + child: Scaffold(
  63 + backgroundColor: MyColours.color_f5f5f5,
  64 + appBar: SystemAppBar(
  65 + '接单时间',
  66 + onTap: () {
  67 + EventBus().emit('changeStatusColor');
  68 + Navigator.of(context).pop();
  69 + },
  70 + ),
  71 + body: SafeArea(
  72 + child: Column(
  73 + children: [
  74 + Expanded(
  75 + child: SingleChildScrollView(
  76 + child: Column(
  77 + crossAxisAlignment: CrossAxisAlignment.start,
  78 + children: [
  79 + Container(
  80 + height: ScreenUtil().setWidth(126 * 2),
  81 + color: MyColours.color_ffffff,
  82 + child: Column(
  83 + children: [
  84 + timeWidget('开始时间', receiveOrdersTime.start,
  85 + highted: true, onTap: () {
  86 + SetTimeWidget().showTimeSelector(
  87 + context,
  88 + SetTimeWidget.dateData,
  89 + receiveOrdersTime.start, (value) {
  90 + if (value != null) {
  91 + String tempMinute =
  92 + _getMinuteStrFromPicker(value);
  93 +
  94 + String time = Utils.getTimeString(
  95 + Utils.getHourFromTitle(SetTimeWidget
  96 + .dateData[value[0]].keys.first),
  97 + tempMinute);
  98 + setState(() {
  99 + receiveOrdersTime.start = time;
  100 + });
  101 + }
  102 + });
  103 + }),
  104 + Padding(
  105 + padding: EdgeInsets.symmetric(
  106 + horizontal: ScreenUtil().setWidth(40)),
  107 + child: MyDivider(
  108 + double.infinity,
  109 + ScreenUtil().setWidth(2),
  110 + color: MyColours.color_f3f3f3,
  111 + )),
  112 + timeWidget('结束时间', receiveOrdersTime.end,
  113 + highted: true, onTap: () {
  114 + SetTimeWidget().showTimeSelector(
  115 + context,
  116 + SetTimeWidget.dateData,
  117 + receiveOrdersTime.end, (value) {
  118 + if (value != null) {
  119 + String tempMinute =
  120 + _getMinuteStrFromPicker(value);
  121 + String time = Utils.getTimeString(
  122 + Utils.getHourFromTitle(SetTimeWidget
  123 + .dateData[value[0]].keys.first),
  124 + tempMinute);
  125 + setState(() {
  126 + receiveOrdersTime.end = time;
  127 + });
  128 + }
  129 + });
  130 + }),
  131 + ],
  132 + ),
  133 + ),
  134 + VEmptyView(60),
  135 + Padding(
  136 + padding: EdgeInsets.symmetric(
  137 + horizontal: ScreenUtil().setWidth(40)),
  138 + child: textWidget('温馨提示:'),
  139 + ),
  140 + VEmptyView(10),
  141 + Padding(
  142 + padding: EdgeInsets.symmetric(
  143 + horizontal: ScreenUtil().setWidth(40)),
  144 + child: textWidget('修改接单时间后,必须重启话机才能正常生效。'))
  145 + ],
  146 + ),
  147 + )),
  148 + Padding(
  149 + padding: EdgeInsets.fromLTRB(
  150 + ScreenUtil().setWidth(40),
  151 + ScreenUtil().setWidth(0),
  152 + ScreenUtil().setWidth(40),
  153 + ScreenUtil().setWidth(60)),
  154 + child: CommonButton(
  155 + width: double.infinity,
  156 + height: 84,
  157 + fontSize: 34,
  158 + content: '保存',
  159 + state: 2,
  160 + onPress: () async {
  161 + bool isSuccess = await bookSetTimeModel.setReOrderTime(
  162 + context,
  163 + receiveOrdersTime.start,
  164 + receiveOrdersTime.end);
  165 + if (isSuccess) {
  166 + ///弹出提示框
  167 + ///
  168 + DialogUtil.openAlertDialog(
  169 + context, '接单时间已修改', '需要重启电话机才能生效', '知道了', 295,
  170 + fontSize: 30, onTap: () {
  171 + EventBus().emit('changeStatusColor');
  172 + Navigator.of(context).pop();
  173 + Navigator.of(context).pop();
  174 + });
  175 + }
  176 + },
  177 + ))
  178 + ],
  179 + )),
  180 + ),
  181 + onWillPop: () async {
  182 + EventBus().emit('changeStatusColor');
  183 + return true;
  184 + });
  185 + }
  186 +}
@@ -2,28 +2,29 @@ import 'dart:async'; @@ -2,28 +2,29 @@ import 'dart:async';
2 import 'dart:convert'; 2 import 'dart:convert';
3 3
4 import 'package:flutter/material.dart'; 4 import 'package:flutter/material.dart';
  5 +import 'package:one_key/utils/event_bus.dart';
5 import 'package:one_key/widgets/app_bar.dart'; 6 import 'package:one_key/widgets/app_bar.dart';
  7 +import 'package:one_key/widgets/system_app_bar.dart';
6 import 'package:webview_flutter/webview_flutter.dart'; 8 import 'package:webview_flutter/webview_flutter.dart';
7 9
8 class WebViewPage extends StatefulWidget { 10 class WebViewPage extends StatefulWidget {
9 -  
10 @override 11 @override
11 _WebViewPageState createState() => _WebViewPageState(); 12 _WebViewPageState createState() => _WebViewPageState();
12 } 13 }
13 14
14 class _WebViewPageState extends State<WebViewPage> { 15 class _WebViewPageState extends State<WebViewPage> {
15 final Completer<WebViewController> _controller = 16 final Completer<WebViewController> _controller =
16 - Completer<WebViewController>(); 17 + Completer<WebViewController>();
17 18
18 @override 19 @override
19 Widget build(BuildContext context) { 20 Widget build(BuildContext context) {
20 return Scaffold( 21 return Scaffold(
21 // We're using a Builder here so we have a context that is below the Scaffold 22 // We're using a Builder here so we have a context that is below the Scaffold
22 // to allow calling Scaffold.of(context) so we can show a snackbar. 23 // to allow calling Scaffold.of(context) so we can show a snackbar.
23 - appBar: AppBar(  
24 - title: const Text('一键订'),  
25 - // This drop down menu demonstrates that Flutter widgets can be shown over the web view.  
26 - ), 24 + appBar: SystemAppBar('一键订',onTap: () {
  25 + EventBus().emit('changeStatusColor');
  26 + Navigator.of(context).pop();
  27 + },),
27 body: Builder(builder: (BuildContext context) { 28 body: Builder(builder: (BuildContext context) {
28 return WebView( 29 return WebView(
29 initialUrl: "https://support.qq.com/product/152856", 30 initialUrl: "https://support.qq.com/product/152856",
@@ -65,5 +66,4 @@ class _WebViewPageState extends State<WebViewPage> { @@ -65,5 +66,4 @@ class _WebViewPageState extends State<WebViewPage> {
65 ); 66 );
66 }); 67 });
67 } 68 }
68 -  
69 -}  
  69 +}
  1 +import 'dart:convert';
  2 +
  3 +import 'package:flutter/material.dart';
  4 +import 'package:one_key/constant/constant.dart';
  5 +import 'package:one_key/models/get_seller_info_model.dart';
  6 +import 'package:one_key/models/seller_info.dart';
  7 +import 'package:one_key/models/set_seller_info_model.dart';
  8 +import 'package:one_key/net/base_resp.dart';
  9 +import 'package:one_key/net/dio_util.dart';
  10 +import 'package:one_key/net/http_url.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 BookSetTimeModel with ChangeNotifier {
  16 + //构造函数,初始化
  17 + BookSetTimeModel() {}
  18 +
  19 + ///获取某个商家下所有服务员信息 **** 取得某个商家的早市、午市、晚市营业时间
  20 + Future<SunSellerInfoModel> getManagersInfo(BuildContext context) async {
  21 + UserModel userModel = Provider.of<UserModel>(context, listen: false);
  22 + Map<String, String> params = {
  23 + "seller_id": userModel.user.sellerid,
  24 + "seller_openid": userModel.user.openid
  25 + };
  26 + BaseResp<Map<String, dynamic>> baseResp = await DioUtil()
  27 + .request<Map<String, dynamic>>(context, Method.get, HttpUrl.sellerinfo,
  28 + data: params)
  29 + .catchError((error) {
  30 + print(error.toString());
  31 + });
  32 + SunSellerInfoModel itemModel;
  33 + if (baseResp == null) return itemModel;
  34 + if (baseResp.code == Constant.status_success) {
  35 + if (int.parse(baseResp.status) != Constant.status_success) {
  36 + Utils.showToast(baseResp.msg ?? "");
  37 + return itemModel;
  38 + }
  39 + if (baseResp.responseData['data'] != null) {
  40 + itemModel = SellerInfoModel.fromJson(baseResp.responseData).data;
  41 + } else {
  42 + Utils.showToast(baseResp.msg ?? "");
  43 + }
  44 + return itemModel;
  45 + }
  46 + }
  47 +
  48 + ///根据商家ID修改商家信息
  49 + Future<SetSellerInfoSunModel> setSellerInfoById(
  50 + BuildContext context, Map daily) async {
  51 + UserModel userModel = Provider.of<UserModel>(context, listen: false);
  52 + Map<String, String> params = {
  53 + "id": userModel.user.sellerid,
  54 + "daily": jsonEncode(daily)
  55 + };
  56 + BaseResp<Map<String, dynamic>> baseResp = await DioUtil()
  57 + .request<Map<String, dynamic>>(
  58 + context, Method.get, HttpUrl.set_seller_info,
  59 + data: params)
  60 + .catchError((error) {
  61 + print(error.toString());
  62 + });
  63 + SetSellerInfoSunModel itemModel;
  64 + if (baseResp == null) return itemModel;
  65 + if (baseResp.code == Constant.status_success) {
  66 + if (int.parse(baseResp.status) != Constant.status_success) {
  67 + Utils.showToast(baseResp.msg ?? "");
  68 + return itemModel;
  69 + }
  70 + if (baseResp.responseData['data'] != null) {
  71 + itemModel = SetSellerInfoModel.fromJson(baseResp.responseData).data;
  72 + } else {
  73 + Utils.showToast(baseResp.msg ?? "");
  74 + }
  75 + return itemModel;
  76 + }
  77 + }
  78 +
  79 + ///根据商家ID获取商家信息
  80 + Future<GetSellerInfoSunModel> getSellerById(BuildContext context) async {
  81 + UserModel userModel = Provider.of<UserModel>(context, listen: false);
  82 + Map<String, String> params = {
  83 + "sellerid": userModel.user.sellerid,
  84 + };
  85 + BaseResp<Map<String, dynamic>> baseResp = await DioUtil()
  86 + .request<Map<String, dynamic>>(
  87 + context, Method.get, HttpUrl.get_seller_info,
  88 + data: params)
  89 + .catchError((error) {
  90 + print(error.toString());
  91 + });
  92 + GetSellerInfoSunModel itemModel;
  93 + if (baseResp == null) return itemModel;
  94 + if (baseResp.code == Constant.status_success) {
  95 + if (int.parse(baseResp.status) != Constant.status_success) {
  96 + Utils.showToast(baseResp.msg ?? "");
  97 + return itemModel;
  98 + }
  99 + if (baseResp.responseData['data'] != null) {
  100 + itemModel = GetSellerInfoModel.fromJson(baseResp.responseData).data;
  101 + } else {
  102 + Utils.showToast(baseResp.msg ?? "");
  103 + }
  104 + return itemModel;
  105 + }
  106 + }
  107 +
  108 + ///在线预订配置-接单时间
  109 + Future<bool> setReOrderTime(
  110 + BuildContext context, String start, String end) async {
  111 + UserModel userModel = Provider.of<UserModel>(context, listen: false);
  112 + Map<String, dynamic> params = {
  113 + "sellerid": int.parse(userModel.user.sellerid),
  114 + "start": start,
  115 + 'end': end
  116 + };
  117 + BaseResp<dynamic> baseResp = await DioUtil()
  118 + .request<dynamic>(context, Method.get, HttpUrl.set_order_time,
  119 + data: params)
  120 + .catchError((error) {
  121 + print(error.toString());
  122 + });
  123 +
  124 + if (baseResp == null) return false;
  125 + if (baseResp.code == Constant.status_success) {
  126 + if (int.parse(baseResp.status) != Constant.status_success) {
  127 + Utils.showToast(baseResp.msg ?? "");
  128 + return false;
  129 + }
  130 + if (baseResp.responseData['ret'] == 200) {
  131 + // if (baseResp.responseData['data'] == 0) {
  132 + return true;
  133 + // } else {
  134 + // return false;
  135 + // }
  136 + } else {
  137 + Utils.showToast(baseResp.msg ?? "");
  138 + return false;
  139 + }
  140 + }
  141 + }
  142 +}
@@ -48,4 +48,5 @@ class MyColours { @@ -48,4 +48,5 @@ class MyColours {
48 static const Color color_A9E3E6 = Color(0xffA9E3E6); 48 static const Color color_A9E3E6 = Color(0xffA9E3E6);
49 static const Color color_e5e5e5 = Color(0xffe5e5e5); 49 static const Color color_e5e5e5 = Color(0xffe5e5e5);
50 static const Color color_efefef = Color(0xffefefef); 50 static const Color color_efefef = Color(0xffefefef);
  51 + static const Color color_0A0A0A = Color(0xff0A0A0A);
51 } 52 }
@@ -13,9 +13,11 @@ import 'package:one_key/pages/detail/handle_online_page.dart'; @@ -13,9 +13,11 @@ import 'package:one_key/pages/detail/handle_online_page.dart';
13 import 'package:one_key/pages/detail/notebook_detail_page.dart'; 13 import 'package:one_key/pages/detail/notebook_detail_page.dart';
14 import 'package:one_key/pages/login/web_page.dart'; 14 import 'package:one_key/pages/login/web_page.dart';
15 import 'package:one_key/pages/my/book_time_set.dart'; 15 import 'package:one_key/pages/my/book_time_set.dart';
  16 +import 'package:one_key/pages/my/receive_orders_time_set.dart';
16 import 'package:one_key/pages/sms/sms_page.dart'; 17 import 'package:one_key/pages/sms/sms_page.dart';
17 import 'package:one_key/pages/table/select_table_page.dart'; 18 import 'package:one_key/pages/table/select_table_page.dart';
18 import 'package:one_key/pages/webview/webview_page.dart'; 19 import 'package:one_key/pages/webview/webview_page.dart';
  20 +import 'package:one_key/provider/book_set_time_model.dart';
19 import 'package:one_key/provider/choose_table_model.dart'; 21 import 'package:one_key/provider/choose_table_model.dart';
20 import 'package:one_key/provider/notebook_detail_change_model.dart'; 22 import 'package:one_key/provider/notebook_detail_change_model.dart';
21 import 'package:one_key/provider/notebook_detail_model.dart'; 23 import 'package:one_key/provider/notebook_detail_model.dart';
@@ -139,5 +141,13 @@ var handleChangeDetailHandler = new Handler( @@ -139,5 +141,13 @@ var handleChangeDetailHandler = new Handler(
139 // 跳转可订时段管理页面 141 // 跳转可订时段管理页面
140 var handleBookTimeSetHandler = new Handler( 142 var handleBookTimeSetHandler = new Handler(
141 handlerFunc: (BuildContext context, Map<String, List<Object>> params) { 143 handlerFunc: (BuildContext context, Map<String, List<Object>> params) {
142 - return BookTimeSetPage(); 144 + return ChangeNotifierProvider<BookSetTimeModel>(
  145 + create: (_) => BookSetTimeModel(), child: BookTimeSetPage());
  146 +});
  147 +
  148 +// 跳转接单时间管理
  149 +var handleReceiveOrdersTimeSetHandler = new Handler(
  150 + handlerFunc: (BuildContext context, Map<String, List<Object>> params) {
  151 + return ChangeNotifierProvider<BookSetTimeModel>(
  152 + create: (_) => BookSetTimeModel(), child: ReceiveOrdersTimeSetPage());
143 }); 153 });
@@ -15,7 +15,8 @@ class Routes { @@ -15,7 +15,8 @@ class Routes {
15 static String webview = "/webview"; //网页 15 static String webview = "/webview"; //网页
16 static String web_page = '/web_page'; //隐私协议 16 static String web_page = '/web_page'; //隐私协议
17 static String change_detail = "/change_detail"; //变更预订 17 static String change_detail = "/change_detail"; //变更预订
18 - static String book_time_set = "/book_time_set"; //可订时段管理 18 + static String book_time_set = "/book_time_set"; //可订时段管理
  19 + static String receive_orders_time_set = "/receive_orders_time_set"; //接单时间管理
19 20
20 static void configureRoutes(Router router) { 21 static void configureRoutes(Router router) {
21 router.notFoundHandler = new Handler( 22 router.notFoundHandler = new Handler(
@@ -34,5 +35,7 @@ class Routes { @@ -34,5 +35,7 @@ class Routes {
34 router.define(web_page, handler: webPageHandler); 35 router.define(web_page, handler: webPageHandler);
35 router.define(change_detail, handler: handleChangeDetailHandler); 36 router.define(change_detail, handler: handleChangeDetailHandler);
36 router.define(book_time_set, handler: handleBookTimeSetHandler); 37 router.define(book_time_set, handler: handleBookTimeSetHandler);
  38 + router.define(receive_orders_time_set,
  39 + handler: handleReceiveOrdersTimeSetHandler);
37 } 40 }
38 } 41 }
@@ -683,14 +683,16 @@ class DialogUtil { @@ -683,14 +683,16 @@ class DialogUtil {
683 }); 683 });
684 } 684 }
685 685
686 - static Future openAlertDialog(BuildContext context) async { 686 + static Future openAlertDialog(BuildContext context, String title,
  687 + String content, String btnTitle, double height,
  688 + {GestureTapCallback onTap, double fontSize = 36}) async {
687 final action = await showDialog( 689 final action = await showDialog(
688 context: context, 690 context: context,
689 barrierDismissible: true, 691 barrierDismissible: true,
690 builder: (BuildContext context) { 692 builder: (BuildContext context) {
691 return Center( 693 return Center(
692 child: Container( 694 child: Container(
693 - height: ScreenUtil().setWidth(160 * 2 + 20), 695 + height: ScreenUtil().setWidth(height),
694 width: ScreenUtil().setWidth(280 * 2), 696 width: ScreenUtil().setWidth(280 * 2),
695 decoration: BoxDecoration( 697 decoration: BoxDecoration(
696 borderRadius: BorderRadius.circular(ScreenUtil().setWidth(30))), 698 borderRadius: BorderRadius.circular(ScreenUtil().setWidth(30))),
@@ -704,9 +706,9 @@ class DialogUtil { @@ -704,9 +706,9 @@ class DialogUtil {
704 Container( 706 Container(
705 height: ScreenUtil().setWidth(48), 707 height: ScreenUtil().setWidth(48),
706 alignment: Alignment.center, 708 alignment: Alignment.center,
707 - child: Text('未获得通讯录权限', 709 + child: Text(title,
708 style: TextStyle( 710 style: TextStyle(
709 - fontSize: ScreenUtil().setSp(36), 711 + fontSize: ScreenUtil().setSp(fontSize),
710 color: MyColours.color_353535)), 712 color: MyColours.color_353535)),
711 ), 713 ),
712 VEmptyView(20), 714 VEmptyView(20),
@@ -723,10 +725,10 @@ class DialogUtil { @@ -723,10 +725,10 @@ class DialogUtil {
723 ScreenUtil() 725 ScreenUtil()
724 .setWidth(2)), //1为 StrutStyle 的 leading的值 726 .setWidth(2)), //1为 StrutStyle 的 leading的值
725 child: Text( 727 child: Text(
726 - "请在手机的权限管理里,将通讯录权限开启", 728 + content,
727 style: TextStyle( 729 style: TextStyle(
728 color: MyColours.color_353535, 730 color: MyColours.color_353535,
729 - fontSize: ScreenUtil().setSp(28), 731 + fontSize: ScreenUtil().setSp(30),
730 ), 732 ),
731 strutStyle: StrutStyle( 733 strutStyle: StrutStyle(
732 forceStrutHeight: true, 734 forceStrutHeight: true,
@@ -743,34 +745,156 @@ class DialogUtil { @@ -743,34 +745,156 @@ class DialogUtil {
743 height: ScreenUtil().setWidth(47 * 2), 745 height: ScreenUtil().setWidth(47 * 2),
744 alignment: Alignment.center, 746 alignment: Alignment.center,
745 child: Text( 747 child: Text(
746 - '去设置', 748 + btnTitle,
747 style: TextStyle( 749 style: TextStyle(
748 - color: MyColours.color_2bb5b7, 750 + color: MyColours.color_199095,
749 fontSize: ScreenUtil().setWidth(34)), 751 fontSize: ScreenUtil().setWidth(34)),
750 ), 752 ),
751 ), 753 ),
752 - onTap: () {  
753 - openSetting();  
754 - Navigator.pop(context, '');  
755 - }, 754 + onTap: onTap,
  755 + )
  756 + ],
  757 + ),
  758 + ),
  759 + ),
  760 + );
  761 + },
  762 + );
  763 + }
  764 +
  765 + ///时段设置提示弹框
  766 + static Future confirmTimeAlertDialog(BuildContext context, String morning,
  767 + String noon, String night, VoidCallback callback) async {
  768 + int space = 52;
  769 + List temp = [morning, noon, night];
  770 + int tempHeight = 0;
  771 + for (int i = 0; i < temp.length; i++) {
  772 + if (temp[i] == '') {
  773 + if (i == 2) {
  774 + space = 42;
  775 + }
  776 + tempHeight += space;
  777 + }
  778 + }
  779 + int height = 166 * 2 + 20 + 15 * 2 + 20 - tempHeight;
  780 + final action = await showDialog(
  781 + context: context,
  782 + barrierDismissible: true,
  783 + builder: (BuildContext context) {
  784 + return Center(
  785 + child: Container(
  786 + height: ScreenUtil().setWidth(height),
  787 + width: ScreenUtil().setWidth(280 * 2),
  788 + decoration: BoxDecoration(
  789 + borderRadius: BorderRadius.circular(ScreenUtil().setWidth(20))),
  790 + child: Card(
  791 + shape: RoundedRectangleBorder(
  792 + borderRadius: BorderRadius.all(
  793 + Radius.circular(ScreenUtil().setWidth(20)))), //设置圆角
  794 + child: Column(
  795 + children: [
  796 + VEmptyView(40),
  797 + Container(
  798 + height: ScreenUtil().setWidth(42),
  799 + alignment: Alignment.center,
  800 + child: Text(
  801 + "请确认时段信息",
  802 + style: TextStyle(
  803 + color: MyColours.color_353535,
  804 + fontSize: ScreenUtil().setSp(30),
  805 + fontWeight: FontWeight.bold),
  806 + ),
  807 + ),
  808 + VEmptyView(20),
  809 + Column(
  810 + children: [
  811 + morning.isNotEmpty
  812 + ? Container(
  813 + height: ScreenUtil().setWidth(42),
  814 + child: Text("早市:${morning}",
  815 + style: TextStyle(
  816 + color: MyColours.color_353535,
  817 + fontSize: ScreenUtil().setSp(30),
  818 + )))
  819 + : Container(),
  820 + morning.isNotEmpty ? VEmptyView(10) : VEmptyView(0),
  821 + noon.isNotEmpty
  822 + ? Container(
  823 + height: ScreenUtil().setWidth(42),
  824 + child: Text(
  825 + "午市:${noon}",
  826 + style: TextStyle(
  827 + color: MyColours.color_353535,
  828 + fontSize: ScreenUtil().setSp(30),
  829 + ),
  830 + ))
  831 + : Container(),
  832 + noon.isNotEmpty ? VEmptyView(10) : VEmptyView(0),
  833 + night.isNotEmpty
  834 + ? Container(
  835 + height: ScreenUtil().setWidth(42),
  836 + child: Text(
  837 + "晚市:${night}",
  838 + style: TextStyle(
  839 + color: MyColours.color_353535,
  840 + fontSize: ScreenUtil().setSp(30),
  841 + ),
  842 + ))
  843 + : Container(),
  844 + ],
  845 + ),
  846 + VEmptyView(40),
  847 + MyDivider(
  848 + ScreenUtil().setWidth(280 * 2), ScreenUtil().setWidth(2),
  849 + color: MyColours.color_efefef),
  850 + Row(
  851 + mainAxisAlignment: MainAxisAlignment.spaceEvenly,
  852 + children: [
  853 + InkWell(
  854 + child: Container(
  855 + height: ScreenUtil().setWidth(47 * 2),
  856 + width: ScreenUtil().setWidth(135 * 2),
  857 + alignment: Alignment.center,
  858 + child: Text(
  859 + "信息有误",
  860 + style: TextStyle(
  861 + color: MyColours.color_666666,
  862 + fontSize: ScreenUtil().setSp(34)),
  863 + ),
  864 + ),
  865 + onTap: () {
  866 + Navigator.pop(context, '');
  867 + },
  868 + ),
  869 + Container(
  870 + color: MyColours.color_efefef,
  871 + width: ScreenUtil().setWidth(2),
  872 + height: ScreenUtil().setWidth(47 * 2),
  873 + ),
  874 + InkWell(
  875 + child: Container(
  876 + height: ScreenUtil().setWidth(47 * 2),
  877 + width: ScreenUtil().setWidth(135 * 2),
  878 + alignment: Alignment.center,
  879 + child: Text(
  880 + "确认无误",
  881 + style: TextStyle(
  882 + color: MyColours.color_199095,
  883 + fontSize: ScreenUtil().setSp(34)),
  884 + ),
  885 + ),
  886 + onTap: () {
  887 + Navigator.pop(context, '');
  888 + callback();
  889 + },
  890 + )
  891 + ],
756 ) 892 )
757 ], 893 ],
758 ), 894 ),
759 ), 895 ),
760 ), 896 ),
761 ); 897 );
762 - // return AlertDialog(  
763 - // title: Text('未获得通讯录权限'),  
764 - // content: Text('请在手机的权限管理里,将联系人权限开启'),  
765 - // actions: <Widget>[  
766 - // FlatButton(  
767 - // child: Text('去设置'),  
768 - // onPressed: () {  
769 - // Navigator.pop(context, '确认');  
770 - // },  
771 - // ),  
772 - // ],  
773 - // );  
774 }, 898 },
775 ); 899 );
776 900
@@ -110,4 +110,9 @@ class NavigatorUtil { @@ -110,4 +110,9 @@ class NavigatorUtil {
110 static void goBookTimeSetPage(BuildContext context) { 110 static void goBookTimeSetPage(BuildContext context) {
111 _navigateTo(context, "${Routes.book_time_set}"); 111 _navigateTo(context, "${Routes.book_time_set}");
112 } 112 }
  113 +
  114 + /// 可订时段管理
  115 + static void goReceiveOrdersTimeSetPage(BuildContext context) {
  116 + _navigateTo(context, "${Routes.receive_orders_time_set}");
  117 + }
113 } 118 }
@@ -18,9 +18,12 @@ import 'package:webview_flutter/webview_flutter.dart'; @@ -18,9 +18,12 @@ import 'package:webview_flutter/webview_flutter.dart';
18 18
19 import '../app.dart'; 19 import '../app.dart';
20 20
  21 +typedef BookTimeSetCallback = void Function(bool needChange);
  22 +
21 class Utils { 23 class Utils {
22 static void showToast(String msg) { 24 static void showToast(String msg) {
23 - Fluttertoast.showToast(msg: msg, toastLength:Toast.LENGTH_LONG,gravity: ToastGravity.CENTER); 25 + Fluttertoast.showToast(
  26 + msg: msg, toastLength: Toast.LENGTH_LONG, gravity: ToastGravity.CENTER);
24 } 27 }
25 28
26 //本地图片资源路径 29 //本地图片资源路径
@@ -196,4 +199,64 @@ class Utils { @@ -196,4 +199,64 @@ class Utils {
196 } 199 }
197 return pnum; 200 return pnum;
198 } 201 }
  202 +
  203 + ///工具
  204 + /// 组装成07:00
  205 + static getTimeString(dynamic hour, String minute) {
  206 + return '${hour}:${minute}';
  207 + }
  208 +
  209 + /// 组装成 07:00-10:00
  210 + static getTimelLongString(String start, String end) {
  211 + return '${start}-${end}';
  212 + }
  213 +
  214 + /// 从07:00中获取07
  215 + static getHourFromhourAndMinute(String hourAndMinute) {
  216 + return hourAndMinute.substring(0, 2);
  217 + }
  218 +
  219 + ///从深夜00时中获取00
  220 + static getHourFromTitle(String title) {
  221 + return title.substring(2, 4);
  222 + }
  223 +
  224 + /// 0 还是 30
  225 + /// 从07:00中获取0 或者 30
  226 + static getMinuteFromhourAndMinute(String hourAndMinute) {
  227 + return hourAndMinute.substring(3, 5);
  228 + }
  229 +
  230 + /// a < b 则 a = b
  231 + static compareDateTime(String a, String b, BookTimeSetCallback callback) {
  232 + String tempa = '${DateUtil.getNowDateStr().substring(0, 10)} ${a}:00';
  233 + String tempb = '${DateUtil.getNowDateStr().substring(0, 10)} ${b}:00';
  234 + int aMs = DateUtil.getDateMsByTimeStr(tempa);
  235 + int bMs = DateUtil.getDateMsByTimeStr(tempb);
  236 + if (aMs < bMs) {
  237 + callback(true);
  238 + } else {
  239 + callback(false);
  240 + }
  241 + }
  242 +
  243 + ///获取时间选择器数据
  244 + static getPickerData(String lastTime, List dateData) {
  245 + String hour = Utils.getHourFromhourAndMinute(lastTime);
  246 + String minute = Utils.getMinuteFromhourAndMinute(lastTime);
  247 + if (minute == '30') {
  248 + hour = '${int.parse(hour) + 1}';
  249 + }
  250 + List tempList = List();
  251 + tempList.addAll(dateData);
  252 + tempList.removeRange(0, int.parse(hour));
  253 + if (tempList.length == 0) {
  254 + tempList = [
  255 + {
  256 + '晚上23时': [30]
  257 + }
  258 + ];
  259 + }
  260 + return tempList;
  261 + }
199 } 262 }
  1 +import 'package:flutter/material.dart';
  2 +import 'package:one_key/utils/dialog_util.dart';
  3 +import 'package:one_key/utils/utils.dart';
  4 +
  5 +typedef SetTimeCallback = void Function(List value);
  6 +
  7 +class SetTimeWidget {
  8 + static List dateData = [
  9 + {
  10 + '深夜00时': [00, 30]
  11 + },
  12 + {
  13 + '深夜01时': [00, 30]
  14 + },
  15 + {
  16 + '深夜02时': [00, 30]
  17 + },
  18 + {
  19 + '深夜03时': [00, 30]
  20 + },
  21 + {
  22 + '深夜04时': [00, 30]
  23 + },
  24 + {
  25 + '深夜05时': [00, 30]
  26 + },
  27 + {
  28 + '早上06时': [00, 30]
  29 + },
  30 + {
  31 + '早上07时': [00, 30]
  32 + },
  33 + {
  34 + '早上08时': [00, 30]
  35 + },
  36 + {
  37 + '早上09时': [00, 30]
  38 + },
  39 + {
  40 + '中午10时': [00, 30]
  41 + },
  42 + {
  43 + '中午11时': [00, 30]
  44 + },
  45 + {
  46 + '中午12时': [00, 30]
  47 + },
  48 + {
  49 + '中午13时': [00, 30]
  50 + },
  51 + {
  52 + '中午14时': [00, 30]
  53 + },
  54 + {
  55 + '下午15时': [00, 30]
  56 + },
  57 + {
  58 + '下午16时': [00, 30]
  59 + },
  60 + {
  61 + '下午17时': [00, 30]
  62 + },
  63 + {
  64 + '下午18时': [00, 30]
  65 + },
  66 + {
  67 + '晚上19时': [00, 30]
  68 + },
  69 + {
  70 + '晚上20时': [00, 30]
  71 + },
  72 + {
  73 + '晚上21时': [00, 30]
  74 + },
  75 + {
  76 + '晚上22时': [00, 30]
  77 + },
  78 + {
  79 + '晚上23时': [00, 30]
  80 + }
  81 + ];
  82 + showTimeSelector(context, data, hourAndMinute, SetTimeCallback setTimeCallback) {
  83 + DialogUtil.showSelectCusmanDialog(context, data, (value) {
  84 + setTimeCallback(value);
  85 + }, selecteds: [
  86 + _getFirSelected(hourAndMinute, data),
  87 + _getSecSelected(hourAndMinute)
  88 + ]).then((value) {
  89 + print(value);
  90 + });
  91 + }
  92 +
  93 + // 第一列当前选中第几个
  94 + _getFirSelected(String hourAndMinute, List data) {
  95 + String hour = Utils.getHourFromhourAndMinute(hourAndMinute);
  96 + for (int i = 0; i < data.length; i++) {
  97 + Map map = data[i];
  98 + String key = map.keys.first;
  99 + if (key.contains(hour)) {
  100 + return i;
  101 + }
  102 + }
  103 + return 0;
  104 + }
  105 +
  106 + // 第二列当前选中第几个
  107 + _getSecSelected(String hourAndMinute) {
  108 + String minute = Utils.getMinuteFromhourAndMinute(hourAndMinute);
  109 + if (minute == '00') {
  110 + return 0;
  111 + }
  112 + return 1;
  113 + }
  114 +}
1 -  
2 import 'package:flutter/material.dart'; 1 import 'package:flutter/material.dart';
3 import 'package:flutter_screenutil/screenutil.dart'; 2 import 'package:flutter_screenutil/screenutil.dart';
4 import 'package:one_key/res/colors.dart'; 3 import 'package:one_key/res/colors.dart';
@@ -16,9 +15,7 @@ class SystemAppBar extends StatelessWidget implements PreferredSizeWidget { @@ -16,9 +15,7 @@ class SystemAppBar extends StatelessWidget implements PreferredSizeWidget {
16 return AppBar( 15 return AppBar(
17 elevation: 0, 16 elevation: 0,
18 leading: InkWell( 17 leading: InkWell(
19 - onTap: () {  
20 - Navigator.of(context).pop();  
21 - }, 18 + onTap: onTap,
22 child: Padding( 19 child: Padding(
23 padding: EdgeInsets.symmetric( 20 padding: EdgeInsets.symmetric(
24 horizontal: ScreenUtil().setWidth(40), 21 horizontal: ScreenUtil().setWidth(40),