Showing
49 changed files
with
3202 additions
and
430 deletions
| @@ -11,14 +11,14 @@ if (flutterRoot == null) { | @@ -11,14 +11,14 @@ if (flutterRoot == null) { | ||
| 11 | throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.") | 11 | throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.") |
| 12 | } | 12 | } |
| 13 | 13 | ||
| 14 | -def flutterVersionCode = "146" | 14 | +def flutterVersionCode = "163" |
| 15 | if (flutterVersionCode == null) { | 15 | if (flutterVersionCode == null) { |
| 16 | - flutterVersionCode = '146' | 16 | + flutterVersionCode = '163' |
| 17 | } | 17 | } |
| 18 | 18 | ||
| 19 | -def flutterVersionName = "1.4.6" | 19 | +def flutterVersionName = "1.6.3" |
| 20 | if (flutterVersionName == null) { | 20 | if (flutterVersionName == null) { |
| 21 | - flutterVersionName = '1.4.6' | 21 | + flutterVersionName = '1.6.3' |
| 22 | } | 22 | } |
| 23 | 23 | ||
| 24 | apply plugin: 'com.android.application' | 24 | apply plugin: 'com.android.application' |
assets/arrow_right_new.png
0 → 100644
271 Bytes
assets/bg_phone_history.png
0 → 100644
19.3 KB
assets/close1.png
0 → 100644
3.06 KB
assets/icon_remark_add.png
0 → 100644
1.78 KB
assets/icon_remark_del.png
0 → 100644
567 Bytes
assets/swich_off.png
0 → 100644
3.82 KB
assets/swich_on.png
0 → 100644
6.19 KB
| @@ -409,7 +409,7 @@ | @@ -409,7 +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 | - CURRENT_PROJECT_VERSION = 146; | 412 | + CURRENT_PROJECT_VERSION = 163; |
| 413 | DEVELOPMENT_TEAM = 8J59HM8B82; | 413 | DEVELOPMENT_TEAM = 8J59HM8B82; |
| 414 | ENABLE_BITCODE = NO; | 414 | ENABLE_BITCODE = NO; |
| 415 | FRAMEWORK_SEARCH_PATHS = ( | 415 | FRAMEWORK_SEARCH_PATHS = ( |
| @@ -422,7 +422,7 @@ | @@ -422,7 +422,7 @@ | ||
| 422 | "$(inherited)", | 422 | "$(inherited)", |
| 423 | "$(PROJECT_DIR)/Flutter", | 423 | "$(PROJECT_DIR)/Flutter", |
| 424 | ); | 424 | ); |
| 425 | - MARKETING_VERSION = 1.4.6; | 425 | + MARKETING_VERSION = 1.6.3; |
| 426 | PRODUCT_BUNDLE_IDENTIFIER = com.naji.reserveLine; | 426 | PRODUCT_BUNDLE_IDENTIFIER = com.naji.reserveLine; |
| 427 | PRODUCT_NAME = "一键订"; | 427 | PRODUCT_NAME = "一键订"; |
| 428 | PROVISIONING_PROFILE_SPECIFIER = ""; | 428 | PROVISIONING_PROFILE_SPECIFIER = ""; |
| @@ -551,7 +551,7 @@ | @@ -551,7 +551,7 @@ | ||
| 551 | CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; | 551 | CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; |
| 552 | CODE_SIGN_IDENTITY = "iPhone Developer"; | 552 | CODE_SIGN_IDENTITY = "iPhone Developer"; |
| 553 | CODE_SIGN_STYLE = Automatic; | 553 | CODE_SIGN_STYLE = Automatic; |
| 554 | - CURRENT_PROJECT_VERSION = 146; | 554 | + CURRENT_PROJECT_VERSION = 163; |
| 555 | DEVELOPMENT_TEAM = 8J59HM8B82; | 555 | DEVELOPMENT_TEAM = 8J59HM8B82; |
| 556 | ENABLE_BITCODE = NO; | 556 | ENABLE_BITCODE = NO; |
| 557 | FRAMEWORK_SEARCH_PATHS = ( | 557 | FRAMEWORK_SEARCH_PATHS = ( |
| @@ -564,7 +564,7 @@ | @@ -564,7 +564,7 @@ | ||
| 564 | "$(inherited)", | 564 | "$(inherited)", |
| 565 | "$(PROJECT_DIR)/Flutter", | 565 | "$(PROJECT_DIR)/Flutter", |
| 566 | ); | 566 | ); |
| 567 | - MARKETING_VERSION = 1.4.6; | 567 | + MARKETING_VERSION = 1.6.3; |
| 568 | PRODUCT_BUNDLE_IDENTIFIER = com.naji.reserveLine; | 568 | PRODUCT_BUNDLE_IDENTIFIER = com.naji.reserveLine; |
| 569 | PRODUCT_NAME = "一键订"; | 569 | PRODUCT_NAME = "一键订"; |
| 570 | PROVISIONING_PROFILE_SPECIFIER = ""; | 570 | PROVISIONING_PROFILE_SPECIFIER = ""; |
| @@ -584,7 +584,7 @@ | @@ -584,7 +584,7 @@ | ||
| 584 | CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; | 584 | CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; |
| 585 | CODE_SIGN_IDENTITY = "iPhone Developer"; | 585 | CODE_SIGN_IDENTITY = "iPhone Developer"; |
| 586 | CODE_SIGN_STYLE = Automatic; | 586 | CODE_SIGN_STYLE = Automatic; |
| 587 | - CURRENT_PROJECT_VERSION = 146; | 587 | + CURRENT_PROJECT_VERSION = 163; |
| 588 | DEVELOPMENT_TEAM = 8J59HM8B82; | 588 | DEVELOPMENT_TEAM = 8J59HM8B82; |
| 589 | ENABLE_BITCODE = NO; | 589 | ENABLE_BITCODE = NO; |
| 590 | FRAMEWORK_SEARCH_PATHS = ( | 590 | FRAMEWORK_SEARCH_PATHS = ( |
| @@ -597,7 +597,7 @@ | @@ -597,7 +597,7 @@ | ||
| 597 | "$(inherited)", | 597 | "$(inherited)", |
| 598 | "$(PROJECT_DIR)/Flutter", | 598 | "$(PROJECT_DIR)/Flutter", |
| 599 | ); | 599 | ); |
| 600 | - MARKETING_VERSION = 1.4.6; | 600 | + MARKETING_VERSION = 1.6.3; |
| 601 | PRODUCT_BUNDLE_IDENTIFIER = com.naji.reserveLine; | 601 | PRODUCT_BUNDLE_IDENTIFIER = com.naji.reserveLine; |
| 602 | PRODUCT_NAME = "一键订"; | 602 | PRODUCT_NAME = "一键订"; |
| 603 | 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((_) { |
lib/models/get_seller_info_model.dart
0 → 100644
| 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 | +} |
lib/models/get_seller_info_model.g.dart
0 → 100644
| 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 | + }; |
| @@ -115,7 +115,7 @@ class NotebookDetail { | @@ -115,7 +115,7 @@ class NotebookDetail { | ||
| 115 | String get ddateMd { | 115 | String get ddateMd { |
| 116 | DateTime dateTime = | 116 | DateTime dateTime = |
| 117 | DateTime.fromMillisecondsSinceEpoch(int.parse(ddate) * 1000); | 117 | DateTime.fromMillisecondsSinceEpoch(int.parse(ddate) * 1000); |
| 118 | - String md = Utils.addZeroNumber(dateTime.month) + | 118 | + String md ="${dateTime.year}年 "+Utils.addZeroNumber(dateTime.month) + |
| 119 | "月" + | 119 | "月" + |
| 120 | Utils.addZeroNumber(dateTime.day) + | 120 | Utils.addZeroNumber(dateTime.day) + |
| 121 | "日"; | 121 | "日"; |
lib/models/remark.dart
0 → 100644
| 1 | +import 'package:json_annotation/json_annotation.dart'; | ||
| 2 | + | ||
| 3 | +part 'remark.g.dart'; | ||
| 4 | + | ||
| 5 | +@JsonSerializable() | ||
| 6 | +class Remark extends Object { | ||
| 7 | + @JsonKey(name: 'id') | ||
| 8 | + String id; | ||
| 9 | + | ||
| 10 | + @JsonKey(name: 'uid') | ||
| 11 | + String uid; | ||
| 12 | + | ||
| 13 | + @JsonKey(name: 'often_use') | ||
| 14 | + String oftenUse; | ||
| 15 | + | ||
| 16 | + @JsonKey(name: 'custom') | ||
| 17 | + String custom; | ||
| 18 | + | ||
| 19 | + @JsonKey(name: 'cdate') | ||
| 20 | + String cdate; | ||
| 21 | + | ||
| 22 | + bool selected = false; | ||
| 23 | + | ||
| 24 | + Remark(); | ||
| 25 | + | ||
| 26 | + factory Remark.fromJson(Map<String, dynamic> srcJson) => | ||
| 27 | + _$RemarkFromJson(srcJson); | ||
| 28 | + | ||
| 29 | + Map<String, dynamic> toJson() => _$RemarkToJson(this); | ||
| 30 | +} |
lib/models/remark.g.dart
0 → 100644
| 1 | +// GENERATED CODE - DO NOT MODIFY BY HAND | ||
| 2 | + | ||
| 3 | +part of 'remark.dart'; | ||
| 4 | + | ||
| 5 | +// ************************************************************************** | ||
| 6 | +// JsonSerializableGenerator | ||
| 7 | +// ************************************************************************** | ||
| 8 | + | ||
| 9 | +Remark _$RemarkFromJson(Map<String, dynamic> json) { | ||
| 10 | + return Remark() | ||
| 11 | + ..id = json['id'] as String | ||
| 12 | + ..uid=json['uid'] as String | ||
| 13 | + ..oftenUse=json['often_use'] as String | ||
| 14 | + ..custom=json['custom'] as String | ||
| 15 | + ..cdate = json['cdate'] as String; | ||
| 16 | +} | ||
| 17 | + | ||
| 18 | +Map<String, dynamic> _$RemarkToJson(Remark instance) => <String, dynamic>{ | ||
| 19 | + 'id': instance.id, | ||
| 20 | + 'uid': instance.uid, | ||
| 21 | + 'often_use': instance.oftenUse, | ||
| 22 | + 'custom': instance.custom, | ||
| 23 | + 'cdate': instance.cdate, | ||
| 24 | +}; |
lib/models/set_seller_info_model.dart
0 → 100644
| 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 | + |
lib/models/set_seller_info_model.g.dart
0 → 100644
| 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}; |
lib/models/settime.dart
0 → 100644
| 1 | +///桌位区域 | ||
| 2 | +class SetTime { | ||
| 3 | + String start; | ||
| 4 | + String end; | ||
| 5 | + | ||
| 6 | + SetTime(); | ||
| 7 | + | ||
| 8 | + factory SetTime.fromJson(Map<String, dynamic> json) => SetTime() | ||
| 9 | + ..start = json["start"] | ||
| 10 | + ..end = json["end"]; | ||
| 11 | + | ||
| 12 | + Map<String, dynamic> toJson() => | ||
| 13 | + <String, dynamic>{"start": start, "end": end}; | ||
| 14 | +} |
lib/models/user_history_entity.dart
0 → 100644
| 1 | +import 'package:json_annotation/json_annotation.dart'; | ||
| 2 | + | ||
| 3 | +part 'user_history_entity.g.dart'; | ||
| 4 | + | ||
| 5 | + | ||
| 6 | +@JsonSerializable() | ||
| 7 | +class UserHistoryEntity extends Object { | ||
| 8 | + | ||
| 9 | + @JsonKey(name: 'id') | ||
| 10 | + String id; | ||
| 11 | + | ||
| 12 | + @JsonKey(name: 'sid') | ||
| 13 | + String sid; | ||
| 14 | + | ||
| 15 | + @JsonKey(name: 'rname') | ||
| 16 | + String rname; | ||
| 17 | + | ||
| 18 | + @JsonKey(name: 'sex') | ||
| 19 | + String sex; | ||
| 20 | + | ||
| 21 | + @JsonKey(name: 'phone') | ||
| 22 | + String phone; | ||
| 23 | + | ||
| 24 | + @JsonKey(name: 'cusdem') | ||
| 25 | + String cusdem; | ||
| 26 | + | ||
| 27 | + UserHistoryEntity(this.id,this.sid,this.rname,this.sex,this.phone,this.cusdem,); | ||
| 28 | + | ||
| 29 | + factory UserHistoryEntity.fromJson(Map<String, dynamic> srcJson) => _$UserHistoryEntityFromJson(srcJson); | ||
| 30 | + | ||
| 31 | + Map<String, dynamic> toJson() => _$UserHistoryEntityToJson(this); | ||
| 32 | + | ||
| 33 | +} | ||
| 34 | + | ||
| 35 | + |
lib/models/user_history_entity.g.dart
0 → 100644
| 1 | +// GENERATED CODE - DO NOT MODIFY BY HAND | ||
| 2 | + | ||
| 3 | +part of 'user_history_entity.dart'; | ||
| 4 | + | ||
| 5 | +// ************************************************************************** | ||
| 6 | +// JsonSerializableGenerator | ||
| 7 | +// ************************************************************************** | ||
| 8 | + | ||
| 9 | +UserHistoryEntity _$UserHistoryEntityFromJson(Map<String, dynamic> json) { | ||
| 10 | + return UserHistoryEntity( | ||
| 11 | + json['id'] as String, | ||
| 12 | + json['sid'] as String, | ||
| 13 | + json['rname'] as String, | ||
| 14 | + json['sex'] as String, | ||
| 15 | + json['phone'] as String, | ||
| 16 | + json['cusdem'] as String); | ||
| 17 | +} | ||
| 18 | + | ||
| 19 | +Map<String, dynamic> _$UserHistoryEntityToJson(UserHistoryEntity instance) => | ||
| 20 | + <String, dynamic>{ | ||
| 21 | + 'id': instance.id, | ||
| 22 | + 'sid': instance.sid, | ||
| 23 | + 'rname': instance.rname, | ||
| 24 | + 'sex': instance.sex, | ||
| 25 | + 'phone': instance.phone, | ||
| 26 | + 'cusdem': instance.cusdem | ||
| 27 | + }; |
| @@ -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,22 @@ class HttpUrl { | @@ -38,4 +38,22 @@ 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 | + | ||
| 48 | + static const String get_custom_remark= | ||
| 49 | + "?service=App.User.GetCustomRemark"; //获取常用备注 | ||
| 50 | + | ||
| 51 | + static const String del_custom_remark= | ||
| 52 | + "?service=App.User.DelCustomRemark"; //删除常用备注 | ||
| 53 | + | ||
| 54 | + static const String add_custom_remark= | ||
| 55 | + "?service=App.User.AddCustomRemark"; //添加常用备注 | ||
| 56 | + | ||
| 57 | + static const String get_reserve_user= | ||
| 58 | + "?service=App.Reserve.GetReserveUser"; //获取历史录入联系人 | ||
| 41 | } | 59 | } |
| @@ -57,6 +57,7 @@ class HandleOnlinePageState extends State<HandleOnlinePage> { | @@ -57,6 +57,7 @@ class HandleOnlinePageState extends State<HandleOnlinePage> { | ||
| 57 | 57 | ||
| 58 | bool isRefused = false; //是否已拒绝 | 58 | bool isRefused = false; //是否已拒绝 |
| 59 | bool isPause = false; //是否暂停预订 | 59 | bool isPause = false; //是否暂停预订 |
| 60 | + bool isSelf=false;//订单是否自己处理 | ||
| 60 | StateSetter refuseDialogState; //决绝弹框setState | 61 | StateSetter refuseDialogState; //决绝弹框setState |
| 61 | 62 | ||
| 62 | @override | 63 | @override |
| @@ -91,7 +92,11 @@ class HandleOnlinePageState extends State<HandleOnlinePage> { | @@ -91,7 +92,11 @@ class HandleOnlinePageState extends State<HandleOnlinePage> { | ||
| 91 | } | 92 | } |
| 92 | } | 93 | } |
| 93 | }); | 94 | }); |
| 94 | - if (detailEntity.status != "0" && !isPause) { | 95 | + if(detailEntity.status=="6"){//已拒绝不跳转 |
| 96 | + if(refuseDialogState!=null){ | ||
| 97 | + refuseDialogState((){}); | ||
| 98 | + } | ||
| 99 | + }else if (detailEntity.status != "0") {//已拒绝 | ||
| 95 | //已处理 | 100 | //已处理 |
| 96 | Future.delayed(Duration(milliseconds: 200), () { | 101 | Future.delayed(Duration(milliseconds: 200), () { |
| 97 | NavigatorUtil.goNotebookDetailPage(context, detailEntity.id, | 102 | NavigatorUtil.goNotebookDetailPage(context, detailEntity.id, |
| @@ -183,7 +188,6 @@ class HandleOnlinePageState extends State<HandleOnlinePage> { | @@ -183,7 +188,6 @@ class HandleOnlinePageState extends State<HandleOnlinePage> { | ||
| 183 | VEmptyView(20), | 188 | VEmptyView(20), |
| 184 | GestureDetector( | 189 | GestureDetector( |
| 185 | onTap: () { | 190 | onTap: () { |
| 186 | - Navigator.of(context).pop(); | ||
| 187 | setReserveStatus("6"); | 191 | setReserveStatus("6"); |
| 188 | }, | 192 | }, |
| 189 | child: Container( | 193 | child: Container( |
| @@ -304,6 +308,9 @@ class HandleOnlinePageState extends State<HandleOnlinePage> { | @@ -304,6 +308,9 @@ class HandleOnlinePageState extends State<HandleOnlinePage> { | ||
| 304 | ], | 308 | ], |
| 305 | ), | 309 | ), |
| 306 | ); | 310 | ); |
| 311 | + if(detailEntity.status=="6"&&isSelf==false){//订单已被拒绝 | ||
| 312 | + Navigator.of(context).pop(); | ||
| 313 | + } | ||
| 307 | return container; | 314 | return container; |
| 308 | }, | 315 | }, |
| 309 | ); | 316 | ); |
| @@ -342,20 +349,21 @@ class HandleOnlinePageState extends State<HandleOnlinePage> { | @@ -342,20 +349,21 @@ class HandleOnlinePageState extends State<HandleOnlinePage> { | ||
| 342 | "cause": json.encode(causeMap) | 349 | "cause": json.encode(causeMap) |
| 343 | }; | 350 | }; |
| 344 | if (status == "6") { | 351 | if (status == "6") { |
| 345 | - isPause = true; | 352 | + isPause = (ac=="1"?true:false); |
| 346 | params['ac'] = ac; //0=直接拒绝 1=拒绝并暂停预订 | 353 | params['ac'] = ac; //0=直接拒绝 1=拒绝并暂停预订 |
| 347 | } | 354 | } |
| 348 | bool success = await detailModel.setReserveStatus(context, params, | 355 | bool success = await detailModel.setReserveStatus(context, params, |
| 349 | - ifPush: (isPause ? false : true), showLoading: true); | 356 | + ifPush: (status=="6" ? false : true), showLoading: true); |
| 350 | if (success != null && success) { | 357 | if (success != null && success) { |
| 351 | bus.emit("refresh_book_list"); | 358 | bus.emit("refresh_book_list"); |
| 352 | if (status == "6") { | 359 | if (status == "6") { |
| 353 | isRefused = true; | 360 | isRefused = true; |
| 354 | - } | ||
| 355 | - if (isPause) { | 361 | + isSelf=true; |
| 356 | _getOrderListData(); | 362 | _getOrderListData(); |
| 357 | - refuseDialogState(() {}); | ||
| 358 | } | 363 | } |
| 364 | + }else{ | ||
| 365 | + isSelf=false; | ||
| 366 | + _getOrderListData(); | ||
| 359 | } | 367 | } |
| 360 | } | 368 | } |
| 361 | 369 |
| @@ -2,20 +2,24 @@ import 'dart:convert'; | @@ -2,20 +2,24 @@ import 'dart:convert'; | ||
| 2 | import 'dart:ui'; | 2 | import 'dart:ui'; |
| 3 | 3 | ||
| 4 | import 'package:common_utils/common_utils.dart'; | 4 | import 'package:common_utils/common_utils.dart'; |
| 5 | + | ||
| 6 | +// import 'package:contacts_service/contacts_service.dart'; | ||
| 5 | import 'package:flutter/material.dart'; | 7 | import 'package:flutter/material.dart'; |
| 6 | import 'package:flutter/services.dart'; | 8 | import 'package:flutter/services.dart'; |
| 7 | import 'package:flutter_screenutil/screenutil.dart'; | 9 | import 'package:flutter_screenutil/screenutil.dart'; |
| 8 | import 'package:one_key/models/notebook_detail.dart'; | 10 | import 'package:one_key/models/notebook_detail.dart'; |
| 11 | +import 'package:one_key/models/remark.dart'; | ||
| 9 | import 'package:one_key/models/reserve_info_model.dart'; | 12 | import 'package:one_key/models/reserve_info_model.dart'; |
| 10 | import 'package:one_key/provider/notebook_detail_change_model.dart'; | 13 | import 'package:one_key/provider/notebook_detail_change_model.dart'; |
| 11 | import 'package:one_key/provider/notebook_detail_model.dart'; | 14 | import 'package:one_key/provider/notebook_detail_model.dart'; |
| 15 | +import 'package:one_key/provider/remark_manager_model.dart'; | ||
| 12 | import 'package:one_key/provider/user_model.dart'; | 16 | import 'package:one_key/provider/user_model.dart'; |
| 13 | import 'package:one_key/res/colors.dart'; | 17 | import 'package:one_key/res/colors.dart'; |
| 14 | -import 'package:one_key/res/styles.dart'; | ||
| 15 | import 'package:one_key/utils/dialog_util.dart'; | 18 | import 'package:one_key/utils/dialog_util.dart'; |
| 16 | import 'package:one_key/utils/event_bus.dart'; | 19 | import 'package:one_key/utils/event_bus.dart'; |
| 17 | import 'package:one_key/utils/misc.dart'; | 20 | import 'package:one_key/utils/misc.dart'; |
| 18 | import 'package:one_key/utils/navigator_util.dart'; | 21 | import 'package:one_key/utils/navigator_util.dart'; |
| 22 | +import 'package:one_key/utils/triangle_custom_painter.dart'; | ||
| 19 | import 'package:one_key/utils/utils.dart'; | 23 | import 'package:one_key/utils/utils.dart'; |
| 20 | import 'package:one_key/widgets/MyDivider.dart'; | 24 | import 'package:one_key/widgets/MyDivider.dart'; |
| 21 | import 'package:one_key/widgets/app_bar.dart'; | 25 | import 'package:one_key/widgets/app_bar.dart'; |
| @@ -23,7 +27,6 @@ import 'package:one_key/widgets/common_button.dart'; | @@ -23,7 +27,6 @@ import 'package:one_key/widgets/common_button.dart'; | ||
| 23 | import 'package:one_key/widgets/h_empty_view.dart'; | 27 | import 'package:one_key/widgets/h_empty_view.dart'; |
| 24 | import 'package:one_key/widgets/new_table_item.dart'; | 28 | import 'package:one_key/widgets/new_table_item.dart'; |
| 25 | import 'package:one_key/widgets/round_button.dart'; | 29 | import 'package:one_key/widgets/round_button.dart'; |
| 26 | -import 'package:one_key/widgets/table_item.dart'; | ||
| 27 | import 'package:one_key/widgets/v_empty_view.dart'; | 30 | import 'package:one_key/widgets/v_empty_view.dart'; |
| 28 | import 'package:permission_handler/permission_handler.dart'; | 31 | import 'package:permission_handler/permission_handler.dart'; |
| 29 | import 'package:provider/provider.dart'; | 32 | import 'package:provider/provider.dart'; |
| @@ -39,6 +42,7 @@ class NoteBookChangePage extends StatefulWidget { | @@ -39,6 +42,7 @@ class NoteBookChangePage extends StatefulWidget { | ||
| 39 | 42 | ||
| 40 | const NoteBookChangePage({Key key, this.detailEntity, this.rid}) | 43 | const NoteBookChangePage({Key key, this.detailEntity, this.rid}) |
| 41 | : super(key: key); | 44 | : super(key: key); |
| 45 | + | ||
| 42 | @override | 46 | @override |
| 43 | _NoteBookChangePageState createState() => _NoteBookChangePageState(); | 47 | _NoteBookChangePageState createState() => _NoteBookChangePageState(); |
| 44 | } | 48 | } |
| @@ -51,6 +55,14 @@ class _NoteBookChangePageState extends State<NoteBookChangePage> { | @@ -51,6 +55,14 @@ class _NoteBookChangePageState extends State<NoteBookChangePage> { | ||
| 51 | FocusNode _needNode = FocusNode(); | 55 | FocusNode _needNode = FocusNode(); |
| 52 | NotebookDetailModel detailModel = NotebookDetailModel(); | 56 | NotebookDetailModel detailModel = NotebookDetailModel(); |
| 53 | EasyContactPicker _contactPicker = EasyContactPicker(); | 57 | EasyContactPicker _contactPicker = EasyContactPicker(); |
| 58 | + RemarkManagerModel remarkManagerModel; | ||
| 59 | + String currentRemark = ''; | ||
| 60 | + | ||
| 61 | + bool showPhoneHistory = false; //显示客户历史记录 | ||
| 62 | + | ||
| 63 | + String sid = ""; //商户id | ||
| 64 | + | ||
| 65 | + ScrollController _controller = ScrollController(); | ||
| 54 | 66 | ||
| 55 | @override | 67 | @override |
| 56 | void initState() { | 68 | void initState() { |
| @@ -59,6 +71,7 @@ class _NoteBookChangePageState extends State<NoteBookChangePage> { | @@ -59,6 +71,7 @@ class _NoteBookChangePageState extends State<NoteBookChangePage> { | ||
| 59 | WidgetsBinding.instance.addPostFrameCallback((timeStamp) { | 71 | WidgetsBinding.instance.addPostFrameCallback((timeStamp) { |
| 60 | // _notebookDetailChangeModel = | 72 | // _notebookDetailChangeModel = |
| 61 | // Provider.of<NotebookDetailChangeModel>(context, listen: false); | 73 | // Provider.of<NotebookDetailChangeModel>(context, listen: false); |
| 74 | + sid = Provider.of<UserModel>(context, listen: false).user.sellerid; | ||
| 62 | _notebookDetailChangeModel.initDateHourMinuteList(context); | 75 | _notebookDetailChangeModel.initDateHourMinuteList(context); |
| 63 | String ddate = widget.detailEntity.ddate.toString() + '000'; | 76 | String ddate = widget.detailEntity.ddate.toString() + '000'; |
| 64 | _notebookDetailChangeModel.getNewTableList( | 77 | _notebookDetailChangeModel.getNewTableList( |
| @@ -68,23 +81,10 @@ class _NoteBookChangePageState extends State<NoteBookChangePage> { | @@ -68,23 +81,10 @@ class _NoteBookChangePageState extends State<NoteBookChangePage> { | ||
| 68 | widget.detailEntity.pnum, | 81 | widget.detailEntity.pnum, |
| 69 | widget.detailEntity.tables); | 82 | widget.detailEntity.tables); |
| 70 | _initData(); | 83 | _initData(); |
| 71 | - // //输入框焦点 | ||
| 72 | - // _nameNode.addListener(() { | ||
| 73 | - // if (!_nameNode.hasFocus) { | ||
| 74 | - // print('失去焦点'); | ||
| 75 | - // } else { | ||
| 76 | - // print('得到焦点'); | ||
| 77 | - // _phoneNode.unfocus(); | ||
| 78 | - // } | ||
| 79 | - // }); | ||
| 80 | - // //输入框焦点 | ||
| 81 | - // _phoneNode.addListener(() { | ||
| 82 | - // if (!_phoneNode.hasFocus) { | ||
| 83 | - // print('失去焦点'); | ||
| 84 | - // } else { | ||
| 85 | - // print('得到焦点'); | ||
| 86 | - // } | ||
| 87 | - // }); | 84 | + Map<String, String> params = { |
| 85 | + "uid": Provider.of<UserModel>(context, listen: false).user.openid | ||
| 86 | + }; | ||
| 87 | + remarkManagerModel.getRemarks(context, params); | ||
| 88 | }); | 88 | }); |
| 89 | } | 89 | } |
| 90 | 90 | ||
| @@ -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'], | 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'], |
| @@ -142,14 +144,10 @@ class _NoteBookChangePageState extends State<NoteBookChangePage> { | @@ -142,14 +144,10 @@ class _NoteBookChangePageState extends State<NoteBookChangePage> { | ||
| 142 | } | 144 | } |
| 143 | if (j == | 145 | if (j == |
| 144 | _notebookDetailChangeModel.dateList.length - 1) { | 146 | _notebookDetailChangeModel.dateList.length - 1) { |
| 145 | - String selectStr = | ||
| 146 | - _notebookDetailChangeModel.dateList[2]['title']; | ||
| 147 | - String timeNow = DateUtil.formatDate( | ||
| 148 | - DateTime.now(), | ||
| 149 | - ); | ||
| 150 | - String selectDate = | ||
| 151 | - timeNow.replaceRange(5, 10, selectStr); | ||
| 152 | - _calendWidget(DateUtil.getDateTime(selectDate)); | 147 | + String selectStr = _notebookDetailChangeModel |
| 148 | + .dateList[2]['title'] + | ||
| 149 | + " 00:00:00"; | ||
| 150 | + _calendWidget(DateUtil.getDateTime(selectStr)); | ||
| 153 | } | 151 | } |
| 154 | } | 152 | } |
| 155 | } | 153 | } |
| @@ -310,7 +308,8 @@ class _NoteBookChangePageState extends State<NoteBookChangePage> { | @@ -310,7 +308,8 @@ class _NoteBookChangePageState extends State<NoteBookChangePage> { | ||
| 310 | // _createDateText(day); | 308 | // _createDateText(day); |
| 311 | dateTime = day; | 309 | dateTime = day; |
| 312 | int dateTimeMill = day.millisecondsSinceEpoch; | 310 | int dateTimeMill = day.millisecondsSinceEpoch; |
| 313 | - String dateText = DateUtil.formatDateMs(dateTimeMill, format: 'MM-dd'); | 311 | + String dateText = |
| 312 | + DateUtil.formatDateMs(dateTimeMill, format: 'yyyy-MM-dd'); | ||
| 314 | bool isThird = true; | 313 | bool isThird = true; |
| 315 | for (int i = 0; i < _notebookDetailChangeModel.dateList.length; i++) { | 314 | for (int i = 0; i < _notebookDetailChangeModel.dateList.length; i++) { |
| 316 | _notebookDetailChangeModel.dateList[i]['select'] = false; | 315 | _notebookDetailChangeModel.dateList[i]['select'] = false; |
| @@ -354,17 +353,13 @@ class _NoteBookChangePageState extends State<NoteBookChangePage> { | @@ -354,17 +353,13 @@ class _NoteBookChangePageState extends State<NoteBookChangePage> { | ||
| 354 | InkWell( | 353 | InkWell( |
| 355 | onTap: () async { | 354 | onTap: () async { |
| 356 | FocusScope.of(context).requestFocus(FocusNode()); //点击空白处隐藏键盘 | 355 | FocusScope.of(context).requestFocus(FocusNode()); //点击空白处隐藏键盘 |
| 357 | - //当前选中 月 日string | ||
| 358 | - String mdStr = ''; | 356 | + String ymyStr = ""; //年月日 |
| 359 | //今天 明天 其他天 | 357 | //今天 明天 其他天 |
| 360 | for (var item in _notebookDetailChangeModel.dateList) { | 358 | for (var item in _notebookDetailChangeModel.dateList) { |
| 361 | if (item['select'] == true) { | 359 | if (item['select'] == true) { |
| 362 | - mdStr = item['title']; | 360 | + ymyStr = item['title']; |
| 363 | } | 361 | } |
| 364 | } | 362 | } |
| 365 | - String timeNowYear = | ||
| 366 | - DateUtil.formatDate(DateTime.now(), format: 'yyyy'); | ||
| 367 | - String ymyStr = timeNowYear + '-' + mdStr; //年月日 | ||
| 368 | String timeStr = ymyStr + ' ' + "00:00:00"; | 363 | String timeStr = ymyStr + ' ' + "00:00:00"; |
| 369 | int ddate = DateUtil.getDateMsByTimeStr(timeStr); //筛选日期时间戳 | 364 | int ddate = DateUtil.getDateMsByTimeStr(timeStr); //筛选日期时间戳 |
| 370 | String ddateSolt = ''; | 365 | String ddateSolt = ''; |
| @@ -596,11 +591,33 @@ class _NoteBookChangePageState extends State<NoteBookChangePage> { | @@ -596,11 +591,33 @@ class _NoteBookChangePageState extends State<NoteBookChangePage> { | ||
| 596 | // EdgeInsets.only(bottom: ScreenUtil().setWidth(17)), | 591 | // EdgeInsets.only(bottom: ScreenUtil().setWidth(17)), |
| 597 | border: InputBorder.none, | 592 | border: InputBorder.none, |
| 598 | ), | 593 | ), |
| 599 | - onChanged: (value) {}, | 594 | + onChanged: (value) { |
| 595 | + LogUtil.v("value:$value"); | ||
| 596 | + if (value.isEmpty || value.length >= 11) { | ||
| 597 | + //内容为空,或 超过11位 | ||
| 598 | + setState(() { | ||
| 599 | + _notebookDetailChangeModel.userHistorys.clear(); | ||
| 600 | + }); | ||
| 601 | + return; | ||
| 602 | + } | ||
| 603 | + Map<String, String> params = { | ||
| 604 | + "keywords": value, | ||
| 605 | + "sid": sid | ||
| 606 | + }; | ||
| 607 | + _notebookDetailChangeModel.getUserHistorys(context, params); | ||
| 608 | + }, | ||
| 600 | onEditingComplete: () { | 609 | onEditingComplete: () { |
| 601 | print('fff'); | 610 | print('fff'); |
| 602 | _phoneNode.unfocus(); | 611 | _phoneNode.unfocus(); |
| 603 | }, | 612 | }, |
| 613 | + onTap: () { | ||
| 614 | + setState(() { | ||
| 615 | + showPhoneHistory = true; | ||
| 616 | + }); | ||
| 617 | + Future.delayed(Duration(milliseconds: 300),(){ | ||
| 618 | + _controller.jumpTo(_controller.position.maxScrollExtent); | ||
| 619 | + }); | ||
| 620 | + }, | ||
| 604 | keyboardType: TextInputType.number, | 621 | keyboardType: TextInputType.number, |
| 605 | ), | 622 | ), |
| 606 | ), | 623 | ), |
| @@ -635,47 +652,239 @@ class _NoteBookChangePageState extends State<NoteBookChangePage> { | @@ -635,47 +652,239 @@ class _NoteBookChangePageState extends State<NoteBookChangePage> { | ||
| 635 | ) | 652 | ) |
| 636 | ], | 653 | ], |
| 637 | ), | 654 | ), |
| 638 | - VEmptyView(40), | ||
| 639 | - MyDivider(ScreenUtil().setWidth(335 * 2), ScreenUtil().setWidth(2), | ||
| 640 | - color: MyColours.color_F1F0F4), | ||
| 641 | - VEmptyView(52), | ||
| 642 | - TextField( | ||
| 643 | - maxLines: 1, | ||
| 644 | - inputFormatters: [LengthLimitingTextInputFormatter(25)], | ||
| 645 | - //输入文本的样式 | ||
| 646 | - style: TextStyle( | ||
| 647 | - fontSize: ScreenUtil().setSp(34), | ||
| 648 | - color: MyColours.color_353535), | ||
| 649 | - controller: _notebookDetailChangeModel.customController, | ||
| 650 | - focusNode: _needNode, | ||
| 651 | - // textAlignVertical: TextAlignVertical.top, | ||
| 652 | - decoration: InputDecoration( | ||
| 653 | - hintText: "客户要求(25字以内,选填)", | ||
| 654 | - hintStyle: TextStyle( | ||
| 655 | - color: MyColours.color_999999, | ||
| 656 | - fontSize: ScreenUtil().setSp(34), | 655 | + Stack( |
| 656 | + children: [ | ||
| 657 | + Column( | ||
| 658 | + mainAxisSize: MainAxisSize.min, | ||
| 659 | + children: [ | ||
| 660 | + VEmptyView(40), | ||
| 661 | + MyDivider( | ||
| 662 | + ScreenUtil().setWidth(335 * 2), ScreenUtil().setWidth(2), | ||
| 663 | + color: MyColours.color_F1F0F4), | ||
| 664 | + VEmptyView(52), | ||
| 665 | + Row( | ||
| 666 | + children: [ | ||
| 667 | + Expanded( | ||
| 668 | + child: TextField( | ||
| 669 | + maxLines: 1, | ||
| 670 | + inputFormatters: [LengthLimitingTextInputFormatter(25)], | ||
| 671 | + //输入文本的样式 | ||
| 672 | + style: TextStyle( | ||
| 673 | + fontSize: ScreenUtil().setSp(34), | ||
| 674 | + color: MyColours.color_353535), | ||
| 675 | + controller: _notebookDetailChangeModel.customController, | ||
| 676 | + focusNode: _needNode, | ||
| 677 | + // textAlignVertical: TextAlignVertical.top, | ||
| 678 | + decoration: InputDecoration( | ||
| 679 | + hintText: "客户要求(25字以内,选填)", | ||
| 680 | + hintStyle: TextStyle( | ||
| 681 | + color: MyColours.color_999999, | ||
| 682 | + fontSize: ScreenUtil().setSp(34), | ||
| 683 | + ), | ||
| 684 | + // contentPadding: | ||
| 685 | + // EdgeInsets.only(bottom: ScreenUtil().setWidth(17)), | ||
| 686 | + border: InputBorder.none, | ||
| 687 | + ), | ||
| 688 | + onChanged: (value) { | ||
| 689 | + print(value); | ||
| 690 | + currentRemark = value; | ||
| 691 | + // print(); | ||
| 692 | + }, | ||
| 693 | + onEditingComplete: () { | ||
| 694 | + print('fff'); | ||
| 695 | + _needNode.unfocus(); | ||
| 696 | + }, | ||
| 697 | + // keyboardType: TextInputType.number, | ||
| 698 | + )), | ||
| 699 | + InkWell( | ||
| 700 | + onTap: () { | ||
| 701 | + DialogUtil.showRemarkDialog( | ||
| 702 | + context, remarkManagerModel.ofenRemarks, (item) { | ||
| 703 | + int index = | ||
| 704 | + remarkManagerModel.ofenRemarks.indexOf(item); | ||
| 705 | + _refreshRemark(remarkManagerModel.ofenRemarks, index); | ||
| 706 | + }); | ||
| 707 | + }, | ||
| 708 | + child: Container( | ||
| 709 | + margin: | ||
| 710 | + EdgeInsets.only(left: ScreenUtil().setWidth(40)), | ||
| 711 | + width: ScreenUtil().setWidth(122), | ||
| 712 | + height: ScreenUtil().setWidth(42), | ||
| 713 | + child: Text( | ||
| 714 | + '快速备注', | ||
| 715 | + style: TextStyle( | ||
| 716 | + fontSize: ScreenUtil().setSp(30), | ||
| 717 | + color: MyColours.color_199095), | ||
| 718 | + ), | ||
| 719 | + ), | ||
| 720 | + ), | ||
| 721 | + ], | ||
| 722 | + ), | ||
| 723 | + VEmptyView(40), | ||
| 724 | + MyDivider( | ||
| 725 | + ScreenUtil().setWidth(335 * 2), ScreenUtil().setWidth(2), | ||
| 726 | + color: MyColours.color_F1F0F4), | ||
| 727 | + VEmptyView(30), | ||
| 728 | + _remarkListWidget() | ||
| 729 | + ], | ||
| 657 | ), | 730 | ), |
| 658 | - // contentPadding: | ||
| 659 | - // EdgeInsets.only(bottom: ScreenUtil().setWidth(17)), | ||
| 660 | - border: InputBorder.none, | ||
| 661 | - ), | ||
| 662 | - onChanged: (value) {}, | ||
| 663 | - onEditingComplete: () { | ||
| 664 | - print('fff'); | ||
| 665 | - _needNode.unfocus(); | ||
| 666 | - }, | ||
| 667 | - // keyboardType: TextInputType.number, | ||
| 668 | - ), | ||
| 669 | - VEmptyView(40), | ||
| 670 | - MyDivider(ScreenUtil().setWidth(335 * 2), ScreenUtil().setWidth(2), | ||
| 671 | - color: MyColours.color_F1F0F4), | ||
| 672 | - // VEmptyView(72), | 731 | + Offstage( |
| 732 | + offstage: !(showPhoneHistory && | ||
| 733 | + _notebookDetailChangeModel.userHistorys.length > 0), | ||
| 734 | + child: Container( | ||
| 735 | + decoration: BoxDecoration( | ||
| 736 | + borderRadius: BorderRadius.circular(8), | ||
| 737 | + border: Border.all(color: Colors.white), | ||
| 738 | + color: MyColours.color_ffffff, | ||
| 739 | + boxShadow: [ | ||
| 740 | + BoxShadow( | ||
| 741 | + color: MyColours.color_e5e5e5, | ||
| 742 | + blurRadius: ScreenUtil().setWidth(20)) | ||
| 743 | + ]), | ||
| 744 | + width: ScreenUtil().setWidth(440), | ||
| 745 | + height: _notebookDetailChangeModel.userHistorys.length>1?ScreenUtil().setWidth(208):ScreenUtil().setWidth(104), | ||
| 746 | + padding: EdgeInsets.symmetric( | ||
| 747 | + horizontal: ScreenUtil().setWidth(30)), | ||
| 748 | + child: Align( | ||
| 749 | + alignment: Alignment.topCenter, | ||
| 750 | + child: MediaQuery.removePadding(context: context, removeTop:true,child: ListView.builder( | ||
| 751 | + itemBuilder: (context, index) { | ||
| 752 | + return GestureDetector( | ||
| 753 | + onTap: () { | ||
| 754 | + setState(() { | ||
| 755 | + showPhoneHistory = false; | ||
| 756 | + _notebookDetailChangeModel | ||
| 757 | + .phoneController.text = | ||
| 758 | + _notebookDetailChangeModel | ||
| 759 | + .userHistorys[index].phone; | ||
| 760 | + _notebookDetailChangeModel.nameController.text = | ||
| 761 | + _notebookDetailChangeModel | ||
| 762 | + .userHistorys[index].rname; | ||
| 763 | + _phoneNode.unfocus(); | ||
| 764 | + _notebookDetailChangeModel.userHistorys.clear(); | ||
| 765 | + }); | ||
| 766 | + }, | ||
| 767 | + child: Container( | ||
| 768 | + width: double.infinity, | ||
| 769 | + height: ScreenUtil().setWidth(102), | ||
| 770 | + decoration: BoxDecoration( | ||
| 771 | + border: Border( | ||
| 772 | + bottom: (index != | ||
| 773 | + (_notebookDetailChangeModel | ||
| 774 | + .userHistorys.length - | ||
| 775 | + 1) && | ||
| 776 | + _notebookDetailChangeModel | ||
| 777 | + .userHistorys.length > | ||
| 778 | + 1) | ||
| 779 | + ? BorderSide( | ||
| 780 | + color: MyColours.color_e5e5e5, | ||
| 781 | + width: ScreenUtil().setWidth(2)) | ||
| 782 | + : BorderSide.none)), | ||
| 783 | + child: Row( | ||
| 784 | + mainAxisAlignment: | ||
| 785 | + MainAxisAlignment.spaceBetween, | ||
| 786 | + children: [ | ||
| 787 | + Text( | ||
| 788 | + _notebookDetailChangeModel | ||
| 789 | + .userHistorys[index].phone, | ||
| 790 | + style: TextStyle( | ||
| 791 | + color: MyColours.color_333333, | ||
| 792 | + fontSize: ScreenUtil().setSp(32)), | ||
| 793 | + ), | ||
| 794 | + Text( | ||
| 795 | + _notebookDetailChangeModel | ||
| 796 | + .userHistorys[index].rname, | ||
| 797 | + style: TextStyle( | ||
| 798 | + color: MyColours.color_333333, | ||
| 799 | + fontSize: ScreenUtil().setSp(32)), | ||
| 800 | + ) | ||
| 801 | + ], | ||
| 802 | + ), | ||
| 803 | + ), | ||
| 804 | + ); | ||
| 805 | + }, | ||
| 806 | + itemExtent: ScreenUtil().setWidth(104), | ||
| 807 | + itemCount: | ||
| 808 | + _notebookDetailChangeModel.userHistorys.length, | ||
| 809 | + )) | ||
| 810 | + ), | ||
| 811 | + ), | ||
| 812 | + ) | ||
| 813 | + ], | ||
| 814 | + ) | ||
| 673 | // VEmptyView(62), | 815 | // VEmptyView(62), |
| 674 | ], | 816 | ], |
| 675 | ), | 817 | ), |
| 676 | ); | 818 | ); |
| 677 | } | 819 | } |
| 678 | 820 | ||
| 821 | + _remarkListWidget() { | ||
| 822 | + List<Remark> remark = []; | ||
| 823 | + if (remarkManagerModel.ofenRemarks.length > 4) { | ||
| 824 | + remark = remarkManagerModel.ofenRemarks.sublist(0, 5); | ||
| 825 | + } else { | ||
| 826 | + remark = remarkManagerModel.ofenRemarks; | ||
| 827 | + } | ||
| 828 | + return Container( | ||
| 829 | + height: ScreenUtil().setWidth(50), | ||
| 830 | + child: ListView.builder( | ||
| 831 | + shrinkWrap: true, | ||
| 832 | + itemCount: remark.length, | ||
| 833 | + scrollDirection: Axis.horizontal, | ||
| 834 | + itemBuilder: (BuildContext contxt, int index) { | ||
| 835 | + return remarkButton( | ||
| 836 | + content: remark[index].custom, | ||
| 837 | + isSelect: remark[index].selected, | ||
| 838 | + onPress: () { | ||
| 839 | + setState(() { | ||
| 840 | + remark[index].selected = !remark[index].selected; | ||
| 841 | + }); | ||
| 842 | + _refreshRemark(remark, index); | ||
| 843 | + }); | ||
| 844 | + }), | ||
| 845 | + ); | ||
| 846 | + } | ||
| 847 | + | ||
| 848 | + _refreshRemark(List<Remark> remark, int index) { | ||
| 849 | + if (remark[index].selected) { | ||
| 850 | + if (currentRemark.length == 0) { | ||
| 851 | + currentRemark += '${remark[index].custom}'; | ||
| 852 | + } else { | ||
| 853 | + if (!currentRemark.contains(remark[index].custom)) { | ||
| 854 | + if (currentRemark.endsWith('、')) { | ||
| 855 | + currentRemark += '${remark[index].custom}'; | ||
| 856 | + } else { | ||
| 857 | + currentRemark += '、${remark[index].custom}'; | ||
| 858 | + } | ||
| 859 | + } | ||
| 860 | + } | ||
| 861 | + } else { | ||
| 862 | + if (currentRemark.contains(remark[index].custom)) { | ||
| 863 | + int start = currentRemark.indexOf(remark[index].custom); | ||
| 864 | + int end = start + remark[index].custom.length; | ||
| 865 | + currentRemark = currentRemark.replaceRange(start, end, ''); | ||
| 866 | + if (currentRemark.endsWith('、')) { | ||
| 867 | + currentRemark = currentRemark.substring(0, currentRemark.length - 1); | ||
| 868 | + } | ||
| 869 | + if (currentRemark.startsWith('、')) { | ||
| 870 | + currentRemark = currentRemark.substring(1, currentRemark.length); | ||
| 871 | + } | ||
| 872 | + if (currentRemark.contains('、、')) { | ||
| 873 | + currentRemark = currentRemark.replaceRange( | ||
| 874 | + currentRemark.indexOf('、、'), | ||
| 875 | + currentRemark.indexOf('、、') + 2, | ||
| 876 | + '、'); | ||
| 877 | + } | ||
| 878 | + } | ||
| 879 | + } | ||
| 880 | + if (currentRemark.length > 25) { | ||
| 881 | + currentRemark = currentRemark.substring(0, 25); | ||
| 882 | + } | ||
| 883 | + setState(() { | ||
| 884 | + _notebookDetailChangeModel.customController.text = currentRemark; | ||
| 885 | + }); | ||
| 886 | + } | ||
| 887 | + | ||
| 679 | ///底部弹框,设置时间30分钟间隔布局 | 888 | ///底部弹框,设置时间30分钟间隔布局 |
| 680 | _showDateChooseWidget(BuildContext context) async { | 889 | _showDateChooseWidget(BuildContext context) async { |
| 681 | List tempMndList = []; | 890 | List tempMndList = []; |
| @@ -689,18 +898,9 @@ class _NoteBookChangePageState extends State<NoteBookChangePage> { | @@ -689,18 +898,9 @@ class _NoteBookChangePageState extends State<NoteBookChangePage> { | ||
| 689 | tempMndList = _notebookDetailChangeModel.dailyMap[key]; | 898 | tempMndList = _notebookDetailChangeModel.dailyMap[key]; |
| 690 | } | 899 | } |
| 691 | } | 900 | } |
| 692 | - //计算行数 | ||
| 693 | - | ||
| 694 | - int line = 0; | ||
| 695 | - int count = tempMndList.length; | ||
| 696 | - if (count % 3 == 0) { | ||
| 697 | - line = int.parse('${count / 3}'); | ||
| 698 | - } else { | ||
| 699 | - line = (count / 3).ceil(); | ||
| 700 | - } | ||
| 701 | - int height = 85 + 40 + 36 * line + (line - 1) * 15; | ||
| 702 | final option = await showModalBottomSheet( | 901 | final option = await showModalBottomSheet( |
| 703 | context: context, | 902 | context: context, |
| 903 | + isScrollControlled: true, | ||
| 704 | backgroundColor: Colors.white, | 904 | backgroundColor: Colors.white, |
| 705 | builder: (context) { | 905 | builder: (context) { |
| 706 | return StatefulBuilder(builder: (context, state) { | 906 | return StatefulBuilder(builder: (context, state) { |
| @@ -709,8 +909,8 @@ class _NoteBookChangePageState extends State<NoteBookChangePage> { | @@ -709,8 +909,8 @@ class _NoteBookChangePageState extends State<NoteBookChangePage> { | ||
| 709 | decoration: BoxDecoration( | 909 | decoration: BoxDecoration( |
| 710 | borderRadius: | 910 | borderRadius: |
| 711 | BorderRadius.circular(ScreenUtil().setWidth(10))), | 911 | BorderRadius.circular(ScreenUtil().setWidth(10))), |
| 712 | - height: ScreenUtil().setWidth(height * 2), | ||
| 713 | child: Column( | 912 | child: Column( |
| 913 | + mainAxisSize: MainAxisSize.min, | ||
| 714 | children: [ | 914 | children: [ |
| 715 | InkWell( | 915 | InkWell( |
| 716 | onTap: () { | 916 | onTap: () { |
| @@ -739,10 +939,10 @@ class _NoteBookChangePageState extends State<NoteBookChangePage> { | @@ -739,10 +939,10 @@ class _NoteBookChangePageState extends State<NoteBookChangePage> { | ||
| 739 | fontWeight: FontWeight.bold, | 939 | fontWeight: FontWeight.bold, |
| 740 | color: MyColours.color_353535)), | 940 | color: MyColours.color_353535)), |
| 741 | ), | 941 | ), |
| 742 | - VEmptyView(40), | ||
| 743 | Padding( | 942 | Padding( |
| 744 | padding: EdgeInsets.symmetric( | 943 | padding: EdgeInsets.symmetric( |
| 745 | - horizontal: ScreenUtil().setWidth(60)), | 944 | + horizontal: ScreenUtil().setWidth(60), |
| 945 | + vertical: ScreenUtil().setWidth(40)), | ||
| 746 | child: GridView.builder( | 946 | child: GridView.builder( |
| 747 | padding: | 947 | padding: |
| 748 | EdgeInsets.only(top: ScreenUtil().setWidth(20)), | 948 | EdgeInsets.only(top: ScreenUtil().setWidth(20)), |
| @@ -838,7 +1038,12 @@ class _NoteBookChangePageState extends State<NoteBookChangePage> { | @@ -838,7 +1038,12 @@ class _NoteBookChangePageState extends State<NoteBookChangePage> { | ||
| 838 | if (permissionStatus == PermissionStatus.neverAskAgain) { | 1038 | if (permissionStatus == PermissionStatus.neverAskAgain) { |
| 839 | //用户选择不在弹出权限提示框 | 1039 | //用户选择不在弹出权限提示框 |
| 840 | print('never'); | 1040 | print('never'); |
| 841 | - DialogUtil.openAlertDialog(context); | 1041 | + DialogUtil.openAlertDialog( |
| 1042 | + context, '未获得通讯录权限', "请在手机的权限管理里,将通讯录权限开启", '去设置', 340.0, | ||
| 1043 | + onTap: () { | ||
| 1044 | + openSetting(); | ||
| 1045 | + Navigator.pop(context, ''); | ||
| 1046 | + }); | ||
| 842 | } else { | 1047 | } else { |
| 843 | // 申请权限 | 1048 | // 申请权限 |
| 844 | bool canContacts = await requestContactPermission(); | 1049 | bool canContacts = await requestContactPermission(); |
| @@ -846,7 +1051,12 @@ class _NoteBookChangePageState extends State<NoteBookChangePage> { | @@ -846,7 +1051,12 @@ class _NoteBookChangePageState extends State<NoteBookChangePage> { | ||
| 846 | _getContactData(); | 1051 | _getContactData(); |
| 847 | } else { | 1052 | } else { |
| 848 | //拒绝通讯录权限 , 苹果拒绝权限后,不再提示权限框,进入此处 | 1053 | //拒绝通讯录权限 , 苹果拒绝权限后,不再提示权限框,进入此处 |
| 849 | - DialogUtil.openAlertDialog(context); | 1054 | + DialogUtil.openAlertDialog( |
| 1055 | + context, '未获得通讯录权限', "请在手机的权限管理里,将通讯录权限开启。", '去设置', 340.0, | ||
| 1056 | + onTap: () { | ||
| 1057 | + openSetting(); | ||
| 1058 | + Navigator.pop(context, ''); | ||
| 1059 | + }); | ||
| 850 | } | 1060 | } |
| 851 | } | 1061 | } |
| 852 | } else { | 1062 | } else { |
| @@ -866,7 +1076,6 @@ class _NoteBookChangePageState extends State<NoteBookChangePage> { | @@ -866,7 +1076,6 @@ class _NoteBookChangePageState extends State<NoteBookChangePage> { | ||
| 866 | } else { | 1076 | } else { |
| 867 | fullName = contact.fullName; | 1077 | fullName = contact.fullName; |
| 868 | } | 1078 | } |
| 869 | - | ||
| 870 | _notebookDetailChangeModel.phoneController.text = contact.phoneNumber; | 1079 | _notebookDetailChangeModel.phoneController.text = contact.phoneNumber; |
| 871 | _notebookDetailChangeModel.nameController.text = fullName; | 1080 | _notebookDetailChangeModel.nameController.text = fullName; |
| 872 | }); | 1081 | }); |
| @@ -876,6 +1085,7 @@ class _NoteBookChangePageState extends State<NoteBookChangePage> { | @@ -876,6 +1085,7 @@ class _NoteBookChangePageState extends State<NoteBookChangePage> { | ||
| 876 | Widget build(BuildContext context) { | 1085 | Widget build(BuildContext context) { |
| 877 | _notebookDetailChangeModel = | 1086 | _notebookDetailChangeModel = |
| 878 | Provider.of<NotebookDetailChangeModel>(context, listen: true); | 1087 | Provider.of<NotebookDetailChangeModel>(context, listen: true); |
| 1088 | + remarkManagerModel = Provider.of<RemarkManagerModel>(context, listen: true); | ||
| 879 | return GestureDetector( | 1089 | return GestureDetector( |
| 880 | behavior: HitTestBehavior.translucent, | 1090 | behavior: HitTestBehavior.translucent, |
| 881 | onTap: () { | 1091 | onTap: () { |
| @@ -891,9 +1101,14 @@ class _NoteBookChangePageState extends State<NoteBookChangePage> { | @@ -891,9 +1101,14 @@ class _NoteBookChangePageState extends State<NoteBookChangePage> { | ||
| 891 | ), | 1101 | ), |
| 892 | Expanded( | 1102 | Expanded( |
| 893 | child: SingleChildScrollView( | 1103 | child: SingleChildScrollView( |
| 1104 | + controller: _controller, | ||
| 894 | child: Column( | 1105 | child: Column( |
| 895 | - children: [_topWidget(), _middleWidget(), _bottomWidget()], | ||
| 896 | - ))), | 1106 | + children: [ |
| 1107 | + _topWidget(), | ||
| 1108 | + _middleWidget(), | ||
| 1109 | + _bottomWidget() | ||
| 1110 | + ], | ||
| 1111 | + ))), | ||
| 897 | Container( | 1112 | Container( |
| 898 | padding: EdgeInsets.symmetric( | 1113 | padding: EdgeInsets.symmetric( |
| 899 | horizontal: ScreenUtil().setWidth(40), | 1114 | horizontal: ScreenUtil().setWidth(40), |
| @@ -1001,12 +1216,14 @@ class CustomButton extends StatefulWidget { | @@ -1001,12 +1216,14 @@ class CustomButton extends StatefulWidget { | ||
| 1001 | this.model, | 1216 | this.model, |
| 1002 | this.height = 25, | 1217 | this.height = 25, |
| 1003 | }) : super(key: key); | 1218 | }) : super(key: key); |
| 1219 | + | ||
| 1004 | @override | 1220 | @override |
| 1005 | _ButtonState createState() => _ButtonState(); | 1221 | _ButtonState createState() => _ButtonState(); |
| 1006 | } | 1222 | } |
| 1007 | 1223 | ||
| 1008 | class _ButtonState extends State<CustomButton> { | 1224 | class _ButtonState extends State<CustomButton> { |
| 1009 | FocusNode _cancelNode = FocusNode(); | 1225 | FocusNode _cancelNode = FocusNode(); |
| 1226 | + | ||
| 1010 | @override | 1227 | @override |
| 1011 | Widget build(BuildContext context) { | 1228 | Widget build(BuildContext context) { |
| 1012 | String imgStrSelect = widget.isImage && !widget.isTextFiled | 1229 | String imgStrSelect = widget.isImage && !widget.isTextFiled |
| @@ -1134,3 +1351,29 @@ class _ButtonState extends State<CustomButton> { | @@ -1134,3 +1351,29 @@ class _ButtonState extends State<CustomButton> { | ||
| 1134 | ); | 1351 | ); |
| 1135 | } | 1352 | } |
| 1136 | } | 1353 | } |
| 1354 | + | ||
| 1355 | +Widget remarkButton({GestureTapCallback onPress, content, isSelect = false}) { | ||
| 1356 | + return InkWell( | ||
| 1357 | + onTap: onPress, | ||
| 1358 | + child: Container( | ||
| 1359 | + height: ScreenUtil().setHeight(48), | ||
| 1360 | + margin: EdgeInsets.only(right: ScreenUtil().setWidth(20)), | ||
| 1361 | + padding: EdgeInsets.symmetric( | ||
| 1362 | + horizontal: ScreenUtil().setWidth(20), | ||
| 1363 | + vertical: ScreenUtil().setWidth(6)), | ||
| 1364 | + decoration: BoxDecoration( | ||
| 1365 | + borderRadius: BorderRadius.circular(ScreenUtil().setWidth(10)), | ||
| 1366 | + color: isSelect ? MyColours.color_199095 : MyColours.color_f5f5f5, | ||
| 1367 | + ), | ||
| 1368 | + child: Align( | ||
| 1369 | + alignment: Alignment.center, | ||
| 1370 | + child: Text( | ||
| 1371 | + content, | ||
| 1372 | + style: TextStyle( | ||
| 1373 | + color: isSelect ? Colors.white : MyColours.color_353535, | ||
| 1374 | + fontSize: ScreenUtil().setSp(28)), | ||
| 1375 | + ), | ||
| 1376 | + ), | ||
| 1377 | + ), | ||
| 1378 | + ); | ||
| 1379 | +} |
| @@ -134,6 +134,7 @@ class HomePageState extends State<HomePage> with WidgetsBindingObserver { | @@ -134,6 +134,7 @@ class HomePageState extends State<HomePage> with WidgetsBindingObserver { | ||
| 134 | /// 开启DEBUG | 134 | /// 开启DEBUG |
| 135 | XgFlutterPlugin().setEnableDebug(false); | 135 | XgFlutterPlugin().setEnableDebug(false); |
| 136 | 136 | ||
| 137 | + | ||
| 137 | /// 添加回调事件 | 138 | /// 添加回调事件 |
| 138 | XgFlutterPlugin().addEventHandler( | 139 | XgFlutterPlugin().addEventHandler( |
| 139 | onRegisteredDeviceToken: (String msg) async { | 140 | onRegisteredDeviceToken: (String msg) async { |
| @@ -434,9 +435,9 @@ class HomePageState extends State<HomePage> with WidgetsBindingObserver { | @@ -434,9 +435,9 @@ class HomePageState extends State<HomePage> with WidgetsBindingObserver { | ||
| 434 | _currIndex = index; | 435 | _currIndex = index; |
| 435 | }); | 436 | }); |
| 436 | if (_currIndex == 3) { | 437 | if (_currIndex == 3) { |
| 437 | - Utils.changeStatusColor(color: MyColours.color_199095); | 438 | + Utils.changeStatusColor(color: Colors.transparent); |
| 438 | } else { | 439 | } else { |
| 439 | - Utils.changeStatusColor(color: MyColours.color_ffffff); | 440 | + Utils.changeStatusColor(color: Colors.white); |
| 440 | } | 441 | } |
| 441 | } | 442 | } |
| 442 | }, | 443 | }, |
| 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:flutter/material.dart'; | 2 | import 'package:flutter/material.dart'; |
| 2 | import 'package:flutter_screenutil/flutter_screenutil.dart'; | 3 | import 'package:flutter_screenutil/flutter_screenutil.dart'; |
| 3 | import 'package:one_key/models/message.dart'; | 4 | import 'package:one_key/models/message.dart'; |
| 5 | +import 'package:one_key/pages/detail/handle_online_page.dart'; | ||
| 6 | +import 'package:one_key/pages/home/home_page.dart'; | ||
| 4 | import 'package:one_key/provider/message_dialog_model.dart'; | 7 | import 'package:one_key/provider/message_dialog_model.dart'; |
| 5 | import 'package:one_key/provider/user_model.dart'; | 8 | import 'package:one_key/provider/user_model.dart'; |
| 6 | import 'package:one_key/res/colors.dart'; | 9 | import 'package:one_key/res/colors.dart'; |
| @@ -10,6 +13,8 @@ import 'package:one_key/widgets/h_empty_view.dart'; | @@ -10,6 +13,8 @@ import 'package:one_key/widgets/h_empty_view.dart'; | ||
| 10 | import 'package:one_key/widgets/v_empty_view.dart'; | 13 | import 'package:one_key/widgets/v_empty_view.dart'; |
| 11 | import 'package:provider/provider.dart'; | 14 | import 'package:provider/provider.dart'; |
| 12 | 15 | ||
| 16 | +import '../../app.dart'; | ||
| 17 | + | ||
| 13 | class MessageDialogItem extends StatelessWidget { | 18 | class MessageDialogItem extends StatelessWidget { |
| 14 | 19 | ||
| 15 | final Message message; | 20 | final Message message; |
lib/pages/my/book_time_set.dart
0 → 100644
| 1 | +import 'package:common_utils/common_utils.dart'; | ||
| 2 | +import 'package:flutter/cupertino.dart'; | ||
| 3 | +import 'package:flutter/material.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'; | ||
| 7 | +import 'package:one_key/models/settime.dart'; | ||
| 8 | +import 'package:one_key/provider/book_set_time_model.dart'; | ||
| 9 | +import 'package:one_key/res/colors.dart'; | ||
| 10 | +import 'package:one_key/utils/dialog_util.dart'; | ||
| 11 | +import 'package:one_key/utils/event_bus.dart'; | ||
| 12 | +import 'package:one_key/utils/utils.dart'; | ||
| 13 | +import 'package:one_key/widgets/MyDivider.dart'; | ||
| 14 | +import 'package:one_key/widgets/common_button.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'; | ||
| 18 | +import 'package:one_key/widgets/v_empty_view.dart'; | ||
| 19 | +import 'package:provider/provider.dart'; | ||
| 20 | + | ||
| 21 | +typedef BookTimeSetCallback = void Function(bool needChange); | ||
| 22 | + | ||
| 23 | +class BookTimeSetPage extends StatefulWidget { | ||
| 24 | + BookTimeSetPage({Key key}) : super(key: key); | ||
| 25 | + | ||
| 26 | + @override | ||
| 27 | + _BookTimeSetPageState createState() => _BookTimeSetPageState(); | ||
| 28 | +} | ||
| 29 | + | ||
| 30 | +class _BookTimeSetPageState extends State<BookTimeSetPage> { | ||
| 31 | + List swichState; | ||
| 32 | + final GlobalKey<ScaffoldState> _scaffoldKey = GlobalKey<ScaffoldState>(); | ||
| 33 | + SetTime morning = SetTime(); | ||
| 34 | + SetTime noon = SetTime(); | ||
| 35 | + SetTime night = SetTime(); | ||
| 36 | + BookSetTimeModel bookSetTimeModel; | ||
| 37 | + | ||
| 38 | + @override | ||
| 39 | + void initState() { | ||
| 40 | + super.initState(); | ||
| 41 | + morning.start = '07:00'; | ||
| 42 | + morning.end = '10:00'; | ||
| 43 | + noon.start = '11:00'; | ||
| 44 | + noon.end = '14:30'; | ||
| 45 | + night.start = '16:00'; | ||
| 46 | + night.end = '21:00'; | ||
| 47 | + swichState = [false, true, true]; | ||
| 48 | + | ||
| 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 | + } | ||
| 189 | + } | ||
| 190 | + }); | ||
| 191 | + } | ||
| 192 | + | ||
| 193 | + ///item 早市,晚市,午时widhet | ||
| 194 | + Widget _itemWidget(String title, String startTime, String endTime, int tag) { | ||
| 195 | + return Container( | ||
| 196 | + color: MyColours.color_ffffff, | ||
| 197 | + child: Column( | ||
| 198 | + children: [ | ||
| 199 | + Padding( | ||
| 200 | + padding: | ||
| 201 | + EdgeInsets.symmetric(horizontal: ScreenUtil().setWidth(40)), | ||
| 202 | + child: Container( | ||
| 203 | + height: ScreenUtil().setWidth(124), | ||
| 204 | + child: Row( | ||
| 205 | + crossAxisAlignment: CrossAxisAlignment.center, | ||
| 206 | + mainAxisAlignment: MainAxisAlignment.spaceBetween, | ||
| 207 | + children: [ | ||
| 208 | + Text(title, | ||
| 209 | + style: TextStyle( | ||
| 210 | + color: MyColours.color_353535, | ||
| 211 | + fontSize: ScreenUtil().setSp(32), | ||
| 212 | + fontWeight: FontWeight.bold)), | ||
| 213 | + InkWell( | ||
| 214 | + onTap: () { | ||
| 215 | + setState(() { | ||
| 216 | + swichState[tag] = !swichState[tag]; | ||
| 217 | + }); | ||
| 218 | + }, | ||
| 219 | + child: Image.asset( | ||
| 220 | + swichState[tag] | ||
| 221 | + ? Utils.getImgPath('swich_on') | ||
| 222 | + : Utils.getImgPath('swich_off'), | ||
| 223 | + width: ScreenUtil().setWidth(122), | ||
| 224 | + height: ScreenUtil().setWidth(82), | ||
| 225 | + ), | ||
| 226 | + ) | ||
| 227 | + ], | ||
| 228 | + ), | ||
| 229 | + )), | ||
| 230 | + MyDivider( | ||
| 231 | + double.infinity, | ||
| 232 | + ScreenUtil().setWidth(2), | ||
| 233 | + color: MyColours.color_f3f3f3, | ||
| 234 | + ), | ||
| 235 | + timeWidget('开始时间', startTime, highted: swichState[tag], onTap: () { | ||
| 236 | + if (swichState[tag]) { | ||
| 237 | + List data = SetTimeWidget.dateData; | ||
| 238 | + if (tag == 0) { | ||
| 239 | + //早市 | ||
| 240 | + data = SetTimeWidget.dateData; | ||
| 241 | + } else if (tag == 1) { | ||
| 242 | + //午市 | ||
| 243 | + data = | ||
| 244 | + Utils.getPickerData(morning.end, SetTimeWidget.dateData); | ||
| 245 | + } else if (tag == 2) { | ||
| 246 | + //晚市 | ||
| 247 | + data = Utils.getPickerData(noon.end, SetTimeWidget.dateData); | ||
| 248 | + } | ||
| 249 | + | ||
| 250 | + SetTimeWidget().showTimeSelector(context, data, startTime, | ||
| 251 | + (value) { | ||
| 252 | + if (value != null) { | ||
| 253 | + String tempMinute = _getMinuteStrFromPicker(data, value); | ||
| 254 | + print(data[value[0]].keys.first); | ||
| 255 | + String time = Utils.getTimeString( | ||
| 256 | + Utils.getHourFromTitle(data[value[0]].keys.first), | ||
| 257 | + tempMinute); | ||
| 258 | + setState(() { | ||
| 259 | + if (tag == 0) { | ||
| 260 | + //早市 | ||
| 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 | + }); | ||
| 291 | + } else if (tag == 1) { | ||
| 292 | + //午市 | ||
| 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 | + }); | ||
| 312 | + } else if (tag == 2) { | ||
| 313 | + //晚市 | ||
| 314 | + night.start = time; | ||
| 315 | + setState(() { | ||
| 316 | + Utils.compareDateTime(night.end, time, (needChange) { | ||
| 317 | + if (needChange) { | ||
| 318 | + night.end = time; | ||
| 319 | + } | ||
| 320 | + }); | ||
| 321 | + }); | ||
| 322 | + } | ||
| 323 | + }); | ||
| 324 | + print(value); | ||
| 325 | + } | ||
| 326 | + }); | ||
| 327 | + } | ||
| 328 | + }), | ||
| 329 | + Padding( | ||
| 330 | + padding: | ||
| 331 | + EdgeInsets.symmetric(horizontal: ScreenUtil().setWidth(40)), | ||
| 332 | + child: MyDivider( | ||
| 333 | + double.infinity, | ||
| 334 | + ScreenUtil().setWidth(2), | ||
| 335 | + color: MyColours.color_f3f3f3, | ||
| 336 | + )), | ||
| 337 | + timeWidget('结束时间', endTime, highted: swichState[tag], onTap: () { | ||
| 338 | + if (swichState[tag]) { | ||
| 339 | + List data = SetTimeWidget.dateData; | ||
| 340 | + if (tag == 0) { | ||
| 341 | + //早市 | ||
| 342 | + data = Utils.getPickerData( | ||
| 343 | + morning.start, SetTimeWidget.dateData); | ||
| 344 | + } else if (tag == 1) { | ||
| 345 | + //午市 | ||
| 346 | + data = | ||
| 347 | + Utils.getPickerData(noon.start, SetTimeWidget.dateData); | ||
| 348 | + } else if (tag == 2) { | ||
| 349 | + //晚市 | ||
| 350 | + data = | ||
| 351 | + Utils.getPickerData(night.start, SetTimeWidget.dateData); | ||
| 352 | + } | ||
| 353 | + SetTimeWidget().showTimeSelector(context, data, startTime, | ||
| 354 | + (value) { | ||
| 355 | + if (value != null) { | ||
| 356 | + String tempMinute = _getMinuteStrFromPicker(data, value); | ||
| 357 | + String time = Utils.getTimeString( | ||
| 358 | + Utils.getHourFromTitle(data[value[0]].keys.first), | ||
| 359 | + tempMinute); | ||
| 360 | + setState(() { | ||
| 361 | + if (tag == 0) { | ||
| 362 | + //早市 | ||
| 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 | + }); | ||
| 387 | + } else if (tag == 1) { | ||
| 388 | + //午市 | ||
| 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 | + }); | ||
| 403 | + } else if (tag == 2) { | ||
| 404 | + //晚市 | ||
| 405 | + night.end = time; | ||
| 406 | + } | ||
| 407 | + }); | ||
| 408 | + print(value); | ||
| 409 | + } | ||
| 410 | + }); | ||
| 411 | + } | ||
| 412 | + }) | ||
| 413 | + ], | ||
| 414 | + )); | ||
| 415 | + } | ||
| 416 | + | ||
| 417 | + ///从时间选择器中获取分钟数字符串 00 or 30 | ||
| 418 | + String _getMinuteStrFromPicker(List data, List value) { | ||
| 419 | + if (data.length == 1) { | ||
| 420 | + return '30'; | ||
| 421 | + } else { | ||
| 422 | + if (value[1] == 0) { | ||
| 423 | + return '00'; | ||
| 424 | + } else { | ||
| 425 | + return '30'; | ||
| 426 | + } | ||
| 427 | + } | ||
| 428 | + } | ||
| 429 | + | ||
| 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 | + ); | ||
| 451 | + } | ||
| 452 | + | ||
| 453 | + @override | ||
| 454 | + Widget build(BuildContext context) { | ||
| 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 | + )), | ||
| 535 | + ), | ||
| 536 | + onWillPop: () async { | ||
| 537 | + EventBus().emit('changeStatusColor'); | ||
| 538 | + return true; | ||
| 539 | + }); | ||
| 540 | + } | ||
| 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,8 @@ import 'package:one_key/provider/my_model.dart'; | @@ -6,6 +6,8 @@ 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'; | ||
| 10 | +import 'package:one_key/utils/navigator_util.dart'; | ||
| 9 | import 'package:one_key/utils/utils.dart'; | 11 | import 'package:one_key/utils/utils.dart'; |
| 10 | import 'package:one_key/widgets/MyDivider.dart'; | 12 | import 'package:one_key/widgets/MyDivider.dart'; |
| 11 | import 'package:one_key/widgets/app_bar.dart'; | 13 | import 'package:one_key/widgets/app_bar.dart'; |
| @@ -28,11 +30,14 @@ class MyPageState extends State<MyPage> with WidgetsBindingObserver { | @@ -28,11 +30,14 @@ class MyPageState extends State<MyPage> with WidgetsBindingObserver { | ||
| 28 | String cur_version = ""; | 30 | String cur_version = ""; |
| 29 | bool newVersion = false; | 31 | bool newVersion = false; |
| 30 | MyModel myModel; | 32 | MyModel myModel; |
| 33 | + ScrollController controller; | ||
| 31 | 34 | ||
| 32 | @override | 35 | @override |
| 33 | void initState() { | 36 | void initState() { |
| 34 | // TODO: implement initState | 37 | // TODO: implement initState |
| 35 | super.initState(); | 38 | super.initState(); |
| 39 | + | ||
| 40 | + controller = ScrollController(initialScrollOffset: 0.0); | ||
| 36 | WidgetsBinding.instance.addObserver(this); | 41 | WidgetsBinding.instance.addObserver(this); |
| 37 | Utils.getCurrVersion().then((version) { | 42 | Utils.getCurrVersion().then((version) { |
| 38 | setState(() { | 43 | setState(() { |
| @@ -43,6 +48,16 @@ class MyPageState extends State<MyPage> with WidgetsBindingObserver { | @@ -43,6 +48,16 @@ class MyPageState extends State<MyPage> with WidgetsBindingObserver { | ||
| 43 | ///获取短信余量 | 48 | ///获取短信余量 |
| 44 | _getSmsInfo(context); | 49 | _getSmsInfo(context); |
| 45 | }); | 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'); | ||
| 46 | } | 61 | } |
| 47 | 62 | ||
| 48 | @override | 63 | @override |
| @@ -70,6 +85,7 @@ class MyPageState extends State<MyPage> with WidgetsBindingObserver { | @@ -70,6 +85,7 @@ class MyPageState extends State<MyPage> with WidgetsBindingObserver { | ||
| 70 | 85 | ||
| 71 | ///获取短信余量 | 86 | ///获取短信余量 |
| 72 | _getSmsInfo(context) async { | 87 | _getSmsInfo(context) async { |
| 88 | + myModel = Provider.of<MyModel>(context, listen: false); | ||
| 73 | await myModel.getSmsInfo(context); | 89 | await myModel.getSmsInfo(context); |
| 74 | // setState(() { | 90 | // setState(() { |
| 75 | // if (smsInfoData != null) { | 91 | // if (smsInfoData != null) { |
| @@ -87,12 +103,110 @@ class MyPageState extends State<MyPage> with WidgetsBindingObserver { | @@ -87,12 +103,110 @@ class MyPageState extends State<MyPage> with WidgetsBindingObserver { | ||
| 87 | @override | 103 | @override |
| 88 | Widget build(BuildContext context) { | 104 | Widget build(BuildContext context) { |
| 89 | myModel = Provider.of<MyModel>(context, listen: true); | 105 | myModel = Provider.of<MyModel>(context, listen: true); |
| 90 | - return Stack( | ||
| 91 | - children: <Widget>[ | ||
| 92 | - Padding( | ||
| 93 | - padding: EdgeInsets.only(top: ScreenUtil().setHeight(242 + 121)), | ||
| 94 | - child: Column( | 106 | + return Scaffold( |
| 107 | + appBar: AppBar( | ||
| 108 | + backgroundColor: MyColours.color_199095, //把appbar的背景色改成透明 | ||
| 109 | + elevation: 0, //appbar的阴影 | ||
| 110 | + centerTitle: true, // 标题居中 | ||
| 111 | + title: Text( | ||
| 112 | + '我的', | ||
| 113 | + style: TextStyle( | ||
| 114 | + color: MyColours.color_fefefe, | ||
| 115 | + fontSize: ScreenUtil().setSp(34), | ||
| 116 | + fontWeight: FontWeight.normal, | ||
| 117 | + decoration: TextDecoration.none), | ||
| 118 | + )), | ||
| 119 | + body: NestedScrollView( | ||
| 120 | + // controller: _scrollViewController, | ||
| 121 | + headerSliverBuilder: (BuildContext context, bool innerBoxIsScrolled) { | ||
| 122 | + return <Widget>[ | ||
| 123 | + SliverAppBar( | ||
| 124 | + pinned: false, | ||
| 125 | + floating: false, | ||
| 126 | + expandedHeight: ScreenUtil().setWidth(200), | ||
| 127 | + flexibleSpace: FlexibleSpaceBar( | ||
| 128 | + collapseMode: CollapseMode.pin, | ||
| 129 | + background: Consumer<UserModel>(builder: | ||
| 130 | + (BuildContext context, UserModel model, Widget child) { | ||
| 131 | + return Stack( | ||
| 132 | + children: [ | ||
| 133 | + Container( | ||
| 134 | + width: double.infinity, | ||
| 135 | + height: ScreenUtil().setHeight(200), | ||
| 136 | + alignment: Alignment.centerLeft, | ||
| 137 | + color: MyColours.color_199095, | ||
| 138 | + ), | ||
| 139 | + Padding( | ||
| 140 | + padding: | ||
| 141 | + EdgeInsets.only(left: ScreenUtil().setWidth(40)), | ||
| 142 | + child: Column( | ||
| 143 | + crossAxisAlignment: CrossAxisAlignment.start, | ||
| 144 | + children: [ | ||
| 145 | + VEmptyView(38), | ||
| 146 | + Text( | ||
| 147 | + model.user.sellername, | ||
| 148 | + style: TextStyle( | ||
| 149 | + color: MyColours.color_ffffff, | ||
| 150 | + fontSize: ScreenUtil().setSp(36)), | ||
| 151 | + ), | ||
| 152 | + VEmptyView(38), | ||
| 153 | + Text( | ||
| 154 | + model.user.account + | ||
| 155 | + " | " + | ||
| 156 | + model.user.role_name, | ||
| 157 | + style: TextStyle( | ||
| 158 | + color: MyColours.color_ffffff, | ||
| 159 | + fontSize: ScreenUtil().setSp(30)), | ||
| 160 | + ), | ||
| 161 | + ], | ||
| 162 | + )) | ||
| 163 | + ], | ||
| 164 | + ); | ||
| 165 | + }), | ||
| 166 | + ), | ||
| 167 | + ) | ||
| 168 | + ]; | ||
| 169 | + }, body: Consumer<UserModel>( | ||
| 170 | + builder: (BuildContext context, UserModel model, Widget child) { | ||
| 171 | + return MediaQuery.removePadding( | ||
| 172 | + context: context, | ||
| 173 | + child: SingleChildScrollView( | ||
| 174 | + child: Column( | ||
| 95 | children: <Widget>[ | 175 | children: <Widget>[ |
| 176 | + // Stack( | ||
| 177 | + // children: [ | ||
| 178 | + // Container( | ||
| 179 | + // width: double.infinity, | ||
| 180 | + // height: ScreenUtil().setHeight(200), | ||
| 181 | + // alignment: Alignment.centerLeft, | ||
| 182 | + // color: MyColours.color_199095, | ||
| 183 | + // ), | ||
| 184 | + // Padding( | ||
| 185 | + // padding: | ||
| 186 | + // EdgeInsets.only(left: ScreenUtil().setWidth(40)), | ||
| 187 | + // child: Column( | ||
| 188 | + // crossAxisAlignment: CrossAxisAlignment.start, | ||
| 189 | + // children: [ | ||
| 190 | + // VEmptyView(38), | ||
| 191 | + // Text( | ||
| 192 | + // model.user.sellername, | ||
| 193 | + // style: TextStyle( | ||
| 194 | + // color: MyColours.color_ffffff, | ||
| 195 | + // fontSize: ScreenUtil().setSp(36)), | ||
| 196 | + // ), | ||
| 197 | + // VEmptyView(38), | ||
| 198 | + // Text( | ||
| 199 | + // model.user.account + | ||
| 200 | + // " | " + | ||
| 201 | + // model.user.role_name, | ||
| 202 | + // style: TextStyle( | ||
| 203 | + // color: MyColours.color_ffffff, | ||
| 204 | + // fontSize: ScreenUtil().setSp(30)), | ||
| 205 | + // ), | ||
| 206 | + // ], | ||
| 207 | + // )) | ||
| 208 | + // ], | ||
| 209 | + // ), | ||
| 96 | VEmptyView(40), | 210 | VEmptyView(40), |
| 97 | MyItem( | 211 | MyItem( |
| 98 | title: "短信管理", | 212 | title: "短信管理", |
| @@ -114,6 +228,42 @@ class MyPageState extends State<MyPage> with WidgetsBindingObserver { | @@ -114,6 +228,42 @@ class MyPageState extends State<MyPage> with WidgetsBindingObserver { | ||
| 114 | Utils.goMiniProgramZm(context, "roomtype/roomtype"); | 228 | Utils.goMiniProgramZm(context, "roomtype/roomtype"); |
| 115 | }, | 229 | }, |
| 116 | ), | 230 | ), |
| 231 | + MyDivider( | ||
| 232 | + double.infinity, | ||
| 233 | + ScreenUtil().setHeight(1), | ||
| 234 | + color: MyColours.color_f3f3f3, | ||
| 235 | + ), | ||
| 236 | + MyItem( | ||
| 237 | + title: "可订时段管理", | ||
| 238 | + content: "", | ||
| 239 | + callback: () { | ||
| 240 | + NavigatorUtil.goBookTimeSetPage(context); | ||
| 241 | + }, | ||
| 242 | + ), | ||
| 243 | + MyDivider( | ||
| 244 | + double.infinity, | ||
| 245 | + ScreenUtil().setHeight(1), | ||
| 246 | + color: MyColours.color_f3f3f3, | ||
| 247 | + ), | ||
| 248 | + MyItem( | ||
| 249 | + title: "接单时间管理", | ||
| 250 | + content: "", | ||
| 251 | + callback: () { | ||
| 252 | + NavigatorUtil.goReceiveOrdersTimeSetPage(context); | ||
| 253 | + }, | ||
| 254 | + ), | ||
| 255 | + MyDivider( | ||
| 256 | + double.infinity, | ||
| 257 | + ScreenUtil().setHeight(1), | ||
| 258 | + color: MyColours.color_f3f3f3, | ||
| 259 | + ), | ||
| 260 | + MyItem( | ||
| 261 | + title: "常用备注管理", | ||
| 262 | + content: "", | ||
| 263 | + callback: () { | ||
| 264 | + NavigatorUtil.goRemarkManagerPage(context); | ||
| 265 | + }, | ||
| 266 | + ), | ||
| 117 | VEmptyView(40), | 267 | VEmptyView(40), |
| 118 | MyItem( | 268 | MyItem( |
| 119 | title: "联系客服", | 269 | title: "联系客服", |
| @@ -229,215 +379,8 @@ class MyPageState extends State<MyPage> with WidgetsBindingObserver { | @@ -229,215 +379,8 @@ class MyPageState extends State<MyPage> with WidgetsBindingObserver { | ||
| 229 | }, | 379 | }, |
| 230 | ) | 380 | ) |
| 231 | ], | 381 | ], |
| 232 | - )), | ||
| 233 | - Container( | ||
| 234 | - width: double.infinity, | ||
| 235 | - height: ScreenUtil().setHeight(242 + 121), | ||
| 236 | - alignment: Alignment.centerLeft, | ||
| 237 | - color: MyColours.color_199095, | ||
| 238 | - child: Scaffold( | ||
| 239 | - backgroundColor: Colors.transparent, //把scaffold的背景色改成透明 | ||
| 240 | - appBar: AppBar( | ||
| 241 | - backgroundColor: Colors.transparent, //把appbar的背景色改成透明 | ||
| 242 | - elevation: 0, //appbar的阴影 | ||
| 243 | - centerTitle: true, // 标题居中 | ||
| 244 | - title: Text( | ||
| 245 | - '我的', | ||
| 246 | - style: TextStyle( | ||
| 247 | - color: MyColours.color_fefefe, | ||
| 248 | - fontSize: ScreenUtil().setSp(34), | ||
| 249 | - fontWeight: FontWeight.normal, | ||
| 250 | - decoration: TextDecoration.none), | ||
| 251 | - )), | ||
| 252 | - body: Consumer<UserModel>( | ||
| 253 | - builder: | ||
| 254 | - (BuildContext context, UserModel model, Widget child) { | ||
| 255 | - return Padding( | ||
| 256 | - padding: | ||
| 257 | - EdgeInsets.only(left: ScreenUtil().setWidth(40)), | ||
| 258 | - child: Column( | ||
| 259 | - crossAxisAlignment: CrossAxisAlignment.start, | ||
| 260 | - children: <Widget>[ | ||
| 261 | - VEmptyView(38), | ||
| 262 | - Text( | ||
| 263 | - model.user.sellername, | ||
| 264 | - style: TextStyle( | ||
| 265 | - color: MyColours.color_ffffff, | ||
| 266 | - fontSize: ScreenUtil().setSp(36)), | ||
| 267 | - ), | ||
| 268 | - VEmptyView(38), | ||
| 269 | - Text( | ||
| 270 | - model.user.account + | ||
| 271 | - " | " + | ||
| 272 | - model.user.role_name, | ||
| 273 | - style: TextStyle( | ||
| 274 | - color: MyColours.color_ffffff, | ||
| 275 | - fontSize: ScreenUtil().setSp(30)), | ||
| 276 | - ), | ||
| 277 | - ], | ||
| 278 | - )); | ||
| 279 | - }, | ||
| 280 | - ))) | ||
| 281 | - ], | ||
| 282 | - ); | ||
| 283 | - // TODO: implement build | ||
| 284 | - /* 原来的 | ||
| 285 | - return Container( | ||
| 286 | - width: double.infinity, | ||
| 287 | - height: double.infinity, | ||
| 288 | - color: MyColours.color_f5f5f5, | ||
| 289 | - child: Column( | ||
| 290 | - children: <Widget>[ | ||
| 291 | - MyAppBar( | ||
| 292 | - "我的", | ||
| 293 | - showBack: false, | ||
| 294 | - backgroundColor: MyColours.color_199095, | ||
| 295 | - fontColor: MyColours.color_fefefe, | ||
| 296 | - ), | ||
| 297 | - Container( | ||
| 298 | - width: double.infinity, | ||
| 299 | - height: ScreenUtil().setHeight(242), | ||
| 300 | - alignment: Alignment.centerLeft, | ||
| 301 | - padding: EdgeInsets.only(left: ScreenUtil().setWidth(40)), | ||
| 302 | - color: MyColours.color_199095, | ||
| 303 | - child: Consumer<UserModel>( | ||
| 304 | - builder: (BuildContext context, UserModel model, Widget child) { | ||
| 305 | - return Column( | ||
| 306 | - crossAxisAlignment: CrossAxisAlignment.start, | ||
| 307 | - children: <Widget>[ | ||
| 308 | - VEmptyView(38), | ||
| 309 | - Text( | ||
| 310 | - model.user.sellername, | ||
| 311 | - style: TextStyle( | ||
| 312 | - color: MyColours.color_ffffff, | ||
| 313 | - fontSize: ScreenUtil().setSp(36)), | ||
| 314 | - ), | ||
| 315 | - VEmptyView(38), | ||
| 316 | - Text( | ||
| 317 | - model.user.account + " | " + model.user.role_name, | ||
| 318 | - style: TextStyle( | ||
| 319 | - color: MyColours.color_ffffff, | ||
| 320 | - fontSize: ScreenUtil().setSp(30)), | ||
| 321 | - ), | ||
| 322 | - ], | ||
| 323 | - ); | ||
| 324 | - }, | ||
| 325 | - )), | ||
| 326 | - VEmptyView(44), | ||
| 327 | - MyItem( | ||
| 328 | - title: "联系客服", | ||
| 329 | - content: "09:00~21:00", | ||
| 330 | - callback: () { | ||
| 331 | - Utils.goPhone("400-000-9690"); | ||
| 332 | - }, | ||
| 333 | - ), | ||
| 334 | - MyDivider( | ||
| 335 | - double.infinity, | ||
| 336 | - ScreenUtil().setHeight(1), | ||
| 337 | - color: MyColours.color_f3f3f3, | ||
| 338 | - ), | ||
| 339 | - MyItem( | ||
| 340 | - title: "帮助与反馈", | ||
| 341 | - content: "", | ||
| 342 | - callback: () { | ||
| 343 | - Utils.goHelp(context); | ||
| 344 | - }, | ||
| 345 | - ), | ||
| 346 | - MyDivider(double.infinity, ScreenUtil().setHeight(1), | ||
| 347 | - color: MyColours.color_f3f3f3), | ||
| 348 | - GestureDetector( | ||
| 349 | - onTap: checkUpdate, | ||
| 350 | - child: Container( | ||
| 351 | - width: double.infinity, | ||
| 352 | - height: ScreenUtil().setHeight(122), | ||
| 353 | - color: MyColours.color_ffffff, | ||
| 354 | - padding: | ||
| 355 | - EdgeInsets.symmetric(horizontal: ScreenUtil().setWidth(40)), | ||
| 356 | - alignment: Alignment.center, | ||
| 357 | - child: Row( | ||
| 358 | - children: <Widget>[ | ||
| 359 | - Text( | ||
| 360 | - "版本更新", | ||
| 361 | - style: TextStyle( | ||
| 362 | - fontSize: ScreenUtil().setSp(30), | ||
| 363 | - color: MyColours.color_353535), | ||
| 364 | - ), | ||
| 365 | - Spacer(), | ||
| 366 | - newVersion | ||
| 367 | - ? Container( | ||
| 368 | - width: ScreenUtil().setWidth(120), | ||
| 369 | - height: ScreenUtil().setWidth(34), | ||
| 370 | - decoration: BoxDecoration( | ||
| 371 | - color: MyColours.color_E14553, | ||
| 372 | - borderRadius: BorderRadius.all( | ||
| 373 | - Radius.circular(ScreenUtil().setWidth(6))), | ||
| 374 | - ), | ||
| 375 | - child: Center( | ||
| 376 | - child: Text( | ||
| 377 | - "发现新版本", | ||
| 378 | - style: TextStyle( | ||
| 379 | - fontSize: ScreenUtil().setSp(24), | ||
| 380 | - color: MyColours.color_ffffff), | ||
| 381 | - ), | ||
| 382 | - ), | ||
| 383 | - ) | ||
| 384 | - : Text( | ||
| 385 | - cur_version, | ||
| 386 | - style: TextStyle( | ||
| 387 | - fontSize: ScreenUtil().setSp(28), | ||
| 388 | - color: MyColours.color_666666), | ||
| 389 | - ), | ||
| 390 | - HEmptyView(20), | ||
| 391 | - Image.asset( | ||
| 392 | - "assets/arr_right_gray.png", | ||
| 393 | - width: ScreenUtil().setWidth(14), | ||
| 394 | - height: ScreenUtil().setWidth(22), | ||
| 395 | - ) | ||
| 396 | - ], | ||
| 397 | - ), | ||
| 398 | - ), | ||
| 399 | - ), | ||
| 400 | - MyDivider( | ||
| 401 | - double.infinity, | ||
| 402 | - ScreenUtil().setHeight(1), | ||
| 403 | - color: MyColours.color_f3f3f3, | ||
| 404 | - ), | ||
| 405 | - VEmptyView(40), | ||
| 406 | - Consumer<UserModel>( | ||
| 407 | - builder: (BuildContext context, UserModel model, Widget child) { | ||
| 408 | - return GestureDetector( | ||
| 409 | - onTap: () { | ||
| 410 | - model.showLoginOutDialog(context); | ||
| 411 | - }, | ||
| 412 | - child: Container( | ||
| 413 | - height: ScreenUtil().setHeight(122), | ||
| 414 | - color: MyColours.color_ffffff, | ||
| 415 | - child: Center( | ||
| 416 | - child: Row( | ||
| 417 | - mainAxisSize: MainAxisSize.min, | ||
| 418 | - crossAxisAlignment: CrossAxisAlignment.center, | ||
| 419 | - children: <Widget>[ | ||
| 420 | - Image.asset( | ||
| 421 | - "assets/icon_exist.png", | ||
| 422 | - width: ScreenUtil().setWidth(30), | ||
| 423 | - height: ScreenUtil().setWidth(30), | ||
| 424 | - ), | ||
| 425 | - HEmptyView(18), | ||
| 426 | - Text("退出登录", | ||
| 427 | - style: TextStyle( | ||
| 428 | - color: MyColours.color_199095, | ||
| 429 | - fontSize: ScreenUtil().setSp(34), | ||
| 430 | - )) | ||
| 431 | - ], | ||
| 432 | - ), | ||
| 433 | - ), | ||
| 434 | - ), | ||
| 435 | - ); | ||
| 436 | - }, | ||
| 437 | - ) | ||
| 438 | - ], | ||
| 439 | - ), | 382 | + ))); |
| 383 | + })), | ||
| 440 | ); | 384 | ); |
| 441 | - */ | ||
| 442 | } | 385 | } |
| 443 | } | 386 | } |
lib/pages/my/receive_orders_time_set.dart
0 → 100644
| 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 | +} |
lib/pages/my/remark_manager_page.dart
0 → 100644
| 1 | +import 'package:flutter/material.dart'; | ||
| 2 | +import 'package:flutter/services.dart'; | ||
| 3 | +import 'package:flutter_screenutil/screenutil.dart'; | ||
| 4 | +import 'package:one_key/constant/state.dart'; | ||
| 5 | +import 'package:one_key/models/remark.dart'; | ||
| 6 | +import 'package:one_key/provider/remark_manager_model.dart'; | ||
| 7 | +import 'package:one_key/provider/user_model.dart'; | ||
| 8 | +import 'package:one_key/res/colors.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/h_empty_view.dart'; | ||
| 13 | +import 'package:one_key/widgets/page_exception.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 | +import '../../app.dart'; | ||
| 19 | + | ||
| 20 | +class RemarkManagerPage extends StatefulWidget { | ||
| 21 | + @override | ||
| 22 | + State<StatefulWidget> createState() { | ||
| 23 | + // TODO: implement createState | ||
| 24 | + return RemarkManagerPageState(); | ||
| 25 | + } | ||
| 26 | +} | ||
| 27 | + | ||
| 28 | +class RemarkManagerPageState extends State<RemarkManagerPage> { | ||
| 29 | + RemarkManagerModel remarkManagerModel; | ||
| 30 | + | ||
| 31 | + bool isAdding = false; //正在添加备注 | ||
| 32 | + | ||
| 33 | + TextEditingController _controller = TextEditingController(); | ||
| 34 | + FocusNode focusNode = FocusNode(); | ||
| 35 | + | ||
| 36 | + int alwaysCount = 0; //常用备注数 | ||
| 37 | + | ||
| 38 | + @override | ||
| 39 | + void initState() { | ||
| 40 | + // TODO: implement initState | ||
| 41 | + super.initState(); | ||
| 42 | + | ||
| 43 | + WidgetsBinding.instance.addPostFrameCallback((timeStamp) { | ||
| 44 | + _getRemarks(showPageLoading: true); | ||
| 45 | + }); | ||
| 46 | + } | ||
| 47 | + | ||
| 48 | + //获取备注 | ||
| 49 | + _getRemarks({bool showPageLoading = false}) { | ||
| 50 | + Map<String, String> params = { | ||
| 51 | + "uid": Provider.of<UserModel>(context, listen: false).user.openid | ||
| 52 | + }; | ||
| 53 | + remarkManagerModel.getRemarks(context, params, | ||
| 54 | + showPageLoading: showPageLoading); | ||
| 55 | + } | ||
| 56 | + | ||
| 57 | + //添加备注 | ||
| 58 | + _addRemark() async { | ||
| 59 | + Map<String, String> params = { | ||
| 60 | + "uid": Provider.of<UserModel>(context, listen: false).user.openid, | ||
| 61 | + "custom": _controller.text | ||
| 62 | + }; | ||
| 63 | + await remarkManagerModel.addRemark(context, params); | ||
| 64 | + _getRemarks(showPageLoading: false); //添加完重新获取备注信息 | ||
| 65 | + } | ||
| 66 | + | ||
| 67 | + //添加常用备注 | ||
| 68 | + _addCustomRemark(Remark remark) { | ||
| 69 | + Map<String, String> params = { | ||
| 70 | + "uid": Provider.of<UserModel>(context, listen: false).user.openid, | ||
| 71 | + "kid": remark.id, | ||
| 72 | + "flag": "custom" | ||
| 73 | + }; | ||
| 74 | + remarkManagerModel.getRemarks(context, params); | ||
| 75 | + } | ||
| 76 | + | ||
| 77 | + //取消常用备注 | ||
| 78 | + _delCustomRemark(Remark remark) { | ||
| 79 | + if (remark.id == "-1") return; | ||
| 80 | + Map<String, String> params = { | ||
| 81 | + "uid": Provider.of<UserModel>(context, listen: false).user.openid, | ||
| 82 | + "kid": remark.id, | ||
| 83 | + "flag": "often" | ||
| 84 | + }; | ||
| 85 | + remarkManagerModel.getRemarks(context, params); | ||
| 86 | + } | ||
| 87 | + | ||
| 88 | + //构建常用备注 | ||
| 89 | + List<Widget> _buildAlwayItems() { | ||
| 90 | + List<Widget> always = []; | ||
| 91 | + for (Remark remark in remarkManagerModel.remarks) { | ||
| 92 | + if (remark.oftenUse != null && remark.oftenUse.isNotEmpty) | ||
| 93 | + always.add(Container( | ||
| 94 | + height: ScreenUtil().setWidth(50), | ||
| 95 | + decoration: BoxDecoration( | ||
| 96 | + color: MyColours.color_199095, | ||
| 97 | + borderRadius: BorderRadius.circular(ScreenUtil().setWidth(10))), | ||
| 98 | + child: Row(mainAxisSize: MainAxisSize.min, children: <Widget>[ | ||
| 99 | + Flexible( | ||
| 100 | + child: Padding( | ||
| 101 | + padding: | ||
| 102 | + EdgeInsets.symmetric(horizontal: ScreenUtil().setWidth(20)), | ||
| 103 | + child: Text( | ||
| 104 | + "${remark.oftenUse}", | ||
| 105 | + style: TextStyle( | ||
| 106 | + fontSize: ScreenUtil().setSp(30), | ||
| 107 | + color: MyColours.color_ffffff, | ||
| 108 | + ), | ||
| 109 | + overflow: TextOverflow.ellipsis, | ||
| 110 | + ), | ||
| 111 | + ), | ||
| 112 | + ), | ||
| 113 | + MyDivider( | ||
| 114 | + ScreenUtil().setWidth(2), | ||
| 115 | + ScreenUtil().setWidth(30), | ||
| 116 | + color: MyColours.color_6AB6B9, | ||
| 117 | + ), | ||
| 118 | + GestureDetector( | ||
| 119 | + onTap: () { | ||
| 120 | + setState(() { | ||
| 121 | + remark.oftenUse = ""; | ||
| 122 | + }); | ||
| 123 | + _delCustomRemark(remark); | ||
| 124 | + }, | ||
| 125 | + child: Padding( | ||
| 126 | + padding: EdgeInsets.all(ScreenUtil().setWidth(10)), | ||
| 127 | + child: Image.asset( | ||
| 128 | + "assets/icon_remark_del.png", | ||
| 129 | + width: ScreenUtil().setWidth(18), | ||
| 130 | + height: ScreenUtil().setWidth(18), | ||
| 131 | + ), | ||
| 132 | + )) | ||
| 133 | + ]), | ||
| 134 | + )); | ||
| 135 | + } | ||
| 136 | + alwaysCount = always.length; | ||
| 137 | + return always; | ||
| 138 | + } | ||
| 139 | + | ||
| 140 | + //构建所有备注 | ||
| 141 | + List<Widget> _buildAllItems() { | ||
| 142 | + List<Widget> alls = []; | ||
| 143 | + for (Remark remark in remarkManagerModel.remarks) { | ||
| 144 | + alls.add( | ||
| 145 | + GestureDetector( | ||
| 146 | + onTap: () { | ||
| 147 | + if (alwaysCount >= 10) { | ||
| 148 | + Utils.showToast("最多添加10个常用备注"); | ||
| 149 | + return; | ||
| 150 | + } | ||
| 151 | + setState(() { | ||
| 152 | + remark.oftenUse = remark.custom; | ||
| 153 | + _addCustomRemark(remark); | ||
| 154 | + }); | ||
| 155 | + }, | ||
| 156 | + child: Container( | ||
| 157 | + height: ScreenUtil().setWidth(50), | ||
| 158 | + padding: | ||
| 159 | + EdgeInsets.symmetric(horizontal: ScreenUtil().setWidth(20)), | ||
| 160 | + decoration: | ||
| 161 | + (remark.oftenUse != null && remark.oftenUse.isNotEmpty) | ||
| 162 | + ? BoxDecoration( | ||
| 163 | + color: MyColours.color_199095, | ||
| 164 | + borderRadius: | ||
| 165 | + BorderRadius.circular(ScreenUtil().setWidth(10))) | ||
| 166 | + : BoxDecoration( | ||
| 167 | + color: MyColours.color_ffffff, | ||
| 168 | + borderRadius: | ||
| 169 | + BorderRadius.circular(ScreenUtil().setWidth(10)), | ||
| 170 | + border: Border.all( | ||
| 171 | + color: MyColours.color_6AB6B9, | ||
| 172 | + width: ScreenUtil().setWidth(2))), | ||
| 173 | + child: Row(mainAxisSize: MainAxisSize.min, children: <Widget>[ | ||
| 174 | + Flexible( | ||
| 175 | + child: Text( | ||
| 176 | + "${remark.custom}", | ||
| 177 | + style: TextStyle( | ||
| 178 | + fontSize: ScreenUtil().setSp(30), | ||
| 179 | + color: | ||
| 180 | + (remark.oftenUse != null && remark.oftenUse.isNotEmpty) | ||
| 181 | + ? MyColours.color_ffffff | ||
| 182 | + : MyColours.color_199095, | ||
| 183 | + ), | ||
| 184 | + overflow: TextOverflow.ellipsis, | ||
| 185 | + )), | ||
| 186 | + ]), | ||
| 187 | + )), | ||
| 188 | + ); | ||
| 189 | + } | ||
| 190 | + alls.add(Stack( | ||
| 191 | + children: [ | ||
| 192 | + isAdding | ||
| 193 | + ? Container( | ||
| 194 | + width: ScreenUtil().setWidth(200), | ||
| 195 | + height: ScreenUtil().setWidth(50), | ||
| 196 | + alignment: Alignment.center, | ||
| 197 | + padding: | ||
| 198 | + EdgeInsets.symmetric(horizontal: ScreenUtil().setWidth(20)), | ||
| 199 | + decoration: BoxDecoration( | ||
| 200 | + border: Border.all( | ||
| 201 | + color: MyColours.color_cccccc, | ||
| 202 | + width: ScreenUtil().setWidth(2)), | ||
| 203 | + borderRadius: | ||
| 204 | + BorderRadius.circular(ScreenUtil().setWidth(10))), | ||
| 205 | + child: TextField( | ||
| 206 | + controller: _controller, | ||
| 207 | + focusNode: focusNode, | ||
| 208 | + autofocus: true, | ||
| 209 | + textInputAction: TextInputAction.done, | ||
| 210 | + textAlignVertical: TextAlignVertical.center, | ||
| 211 | + keyboardType: TextInputType.text, | ||
| 212 | + decoration: InputDecoration.collapsed(hintText: ""), | ||
| 213 | + inputFormatters: [LengthLimitingTextInputFormatter(10)], | ||
| 214 | + style: TextStyle( | ||
| 215 | + color: MyColours.color_353535, | ||
| 216 | + fontSize: ScreenUtil().setSp(30), | ||
| 217 | + textBaseline: TextBaseline.alphabetic), | ||
| 218 | + onEditingComplete: () { | ||
| 219 | + if (_controller.text.isEmpty) { | ||
| 220 | + setState(() { | ||
| 221 | + isAdding = false; | ||
| 222 | + return; | ||
| 223 | + }); | ||
| 224 | + } | ||
| 225 | + setState(() { | ||
| 226 | + isAdding = false; | ||
| 227 | + }); | ||
| 228 | + _addRemark(); | ||
| 229 | + _controller.clear(); | ||
| 230 | + }, | ||
| 231 | + )) | ||
| 232 | + : GestureDetector( | ||
| 233 | + onTap: () { | ||
| 234 | + if (remarkManagerModel.remarks.length >= 20) { | ||
| 235 | + Utils.showToast("最多添加20个备注"); | ||
| 236 | + return; | ||
| 237 | + } | ||
| 238 | + if (alwaysCount >= 10) { | ||
| 239 | + Utils.showToast("最多添加10个常用备注"); | ||
| 240 | + return; | ||
| 241 | + } | ||
| 242 | + setState(() { | ||
| 243 | + isAdding = true; | ||
| 244 | + }); | ||
| 245 | + }, | ||
| 246 | + child: Container( | ||
| 247 | + width: ScreenUtil().setWidth(200), | ||
| 248 | + height: ScreenUtil().setWidth(50), | ||
| 249 | + alignment: Alignment.center, | ||
| 250 | + decoration: BoxDecoration( | ||
| 251 | + border: Border.all( | ||
| 252 | + color: MyColours.color_cccccc, | ||
| 253 | + width: ScreenUtil().setWidth(2)), | ||
| 254 | + borderRadius: | ||
| 255 | + BorderRadius.circular(ScreenUtil().setWidth(10))), | ||
| 256 | + child: Row( | ||
| 257 | + mainAxisSize: MainAxisSize.min, | ||
| 258 | + children: [ | ||
| 259 | + Image.asset( | ||
| 260 | + "assets/icon_remark_add.png", | ||
| 261 | + width: ScreenUtil().setWidth(30), | ||
| 262 | + height: ScreenUtil().setWidth(30), | ||
| 263 | + ), | ||
| 264 | + HEmptyView(10), | ||
| 265 | + Text( | ||
| 266 | + "添加备注", | ||
| 267 | + style: TextStyle( | ||
| 268 | + color: MyColours.color_999999, | ||
| 269 | + fontSize: ScreenUtil().setSp(30)), | ||
| 270 | + ) | ||
| 271 | + ], | ||
| 272 | + ), | ||
| 273 | + ), | ||
| 274 | + ) | ||
| 275 | + ], | ||
| 276 | + )); | ||
| 277 | + return alls; | ||
| 278 | + } | ||
| 279 | + | ||
| 280 | + @override | ||
| 281 | + Widget build(BuildContext context) { | ||
| 282 | + // TODO: implement build | ||
| 283 | + remarkManagerModel = | ||
| 284 | + Provider.of<RemarkManagerModel>(context, listen: false); | ||
| 285 | + return WillPopScope( | ||
| 286 | + child: Scaffold( | ||
| 287 | + backgroundColor: MyColours.color_ffffff, | ||
| 288 | + appBar: SystemAppBar( | ||
| 289 | + '常用备注管理', | ||
| 290 | + onTap: () { | ||
| 291 | + EventBus().emit('changeStatusColor'); | ||
| 292 | + Navigator.of(context).pop(); | ||
| 293 | + }, | ||
| 294 | + ), | ||
| 295 | + body: SafeArea( | ||
| 296 | + child: Consumer<RemarkManagerModel>( | ||
| 297 | + builder: (context, model, _) { | ||
| 298 | + if (model.pageState != PageState.Success) { | ||
| 299 | + return ExceptionPage( | ||
| 300 | + pageState: model.pageState, | ||
| 301 | + callback: () { | ||
| 302 | + _getRemarks(showPageLoading: true); | ||
| 303 | + }, | ||
| 304 | + emptyMsg: "暂时没有备注哦", | ||
| 305 | + emptyImg: "empty_search", | ||
| 306 | + showMsg: "加载中,请稍后...", | ||
| 307 | + ); | ||
| 308 | + } else { | ||
| 309 | + return Container( | ||
| 310 | + padding: EdgeInsets.symmetric( | ||
| 311 | + horizontal: ScreenUtil().setWidth(40)), | ||
| 312 | + child: Column( | ||
| 313 | + crossAxisAlignment: CrossAxisAlignment.start, | ||
| 314 | + children: [ | ||
| 315 | + VEmptyView(60), | ||
| 316 | + Row( | ||
| 317 | + crossAxisAlignment: CrossAxisAlignment.end, | ||
| 318 | + children: [ | ||
| 319 | + Text( | ||
| 320 | + "我的常用备注", | ||
| 321 | + style: TextStyle( | ||
| 322 | + color: MyColours.color_353535, | ||
| 323 | + fontSize: ScreenUtil().setSp(30), | ||
| 324 | + fontWeight: FontWeight.bold), | ||
| 325 | + ), | ||
| 326 | + Text( | ||
| 327 | + "(最多添加10个)", | ||
| 328 | + style: TextStyle( | ||
| 329 | + color: MyColours.color_666666, | ||
| 330 | + fontSize: ScreenUtil().setSp(26)), | ||
| 331 | + ), | ||
| 332 | + ], | ||
| 333 | + ), | ||
| 334 | + Padding( | ||
| 335 | + padding: EdgeInsets.symmetric( | ||
| 336 | + vertical: ScreenUtil().setWidth(40)), | ||
| 337 | + child: Wrap( | ||
| 338 | + spacing: ScreenUtil().setWidth(20), | ||
| 339 | + runSpacing: ScreenUtil().setWidth(20), | ||
| 340 | + children: _buildAlwayItems()), | ||
| 341 | + ), | ||
| 342 | + MyDivider( | ||
| 343 | + double.infinity, | ||
| 344 | + ScreenUtil().setWidth(2), | ||
| 345 | + color: MyColours.color_f3f3f3, | ||
| 346 | + ), | ||
| 347 | + VEmptyView(40), | ||
| 348 | + Row( | ||
| 349 | + crossAxisAlignment: CrossAxisAlignment.end, | ||
| 350 | + children: [ | ||
| 351 | + Text( | ||
| 352 | + "所有备注", | ||
| 353 | + style: TextStyle( | ||
| 354 | + color: MyColours.color_353535, | ||
| 355 | + fontSize: ScreenUtil().setSp(30), | ||
| 356 | + fontWeight: FontWeight.bold), | ||
| 357 | + ), | ||
| 358 | + Text( | ||
| 359 | + "(最多添加20个)", | ||
| 360 | + style: TextStyle( | ||
| 361 | + color: MyColours.color_666666, | ||
| 362 | + fontSize: ScreenUtil().setSp(26)), | ||
| 363 | + ), | ||
| 364 | + ], | ||
| 365 | + ), | ||
| 366 | + Padding( | ||
| 367 | + padding: EdgeInsets.symmetric( | ||
| 368 | + vertical: ScreenUtil().setWidth(40)), | ||
| 369 | + child: Wrap( | ||
| 370 | + spacing: ScreenUtil().setWidth(20), | ||
| 371 | + runSpacing: ScreenUtil().setWidth(20), | ||
| 372 | + children: _buildAllItems()), | ||
| 373 | + ) | ||
| 374 | + ], | ||
| 375 | + ), | ||
| 376 | + ); | ||
| 377 | + } | ||
| 378 | + }, | ||
| 379 | + ), | ||
| 380 | + )), | ||
| 381 | + onWillPop: () async { | ||
| 382 | + EventBus().emit('changeStatusColor'); | ||
| 383 | + return true; | ||
| 384 | + }); | ||
| 385 | + } | ||
| 386 | +} |
| @@ -20,7 +20,6 @@ import 'package:one_key/widgets/page_exception.dart'; | @@ -20,7 +20,6 @@ import 'package:one_key/widgets/page_exception.dart'; | ||
| 20 | import 'package:provider/provider.dart'; | 20 | import 'package:provider/provider.dart'; |
| 21 | 21 | ||
| 22 | class NoteBookPage extends StatefulWidget { | 22 | class NoteBookPage extends StatefulWidget { |
| 23 | - | ||
| 24 | @override | 23 | @override |
| 25 | State<StatefulWidget> createState() { | 24 | State<StatefulWidget> createState() { |
| 26 | // TODO: implement createState | 25 | // TODO: implement createState |
| @@ -41,6 +40,8 @@ class NoteBookPageState extends State<NoteBookPage> { | @@ -41,6 +40,8 @@ class NoteBookPageState extends State<NoteBookPage> { | ||
| 41 | 40 | ||
| 42 | UserModel userModel; | 41 | UserModel userModel; |
| 43 | 42 | ||
| 43 | + int tabIndex = 0; //当前选中的tab 标签 | ||
| 44 | + | ||
| 44 | @override | 45 | @override |
| 45 | void initState() { | 46 | void initState() { |
| 46 | // TODO: implement initState | 47 | // TODO: implement initState |
| @@ -68,7 +69,7 @@ class NoteBookPageState extends State<NoteBookPage> { | @@ -68,7 +69,7 @@ class NoteBookPageState extends State<NoteBookPage> { | ||
| 68 | //初始化时间 | 69 | //初始化时间 |
| 69 | _initTime() { | 70 | _initTime() { |
| 70 | dateTime = DateTime.now(); | 71 | dateTime = DateTime.now(); |
| 71 | - dateText = Utils.addZeroNumber(dateTime.month) + | 72 | + dateText = "${dateTime.year}年 "+Utils.addZeroNumber(dateTime.month) + |
| 72 | "月" + | 73 | "月" + |
| 73 | Utils.addZeroNumber(dateTime.day) + | 74 | Utils.addZeroNumber(dateTime.day) + |
| 74 | "日" + | 75 | "日" + |
| @@ -141,6 +142,9 @@ class NoteBookPageState extends State<NoteBookPage> { | @@ -141,6 +142,9 @@ class NoteBookPageState extends State<NoteBookPage> { | ||
| 141 | "keywords": "", | 142 | "keywords": "", |
| 142 | "sort": "1" | 143 | "sort": "1" |
| 143 | }; | 144 | }; |
| 145 | + if(tabIndex==1){ | ||
| 146 | + params["account"]=userModel.user.account; | ||
| 147 | + } | ||
| 144 | model.getReserveList(context, params); | 148 | model.getReserveList(context, params); |
| 145 | } | 149 | } |
| 146 | 150 | ||
| @@ -180,6 +184,9 @@ class NoteBookPageState extends State<NoteBookPage> { | @@ -180,6 +184,9 @@ class NoteBookPageState extends State<NoteBookPage> { | ||
| 180 | ? "0" + dateTime.day.toString() | 184 | ? "0" + dateTime.day.toString() |
| 181 | : dateTime.day.toString()) | 185 | : dateTime.day.toString()) |
| 182 | }; | 186 | }; |
| 187 | + if(tabIndex==1){ | ||
| 188 | + params["account"]=userModel.user.account; | ||
| 189 | + } | ||
| 183 | model.getReserveCountDay(context, params); | 190 | model.getReserveCountDay(context, params); |
| 184 | } | 191 | } |
| 185 | 192 | ||
| @@ -256,7 +263,7 @@ class NoteBookPageState extends State<NoteBookPage> { | @@ -256,7 +263,7 @@ class NoteBookPageState extends State<NoteBookPage> { | ||
| 256 | if (Utils.isOneDay(day, dateTime)) return; //日期没变 | 263 | if (Utils.isOneDay(day, dateTime)) return; //日期没变 |
| 257 | setState(() { | 264 | setState(() { |
| 258 | DateTime dateNow = DateTime.now(); | 265 | DateTime dateNow = DateTime.now(); |
| 259 | - dateText = Utils.addZeroNumber(day.month) + | 266 | + dateText = "${day.year}年 "+Utils.addZeroNumber(day.month) + |
| 260 | "月" + | 267 | "月" + |
| 261 | Utils.addZeroNumber(day.day) + | 268 | Utils.addZeroNumber(day.day) + |
| 262 | "日"; | 269 | "日"; |
| @@ -275,6 +282,122 @@ class NoteBookPageState extends State<NoteBookPage> { | @@ -275,6 +282,122 @@ class NoteBookPageState extends State<NoteBookPage> { | ||
| 275 | _reserveCountDay(); | 282 | _reserveCountDay(); |
| 276 | } | 283 | } |
| 277 | 284 | ||
| 285 | + Widget _buildTabbar() { | ||
| 286 | + Container container = Container( | ||
| 287 | + color: MyColours.color_ffffff, | ||
| 288 | + width: double.infinity, | ||
| 289 | + padding: EdgeInsets.only(left: ScreenUtil().setWidth(20),top: ScreenUtil().setWidth(20)), | ||
| 290 | + child: Row( | ||
| 291 | + mainAxisSize: MainAxisSize.min, | ||
| 292 | + children: <Widget>[ | ||
| 293 | + Container( | ||
| 294 | + padding: EdgeInsets.symmetric(horizontal: ScreenUtil().setWidth(20)), | ||
| 295 | + child: GestureDetector( | ||
| 296 | + onTap: () { | ||
| 297 | + if(tabIndex==0)return; | ||
| 298 | + setState(() { | ||
| 299 | + tabIndex = 0; | ||
| 300 | + _getReserveList(); | ||
| 301 | + _reserveCountDay(); | ||
| 302 | + }); | ||
| 303 | + }, | ||
| 304 | + child: Column( | ||
| 305 | + mainAxisAlignment: MainAxisAlignment.center, | ||
| 306 | + children: <Widget>[ | ||
| 307 | + Text( | ||
| 308 | + "全部预订", | ||
| 309 | + style: TextStyle( | ||
| 310 | + color: tabIndex == 0 | ||
| 311 | + ? MyColours.color_353535 | ||
| 312 | + : MyColours.color_999999, | ||
| 313 | + fontSize: tabIndex == 0 | ||
| 314 | + ? ScreenUtil().setSp(36) | ||
| 315 | + : ScreenUtil().setSp(28), | ||
| 316 | + fontWeight: tabIndex == 0 | ||
| 317 | + ? FontWeight.bold | ||
| 318 | + : FontWeight.normal), | ||
| 319 | + ), | ||
| 320 | + Align( | ||
| 321 | + alignment: Alignment.bottomCenter, | ||
| 322 | + child: Container( | ||
| 323 | + height: ScreenUtil().setWidth(6), | ||
| 324 | + width: ScreenUtil().setWidth(60), | ||
| 325 | + margin: | ||
| 326 | + EdgeInsets.only(top: ScreenUtil().setWidth(8)), | ||
| 327 | + decoration: tabIndex == 0 | ||
| 328 | + ? BoxDecoration(color: MyColours.color_199095,borderRadius: BorderRadius.circular( | ||
| 329 | + ScreenUtil() | ||
| 330 | + .setWidth( | ||
| 331 | + 6))) | ||
| 332 | + : BoxDecoration( | ||
| 333 | + color: MyColours.color_ffffff, | ||
| 334 | + borderRadius: BorderRadius.circular( | ||
| 335 | + ScreenUtil() | ||
| 336 | + .setWidth( | ||
| 337 | + 6)) | ||
| 338 | + ), | ||
| 339 | + ), | ||
| 340 | + ), | ||
| 341 | + ], | ||
| 342 | + )), | ||
| 343 | + ), | ||
| 344 | + Container( | ||
| 345 | + padding: EdgeInsets.symmetric(horizontal: ScreenUtil().setWidth(20)), | ||
| 346 | + child: GestureDetector( | ||
| 347 | + onTap: () { | ||
| 348 | + if(tabIndex==1)return; | ||
| 349 | + setState(() { | ||
| 350 | + tabIndex = 1; | ||
| 351 | + _getReserveList(); | ||
| 352 | + _reserveCountDay(); | ||
| 353 | + }); | ||
| 354 | + }, | ||
| 355 | + child: Column( | ||
| 356 | + mainAxisAlignment: MainAxisAlignment.center, | ||
| 357 | + children: <Widget>[ | ||
| 358 | + Text( | ||
| 359 | + "我录入的", | ||
| 360 | + style: TextStyle( | ||
| 361 | + color: tabIndex == 1 | ||
| 362 | + ? MyColours.color_353535 | ||
| 363 | + : MyColours.color_999999, | ||
| 364 | + fontSize: tabIndex == 1 | ||
| 365 | + ? ScreenUtil().setSp(36) | ||
| 366 | + : ScreenUtil().setSp(28), | ||
| 367 | + fontWeight: tabIndex == 1 | ||
| 368 | + ? FontWeight.bold | ||
| 369 | + : FontWeight.normal), | ||
| 370 | + ), | ||
| 371 | + Align( | ||
| 372 | + alignment: Alignment.bottomCenter, | ||
| 373 | + child: Container( | ||
| 374 | + height: ScreenUtil().setWidth(6), | ||
| 375 | + width: ScreenUtil().setWidth(60), | ||
| 376 | + margin: | ||
| 377 | + EdgeInsets.only(top: ScreenUtil().setWidth(8)), | ||
| 378 | + decoration: tabIndex == 1 | ||
| 379 | + ? BoxDecoration(color: MyColours.color_199095,borderRadius: BorderRadius.circular( | ||
| 380 | + ScreenUtil() | ||
| 381 | + .setWidth( | ||
| 382 | + 6))) | ||
| 383 | + : BoxDecoration( | ||
| 384 | + color: MyColours.color_ffffff, | ||
| 385 | + borderRadius: BorderRadius.circular( | ||
| 386 | + ScreenUtil() | ||
| 387 | + .setWidth( | ||
| 388 | + 6)) | ||
| 389 | + ), | ||
| 390 | + ), | ||
| 391 | + ), | ||
| 392 | + ], | ||
| 393 | + )), | ||
| 394 | + ), | ||
| 395 | + ], | ||
| 396 | + ), | ||
| 397 | + ); | ||
| 398 | + return container; | ||
| 399 | + } | ||
| 400 | + | ||
| 278 | @override | 401 | @override |
| 279 | Widget build(BuildContext context) { | 402 | Widget build(BuildContext context) { |
| 280 | // TODO: implement build | 403 | // TODO: implement build |
| @@ -284,10 +407,7 @@ class NoteBookPageState extends State<NoteBookPage> { | @@ -284,10 +407,7 @@ class NoteBookPageState extends State<NoteBookPage> { | ||
| 284 | color: MyColours.color_f5f5f5, | 407 | color: MyColours.color_f5f5f5, |
| 285 | child: Column( | 408 | child: Column( |
| 286 | children: <Widget>[ | 409 | children: <Widget>[ |
| 287 | - MyAppBar( | ||
| 288 | - "已预订", | ||
| 289 | - showBack: false, | ||
| 290 | - ), | 410 | + _buildTabbar(), |
| 291 | Container( | 411 | Container( |
| 292 | color: MyColours.color_ffffff, | 412 | color: MyColours.color_ffffff, |
| 293 | width: double.infinity, | 413 | width: double.infinity, |
| @@ -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 | +} |
lib/provider/book_set_time_model.dart
0 → 100644
| 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 | +} |
| @@ -6,6 +6,7 @@ import 'package:one_key/models/notebook_detail.dart'; | @@ -6,6 +6,7 @@ import 'package:one_key/models/notebook_detail.dart'; | ||
| 6 | import 'package:one_key/models/reserve_info_model.dart'; | 6 | import 'package:one_key/models/reserve_info_model.dart'; |
| 7 | import 'package:one_key/models/seller_info.dart'; | 7 | import 'package:one_key/models/seller_info.dart'; |
| 8 | import 'package:one_key/models/table_list.dart'; | 8 | import 'package:one_key/models/table_list.dart'; |
| 9 | +import 'package:one_key/models/user_history_entity.dart'; | ||
| 9 | import 'package:one_key/net/base_resp.dart'; | 10 | import 'package:one_key/net/base_resp.dart'; |
| 10 | import 'package:one_key/net/dio_util.dart'; | 11 | import 'package:one_key/net/dio_util.dart'; |
| 11 | import 'package:one_key/net/http_url.dart'; | 12 | import 'package:one_key/net/http_url.dart'; |
| @@ -15,6 +16,7 @@ import 'package:one_key/utils/utils.dart'; | @@ -15,6 +16,7 @@ import 'package:one_key/utils/utils.dart'; | ||
| 15 | import 'package:provider/provider.dart'; | 16 | import 'package:provider/provider.dart'; |
| 16 | 17 | ||
| 17 | class NotebookDetailChangeModel with ChangeNotifier { | 18 | class NotebookDetailChangeModel with ChangeNotifier { |
| 19 | + | ||
| 18 | List dateList = []; //日期选择 月-日 某天 | 20 | List dateList = []; //日期选择 月-日 某天 |
| 19 | List sunDateList = []; // 早市、午市、晚市 | 21 | List sunDateList = []; // 早市、午市、晚市 |
| 20 | List personNumList = []; // 人数 | 22 | List personNumList = []; // 人数 |
| @@ -35,6 +37,8 @@ class NotebookDetailChangeModel with ChangeNotifier { | @@ -35,6 +37,8 @@ class NotebookDetailChangeModel with ChangeNotifier { | ||
| 35 | bool isRecommend = false; //是否展示推荐 | 37 | bool isRecommend = false; //是否展示推荐 |
| 36 | List oldTableList = []; | 38 | List oldTableList = []; |
| 37 | 39 | ||
| 40 | + List<UserHistoryEntity> userHistorys=[];//历史录入 | ||
| 41 | + | ||
| 38 | clearData() { | 42 | clearData() { |
| 39 | dateList = []; //日期选择 月-日 某天 | 43 | dateList = []; //日期选择 月-日 某天 |
| 40 | sunDateList = []; // 早市、午市、晚市 | 44 | sunDateList = []; // 早市、午市、晚市 |
| @@ -77,11 +81,11 @@ class NotebookDetailChangeModel with ChangeNotifier { | @@ -77,11 +81,11 @@ class NotebookDetailChangeModel with ChangeNotifier { | ||
| 77 | ddateStr = DateUtil.formatDate(createTime, format: DateFormats.h_m); | 81 | ddateStr = DateUtil.formatDate(createTime, format: DateFormats.h_m); |
| 78 | String dateTimeSelect = DateUtil.formatDateMs( | 82 | String dateTimeSelect = DateUtil.formatDateMs( |
| 79 | createTime.millisecondsSinceEpoch, | 83 | createTime.millisecondsSinceEpoch, |
| 80 | - format: 'MM-dd'); | 84 | + format: 'yyyy-MM-dd'); |
| 81 | //今天 | 85 | //今天 |
| 82 | DateTime dateTime = DateTime.now(); | 86 | DateTime dateTime = DateTime.now(); |
| 83 | int dateTimeMill = dateTime.millisecondsSinceEpoch; | 87 | int dateTimeMill = dateTime.millisecondsSinceEpoch; |
| 84 | - String dateText = DateUtil.formatDateMs(dateTimeMill, format: 'MM-dd'); | 88 | + String dateText = DateUtil.formatDateMs(dateTimeMill, format: 'yyyy-MM-dd'); |
| 85 | dateList.add({ | 89 | dateList.add({ |
| 86 | 'title': dateText, | 90 | 'title': dateText, |
| 87 | 'select': dateTimeSelect == dateText ? true : false, | 91 | 'select': dateTimeSelect == dateText ? true : false, |
| @@ -92,7 +96,7 @@ class NotebookDetailChangeModel with ChangeNotifier { | @@ -92,7 +96,7 @@ class NotebookDetailChangeModel with ChangeNotifier { | ||
| 92 | //明天 | 96 | //明天 |
| 93 | int tomorrowMill = dateTimeMill + 24 * 60 * 60 * 1000; | 97 | int tomorrowMill = dateTimeMill + 24 * 60 * 60 * 1000; |
| 94 | String dateTextTomorrow = | 98 | String dateTextTomorrow = |
| 95 | - DateUtil.formatDateMs(tomorrowMill, format: 'MM-dd'); | 99 | + DateUtil.formatDateMs(tomorrowMill, format: 'yyyy-MM-dd'); |
| 96 | dateList.add({ | 100 | dateList.add({ |
| 97 | 'title': dateTextTomorrow, | 101 | 'title': dateTextTomorrow, |
| 98 | 'select': dateTimeSelect == dateTextTomorrow ? true : false, | 102 | 'select': dateTimeSelect == dateTextTomorrow ? true : false, |
| @@ -316,16 +320,14 @@ class NotebookDetailChangeModel with ChangeNotifier { | @@ -316,16 +320,14 @@ class NotebookDetailChangeModel with ChangeNotifier { | ||
| 316 | //初始化早市午市晚市选中时间 | 320 | //初始化早市午市晚市选中时间 |
| 317 | initHourAndMinuteSelect() { | 321 | initHourAndMinuteSelect() { |
| 318 | int timeMillsNow = DateTime.now().millisecondsSinceEpoch; | 322 | int timeMillsNow = DateTime.now().millisecondsSinceEpoch; |
| 319 | - //当前选中 月 日string | ||
| 320 | - String mdStr = ''; | 323 | + //当前选中 年-月-日 |
| 324 | + String ymyStr=""; | ||
| 321 | //今天 明天 其他天 | 325 | //今天 明天 其他天 |
| 322 | for (var item in dateList) { | 326 | for (var item in dateList) { |
| 323 | if (item['select'] == true) { | 327 | if (item['select'] == true) { |
| 324 | - mdStr = item['title']; | 328 | + ymyStr = item['title']; |
| 325 | } | 329 | } |
| 326 | } | 330 | } |
| 327 | - String timeNowYear = DateUtil.formatDate(DateTime.now(), format: 'yyyy'); | ||
| 328 | - String ymyStr = timeNowYear + '-' + mdStr; //年月日 | ||
| 329 | String timeStr = ymyStr + ' 00:00:00'; | 331 | String timeStr = ymyStr + ' 00:00:00'; |
| 330 | LogUtil.v(timeStr); | 332 | LogUtil.v(timeStr); |
| 331 | DateTime dateTime = DateUtil.getDateTime(timeStr); //当前年月日 | 333 | DateTime dateTime = DateUtil.getDateTime(timeStr); //当前年月日 |
| @@ -589,16 +591,14 @@ class NotebookDetailChangeModel with ChangeNotifier { | @@ -589,16 +591,14 @@ class NotebookDetailChangeModel with ChangeNotifier { | ||
| 589 | sex = item['code']; | 591 | sex = item['code']; |
| 590 | } | 592 | } |
| 591 | } | 593 | } |
| 592 | - //当前选中 月 日string | ||
| 593 | - String mdStr = ''; | 594 | + //当前选中 年-月-日string |
| 595 | + String ymyStr=""; | ||
| 594 | //今天 明天 其他天 | 596 | //今天 明天 其他天 |
| 595 | for (var item in dateList) { | 597 | for (var item in dateList) { |
| 596 | if (item['select'] == true) { | 598 | if (item['select'] == true) { |
| 597 | - mdStr = item['title']; | 599 | + ymyStr = item['title']; |
| 598 | } | 600 | } |
| 599 | } | 601 | } |
| 600 | - String timeNowYear = DateUtil.formatDate(DateTime.now(), format: 'yyyy'); | ||
| 601 | - String ymyStr = timeNowYear + '-' + mdStr; //年月日 | ||
| 602 | String timeStr = ymyStr + ' ' + ddateStr + ':00'; | 602 | String timeStr = ymyStr + ' ' + ddateStr + ':00'; |
| 603 | // int start = DateUtil.getDateMsByTimeStr(timeStr); | 603 | // int start = DateUtil.getDateMsByTimeStr(timeStr); |
| 604 | 604 | ||
| @@ -708,16 +708,14 @@ class NotebookDetailChangeModel with ChangeNotifier { | @@ -708,16 +708,14 @@ class NotebookDetailChangeModel with ChangeNotifier { | ||
| 708 | sex = item['code']; | 708 | sex = item['code']; |
| 709 | } | 709 | } |
| 710 | } | 710 | } |
| 711 | - //当前选中 月 日string | ||
| 712 | - String mdStr = ''; | 711 | + //当前选中 年-月-日string |
| 712 | + String ymyStr=""; | ||
| 713 | //今天 明天 其他天 | 713 | //今天 明天 其他天 |
| 714 | for (var item in dateList) { | 714 | for (var item in dateList) { |
| 715 | if (item['select'] == true) { | 715 | if (item['select'] == true) { |
| 716 | - mdStr = item['title']; | 716 | + ymyStr = item['title']; |
| 717 | } | 717 | } |
| 718 | } | 718 | } |
| 719 | - String timeNowYear = DateUtil.formatDate(DateTime.now(), format: 'yyyy'); | ||
| 720 | - String ymyStr = timeNowYear + '-' + mdStr; //年月日 | ||
| 721 | String timeStr = ymyStr + ' ' + ddateStr + ':00'; | 719 | String timeStr = ymyStr + ' ' + ddateStr + ':00'; |
| 722 | // int start = DateUtil.getDateMsByTimeStr(timeStr); | 720 | // int start = DateUtil.getDateMsByTimeStr(timeStr); |
| 723 | 721 | ||
| @@ -802,4 +800,20 @@ class NotebookDetailChangeModel with ChangeNotifier { | @@ -802,4 +800,20 @@ class NotebookDetailChangeModel with ChangeNotifier { | ||
| 802 | return itemModel; | 800 | return itemModel; |
| 803 | } | 801 | } |
| 804 | } | 802 | } |
| 803 | + | ||
| 804 | + //获取历史录入 | ||
| 805 | + getUserHistorys(BuildContext context, Map<String, String> params) async { | ||
| 806 | + BaseResp<List> baseResp = await DioUtil() | ||
| 807 | + .request<List>(context, Method.get, HttpUrl.get_reserve_user, | ||
| 808 | + data: params, showLoading: false) | ||
| 809 | + .catchError((error) { | ||
| 810 | + print(error.toString()); | ||
| 811 | + }); | ||
| 812 | + if (baseResp != null && baseResp.code == Constant.status_success) { | ||
| 813 | + userHistorys = baseResp.data.map<UserHistoryEntity>((value) { | ||
| 814 | + return UserHistoryEntity.fromJson(value); | ||
| 815 | + }).toList(); | ||
| 816 | + notifyListeners(); | ||
| 817 | + } | ||
| 818 | + } | ||
| 805 | } | 819 | } |
| @@ -105,15 +105,15 @@ class NotebookDetailModel extends ChangeNotifier { | @@ -105,15 +105,15 @@ class NotebookDetailModel extends ChangeNotifier { | ||
| 105 | .catchError((error) { | 105 | .catchError((error) { |
| 106 | print(error.toString()); | 106 | print(error.toString()); |
| 107 | }); | 107 | }); |
| 108 | - if (baseResp == null) return false; | ||
| 109 | - if (baseResp.code == Constant.status_success) { | 108 | + if (baseResp == null)return false; |
| 109 | + if (baseResp.code == Constant.status_success&&baseResp.data!=null) { | ||
| 110 | if (ifPush) { | 110 | if (ifPush) { |
| 111 | NavigatorUtil.goNotebookDetailPage(context, params["rid"], | 111 | NavigatorUtil.goNotebookDetailPage(context, params["rid"], |
| 112 | replace: true); | 112 | replace: true); |
| 113 | } | 113 | } |
| 114 | return true; | 114 | return true; |
| 115 | } else { | 115 | } else { |
| 116 | - Utils.showToast(baseResp.msg); | 116 | + Utils.showToast("订单已被处理"); |
| 117 | return false; | 117 | return false; |
| 118 | } | 118 | } |
| 119 | } | 119 | } |
lib/provider/remark_manager_model.dart
0 → 100644
| 1 | +import 'package:flutter/material.dart'; | ||
| 2 | +import 'package:one_key/constant/constant.dart'; | ||
| 3 | +import 'package:one_key/constant/error.dart'; | ||
| 4 | +import 'package:one_key/constant/state.dart'; | ||
| 5 | +import 'package:one_key/models/remark.dart'; | ||
| 6 | +import 'package:one_key/net/base_resp.dart'; | ||
| 7 | +import 'package:one_key/net/dio_util.dart'; | ||
| 8 | +import 'package:one_key/net/http_url.dart'; | ||
| 9 | + | ||
| 10 | +/** | ||
| 11 | + * 常用备注管理 | ||
| 12 | + */ | ||
| 13 | +class RemarkManagerModel extends ChangeNotifier { | ||
| 14 | + List<Remark> remarks = []; //所有备注 | ||
| 15 | + List<Remark> ofenRemarks = []; //常用备注 | ||
| 16 | + | ||
| 17 | + PageState pageState = PageState.Loading; | ||
| 18 | + | ||
| 19 | + //获取备注 | ||
| 20 | + getRemarks(BuildContext context, Map<String, String> params, | ||
| 21 | + {bool showPageLoading = false}) async { | ||
| 22 | + if (showPageLoading) { | ||
| 23 | + pageState = PageState.Loading; | ||
| 24 | + notifyListeners(); | ||
| 25 | + } | ||
| 26 | + BaseResp<List> baseResp = await DioUtil() | ||
| 27 | + .request<List>(context, Method.get, HttpUrl.get_custom_remark, | ||
| 28 | + data: params, showLoading: showPageLoading ? false : true) | ||
| 29 | + .catchError((error) { | ||
| 30 | + print(error.toString()); | ||
| 31 | + if (error is MyError) { | ||
| 32 | + switch (error.type) { | ||
| 33 | + case 1: | ||
| 34 | + pageState = PageState.ConnectivityError; | ||
| 35 | + break; | ||
| 36 | + case 2: | ||
| 37 | + pageState = PageState.ConnectivityTimeOut; | ||
| 38 | + break; | ||
| 39 | + default: | ||
| 40 | + pageState = PageState.ConnectivityError; | ||
| 41 | + break; | ||
| 42 | + } | ||
| 43 | + } | ||
| 44 | + notifyListeners(); | ||
| 45 | + }); | ||
| 46 | + if (baseResp != null && baseResp.code == Constant.status_success) { | ||
| 47 | + remarks = baseResp.data.map<Remark>((value) { | ||
| 48 | + return Remark.fromJson(value); | ||
| 49 | + }).toList(); | ||
| 50 | + ofenRemarks = []; | ||
| 51 | + for (Remark item in remarks) { | ||
| 52 | + if (item.oftenUse != '') { | ||
| 53 | + ofenRemarks.add(item); | ||
| 54 | + } | ||
| 55 | + } | ||
| 56 | + if (remarks.isEmpty) { | ||
| 57 | + pageState = PageState.Empty; | ||
| 58 | + } else { | ||
| 59 | + pageState = PageState.Success; | ||
| 60 | + } | ||
| 61 | + notifyListeners(); | ||
| 62 | + } | ||
| 63 | + } | ||
| 64 | + | ||
| 65 | + //添加备注 | ||
| 66 | + Future addRemark(BuildContext context, Map<String, String> params) async { | ||
| 67 | + BaseResp<dynamic> baseResp = await DioUtil() | ||
| 68 | + .request<dynamic>(context, Method.get, HttpUrl.add_custom_remark, | ||
| 69 | + data: params, showLoading: false) | ||
| 70 | + .catchError((error) { | ||
| 71 | + print(error.toString()); | ||
| 72 | + }); | ||
| 73 | + return; | ||
| 74 | + } | ||
| 75 | + | ||
| 76 | + //删除备注 | ||
| 77 | + delRemark(BuildContext context, Map<String, String> params) async { | ||
| 78 | + BaseResp<dynamic> baseResp = await DioUtil() | ||
| 79 | + .request<dynamic>(context, Method.get, HttpUrl.del_custom_remark, | ||
| 80 | + data: params, showLoading: false) | ||
| 81 | + .catchError((error) { | ||
| 82 | + print(error.toString()); | ||
| 83 | + }); | ||
| 84 | + if (baseResp != null && baseResp.code == Constant.status_success) {} | ||
| 85 | + } | ||
| 86 | +} |
| @@ -51,7 +51,7 @@ class TableManagerModel with ChangeNotifier{ | @@ -51,7 +51,7 @@ class TableManagerModel with ChangeNotifier{ | ||
| 51 | initTime(BuildContext context) async { | 51 | initTime(BuildContext context) async { |
| 52 | userModel = Provider.of<UserModel>(context, listen: false); | 52 | userModel = Provider.of<UserModel>(context, listen: false); |
| 53 | dateTime = DateTime.now(); | 53 | dateTime = DateTime.now(); |
| 54 | - dateText = Utils.addZeroNumber(dateTime.month) + | 54 | + dateText = "${dateTime.year}年 "+Utils.addZeroNumber(dateTime.month) + |
| 55 | "月" + | 55 | "月" + |
| 56 | Utils.addZeroNumber(dateTime.day) + | 56 | Utils.addZeroNumber(dateTime.day) + |
| 57 | "日" + | 57 | "日" + |
| @@ -346,7 +346,7 @@ class TableManagerModel with ChangeNotifier{ | @@ -346,7 +346,7 @@ class TableManagerModel with ChangeNotifier{ | ||
| 346 | createDateText(BuildContext context,DateTime day) { | 346 | createDateText(BuildContext context,DateTime day) { |
| 347 | if (Utils.isOneDay(day, dateTime)) return; //日期没变 | 347 | if (Utils.isOneDay(day, dateTime)) return; //日期没变 |
| 348 | DateTime dateNow = DateTime.now(); | 348 | DateTime dateNow = DateTime.now(); |
| 349 | - dateText = Utils.addZeroNumber(day.month) + | 349 | + dateText = "${day.year}年 "+Utils.addZeroNumber(day.month) + |
| 350 | "月" + | 350 | "月" + |
| 351 | Utils.addZeroNumber(day.day) + | 351 | Utils.addZeroNumber(day.day) + |
| 352 | "日"; | 352 | "日"; |
| @@ -11,6 +11,7 @@ class MyColours { | @@ -11,6 +11,7 @@ class MyColours { | ||
| 11 | static const Color color_d8d8d8 = Color(0xffD8D8D8); | 11 | static const Color color_d8d8d8 = Color(0xffD8D8D8); |
| 12 | static const Color color_bff6f7 = Color(0xffBFF6F7); | 12 | static const Color color_bff6f7 = Color(0xffBFF6F7); |
| 13 | static const Color color_c1c1c1 = Color(0xffC1C1C1); | 13 | static const Color color_c1c1c1 = Color(0xffC1C1C1); |
| 14 | + static const Color color_cccccc = Color(0xffCCCCCC); | ||
| 14 | static const Color color_2bb5b7 = Color(0xff2BB5B7); | 15 | static const Color color_2bb5b7 = Color(0xff2BB5B7); |
| 15 | static const Color color_26000000 = Color(0x26000000); | 16 | static const Color color_26000000 = Color(0x26000000); |
| 16 | static const Color color_d93535 = Color(0xffD93535); | 17 | static const Color color_d93535 = Color(0xffD93535); |
| @@ -48,4 +49,5 @@ class MyColours { | @@ -48,4 +49,5 @@ class MyColours { | ||
| 48 | static const Color color_A9E3E6 = Color(0xffA9E3E6); | 49 | static const Color color_A9E3E6 = Color(0xffA9E3E6); |
| 49 | static const Color color_e5e5e5 = Color(0xffe5e5e5); | 50 | static const Color color_e5e5e5 = Color(0xffe5e5e5); |
| 50 | static const Color color_efefef = Color(0xffefefef); | 51 | static const Color color_efefef = Color(0xffefefef); |
| 52 | + static const Color color_0A0A0A = Color(0xff0A0A0A); | ||
| 51 | } | 53 | } |
| @@ -12,12 +12,17 @@ import 'package:one_key/pages/login/login_page.dart'; | @@ -12,12 +12,17 @@ import 'package:one_key/pages/login/login_page.dart'; | ||
| 12 | import 'package:one_key/pages/detail/handle_online_page.dart'; | 12 | 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'; | ||
| 16 | +import 'package:one_key/pages/my/receive_orders_time_set.dart'; | ||
| 17 | +import 'package:one_key/pages/my/remark_manager_page.dart'; | ||
| 15 | import 'package:one_key/pages/sms/sms_page.dart'; | 18 | import 'package:one_key/pages/sms/sms_page.dart'; |
| 16 | import 'package:one_key/pages/table/select_table_page.dart'; | 19 | import 'package:one_key/pages/table/select_table_page.dart'; |
| 17 | import 'package:one_key/pages/webview/webview_page.dart'; | 20 | import 'package:one_key/pages/webview/webview_page.dart'; |
| 21 | +import 'package:one_key/provider/book_set_time_model.dart'; | ||
| 18 | import 'package:one_key/provider/choose_table_model.dart'; | 22 | import 'package:one_key/provider/choose_table_model.dart'; |
| 19 | import 'package:one_key/provider/notebook_detail_change_model.dart'; | 23 | import 'package:one_key/provider/notebook_detail_change_model.dart'; |
| 20 | import 'package:one_key/provider/notebook_detail_model.dart'; | 24 | import 'package:one_key/provider/notebook_detail_model.dart'; |
| 25 | +import 'package:one_key/provider/remark_manager_model.dart'; | ||
| 21 | import 'package:one_key/utils/fluro_convert_utils.dart'; | 26 | import 'package:one_key/utils/fluro_convert_utils.dart'; |
| 22 | import 'package:provider/provider.dart'; | 27 | import 'package:provider/provider.dart'; |
| 23 | 28 | ||
| @@ -97,8 +102,8 @@ var handleInvicationHandler = new Handler( | @@ -97,8 +102,8 @@ var handleInvicationHandler = new Handler( | ||
| 97 | String ddate = params["ddate"].first; | 102 | String ddate = params["ddate"].first; |
| 98 | String ddateStr = | 103 | String ddateStr = |
| 99 | FluroConvertUtils.fluroCnParamsDecode(params["ddateStr"].first); | 104 | FluroConvertUtils.fluroCnParamsDecode(params["ddateStr"].first); |
| 100 | - String phone=params["phone"].first; | ||
| 101 | - return InvicationPage(rid, tableInfo, ddate, ddateStr,phone); | 105 | + String phone = params["phone"].first; |
| 106 | + return InvicationPage(rid, tableInfo, ddate, ddateStr, phone); | ||
| 102 | }); | 107 | }); |
| 103 | 108 | ||
| 104 | // 发短信 | 109 | // 发短信 |
| @@ -132,5 +137,28 @@ var handleChangeDetailHandler = new Handler( | @@ -132,5 +137,28 @@ var handleChangeDetailHandler = new Handler( | ||
| 132 | String rid = params['rid'].first; | 137 | String rid = params['rid'].first; |
| 133 | return ChangeNotifierProvider<NotebookDetailChangeModel>( | 138 | return ChangeNotifierProvider<NotebookDetailChangeModel>( |
| 134 | create: (_) => NotebookDetailChangeModel(detailEntity), | 139 | create: (_) => NotebookDetailChangeModel(detailEntity), |
| 135 | - child: NoteBookChangePage(detailEntity: detailEntity, rid: rid)); | 140 | + child: ChangeNotifierProvider<RemarkManagerModel>( |
| 141 | + create: (_) => RemarkManagerModel(), | ||
| 142 | + child: NoteBookChangePage(detailEntity: detailEntity, rid: rid))); | ||
| 143 | +}); | ||
| 144 | + | ||
| 145 | +// 跳转可订时段管理页面 | ||
| 146 | +var handleBookTimeSetHandler = new Handler( | ||
| 147 | + handlerFunc: (BuildContext context, Map<String, List<Object>> params) { | ||
| 148 | + return ChangeNotifierProvider<BookSetTimeModel>( | ||
| 149 | + create: (_) => BookSetTimeModel(), child: BookTimeSetPage()); | ||
| 150 | +}); | ||
| 151 | + | ||
| 152 | +// 跳转接单时间管理 | ||
| 153 | +var handleReceiveOrdersTimeSetHandler = new Handler( | ||
| 154 | + handlerFunc: (BuildContext context, Map<String, List<Object>> params) { | ||
| 155 | + return ChangeNotifierProvider<BookSetTimeModel>( | ||
| 156 | + create: (_) => BookSetTimeModel(), child: ReceiveOrdersTimeSetPage()); | ||
| 157 | +}); | ||
| 158 | + | ||
| 159 | +// 常用备注管理 | ||
| 160 | +var handleRemarkManagerHandler = new Handler( | ||
| 161 | + handlerFunc: (BuildContext context, Map<String, List<Object>> params) { | ||
| 162 | + return ChangeNotifierProvider<RemarkManagerModel>( | ||
| 163 | + create: (_) => RemarkManagerModel(), child: RemarkManagerPage()); | ||
| 136 | }); | 164 | }); |
| @@ -5,17 +5,19 @@ import 'package:one_key/pages/login/login_page.dart'; | @@ -5,17 +5,19 @@ import 'package:one_key/pages/login/login_page.dart'; | ||
| 5 | import 'route_handles.dart'; | 5 | import 'route_handles.dart'; |
| 6 | 6 | ||
| 7 | class Routes { | 7 | class Routes { |
| 8 | - static String login = "/";//登录页 | ||
| 9 | - static String home = "/home";//主页 | ||
| 10 | - static String handle_online_page="/handle_online_page";//处理在线预订 | ||
| 11 | - static String reserve_detail="/reserve_detail";//预订详情 | ||
| 12 | - static String select_table="/select_table";//选择桌位 | ||
| 13 | - static String invication="/invication";//邀请函 | ||
| 14 | - static String sms="/sms";//发短信 | ||
| 15 | - static String webview="/webview";//网页 | 8 | + static String login = "/"; //登录页 |
| 9 | + static String home = "/home"; //主页 | ||
| 10 | + static String handle_online_page = "/handle_online_page"; //处理在线预订 | ||
| 11 | + static String reserve_detail = "/reserve_detail"; //预订详情 | ||
| 12 | + static String select_table = "/select_table"; //选择桌位 | ||
| 13 | + static String invication = "/invication"; //邀请函 | ||
| 14 | + static String sms = "/sms"; //发短信 | ||
| 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";//变更预订 | ||
| 18 | - | 17 | + static String change_detail = "/change_detail"; //变更预订 |
| 18 | + static String book_time_set = "/book_time_set"; //可订时段管理 | ||
| 19 | + static String receive_orders_time_set = "/receive_orders_time_set"; //接单时间管理 | ||
| 20 | + static String remark_manager = "/remark_manager"; //常用备注管理 | ||
| 19 | 21 | ||
| 20 | static void configureRoutes(Router router) { | 22 | static void configureRoutes(Router router) { |
| 21 | router.notFoundHandler = new Handler( | 23 | router.notFoundHandler = new Handler( |
| @@ -33,5 +35,10 @@ class Routes { | @@ -33,5 +35,10 @@ class Routes { | ||
| 33 | router.define(webview, handler: handleWebviewHandler); | 35 | router.define(webview, handler: handleWebviewHandler); |
| 34 | router.define(web_page, handler: webPageHandler); | 36 | router.define(web_page, handler: webPageHandler); |
| 35 | router.define(change_detail, handler: handleChangeDetailHandler); | 37 | router.define(change_detail, handler: handleChangeDetailHandler); |
| 38 | + router.define(book_time_set, handler: handleBookTimeSetHandler); | ||
| 39 | + router.define(receive_orders_time_set, | ||
| 40 | + handler: handleReceiveOrdersTimeSetHandler); | ||
| 41 | + router.define(remark_manager, | ||
| 42 | + handler: handleRemarkManagerHandler); | ||
| 36 | } | 43 | } |
| 37 | } | 44 | } |
| @@ -5,6 +5,7 @@ import 'package:flutter/material.dart'; | @@ -5,6 +5,7 @@ import 'package:flutter/material.dart'; | ||
| 5 | import 'package:flutter_picker/flutter_picker.dart'; | 5 | import 'package:flutter_picker/flutter_picker.dart'; |
| 6 | import 'package:flutter_screenutil/flutter_screenutil.dart'; | 6 | import 'package:flutter_screenutil/flutter_screenutil.dart'; |
| 7 | import 'package:one_key/constant/constant.dart'; | 7 | import 'package:one_key/constant/constant.dart'; |
| 8 | +import 'package:one_key/models/remark.dart'; | ||
| 8 | import 'package:one_key/pages/message/message_dialog_item.dart'; | 9 | import 'package:one_key/pages/message/message_dialog_item.dart'; |
| 9 | import 'package:one_key/provider/message_dialog_model.dart'; | 10 | import 'package:one_key/provider/message_dialog_model.dart'; |
| 10 | import 'package:one_key/res/colors.dart'; | 11 | import 'package:one_key/res/colors.dart'; |
| @@ -19,7 +20,120 @@ import 'package:provider/provider.dart'; | @@ -19,7 +20,120 @@ import 'package:provider/provider.dart'; | ||
| 19 | import 'package:table_calendar/table_calendar.dart'; | 20 | import 'package:table_calendar/table_calendar.dart'; |
| 20 | import 'package:one_key/models/table.dart' as t; | 21 | import 'package:one_key/models/table.dart' as t; |
| 21 | 22 | ||
| 23 | +typedef CustomCallBack = void Function(Object object); | ||
| 24 | + | ||
| 22 | class DialogUtil { | 25 | class DialogUtil { |
| 26 | + //备注弹框 | ||
| 27 | + static showRemarkDialog( | ||
| 28 | + BuildContext context, List<Remark> remarks, CustomCallBack callback, | ||
| 29 | + {GestureTapCallback onTapLeft, GestureTapCallback onTapRight}) { | ||
| 30 | + return showModalBottomSheet( | ||
| 31 | + context: context, | ||
| 32 | + isScrollControlled: true, | ||
| 33 | + // isDismissible: false, | ||
| 34 | + backgroundColor: Colors.transparent, | ||
| 35 | + builder: (context) { | ||
| 36 | + return StatefulBuilder(builder: (context, state) { | ||
| 37 | + // locationState = state; | ||
| 38 | + return Container( | ||
| 39 | + decoration: BoxDecoration( | ||
| 40 | + color: MyColours.color_ffffff, | ||
| 41 | + borderRadius: BorderRadius.only( | ||
| 42 | + topLeft: Radius.circular(ScreenUtil().setWidth(24)), | ||
| 43 | + topRight: Radius.circular(ScreenUtil().setWidth(24)))), | ||
| 44 | + child: Column( | ||
| 45 | + mainAxisSize: MainAxisSize.min, | ||
| 46 | + crossAxisAlignment: CrossAxisAlignment.start, | ||
| 47 | + children: <Widget>[ | ||
| 48 | + VEmptyView(40), | ||
| 49 | + InkWell( | ||
| 50 | + onTap: () { | ||
| 51 | + Navigator.pop(context); | ||
| 52 | + }, | ||
| 53 | + child: Container( | ||
| 54 | + height: ScreenUtil().setWidth(44), | ||
| 55 | + // color: Colors.red, | ||
| 56 | + child: Stack( | ||
| 57 | + children: [ | ||
| 58 | + Center( | ||
| 59 | + child: Text( | ||
| 60 | + '更多标签', | ||
| 61 | + style: TextStyle( | ||
| 62 | + fontSize: ScreenUtil().setSp(32), | ||
| 63 | + color: MyColours.color_353535, | ||
| 64 | + ), | ||
| 65 | + softWrap: true, | ||
| 66 | + textAlign: TextAlign.center, | ||
| 67 | + ), | ||
| 68 | + ), | ||
| 69 | + Positioned( | ||
| 70 | + top: ScreenUtil().setWidth(10), | ||
| 71 | + right: ScreenUtil().setWidth(40), | ||
| 72 | + child: Image.asset( | ||
| 73 | + Utils.getImgPath('close1'), | ||
| 74 | + width: ScreenUtil().setWidth(28), | ||
| 75 | + height: ScreenUtil().setWidth(28), | ||
| 76 | + ), | ||
| 77 | + ) | ||
| 78 | + ], | ||
| 79 | + ), | ||
| 80 | + )), | ||
| 81 | + VEmptyView(60), | ||
| 82 | + Container( | ||
| 83 | + padding: EdgeInsets.symmetric( | ||
| 84 | + horizontal: ScreenUtil().setWidth(40)), | ||
| 85 | + child: Wrap( | ||
| 86 | + children: listWidget(remarks, state, callback), | ||
| 87 | + spacing: ScreenUtil().setWidth(20), | ||
| 88 | + runSpacing: ScreenUtil().setWidth(20), | ||
| 89 | + // alignment: WrapAlignment.start, | ||
| 90 | + // runAlignment: WrapAlignment.end, | ||
| 91 | + ), | ||
| 92 | + ), | ||
| 93 | + VEmptyView(60) | ||
| 94 | + ])); | ||
| 95 | + }); | ||
| 96 | + }); | ||
| 97 | + } | ||
| 98 | + | ||
| 99 | + static listWidget( | ||
| 100 | + List<Remark> remarks, StateSetter state, CustomCallBack callback) { | ||
| 101 | + List<Widget> lists = remarks.map((item) { | ||
| 102 | + return remarkButton( | ||
| 103 | + content: item.custom, | ||
| 104 | + isSelect: item.selected, | ||
| 105 | + onPress: () { | ||
| 106 | + state(() { | ||
| 107 | + item.selected = !item.selected; | ||
| 108 | + }); | ||
| 109 | + callback(item); | ||
| 110 | + }); | ||
| 111 | + }).toList(); | ||
| 112 | + return lists; | ||
| 113 | + } | ||
| 114 | + | ||
| 115 | + static Widget remarkButton( | ||
| 116 | + {GestureTapCallback onPress, content, isSelect = false}) { | ||
| 117 | + return InkWell( | ||
| 118 | + onTap: onPress, | ||
| 119 | + child: Container( | ||
| 120 | + height: ScreenUtil().setHeight(54), | ||
| 121 | + padding: EdgeInsets.symmetric( | ||
| 122 | + horizontal: ScreenUtil().setWidth(20), | ||
| 123 | + vertical: ScreenUtil().setWidth(10)), | ||
| 124 | + decoration: BoxDecoration( | ||
| 125 | + borderRadius: BorderRadius.circular(ScreenUtil().setWidth(10)), | ||
| 126 | + color: isSelect ? MyColours.color_199095 : MyColours.color_f5f5f5, | ||
| 127 | + ), | ||
| 128 | + child: Text( | ||
| 129 | + content, | ||
| 130 | + style: TextStyle( | ||
| 131 | + color: isSelect ? Colors.white : MyColours.color_353535, | ||
| 132 | + fontSize: ScreenUtil().setSp(28)), | ||
| 133 | + ), | ||
| 134 | + )); | ||
| 135 | + } | ||
| 136 | + | ||
| 23 | //显示消息弹框 | 137 | //显示消息弹框 |
| 24 | static showMessageDialog(BuildContext context) async { | 138 | static showMessageDialog(BuildContext context) async { |
| 25 | MessageDialogModel messageModel = | 139 | MessageDialogModel messageModel = |
| @@ -654,15 +768,18 @@ class DialogUtil { | @@ -654,15 +768,18 @@ class DialogUtil { | ||
| 654 | 768 | ||
| 655 | //显示选择客户经理弹框 | 769 | //显示选择客户经理弹框 |
| 656 | static Future<List<int>> showSelectCusmanDialog( | 770 | static Future<List<int>> showSelectCusmanDialog( |
| 657 | - BuildContext context, List<String> data, ValueChanged valueChanged) { | 771 | + BuildContext context, List<dynamic> data, ValueChanged valueChanged, |
| 772 | + {List<int> selecteds}) { | ||
| 658 | return Picker( | 773 | return Picker( |
| 774 | + selecteds: selecteds, | ||
| 659 | adapter: PickerDataAdapter<String>(pickerdata: data), | 775 | adapter: PickerDataAdapter<String>(pickerdata: data), |
| 776 | + height: ScreenUtil().setWidth(480), | ||
| 660 | hideHeader: false, | 777 | hideHeader: false, |
| 661 | cancelText: "取消", | 778 | cancelText: "取消", |
| 662 | cancelTextStyle: TextStyle( | 779 | cancelTextStyle: TextStyle( |
| 663 | color: MyColours.color_828282, fontSize: ScreenUtil().setSp(36)), | 780 | color: MyColours.color_828282, fontSize: ScreenUtil().setSp(36)), |
| 664 | confirmText: "确定", | 781 | confirmText: "确定", |
| 665 | - itemExtent: ScreenUtil().setWidth(80), | 782 | + itemExtent: ScreenUtil().setWidth(90), |
| 666 | confirmTextStyle: TextStyle( | 783 | confirmTextStyle: TextStyle( |
| 667 | color: MyColours.color_2bb5b7, fontSize: ScreenUtil().setSp(36)), | 784 | color: MyColours.color_2bb5b7, fontSize: ScreenUtil().setSp(36)), |
| 668 | selectedTextStyle: TextStyle( | 785 | selectedTextStyle: TextStyle( |
| @@ -680,14 +797,16 @@ class DialogUtil { | @@ -680,14 +797,16 @@ class DialogUtil { | ||
| 680 | }); | 797 | }); |
| 681 | } | 798 | } |
| 682 | 799 | ||
| 683 | - static Future openAlertDialog(BuildContext context) async { | 800 | + static Future openAlertDialog(BuildContext context, String title, |
| 801 | + String content, String btnTitle, double height, | ||
| 802 | + {GestureTapCallback onTap, double fontSize = 36}) async { | ||
| 684 | final action = await showDialog( | 803 | final action = await showDialog( |
| 685 | context: context, | 804 | context: context, |
| 686 | barrierDismissible: true, | 805 | barrierDismissible: true, |
| 687 | builder: (BuildContext context) { | 806 | builder: (BuildContext context) { |
| 688 | return Center( | 807 | return Center( |
| 689 | child: Container( | 808 | child: Container( |
| 690 | - height: ScreenUtil().setWidth(160 * 2 + 20), | 809 | + height: ScreenUtil().setWidth(height), |
| 691 | width: ScreenUtil().setWidth(280 * 2), | 810 | width: ScreenUtil().setWidth(280 * 2), |
| 692 | decoration: BoxDecoration( | 811 | decoration: BoxDecoration( |
| 693 | borderRadius: BorderRadius.circular(ScreenUtil().setWidth(30))), | 812 | borderRadius: BorderRadius.circular(ScreenUtil().setWidth(30))), |
| @@ -701,9 +820,9 @@ class DialogUtil { | @@ -701,9 +820,9 @@ class DialogUtil { | ||
| 701 | Container( | 820 | Container( |
| 702 | height: ScreenUtil().setWidth(48), | 821 | height: ScreenUtil().setWidth(48), |
| 703 | alignment: Alignment.center, | 822 | alignment: Alignment.center, |
| 704 | - child: Text('未获得通讯录权限', | 823 | + child: Text(title, |
| 705 | style: TextStyle( | 824 | style: TextStyle( |
| 706 | - fontSize: ScreenUtil().setSp(36), | 825 | + fontSize: ScreenUtil().setSp(fontSize), |
| 707 | color: MyColours.color_353535)), | 826 | color: MyColours.color_353535)), |
| 708 | ), | 827 | ), |
| 709 | VEmptyView(20), | 828 | VEmptyView(20), |
| @@ -720,10 +839,10 @@ class DialogUtil { | @@ -720,10 +839,10 @@ class DialogUtil { | ||
| 720 | ScreenUtil() | 839 | ScreenUtil() |
| 721 | .setWidth(2)), //1为 StrutStyle 的 leading的值 | 840 | .setWidth(2)), //1为 StrutStyle 的 leading的值 |
| 722 | child: Text( | 841 | child: Text( |
| 723 | - "请在手机的权限管理里,将通讯录权限开启", | 842 | + content, |
| 724 | style: TextStyle( | 843 | style: TextStyle( |
| 725 | color: MyColours.color_353535, | 844 | color: MyColours.color_353535, |
| 726 | - fontSize: ScreenUtil().setSp(28), | 845 | + fontSize: ScreenUtil().setSp(30), |
| 727 | ), | 846 | ), |
| 728 | strutStyle: StrutStyle( | 847 | strutStyle: StrutStyle( |
| 729 | forceStrutHeight: true, | 848 | forceStrutHeight: true, |
| @@ -740,34 +859,156 @@ class DialogUtil { | @@ -740,34 +859,156 @@ class DialogUtil { | ||
| 740 | height: ScreenUtil().setWidth(47 * 2), | 859 | height: ScreenUtil().setWidth(47 * 2), |
| 741 | alignment: Alignment.center, | 860 | alignment: Alignment.center, |
| 742 | child: Text( | 861 | child: Text( |
| 743 | - '去设置', | 862 | + btnTitle, |
| 744 | style: TextStyle( | 863 | style: TextStyle( |
| 745 | - color: MyColours.color_2bb5b7, | 864 | + color: MyColours.color_199095, |
| 746 | fontSize: ScreenUtil().setWidth(34)), | 865 | fontSize: ScreenUtil().setWidth(34)), |
| 747 | ), | 866 | ), |
| 748 | ), | 867 | ), |
| 749 | - onTap: () { | ||
| 750 | - openSetting(); | ||
| 751 | - Navigator.pop(context, ''); | ||
| 752 | - }, | 868 | + onTap: onTap, |
| 869 | + ) | ||
| 870 | + ], | ||
| 871 | + ), | ||
| 872 | + ), | ||
| 873 | + ), | ||
| 874 | + ); | ||
| 875 | + }, | ||
| 876 | + ); | ||
| 877 | + } | ||
| 878 | + | ||
| 879 | + ///时段设置提示弹框 | ||
| 880 | + static Future confirmTimeAlertDialog(BuildContext context, String morning, | ||
| 881 | + String noon, String night, VoidCallback callback) async { | ||
| 882 | + int space = 52; | ||
| 883 | + List temp = [morning, noon, night]; | ||
| 884 | + int tempHeight = 0; | ||
| 885 | + for (int i = 0; i < temp.length; i++) { | ||
| 886 | + if (temp[i] == '') { | ||
| 887 | + if (i == 2) { | ||
| 888 | + space = 42; | ||
| 889 | + } | ||
| 890 | + tempHeight += space; | ||
| 891 | + } | ||
| 892 | + } | ||
| 893 | + int height = 166 * 2 + 20 + 15 * 2 + 20 - tempHeight; | ||
| 894 | + final action = await showDialog( | ||
| 895 | + context: context, | ||
| 896 | + barrierDismissible: true, | ||
| 897 | + builder: (BuildContext context) { | ||
| 898 | + return Center( | ||
| 899 | + child: Container( | ||
| 900 | + height: ScreenUtil().setWidth(height), | ||
| 901 | + width: ScreenUtil().setWidth(280 * 2), | ||
| 902 | + decoration: BoxDecoration( | ||
| 903 | + borderRadius: BorderRadius.circular(ScreenUtil().setWidth(20))), | ||
| 904 | + child: Card( | ||
| 905 | + shape: RoundedRectangleBorder( | ||
| 906 | + borderRadius: BorderRadius.all( | ||
| 907 | + Radius.circular(ScreenUtil().setWidth(20)))), //设置圆角 | ||
| 908 | + child: Column( | ||
| 909 | + children: [ | ||
| 910 | + VEmptyView(40), | ||
| 911 | + Container( | ||
| 912 | + height: ScreenUtil().setWidth(42), | ||
| 913 | + alignment: Alignment.center, | ||
| 914 | + child: Text( | ||
| 915 | + "请确认时段信息", | ||
| 916 | + style: TextStyle( | ||
| 917 | + color: MyColours.color_353535, | ||
| 918 | + fontSize: ScreenUtil().setSp(30), | ||
| 919 | + fontWeight: FontWeight.bold), | ||
| 920 | + ), | ||
| 921 | + ), | ||
| 922 | + VEmptyView(20), | ||
| 923 | + Column( | ||
| 924 | + children: [ | ||
| 925 | + morning.isNotEmpty | ||
| 926 | + ? Container( | ||
| 927 | + height: ScreenUtil().setWidth(42), | ||
| 928 | + child: Text("早市:${morning}", | ||
| 929 | + style: TextStyle( | ||
| 930 | + color: MyColours.color_353535, | ||
| 931 | + fontSize: ScreenUtil().setSp(30), | ||
| 932 | + ))) | ||
| 933 | + : Container(), | ||
| 934 | + morning.isNotEmpty ? VEmptyView(10) : VEmptyView(0), | ||
| 935 | + noon.isNotEmpty | ||
| 936 | + ? Container( | ||
| 937 | + height: ScreenUtil().setWidth(42), | ||
| 938 | + child: Text( | ||
| 939 | + "午市:${noon}", | ||
| 940 | + style: TextStyle( | ||
| 941 | + color: MyColours.color_353535, | ||
| 942 | + fontSize: ScreenUtil().setSp(30), | ||
| 943 | + ), | ||
| 944 | + )) | ||
| 945 | + : Container(), | ||
| 946 | + noon.isNotEmpty ? VEmptyView(10) : VEmptyView(0), | ||
| 947 | + night.isNotEmpty | ||
| 948 | + ? Container( | ||
| 949 | + height: ScreenUtil().setWidth(42), | ||
| 950 | + child: Text( | ||
| 951 | + "晚市:${night}", | ||
| 952 | + style: TextStyle( | ||
| 953 | + color: MyColours.color_353535, | ||
| 954 | + fontSize: ScreenUtil().setSp(30), | ||
| 955 | + ), | ||
| 956 | + )) | ||
| 957 | + : Container(), | ||
| 958 | + ], | ||
| 959 | + ), | ||
| 960 | + VEmptyView(40), | ||
| 961 | + MyDivider( | ||
| 962 | + ScreenUtil().setWidth(280 * 2), ScreenUtil().setWidth(2), | ||
| 963 | + color: MyColours.color_efefef), | ||
| 964 | + Row( | ||
| 965 | + mainAxisAlignment: MainAxisAlignment.spaceEvenly, | ||
| 966 | + children: [ | ||
| 967 | + InkWell( | ||
| 968 | + child: Container( | ||
| 969 | + height: ScreenUtil().setWidth(47 * 2), | ||
| 970 | + width: ScreenUtil().setWidth(135 * 2), | ||
| 971 | + alignment: Alignment.center, | ||
| 972 | + child: Text( | ||
| 973 | + "信息有误", | ||
| 974 | + style: TextStyle( | ||
| 975 | + color: MyColours.color_666666, | ||
| 976 | + fontSize: ScreenUtil().setSp(34)), | ||
| 977 | + ), | ||
| 978 | + ), | ||
| 979 | + onTap: () { | ||
| 980 | + Navigator.pop(context, ''); | ||
| 981 | + }, | ||
| 982 | + ), | ||
| 983 | + Container( | ||
| 984 | + color: MyColours.color_efefef, | ||
| 985 | + width: ScreenUtil().setWidth(2), | ||
| 986 | + height: ScreenUtil().setWidth(47 * 2), | ||
| 987 | + ), | ||
| 988 | + InkWell( | ||
| 989 | + child: Container( | ||
| 990 | + height: ScreenUtil().setWidth(47 * 2), | ||
| 991 | + width: ScreenUtil().setWidth(135 * 2), | ||
| 992 | + alignment: Alignment.center, | ||
| 993 | + child: Text( | ||
| 994 | + "确认无误", | ||
| 995 | + style: TextStyle( | ||
| 996 | + color: MyColours.color_199095, | ||
| 997 | + fontSize: ScreenUtil().setSp(34)), | ||
| 998 | + ), | ||
| 999 | + ), | ||
| 1000 | + onTap: () { | ||
| 1001 | + Navigator.pop(context, ''); | ||
| 1002 | + callback(); | ||
| 1003 | + }, | ||
| 1004 | + ) | ||
| 1005 | + ], | ||
| 753 | ) | 1006 | ) |
| 754 | ], | 1007 | ], |
| 755 | ), | 1008 | ), |
| 756 | ), | 1009 | ), |
| 757 | ), | 1010 | ), |
| 758 | ); | 1011 | ); |
| 759 | - // return AlertDialog( | ||
| 760 | - // title: Text('未获得通讯录权限'), | ||
| 761 | - // content: Text('请在手机的权限管理里,将联系人权限开启'), | ||
| 762 | - // actions: <Widget>[ | ||
| 763 | - // FlatButton( | ||
| 764 | - // child: Text('去设置'), | ||
| 765 | - // onPressed: () { | ||
| 766 | - // Navigator.pop(context, '确认'); | ||
| 767 | - // }, | ||
| 768 | - // ), | ||
| 769 | - // ], | ||
| 770 | - // ); | ||
| 771 | }, | 1012 | }, |
| 772 | ); | 1013 | ); |
| 773 | 1014 |
| @@ -38,14 +38,17 @@ class NavigatorUtil { | @@ -38,14 +38,17 @@ class NavigatorUtil { | ||
| 38 | 38 | ||
| 39 | /// 订单详情 | 39 | /// 订单详情 |
| 40 | static void goNotebookDetailPage(BuildContext context, String rid, | 40 | static void goNotebookDetailPage(BuildContext context, String rid, |
| 41 | - {String mid="",bool fromNotify=false,replace = false}) { | ||
| 42 | - _navigateTo(context, "${Routes.reserve_detail}?rid=$rid&mid=$mid&fromNotify=$fromNotify", replace: replace); | 41 | + {String mid = "", bool fromNotify = false, replace = false}) { |
| 42 | + _navigateTo(context, | ||
| 43 | + "${Routes.reserve_detail}?rid=$rid&mid=$mid&fromNotify=$fromNotify", | ||
| 44 | + replace: replace); | ||
| 43 | } | 45 | } |
| 44 | 46 | ||
| 45 | /// 处理在线预订 | 47 | /// 处理在线预订 |
| 46 | static void goHandleOnlinePage(BuildContext context, String rid, String mid, | 48 | static void goHandleOnlinePage(BuildContext context, String rid, String mid, |
| 47 | - {fromNotify=false,replace = false}) { | ||
| 48 | - _navigateTo(context, "${Routes.handle_online_page}?rid=$rid&mid=$mid&fromNotify=$fromNotify", | 49 | + {fromNotify = false, replace = false}) { |
| 50 | + _navigateTo(context, | ||
| 51 | + "${Routes.handle_online_page}?rid=$rid&mid=$mid&fromNotify=$fromNotify", | ||
| 49 | replace: replace); | 52 | replace: replace); |
| 50 | } | 53 | } |
| 51 | 54 | ||
| @@ -64,7 +67,7 @@ class NavigatorUtil { | @@ -64,7 +67,7 @@ class NavigatorUtil { | ||
| 64 | 67 | ||
| 65 | /// 邀请函 | 68 | /// 邀请函 |
| 66 | static void goInvicationPage(BuildContext context, String rid, | 69 | static void goInvicationPage(BuildContext context, String rid, |
| 67 | - String tableInfo, String ddate, String ddateStr,String phone, | 70 | + String tableInfo, String ddate, String ddateStr, String phone, |
| 68 | {bool replace = false}) { | 71 | {bool replace = false}) { |
| 69 | _navigateTo(context, | 72 | _navigateTo(context, |
| 70 | "${Routes.invication}?rid=$rid&tableInfo=${FluroConvertUtils.fluroCnParamsEncode(tableInfo)}&ddate=$ddate&ddateStr=${FluroConvertUtils.fluroCnParamsEncode(ddateStr)}&phone=$phone", | 73 | "${Routes.invication}?rid=$rid&tableInfo=${FluroConvertUtils.fluroCnParamsEncode(tableInfo)}&ddate=$ddate&ddateStr=${FluroConvertUtils.fluroCnParamsEncode(ddateStr)}&phone=$phone", |
| @@ -94,19 +97,27 @@ class NavigatorUtil { | @@ -94,19 +97,27 @@ class NavigatorUtil { | ||
| 94 | static void goNoteBookChangePage( | 97 | static void goNoteBookChangePage( |
| 95 | BuildContext context, NotebookDetail detailEntity, String rid, | 98 | BuildContext context, NotebookDetail detailEntity, String rid, |
| 96 | {replace = false}) { | 99 | {replace = false}) { |
| 97 | - if(detailEntity.type=="0"){//内部预订 | ||
| 98 | - detailEntity.is_set_ddate="1"; | 100 | + if (detailEntity.type == "0") { |
| 101 | + //内部预订 | ||
| 102 | + detailEntity.is_set_ddate = "1"; | ||
| 99 | } | 103 | } |
| 100 | _navigateTo(context, | 104 | _navigateTo(context, |
| 101 | "${Routes.change_detail}?detail=${FluroConvertUtils.object2string(detailEntity)}&rid=$rid", | 105 | "${Routes.change_detail}?detail=${FluroConvertUtils.object2string(detailEntity)}&rid=$rid", |
| 102 | replace: replace); | 106 | replace: replace); |
| 103 | } | 107 | } |
| 104 | - // /// 变更预订 | ||
| 105 | - // static void goNoteBookChangePage( | ||
| 106 | - // BuildContext context, NotebookDetail detailEntity, String rid, | ||
| 107 | - // {replace = false}) { | ||
| 108 | - // _navigateTo(context, | ||
| 109 | - // "${Routes.change_detail}?detail=${FluroConvertUtils.object2string(detailEntity)}&rid=$rid", | ||
| 110 | - // replace: replace); | ||
| 111 | - // } | 108 | + |
| 109 | + /// 可订时段管理 | ||
| 110 | + static void goBookTimeSetPage(BuildContext context) { | ||
| 111 | + _navigateTo(context, "${Routes.book_time_set}"); | ||
| 112 | + } | ||
| 113 | + | ||
| 114 | + /// 可订时段管理 | ||
| 115 | + static void goReceiveOrdersTimeSetPage(BuildContext context) { | ||
| 116 | + _navigateTo(context, "${Routes.receive_orders_time_set}"); | ||
| 117 | + } | ||
| 118 | + | ||
| 119 | + /// 常用备注管理 | ||
| 120 | + static void goRemarkManagerPage(BuildContext context) { | ||
| 121 | + _navigateTo(context, "${Routes.remark_manager}"); | ||
| 122 | + } | ||
| 112 | } | 123 | } |
lib/utils/triangle_custom_painter.dart
0 → 100644
| 1 | +import 'package:flutter/material.dart'; | ||
| 2 | + | ||
| 3 | +//自定义 坐标 | ||
| 4 | +class Coordinate { | ||
| 5 | + final double cx; | ||
| 6 | + final double cy; | ||
| 7 | + Coordinate({this.cx, this.cy}); | ||
| 8 | +} | ||
| 9 | + | ||
| 10 | +class TriangleCustomPainter extends CustomPainter { | ||
| 11 | + Paint _paint = new Paint(); //画笔富含各种属性方法。仔细查看源码 | ||
| 12 | + final BuildContext context; | ||
| 13 | + final List spots; | ||
| 14 | + final Color color; | ||
| 15 | + | ||
| 16 | + TriangleCustomPainter(this.context, this.spots, {this.color}); | ||
| 17 | + | ||
| 18 | + @override | ||
| 19 | + void paint(Canvas canvas, Size size) { | ||
| 20 | + Path path = new Path()..moveTo(spots[0].cx, spots[0].cy); | ||
| 21 | + path.lineTo(spots[1].cx, spots[1].cy); | ||
| 22 | + path.lineTo(spots[2].cx, spots[2].cy); | ||
| 23 | + canvas.drawPath( | ||
| 24 | + path, | ||
| 25 | + _paint | ||
| 26 | + ..style = PaintingStyle.fill | ||
| 27 | + ..color = color); | ||
| 28 | + } | ||
| 29 | + | ||
| 30 | + @override | ||
| 31 | + bool shouldRepaint(CustomPainter oldDelegate) { | ||
| 32 | + return true; | ||
| 33 | + } | ||
| 34 | +} |
| @@ -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, gravity: ToastGravity.CENTER); | 25 | + Fluttertoast.showToast( |
| 26 | + msg: msg, toastLength: Toast.LENGTH_LONG, gravity: ToastGravity.CENTER); | ||
| 24 | } | 27 | } |
| 25 | 28 | ||
| 26 | //本地图片资源路径 | 29 | //本地图片资源路径 |
| @@ -160,16 +163,13 @@ class Utils { | @@ -160,16 +163,13 @@ class Utils { | ||
| 160 | 163 | ||
| 161 | /// 获取日期 今天 明天 后天等等 | 164 | /// 获取日期 今天 明天 后天等等 |
| 162 | static int getDdate(List dateList) { | 165 | static int getDdate(List dateList) { |
| 163 | - //当前选中 月 日string | ||
| 164 | - String mdStr = ''; | 166 | + String ymyStr = ""; //年月日 |
| 165 | //今天 明天 其他天 | 167 | //今天 明天 其他天 |
| 166 | for (var item in dateList) { | 168 | for (var item in dateList) { |
| 167 | if (item['select'] == true) { | 169 | if (item['select'] == true) { |
| 168 | - mdStr = item['title']; | 170 | + ymyStr = item['title']; |
| 169 | } | 171 | } |
| 170 | } | 172 | } |
| 171 | - String timeNowYear = DateUtil.formatDate(DateTime.now(), format: 'yyyy'); | ||
| 172 | - String ymyStr = timeNowYear + '-' + mdStr; //年月日 | ||
| 173 | String timeStr = ymyStr + ' ' + "00:00:00"; | 173 | String timeStr = ymyStr + ' ' + "00:00:00"; |
| 174 | int ddate = DateUtil.getDateMsByTimeStr(timeStr); //筛选日期时间戳 | 174 | int ddate = DateUtil.getDateMsByTimeStr(timeStr); //筛选日期时间戳 |
| 175 | return ddate; | 175 | return ddate; |
| @@ -199,4 +199,64 @@ class Utils { | @@ -199,4 +199,64 @@ class Utils { | ||
| 199 | } | 199 | } |
| 200 | return pnum; | 200 | return pnum; |
| 201 | } | 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 | + } | ||
| 202 | } | 262 | } |
lib/widgets/set_time_widget.dart
0 → 100644
| 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), |
-
Please register or login to post a comment