Showing
12 changed files
with
539 additions
and
5 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 = "151" | 14 | +def flutterVersionCode = "153" |
| 15 | if (flutterVersionCode == null) { | 15 | if (flutterVersionCode == null) { |
| 16 | - flutterVersionCode = '151' | 16 | + flutterVersionCode = '153' |
| 17 | } | 17 | } |
| 18 | 18 | ||
| 19 | -def flutterVersionName = "1.5.1" | 19 | +def flutterVersionName = "1.5.3" |
| 20 | if (flutterVersionName == null) { | 20 | if (flutterVersionName == null) { |
| 21 | - flutterVersionName = '1.5.1' | 21 | + flutterVersionName = '1.5.3' |
| 22 | } | 22 | } |
| 23 | 23 | ||
| 24 | apply plugin: 'com.android.application' | 24 | apply plugin: 'com.android.application' |
| @@ -34,7 +34,7 @@ Future<void> main() async { | @@ -34,7 +34,7 @@ Future<void> main() async { | ||
| 34 | Routes.configureRoutes(router); | 34 | Routes.configureRoutes(router); |
| 35 | App.router = router; | 35 | App.router = router; |
| 36 | App.setupLocator(); | 36 | App.setupLocator(); |
| 37 | - LogUtil.init(isDebug: false, tag: 'ONE_KEY'); | 37 | + LogUtil.init(isDebug: true, tag: 'ONE_KEY'); |
| 38 | Provider.debugCheckInvalidValueType = null; | 38 | Provider.debugCheckInvalidValueType = null; |
| 39 | await initializeDateFormatting(); | 39 | await initializeDateFormatting(); |
| 40 | Utils.changeStatusColor(); | 40 | Utils.changeStatusColor(); |
lib/models/remark.dart
0 → 100644
| 1 | +import 'package:json_annotation/json_annotation.dart'; | ||
| 2 | + | ||
| 3 | +part 'remark.g.dart'; | ||
| 4 | + | ||
| 5 | + | ||
| 6 | +@JsonSerializable() | ||
| 7 | +class Remark extends Object { | ||
| 8 | + | ||
| 9 | + @JsonKey(name: 'id') | ||
| 10 | + String id; | ||
| 11 | + | ||
| 12 | + @JsonKey(name: 'uid') | ||
| 13 | + String uid; | ||
| 14 | + | ||
| 15 | + @JsonKey(name: 'often_use') | ||
| 16 | + String oftenUse; | ||
| 17 | + | ||
| 18 | + @JsonKey(name: 'custom') | ||
| 19 | + String custom; | ||
| 20 | + | ||
| 21 | + @JsonKey(name: 'cdate') | ||
| 22 | + String cdate; | ||
| 23 | + | ||
| 24 | + Remark(); | ||
| 25 | + | ||
| 26 | + factory Remark.fromJson(Map<String, dynamic> srcJson) => _$RemarkFromJson(srcJson); | ||
| 27 | + | ||
| 28 | + Map<String, dynamic> toJson() => _$RemarkToJson(this); | ||
| 29 | + | ||
| 30 | +} | ||
| 31 | + | ||
| 32 | + |
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 | +}; |
| @@ -45,4 +45,12 @@ class HttpUrl { | @@ -45,4 +45,12 @@ class HttpUrl { | ||
| 45 | static const String set_order_time = | 45 | static const String set_order_time = |
| 46 | "?service=App.Seller.SetReOrderTime"; //在线预订配置-接单时间 | 46 | "?service=App.Seller.SetReOrderTime"; //在线预订配置-接单时间 |
| 47 | 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"; //添加常用备注 | ||
| 48 | } | 56 | } |
| @@ -203,6 +203,18 @@ class MyPageState extends State<MyPage> with WidgetsBindingObserver { | @@ -203,6 +203,18 @@ class MyPageState extends State<MyPage> with WidgetsBindingObserver { | ||
| 203 | NavigatorUtil.goReceiveOrdersTimeSetPage(context); | 203 | NavigatorUtil.goReceiveOrdersTimeSetPage(context); |
| 204 | }, | 204 | }, |
| 205 | ), | 205 | ), |
| 206 | + MyDivider( | ||
| 207 | + double.infinity, | ||
| 208 | + ScreenUtil().setHeight(1), | ||
| 209 | + color: MyColours.color_f3f3f3, | ||
| 210 | + ), | ||
| 211 | + MyItem( | ||
| 212 | + title: "常用备注管理", | ||
| 213 | + content: "", | ||
| 214 | + callback: () { | ||
| 215 | + NavigatorUtil.goRemarkManagerPage(context); | ||
| 216 | + }, | ||
| 217 | + ), | ||
| 206 | VEmptyView(40), | 218 | VEmptyView(40), |
| 207 | MyItem( | 219 | MyItem( |
| 208 | title: "联系客服", | 220 | title: "联系客服", |
lib/pages/my/remark_manager_page.dart
0 → 100644
| 1 | +import 'package:flutter/material.dart'; | ||
| 2 | +import 'package:flutter_screenutil/screenutil.dart'; | ||
| 3 | +import 'package:one_key/constant/state.dart'; | ||
| 4 | +import 'package:one_key/models/remark.dart'; | ||
| 5 | +import 'package:one_key/provider/remark_manager_model.dart'; | ||
| 6 | +import 'package:one_key/provider/user_model.dart'; | ||
| 7 | +import 'package:one_key/res/colors.dart'; | ||
| 8 | +import 'package:one_key/widgets/MyDivider.dart'; | ||
| 9 | +import 'package:one_key/widgets/h_empty_view.dart'; | ||
| 10 | +import 'package:one_key/widgets/page_exception.dart'; | ||
| 11 | +import 'package:one_key/widgets/system_app_bar.dart'; | ||
| 12 | +import 'package:one_key/widgets/v_empty_view.dart'; | ||
| 13 | +import 'package:provider/provider.dart'; | ||
| 14 | + | ||
| 15 | +import '../../app.dart'; | ||
| 16 | + | ||
| 17 | +class RemarkManagerPage extends StatefulWidget { | ||
| 18 | + @override | ||
| 19 | + State<StatefulWidget> createState() { | ||
| 20 | + // TODO: implement createState | ||
| 21 | + return RemarkManagerPageState(); | ||
| 22 | + } | ||
| 23 | +} | ||
| 24 | + | ||
| 25 | +class RemarkManagerPageState extends State<RemarkManagerPage> { | ||
| 26 | + RemarkManagerModel remarkManagerModel; | ||
| 27 | + | ||
| 28 | + bool isAdding = false; //正在添加备注 | ||
| 29 | + | ||
| 30 | + TextEditingController _controller = TextEditingController(); | ||
| 31 | + FocusNode focusNode = FocusNode(); | ||
| 32 | + | ||
| 33 | + @override | ||
| 34 | + void initState() { | ||
| 35 | + // TODO: implement initState | ||
| 36 | + super.initState(); | ||
| 37 | + | ||
| 38 | + WidgetsBinding.instance.addPostFrameCallback((timeStamp) { | ||
| 39 | + _getRemarks(); | ||
| 40 | + }); | ||
| 41 | + } | ||
| 42 | + | ||
| 43 | + //获取备注 | ||
| 44 | + _getRemarks() { | ||
| 45 | + Map<String, String> params = { | ||
| 46 | + "uid": Provider.of<UserModel>(context, listen: false).user.openid | ||
| 47 | + }; | ||
| 48 | + remarkManagerModel.getRemarks(context, params); | ||
| 49 | + } | ||
| 50 | + | ||
| 51 | + //添加备注 | ||
| 52 | + _addRemark() { | ||
| 53 | + Map<String, String> params = { | ||
| 54 | + "uid": Provider.of<UserModel>(context, listen: false).user.openid, | ||
| 55 | + "custom": _controller.text | ||
| 56 | + }; | ||
| 57 | + remarkManagerModel.addRemark(context, params); | ||
| 58 | + } | ||
| 59 | + | ||
| 60 | + //删除备注 | ||
| 61 | + _delRemark(Remark remark) { | ||
| 62 | + if (remark.id == "-1") return; | ||
| 63 | + Map<String, String> params = { | ||
| 64 | + "uid": Provider.of<UserModel>(context, listen: false).user.openid, | ||
| 65 | + "kid": remark.id, | ||
| 66 | + }; | ||
| 67 | + remarkManagerModel.delRemark(context, params); | ||
| 68 | + } | ||
| 69 | + | ||
| 70 | + //构建常用备注 | ||
| 71 | + List<Widget> _buildAlwayItems() { | ||
| 72 | + List<Widget> always = []; | ||
| 73 | + for (Remark remark in remarkManagerModel.remarks) { | ||
| 74 | + if (remark.oftenUse != null && remark.oftenUse.isNotEmpty) | ||
| 75 | + always.add(Container( | ||
| 76 | + height: ScreenUtil().setWidth(50), | ||
| 77 | + decoration: BoxDecoration( | ||
| 78 | + color: MyColours.color_199095, | ||
| 79 | + borderRadius: BorderRadius.circular(ScreenUtil().setWidth(10))), | ||
| 80 | + child: Row(mainAxisSize: MainAxisSize.min, children: <Widget>[ | ||
| 81 | + Flexible( | ||
| 82 | + child: Padding( | ||
| 83 | + padding: | ||
| 84 | + EdgeInsets.symmetric(horizontal: ScreenUtil().setWidth(20)), | ||
| 85 | + child: Text( | ||
| 86 | + "${remark.oftenUse}", | ||
| 87 | + style: TextStyle( | ||
| 88 | + fontSize: ScreenUtil().setSp(30), | ||
| 89 | + color: MyColours.color_ffffff, | ||
| 90 | + ), | ||
| 91 | + overflow: TextOverflow.ellipsis, | ||
| 92 | + ), | ||
| 93 | + ), | ||
| 94 | + ), | ||
| 95 | + MyDivider( | ||
| 96 | + ScreenUtil().setWidth(2), | ||
| 97 | + ScreenUtil().setWidth(30), | ||
| 98 | + color: MyColours.color_6AB6B9, | ||
| 99 | + ), | ||
| 100 | + GestureDetector( | ||
| 101 | + onTap: () { | ||
| 102 | + setState(() { | ||
| 103 | + remark.oftenUse = ""; | ||
| 104 | + }); | ||
| 105 | + _delRemark(remark); | ||
| 106 | + }, | ||
| 107 | + child: Padding( | ||
| 108 | + padding: EdgeInsets.all(ScreenUtil().setWidth(10)), | ||
| 109 | + child: Text( | ||
| 110 | + "X", | ||
| 111 | + style: TextStyle( | ||
| 112 | + color: MyColours.color_ffffff, | ||
| 113 | + fontSize: ScreenUtil().setSp(30)), | ||
| 114 | + )), | ||
| 115 | + ) | ||
| 116 | + ]), | ||
| 117 | + )); | ||
| 118 | + } | ||
| 119 | + return always; | ||
| 120 | + } | ||
| 121 | + | ||
| 122 | + //构建所有备注 | ||
| 123 | + List<Widget> _buildAllItems() { | ||
| 124 | + List<Widget> alls = []; | ||
| 125 | + for (Remark remark in remarkManagerModel.remarks) { | ||
| 126 | + alls.add( | ||
| 127 | + GestureDetector( | ||
| 128 | + onTap: () { | ||
| 129 | + setState(() { | ||
| 130 | + remark.oftenUse = remark.custom; | ||
| 131 | + }); | ||
| 132 | + }, | ||
| 133 | + child: Container( | ||
| 134 | + height: ScreenUtil().setWidth(50), | ||
| 135 | + padding: | ||
| 136 | + EdgeInsets.symmetric(horizontal: ScreenUtil().setWidth(20)), | ||
| 137 | + decoration: | ||
| 138 | + (remark.oftenUse != null && remark.oftenUse.isNotEmpty) | ||
| 139 | + ? BoxDecoration( | ||
| 140 | + color: MyColours.color_199095, | ||
| 141 | + borderRadius: | ||
| 142 | + BorderRadius.circular(ScreenUtil().setWidth(10))) | ||
| 143 | + : BoxDecoration( | ||
| 144 | + color: MyColours.color_ffffff, | ||
| 145 | + borderRadius: | ||
| 146 | + BorderRadius.circular(ScreenUtil().setWidth(10)), | ||
| 147 | + border: Border.all( | ||
| 148 | + color: MyColours.color_6AB6B9, | ||
| 149 | + width: ScreenUtil().setWidth(2))), | ||
| 150 | + child: Row(mainAxisSize: MainAxisSize.min, children: <Widget>[ | ||
| 151 | + Flexible( | ||
| 152 | + child: Text( | ||
| 153 | + "${remark.custom}", | ||
| 154 | + style: TextStyle( | ||
| 155 | + fontSize: ScreenUtil().setSp(30), | ||
| 156 | + color: | ||
| 157 | + (remark.oftenUse != null && remark.oftenUse.isNotEmpty) | ||
| 158 | + ? MyColours.color_ffffff | ||
| 159 | + : MyColours.color_199095, | ||
| 160 | + ), | ||
| 161 | + overflow: TextOverflow.ellipsis, | ||
| 162 | + )), | ||
| 163 | + ]), | ||
| 164 | + )), | ||
| 165 | + ); | ||
| 166 | + } | ||
| 167 | + alls.add(Stack( | ||
| 168 | + children: [ | ||
| 169 | + isAdding | ||
| 170 | + ? Container( | ||
| 171 | + width: ScreenUtil().setWidth(200), | ||
| 172 | + height: ScreenUtil().setWidth(50), | ||
| 173 | + padding: | ||
| 174 | + EdgeInsets.symmetric(horizontal: ScreenUtil().setWidth(20)), | ||
| 175 | + decoration: BoxDecoration( | ||
| 176 | + border: Border.all( | ||
| 177 | + color: MyColours.color_cccccc, | ||
| 178 | + width: ScreenUtil().setWidth(2)), | ||
| 179 | + borderRadius: | ||
| 180 | + BorderRadius.circular(ScreenUtil().setWidth(10))), | ||
| 181 | + child: Expanded( | ||
| 182 | + child: TextField( | ||
| 183 | + controller: _controller, | ||
| 184 | + focusNode: focusNode, | ||
| 185 | + autofocus: true, | ||
| 186 | + textInputAction: TextInputAction.done, | ||
| 187 | + textAlignVertical: TextAlignVertical.center, | ||
| 188 | + keyboardType: TextInputType.text, | ||
| 189 | + maxLength: 10, | ||
| 190 | + decoration: InputDecoration( | ||
| 191 | + border: InputBorder.none, | ||
| 192 | + ), | ||
| 193 | + style: TextStyle( | ||
| 194 | + color: MyColours.color_353535, | ||
| 195 | + fontSize: ScreenUtil().setSp(30), | ||
| 196 | + textBaseline: | ||
| 197 | + TextBaseline.alphabetic), | ||
| 198 | + onEditingComplete: () { | ||
| 199 | + if(_controller.text.isEmpty){ | ||
| 200 | + setState(() { | ||
| 201 | + isAdding=false; | ||
| 202 | + return; | ||
| 203 | + }); | ||
| 204 | + } | ||
| 205 | + setState(() { | ||
| 206 | + isAdding = false; | ||
| 207 | + remarkManagerModel.remarks.add(Remark() | ||
| 208 | + ..id = "-1" | ||
| 209 | + ..custom = _controller.text | ||
| 210 | + ..oftenUse = _controller.text); | ||
| 211 | + }); | ||
| 212 | + _addRemark(); | ||
| 213 | + _controller.clear(); | ||
| 214 | + }, | ||
| 215 | + ), | ||
| 216 | + ), | ||
| 217 | + ) | ||
| 218 | + : GestureDetector( | ||
| 219 | + onTap: () { | ||
| 220 | + if(remarkManagerModel.remarks.length>=20)return; | ||
| 221 | + setState(() { | ||
| 222 | + isAdding = true; | ||
| 223 | + }); | ||
| 224 | + }, | ||
| 225 | + child: Container( | ||
| 226 | + width: ScreenUtil().setWidth(200), | ||
| 227 | + height: ScreenUtil().setWidth(50), | ||
| 228 | + alignment: Alignment.center, | ||
| 229 | + decoration: BoxDecoration( | ||
| 230 | + border: Border.all( | ||
| 231 | + color: MyColours.color_cccccc, | ||
| 232 | + width: ScreenUtil().setWidth(2)), | ||
| 233 | + borderRadius: | ||
| 234 | + BorderRadius.circular(ScreenUtil().setWidth(10))), | ||
| 235 | + child: Row( | ||
| 236 | + mainAxisSize: MainAxisSize.min, | ||
| 237 | + children: [ | ||
| 238 | + Icon( | ||
| 239 | + Icons.add, | ||
| 240 | + size: ScreenUtil().setWidth(30), | ||
| 241 | + color: MyColours.color_999999, | ||
| 242 | + ), | ||
| 243 | + HEmptyView(10), | ||
| 244 | + Text( | ||
| 245 | + "添加备注", | ||
| 246 | + style: TextStyle( | ||
| 247 | + color: MyColours.color_999999, | ||
| 248 | + fontSize: ScreenUtil().setSp(30)), | ||
| 249 | + ) | ||
| 250 | + ], | ||
| 251 | + ), | ||
| 252 | + ), | ||
| 253 | + ) | ||
| 254 | + ], | ||
| 255 | + )); | ||
| 256 | + return alls; | ||
| 257 | + } | ||
| 258 | + | ||
| 259 | + @override | ||
| 260 | + Widget build(BuildContext context) { | ||
| 261 | + // TODO: implement build | ||
| 262 | + remarkManagerModel = | ||
| 263 | + Provider.of<RemarkManagerModel>(context, listen: false); | ||
| 264 | + return Scaffold( | ||
| 265 | + backgroundColor: MyColours.color_ffffff, | ||
| 266 | + appBar: SystemAppBar( | ||
| 267 | + '常用备注管理', | ||
| 268 | + onTap: () { | ||
| 269 | + Navigator.of(context).pop(); | ||
| 270 | + }, | ||
| 271 | + ), | ||
| 272 | + body: SafeArea( | ||
| 273 | + child: Consumer<RemarkManagerModel>( | ||
| 274 | + builder: (context, model, _) { | ||
| 275 | + if (model.pageState != PageState.Success) { | ||
| 276 | + return ExceptionPage( | ||
| 277 | + pageState: model.pageState, | ||
| 278 | + callback: () { | ||
| 279 | + _getRemarks(); | ||
| 280 | + }, | ||
| 281 | + emptyMsg: "暂时没有备注哦", | ||
| 282 | + emptyImg: "empty_search", | ||
| 283 | + showMsg: "加载中,请稍后...", | ||
| 284 | + ); | ||
| 285 | + } else { | ||
| 286 | + return Container( | ||
| 287 | + padding: EdgeInsets.symmetric( | ||
| 288 | + horizontal: ScreenUtil().setWidth(40)), | ||
| 289 | + child: Column( | ||
| 290 | + crossAxisAlignment: CrossAxisAlignment.start, | ||
| 291 | + children: [ | ||
| 292 | + VEmptyView(60), | ||
| 293 | + Row( | ||
| 294 | + crossAxisAlignment: CrossAxisAlignment.end, | ||
| 295 | + children: [ | ||
| 296 | + Text( | ||
| 297 | + "我的常用备注", | ||
| 298 | + style: TextStyle( | ||
| 299 | + color: MyColours.color_353535, | ||
| 300 | + fontSize: ScreenUtil().setSp(30), | ||
| 301 | + fontWeight: FontWeight.bold), | ||
| 302 | + ), | ||
| 303 | + Text( | ||
| 304 | + "(最多添加10个)", | ||
| 305 | + style: TextStyle( | ||
| 306 | + color: MyColours.color_666666, | ||
| 307 | + fontSize: ScreenUtil().setSp(26)), | ||
| 308 | + ), | ||
| 309 | + ], | ||
| 310 | + ), | ||
| 311 | + Padding( | ||
| 312 | + padding: EdgeInsets.symmetric( | ||
| 313 | + vertical: ScreenUtil().setWidth(20)), | ||
| 314 | + child: Wrap( | ||
| 315 | + spacing: ScreenUtil().setWidth(20), | ||
| 316 | + runSpacing: ScreenUtil().setWidth(20), | ||
| 317 | + children: _buildAlwayItems()), | ||
| 318 | + ), | ||
| 319 | + VEmptyView(20), | ||
| 320 | + MyDivider( | ||
| 321 | + double.infinity, | ||
| 322 | + ScreenUtil().setWidth(2), | ||
| 323 | + color: MyColours.color_f3f3f3, | ||
| 324 | + ), | ||
| 325 | + VEmptyView(40), | ||
| 326 | + Row( | ||
| 327 | + crossAxisAlignment: CrossAxisAlignment.end, | ||
| 328 | + children: [ | ||
| 329 | + Text( | ||
| 330 | + "所有备注", | ||
| 331 | + style: TextStyle( | ||
| 332 | + color: MyColours.color_353535, | ||
| 333 | + fontSize: ScreenUtil().setSp(30), | ||
| 334 | + fontWeight: FontWeight.bold), | ||
| 335 | + ), | ||
| 336 | + Text( | ||
| 337 | + "(最多添加20个)", | ||
| 338 | + style: TextStyle( | ||
| 339 | + color: MyColours.color_666666, | ||
| 340 | + fontSize: ScreenUtil().setSp(26)), | ||
| 341 | + ), | ||
| 342 | + ], | ||
| 343 | + ), | ||
| 344 | + Padding( | ||
| 345 | + padding: EdgeInsets.symmetric( | ||
| 346 | + vertical: ScreenUtil().setWidth(20)), | ||
| 347 | + child: Wrap( | ||
| 348 | + spacing: ScreenUtil().setWidth(20), | ||
| 349 | + runSpacing: ScreenUtil().setWidth(20), | ||
| 350 | + children: _buildAllItems()), | ||
| 351 | + ) | ||
| 352 | + ], | ||
| 353 | + ), | ||
| 354 | + ); | ||
| 355 | + } | ||
| 356 | + }, | ||
| 357 | + ), | ||
| 358 | + )); | ||
| 359 | + } | ||
| 360 | +} |
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 | + | ||
| 15 | + List<Remark> remarks=[];//所有备注 | ||
| 16 | + | ||
| 17 | + PageState pageState = PageState.Loading; | ||
| 18 | + | ||
| 19 | + | ||
| 20 | + //获取备注 | ||
| 21 | + getRemarks(BuildContext context, Map<String, String> params) async { | ||
| 22 | + pageState = PageState.Loading; | ||
| 23 | + notifyListeners(); | ||
| 24 | + BaseResp<List> baseResp = await DioUtil() | ||
| 25 | + .request<List>(context, Method.get, HttpUrl.get_custom_remark, | ||
| 26 | + data: params, showLoading: false) | ||
| 27 | + .catchError((error) { | ||
| 28 | + print(error.toString()); | ||
| 29 | + if (error is MyError) { | ||
| 30 | + switch (error.type) { | ||
| 31 | + case 1: | ||
| 32 | + pageState = PageState.ConnectivityError; | ||
| 33 | + break; | ||
| 34 | + case 2: | ||
| 35 | + pageState = PageState.ConnectivityTimeOut; | ||
| 36 | + break; | ||
| 37 | + default: | ||
| 38 | + pageState = PageState.ConnectivityError; | ||
| 39 | + break; | ||
| 40 | + } | ||
| 41 | + } | ||
| 42 | + notifyListeners(); | ||
| 43 | + }); | ||
| 44 | + if (baseResp != null && baseResp.code == Constant.status_success) { | ||
| 45 | + remarks = baseResp.data.map<Remark>((value) { | ||
| 46 | + return Remark.fromJson(value); | ||
| 47 | + }).toList(); | ||
| 48 | + if (remarks.isEmpty) { | ||
| 49 | + pageState = PageState.Empty; | ||
| 50 | + } else { | ||
| 51 | + pageState = PageState.Success; | ||
| 52 | + } | ||
| 53 | + notifyListeners(); | ||
| 54 | + } | ||
| 55 | + } | ||
| 56 | + | ||
| 57 | + //添加备注 | ||
| 58 | + addRemark(BuildContext context, Map<String, String> params) async { | ||
| 59 | + BaseResp<dynamic> baseResp = await DioUtil() | ||
| 60 | + .request<dynamic>(context, Method.get, HttpUrl.add_custom_remark, | ||
| 61 | + data: params, showLoading: false) | ||
| 62 | + .catchError((error) { | ||
| 63 | + print(error.toString()); | ||
| 64 | + }); | ||
| 65 | + if (baseResp != null && baseResp.code == Constant.status_success) { | ||
| 66 | + } | ||
| 67 | + } | ||
| 68 | + | ||
| 69 | + //删除备注 | ||
| 70 | + delRemark(BuildContext context, Map<String, String> params) async { | ||
| 71 | + BaseResp<dynamic> baseResp = await DioUtil() | ||
| 72 | + .request<dynamic>(context, Method.get, HttpUrl.del_custom_remark, | ||
| 73 | + data: params, showLoading: false) | ||
| 74 | + .catchError((error) { | ||
| 75 | + print(error.toString()); | ||
| 76 | + }); | ||
| 77 | + if (baseResp != null && baseResp.code == Constant.status_success) { | ||
| 78 | + } | ||
| 79 | + } | ||
| 80 | +} |
| @@ -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); |
| @@ -14,6 +14,7 @@ import 'package:one_key/pages/detail/notebook_detail_page.dart'; | @@ -14,6 +14,7 @@ import 'package:one_key/pages/detail/notebook_detail_page.dart'; | ||
| 14 | import 'package:one_key/pages/login/web_page.dart'; | 14 | import 'package:one_key/pages/login/web_page.dart'; |
| 15 | import 'package:one_key/pages/my/book_time_set.dart'; | 15 | import 'package:one_key/pages/my/book_time_set.dart'; |
| 16 | import 'package:one_key/pages/my/receive_orders_time_set.dart'; | 16 | import 'package:one_key/pages/my/receive_orders_time_set.dart'; |
| 17 | +import 'package:one_key/pages/my/remark_manager_page.dart'; | ||
| 17 | import 'package:one_key/pages/sms/sms_page.dart'; | 18 | import 'package:one_key/pages/sms/sms_page.dart'; |
| 18 | import 'package:one_key/pages/table/select_table_page.dart'; | 19 | import 'package:one_key/pages/table/select_table_page.dart'; |
| 19 | import 'package:one_key/pages/webview/webview_page.dart'; | 20 | import 'package:one_key/pages/webview/webview_page.dart'; |
| @@ -21,6 +22,7 @@ import 'package:one_key/provider/book_set_time_model.dart'; | @@ -21,6 +22,7 @@ import 'package:one_key/provider/book_set_time_model.dart'; | ||
| 21 | import 'package:one_key/provider/choose_table_model.dart'; | 22 | import 'package:one_key/provider/choose_table_model.dart'; |
| 22 | import 'package:one_key/provider/notebook_detail_change_model.dart'; | 23 | import 'package:one_key/provider/notebook_detail_change_model.dart'; |
| 23 | 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'; | ||
| 24 | import 'package:one_key/utils/fluro_convert_utils.dart'; | 26 | import 'package:one_key/utils/fluro_convert_utils.dart'; |
| 25 | import 'package:provider/provider.dart'; | 27 | import 'package:provider/provider.dart'; |
| 26 | 28 | ||
| @@ -151,3 +153,10 @@ var handleReceiveOrdersTimeSetHandler = new Handler( | @@ -151,3 +153,10 @@ var handleReceiveOrdersTimeSetHandler = new Handler( | ||
| 151 | return ChangeNotifierProvider<BookSetTimeModel>( | 153 | return ChangeNotifierProvider<BookSetTimeModel>( |
| 152 | create: (_) => BookSetTimeModel(), child: ReceiveOrdersTimeSetPage()); | 154 | create: (_) => BookSetTimeModel(), child: ReceiveOrdersTimeSetPage()); |
| 153 | }); | 155 | }); |
| 156 | + | ||
| 157 | +// 常用备注管理 | ||
| 158 | +var handleRemarkManagerHandler = new Handler( | ||
| 159 | + handlerFunc: (BuildContext context, Map<String, List<Object>> params) { | ||
| 160 | + return ChangeNotifierProvider<RemarkManagerModel>( | ||
| 161 | + create: (_) => RemarkManagerModel(), child: RemarkManagerPage()); | ||
| 162 | + }); |
| @@ -17,6 +17,7 @@ class Routes { | @@ -17,6 +17,7 @@ class Routes { | ||
| 17 | static String change_detail = "/change_detail"; //变更预订 | 17 | static String change_detail = "/change_detail"; //变更预订 |
| 18 | static String book_time_set = "/book_time_set"; //可订时段管理 | 18 | static String book_time_set = "/book_time_set"; //可订时段管理 |
| 19 | static String receive_orders_time_set = "/receive_orders_time_set"; //接单时间管理 | 19 | static String receive_orders_time_set = "/receive_orders_time_set"; //接单时间管理 |
| 20 | + static String remark_manager = "/remark_manager"; //常用备注管理 | ||
| 20 | 21 | ||
| 21 | static void configureRoutes(Router router) { | 22 | static void configureRoutes(Router router) { |
| 22 | router.notFoundHandler = new Handler( | 23 | router.notFoundHandler = new Handler( |
| @@ -37,5 +38,7 @@ class Routes { | @@ -37,5 +38,7 @@ class Routes { | ||
| 37 | router.define(book_time_set, handler: handleBookTimeSetHandler); | 38 | router.define(book_time_set, handler: handleBookTimeSetHandler); |
| 38 | router.define(receive_orders_time_set, | 39 | router.define(receive_orders_time_set, |
| 39 | handler: handleReceiveOrdersTimeSetHandler); | 40 | handler: handleReceiveOrdersTimeSetHandler); |
| 41 | + router.define(remark_manager, | ||
| 42 | + handler: handleRemarkManagerHandler); | ||
| 40 | } | 43 | } |
| 41 | } | 44 | } |
| @@ -115,4 +115,9 @@ class NavigatorUtil { | @@ -115,4 +115,9 @@ class NavigatorUtil { | ||
| 115 | static void goReceiveOrdersTimeSetPage(BuildContext context) { | 115 | static void goReceiveOrdersTimeSetPage(BuildContext context) { |
| 116 | _navigateTo(context, "${Routes.receive_orders_time_set}"); | 116 | _navigateTo(context, "${Routes.receive_orders_time_set}"); |
| 117 | } | 117 | } |
| 118 | + | ||
| 119 | + /// 常用备注管理 | ||
| 120 | + static void goRemarkManagerPage(BuildContext context) { | ||
| 121 | + _navigateTo(context, "${Routes.remark_manager}"); | ||
| 122 | + } | ||
| 118 | } | 123 | } |
-
Please register or login to post a comment