Showing
11 changed files
with
982 additions
and
37 deletions
assets/ordered_off.png
0 → 100755
3.72 KB
assets/ordered_open.png
0 → 100755
4.15 KB
| @@ -8,6 +8,7 @@ part 'notebook.g.dart'; | @@ -8,6 +8,7 @@ part 'notebook.g.dart'; | ||
| 8 | class Notebook { | 8 | class Notebook { |
| 9 | Notebook(); | 9 | Notebook(); |
| 10 | 10 | ||
| 11 | + String tableinfo; | ||
| 11 | String id; | 12 | String id; |
| 12 | String orderid; | 13 | String orderid; |
| 13 | String openid; | 14 | String openid; |
| @@ -49,12 +50,25 @@ class Notebook { | @@ -49,12 +50,25 @@ class Notebook { | ||
| 49 | OrderInfo orderInfo; | 50 | OrderInfo orderInfo; |
| 50 | String nick_name; | 51 | String nick_name; |
| 51 | 52 | ||
| 53 | + // String get tableinfoStr { | ||
| 54 | + // return name + | ||
| 55 | + // "\n" + | ||
| 56 | + // (tid.split(",").length >= 2 | ||
| 57 | + // ? ('等' + tid.split(",").length.toString() + '桌') | ||
| 58 | + // : ''); | ||
| 59 | + // } | ||
| 60 | + | ||
| 52 | String get tableinfoStr { | 61 | String get tableinfoStr { |
| 53 | - return name + | ||
| 54 | - "\n" + | ||
| 55 | - (tid.split(",").length >= 2 | ||
| 56 | - ? ('等' + tid.split(",").length.toString() + '桌') | ||
| 57 | - : ''); | 62 | + List list = json.decode(tableinfo); |
| 63 | + String temp = ''; | ||
| 64 | + for (var item in list) { | ||
| 65 | + temp += item['name'] + '、'; | ||
| 66 | + } | ||
| 67 | + if (temp.endsWith('、')) { | ||
| 68 | + temp = temp.substring(0, temp.length - 1); | ||
| 69 | + } | ||
| 70 | + | ||
| 71 | + return temp; | ||
| 58 | } | 72 | } |
| 59 | 73 | ||
| 60 | String get rnameStr { | 74 | String get rnameStr { |
| @@ -112,7 +126,7 @@ class Notebook { | @@ -112,7 +126,7 @@ class Notebook { | ||
| 112 | switch (status) { | 126 | switch (status) { |
| 113 | //订单状态 0:待确认,1:已定座,2:确认到店,3:用餐完成,4:取消预订 | 127 | //订单状态 0:待确认,1:已定座,2:确认到店,3:用餐完成,4:取消预订 |
| 114 | case "1": | 128 | case "1": |
| 115 | - return "通知客户"; | 129 | + return ""; |
| 116 | case "2": | 130 | case "2": |
| 117 | return "已到店"; | 131 | return "已到店"; |
| 118 | case "3": | 132 | case "3": |
| @@ -120,9 +134,9 @@ class Notebook { | @@ -120,9 +134,9 @@ class Notebook { | ||
| 120 | case "4": | 134 | case "4": |
| 121 | return "已取消"; | 135 | return "已取消"; |
| 122 | case "6": | 136 | case "6": |
| 123 | - return "已拒绝"; | 137 | + return ""; |
| 124 | default: | 138 | default: |
| 125 | - return "通知客户"; | 139 | + return ""; |
| 126 | } | 140 | } |
| 127 | } | 141 | } |
| 128 | 142 |
| @@ -8,6 +8,7 @@ part of 'notebook.dart'; | @@ -8,6 +8,7 @@ part of 'notebook.dart'; | ||
| 8 | 8 | ||
| 9 | Notebook _$NotebookFromJson(Map<String, dynamic> json) { | 9 | Notebook _$NotebookFromJson(Map<String, dynamic> json) { |
| 10 | return Notebook() | 10 | return Notebook() |
| 11 | + ..tableinfo = json['tableinfo'] as String | ||
| 11 | ..id = json['id'] as String | 12 | ..id = json['id'] as String |
| 12 | ..orderid = json['orderid'] as String | 13 | ..orderid = json['orderid'] as String |
| 13 | ..openid = json['openid'] as String | 14 | ..openid = json['openid'] as String |
| @@ -53,6 +54,7 @@ Notebook _$NotebookFromJson(Map<String, dynamic> json) { | @@ -53,6 +54,7 @@ Notebook _$NotebookFromJson(Map<String, dynamic> json) { | ||
| 53 | } | 54 | } |
| 54 | 55 | ||
| 55 | Map<String, dynamic> _$NotebookToJson(Notebook instance) => <String, dynamic>{ | 56 | Map<String, dynamic> _$NotebookToJson(Notebook instance) => <String, dynamic>{ |
| 57 | + 'tableinfo': instance.tableinfo, | ||
| 56 | 'id': instance.id, | 58 | 'id': instance.id, |
| 57 | 'orderid': instance.orderid, | 59 | 'orderid': instance.orderid, |
| 58 | 'openid': instance.openid, | 60 | 'openid': instance.openid, |
lib/pages/notebook/notebook_item_f.dart
0 → 100644
| 1 | +import 'dart:ui'; | ||
| 2 | + | ||
| 3 | +import 'package:flutter/material.dart'; | ||
| 4 | +import 'package:flutter_screenutil/flutter_screenutil.dart'; | ||
| 5 | +import 'package:one_key/models/notebook.dart'; | ||
| 6 | +import 'package:one_key/res/colors.dart'; | ||
| 7 | +import 'package:one_key/route/navigator_util.dart'; | ||
| 8 | +import 'package:one_key/utils/utils.dart'; | ||
| 9 | +import 'package:one_key/widgets/MyDivider.dart'; | ||
| 10 | +import 'package:one_key/widgets/h_empty_view.dart'; | ||
| 11 | +import 'package:one_key/widgets/round_button.dart'; | ||
| 12 | +import 'package:one_key/widgets/v_empty_view.dart'; | ||
| 13 | + | ||
| 14 | +/** | ||
| 15 | + * 详细模式 | ||
| 16 | + */ | ||
| 17 | +class NoteBookItemF extends StatefulWidget { | ||
| 18 | + final num index; | ||
| 19 | + final Notebook notebook; | ||
| 20 | + | ||
| 21 | + NoteBookItemF(this.notebook, this.index); | ||
| 22 | + | ||
| 23 | + @override | ||
| 24 | + State<StatefulWidget> createState() { | ||
| 25 | + // TODO: implement createState | ||
| 26 | + return new NoteBookItemFState(); | ||
| 27 | + } | ||
| 28 | +} | ||
| 29 | + | ||
| 30 | +class NoteBookItemFState extends State<NoteBookItemF> { | ||
| 31 | + _onOperateClick() { | ||
| 32 | + if (widget.notebook.operationText == "通知客户") { | ||
| 33 | + // String _nameStr = ''; | ||
| 34 | + // String _tid = ''; | ||
| 35 | + // for (int i = 0; | ||
| 36 | + // i < | ||
| 37 | + // detailEntity | ||
| 38 | + // .tables.length; | ||
| 39 | + // i++) { | ||
| 40 | + // _nameStr += | ||
| 41 | + // '${detailEntity.tables[i].name},'; | ||
| 42 | + | ||
| 43 | + // _tid += | ||
| 44 | + // '${detailEntity.tables[i].id},'; | ||
| 45 | + // } | ||
| 46 | + // if (_tid.endsWith(',')) { | ||
| 47 | + // _tid = _tid.substring( | ||
| 48 | + // 0, _tid.length - 1); | ||
| 49 | + // } | ||
| 50 | + // if (_nameStr | ||
| 51 | + // .endsWith(',')) { | ||
| 52 | + // _nameStr = | ||
| 53 | + // _nameStr.substring( | ||
| 54 | + // 0, | ||
| 55 | + // _nameStr.length - | ||
| 56 | + // 1); | ||
| 57 | + // } | ||
| 58 | + NavigatorUtil.goInvicationPage( | ||
| 59 | + context, | ||
| 60 | + widget.notebook.id, | ||
| 61 | + widget.notebook.tableinfoStr, | ||
| 62 | + widget.notebook.ddate, | ||
| 63 | + widget.notebook.ddateStr, | ||
| 64 | + widget.notebook.phone, | ||
| 65 | + widget.notebook.ddate_solt, | ||
| 66 | + widget.notebook.rname == null ? '' : widget.notebook.rname, | ||
| 67 | + widget.notebook.sex == null ? '' : widget.notebook.sex, | ||
| 68 | + tid: widget.notebook.tid); | ||
| 69 | + } | ||
| 70 | + } | ||
| 71 | + | ||
| 72 | + @override | ||
| 73 | + Widget build(BuildContext context) { | ||
| 74 | + // TODO: implement build | ||
| 75 | + Notebook notebook = widget.notebook; | ||
| 76 | + | ||
| 77 | + Color bgColor = notebook.status == "2" || notebook.status == "1" | ||
| 78 | + ? MyColours.color_438E93 | ||
| 79 | + : Color.fromRGBO(191, 196, 212, 0.2); | ||
| 80 | + | ||
| 81 | + String detail = ''; | ||
| 82 | + if (notebook.tid.split(",").length >= 2) { | ||
| 83 | + //连台 | ||
| 84 | + detail += '[连台]:${notebook.tableinfoStr};'; | ||
| 85 | + } | ||
| 86 | + if (notebook.cusdem != null && notebook.cusdem != '') { | ||
| 87 | + //有备注 | ||
| 88 | + detail += '[备注]:${notebook.cusdem};'; | ||
| 89 | + } | ||
| 90 | + if (true) { | ||
| 91 | + //有优惠 | ||
| 92 | + detail += '[优惠]:'; | ||
| 93 | + } | ||
| 94 | + if (detail.endsWith(';')) { | ||
| 95 | + detail = detail.substring(0, detail.length - 1); | ||
| 96 | + } | ||
| 97 | + return Stack( | ||
| 98 | + clipBehavior: Clip.none, | ||
| 99 | + alignment: Alignment.centerRight, | ||
| 100 | + children: [ | ||
| 101 | + Container( | ||
| 102 | + padding: EdgeInsets.only( | ||
| 103 | + left: ScreenUtil().setWidth(16), | ||
| 104 | + top: ScreenUtil().setWidth(16), | ||
| 105 | + bottom: ScreenUtil().setWidth(16), | ||
| 106 | + right: ScreenUtil().setWidth(44), | ||
| 107 | + ), | ||
| 108 | + margin: EdgeInsets.only(right: ScreenUtil().setWidth(48)), | ||
| 109 | + decoration: BoxDecoration( | ||
| 110 | + color: MyColours.color_ffffff, | ||
| 111 | + borderRadius: BorderRadius.circular(ScreenUtil().setWidth(32)), | ||
| 112 | + border: Border.all( | ||
| 113 | + color: Color.fromRGBO(191, 196, 212, 0.2), | ||
| 114 | + width: ScreenUtil().setWidth(1)), | ||
| 115 | + ), | ||
| 116 | + child: Row( | ||
| 117 | + children: [ | ||
| 118 | + Column( | ||
| 119 | + crossAxisAlignment: CrossAxisAlignment.center, | ||
| 120 | + children: [ | ||
| 121 | + Container( | ||
| 122 | + width: ScreenUtil().setWidth(82 * 2), | ||
| 123 | + margin: | ||
| 124 | + EdgeInsets.only(bottom: ScreenUtil().setWidth(9 * 2)), | ||
| 125 | + alignment: Alignment.center, | ||
| 126 | + child: Text( | ||
| 127 | + notebook.name, | ||
| 128 | + maxLines: 1, | ||
| 129 | + overflow: TextOverflow.ellipsis, | ||
| 130 | + style: TextStyle( | ||
| 131 | + color: bgColor, | ||
| 132 | + fontWeight: FontWeight.bold, | ||
| 133 | + fontSize: ScreenUtil().setSp(32)), | ||
| 134 | + ), | ||
| 135 | + ), | ||
| 136 | + Padding( | ||
| 137 | + padding: EdgeInsets.only( | ||
| 138 | + bottom: ScreenUtil().setWidth(9 * 2)), | ||
| 139 | + child: Row( | ||
| 140 | + mainAxisAlignment: MainAxisAlignment.spaceEvenly, | ||
| 141 | + children: [ | ||
| 142 | + Offstage( | ||
| 143 | + offstage: notebook.tid.split(",").length < 2, | ||
| 144 | + child: Image.asset( | ||
| 145 | + Utils.getImgPath('ordered_lian'), | ||
| 146 | + width: ScreenUtil().setWidth(18 * 2), | ||
| 147 | + ), | ||
| 148 | + ), | ||
| 149 | + notebook.cusdem == null || notebook.cusdem == '' | ||
| 150 | + ? SizedBox() | ||
| 151 | + : HEmptyView(8), | ||
| 152 | + Offstage( | ||
| 153 | + offstage: notebook.cusdem == null || | ||
| 154 | + notebook.cusdem == '', | ||
| 155 | + child: Image.asset( | ||
| 156 | + Utils.getImgPath('ordered_bei'), | ||
| 157 | + width: ScreenUtil().setWidth(18 * 2), | ||
| 158 | + ), | ||
| 159 | + ), | ||
| 160 | + false ? SizedBox() : HEmptyView(8), | ||
| 161 | + Offstage( | ||
| 162 | + offstage: true, | ||
| 163 | + child: Image.asset( | ||
| 164 | + Utils.getImgPath('ordered_hui'), | ||
| 165 | + width: ScreenUtil().setWidth(18 * 2), | ||
| 166 | + ), | ||
| 167 | + ) | ||
| 168 | + ], | ||
| 169 | + )), | ||
| 170 | + widget.notebook.operationText == '' | ||
| 171 | + ? SizedBox() | ||
| 172 | + : RoundButton( | ||
| 173 | + text: widget.notebook.operationText, | ||
| 174 | + gradientStart: bgColor, | ||
| 175 | + gradientEnd: bgColor, | ||
| 176 | + textColor: MyColours.color_ffffff, | ||
| 177 | + radius: ScreenUtil().setWidth(6), | ||
| 178 | + fontSize: 28, | ||
| 179 | + width: ScreenUtil().setWidth(56 * 2), | ||
| 180 | + ) | ||
| 181 | + ], | ||
| 182 | + ), | ||
| 183 | + HEmptyView(24), | ||
| 184 | + MyDivider( | ||
| 185 | + ScreenUtil().setWidth(2), | ||
| 186 | + ScreenUtil().setWidth(66 * 2), | ||
| 187 | + color: Color.fromRGBO(191, 196, 212, 0.2), | ||
| 188 | + ), | ||
| 189 | + HEmptyView(32), | ||
| 190 | + Expanded( | ||
| 191 | + child: GestureDetector( | ||
| 192 | + behavior: HitTestBehavior.translucent, | ||
| 193 | + onTap: () { | ||
| 194 | + NavigatorUtil.goNotebookDetailPage( | ||
| 195 | + context, notebook.id, notebook.uid); | ||
| 196 | + }, | ||
| 197 | + child: Column( | ||
| 198 | + crossAxisAlignment: CrossAxisAlignment.start, | ||
| 199 | + children: [ | ||
| 200 | + Row( | ||
| 201 | + children: [ | ||
| 202 | + notebook.rnameStr == '' | ||
| 203 | + ? SizedBox() | ||
| 204 | + : Container( | ||
| 205 | + child: Text( | ||
| 206 | + notebook.rnameStr, | ||
| 207 | + maxLines: 1, | ||
| 208 | + overflow: TextOverflow.ellipsis, | ||
| 209 | + style: TextStyle( | ||
| 210 | + color: MyColours.color_260101, | ||
| 211 | + fontWeight: FontWeight.bold, | ||
| 212 | + fontSize: ScreenUtil().setSp(28)), | ||
| 213 | + ), | ||
| 214 | + ), | ||
| 215 | + notebook.phoneStr.isNotEmpty | ||
| 216 | + ? Text( | ||
| 217 | + '(' + | ||
| 218 | + Utils.showEndPhone( | ||
| 219 | + '${notebook.phoneStr}') + | ||
| 220 | + ')', | ||
| 221 | + maxLines: 1, | ||
| 222 | + overflow: TextOverflow.ellipsis, | ||
| 223 | + style: TextStyle( | ||
| 224 | + color: MyColours.color_260101, | ||
| 225 | + fontWeight: FontWeight.bold, | ||
| 226 | + fontSize: ScreenUtil().setSp(28)), | ||
| 227 | + ) | ||
| 228 | + : SizedBox(), | ||
| 229 | + notebook.rnameStr == '' && | ||
| 230 | + notebook.phoneStr.isEmpty | ||
| 231 | + ? SizedBox() | ||
| 232 | + : HEmptyView(8), | ||
| 233 | + notebook.rnameStr == '' && | ||
| 234 | + notebook.phoneStr.isEmpty | ||
| 235 | + ? SizedBox() | ||
| 236 | + : Expanded( | ||
| 237 | + child: Container( | ||
| 238 | + padding: EdgeInsets.symmetric( | ||
| 239 | + horizontal: | ||
| 240 | + ScreenUtil().setWidth(12), | ||
| 241 | + vertical: ScreenUtil().setWidth(4)), | ||
| 242 | + decoration: BoxDecoration( | ||
| 243 | + border: Border.all( | ||
| 244 | + width: ScreenUtil().setWidth(2), | ||
| 245 | + color: MyColours.color_A78E44), | ||
| 246 | + borderRadius: | ||
| 247 | + BorderRadius.circular(6)), | ||
| 248 | + child: Text( | ||
| 249 | + 'biaoqianvipdsdsbiaoqianvipdsdsbiaoqianvipdsdsbiaoqianvipdsdsbiaoqianvipdsds', | ||
| 250 | + overflow: TextOverflow.ellipsis, | ||
| 251 | + style: TextStyle( | ||
| 252 | + color: MyColours.color_A78E44, | ||
| 253 | + fontSize: ScreenUtil().setSp(18)), | ||
| 254 | + ), | ||
| 255 | + )) | ||
| 256 | + ], | ||
| 257 | + ), | ||
| 258 | + VEmptyView(6), | ||
| 259 | + Text( | ||
| 260 | + notebook.actual_pnum == null | ||
| 261 | + ? notebook.ddateStr | ||
| 262 | + : notebook.actual_pnum + | ||
| 263 | + '人' + | ||
| 264 | + ' ' + | ||
| 265 | + notebook.ddateStr, | ||
| 266 | + maxLines: 1, | ||
| 267 | + overflow: TextOverflow.ellipsis, | ||
| 268 | + style: TextStyle( | ||
| 269 | + color: MyColours.color_260101, | ||
| 270 | + fontWeight: FontWeight.bold, | ||
| 271 | + fontSize: ScreenUtil().setSp(28)), | ||
| 272 | + ), | ||
| 273 | + detail == '' ? SizedBox() : VEmptyView(6), | ||
| 274 | + notebook.nick_name == null | ||
| 275 | + ? SizedBox() | ||
| 276 | + : Text( | ||
| 277 | + notebook.nick_name + '订', | ||
| 278 | + maxLines: 1, | ||
| 279 | + overflow: TextOverflow.ellipsis, | ||
| 280 | + style: TextStyle( | ||
| 281 | + color: MyColours.color_999999, | ||
| 282 | + fontSize: ScreenUtil().setSp(24)), | ||
| 283 | + ), | ||
| 284 | + notebook.nick_name == '' | ||
| 285 | + ? VEmptyView(6) | ||
| 286 | + : SizedBox(), | ||
| 287 | + Text( | ||
| 288 | + detail, | ||
| 289 | + maxLines: 100, | ||
| 290 | + overflow: TextOverflow.ellipsis, | ||
| 291 | + style: TextStyle( | ||
| 292 | + color: MyColours.color_999999, | ||
| 293 | + fontSize: ScreenUtil().setSp(24)), | ||
| 294 | + ), | ||
| 295 | + ], | ||
| 296 | + ))) | ||
| 297 | + ], | ||
| 298 | + ), | ||
| 299 | + ), | ||
| 300 | + Positioned( | ||
| 301 | + right: ScreenUtil().setWidth(8), | ||
| 302 | + child: Image.asset( | ||
| 303 | + Utils.getImgPath(true ? 'ordered_open' : 'ordered_off'), | ||
| 304 | + width: ScreenUtil().setWidth(80), | ||
| 305 | + )) | ||
| 306 | + ]); | ||
| 307 | + // return Stack( | ||
| 308 | + // children: [ | ||
| 309 | + // Container( | ||
| 310 | + // width: double.infinity, | ||
| 311 | + // // height: ScreenUtil().setWidth(120), | ||
| 312 | + // color: (widget.index % 2 == 0) | ||
| 313 | + // ? MyColours.color_f7fdfd | ||
| 314 | + // : MyColours.color_ffffff, | ||
| 315 | + // child: Row( | ||
| 316 | + // children: <Widget>[ | ||
| 317 | + // GestureDetector( | ||
| 318 | + // behavior: HitTestBehavior.translucent, | ||
| 319 | + // onTap: () { | ||
| 320 | + // NavigatorUtil.goNotebookDetailPage( | ||
| 321 | + // context, notebook.id, notebook.uid); | ||
| 322 | + // }, | ||
| 323 | + // child: Row( | ||
| 324 | + // children: <Widget>[ | ||
| 325 | + // Container( | ||
| 326 | + // width: ScreenUtil().setWidth(86 * 2), | ||
| 327 | + // padding: EdgeInsets.symmetric( | ||
| 328 | + // horizontal: ScreenUtil().setWidth(14), | ||
| 329 | + // vertical: ScreenUtil().setWidth(40)), | ||
| 330 | + // alignment: Alignment.center, | ||
| 331 | + // child: Column( | ||
| 332 | + // children: [ | ||
| 333 | + // Text( | ||
| 334 | + // '${notebook.tableinfoStr?.trim()}', | ||
| 335 | + // maxLines: 30, | ||
| 336 | + // overflow: TextOverflow.ellipsis, | ||
| 337 | + // style: TextStyle( | ||
| 338 | + // color: textColor, | ||
| 339 | + // // fontWeight: FontWeight.bold, | ||
| 340 | + // fontSize: ScreenUtil().setSp(30)), | ||
| 341 | + // ), | ||
| 342 | + // notebook.type == '1' | ||
| 343 | + // ? Text('online', | ||
| 344 | + // style: TextStyle( | ||
| 345 | + // color: Colors.blue, | ||
| 346 | + // // fontWeight: FontWeight.bold, | ||
| 347 | + // fontSize: ScreenUtil().setSp(26))) | ||
| 348 | + // : SizedBox() | ||
| 349 | + // ], | ||
| 350 | + // ), | ||
| 351 | + // ), | ||
| 352 | + // MyDivider( | ||
| 353 | + // ScreenUtil().setWidth(1), | ||
| 354 | + // ScreenUtil().setHeight(90), | ||
| 355 | + // color: MyColours.color_ededed, | ||
| 356 | + // ), | ||
| 357 | + // Container( | ||
| 358 | + // width: ScreenUtil().setWidth(230), | ||
| 359 | + // alignment: Alignment.center, | ||
| 360 | + // child: Column( | ||
| 361 | + // mainAxisSize: MainAxisSize.min, | ||
| 362 | + // mainAxisAlignment: MainAxisAlignment.center, | ||
| 363 | + // children: <Widget>[ | ||
| 364 | + // Text( | ||
| 365 | + // notebook.rnameStr, | ||
| 366 | + // // 'nnnnnnnnnnnnnn', | ||
| 367 | + // maxLines: 1, | ||
| 368 | + // overflow: TextOverflow.ellipsis, | ||
| 369 | + // style: TextStyle( | ||
| 370 | + // color: textColor, | ||
| 371 | + // // fontWeight: FontWeight.bold, | ||
| 372 | + // fontSize: ScreenUtil().setSp(30)), | ||
| 373 | + // ), | ||
| 374 | + // notebook.phoneStr.isNotEmpty | ||
| 375 | + // ? Padding( | ||
| 376 | + // padding: EdgeInsets.only( | ||
| 377 | + // top: ScreenUtil().setWidth(10)), | ||
| 378 | + // child: Text( | ||
| 379 | + // notebook.phoneStr, | ||
| 380 | + // maxLines: 1, | ||
| 381 | + // overflow: TextOverflow.ellipsis, | ||
| 382 | + // style: TextStyle( | ||
| 383 | + // color: textColor, | ||
| 384 | + // // fontWeight: FontWeight.bold, | ||
| 385 | + // fontSize: ScreenUtil().setSp(26)), | ||
| 386 | + // )) | ||
| 387 | + // : Container() | ||
| 388 | + // ], | ||
| 389 | + // ), | ||
| 390 | + // ), | ||
| 391 | + // MyDivider( | ||
| 392 | + // ScreenUtil().setWidth(1), | ||
| 393 | + // ScreenUtil().setHeight(90), | ||
| 394 | + // color: MyColours.color_ededed, | ||
| 395 | + // ), | ||
| 396 | + // Container( | ||
| 397 | + // width: ScreenUtil().setWidth(159), | ||
| 398 | + // alignment: Alignment.center, | ||
| 399 | + // child: Text( | ||
| 400 | + // notebook.ddateStr, | ||
| 401 | + // style: TextStyle( | ||
| 402 | + // color: textColor, | ||
| 403 | + // // fontWeight: FontWeight.bold, | ||
| 404 | + // fontSize: ScreenUtil().setSp(30)), | ||
| 405 | + // ), | ||
| 406 | + // ), | ||
| 407 | + // ], | ||
| 408 | + // ), | ||
| 409 | + // ), | ||
| 410 | + // MyDivider( | ||
| 411 | + // ScreenUtil().setWidth(1), | ||
| 412 | + // ScreenUtil().setHeight(90), | ||
| 413 | + // color: MyColours.color_ededed, | ||
| 414 | + // ), | ||
| 415 | + // GestureDetector( | ||
| 416 | + // onTap: _onOperateClick, | ||
| 417 | + // behavior: HitTestBehavior.opaque, | ||
| 418 | + // child: Container( | ||
| 419 | + // padding: | ||
| 420 | + // EdgeInsets.symmetric(vertical: ScreenUtil().setWidth(20)), | ||
| 421 | + // width: ScreenUtil().setWidth(184), | ||
| 422 | + // // color: Colors.red, | ||
| 423 | + // alignment: Alignment.center, | ||
| 424 | + // child: Text( | ||
| 425 | + // notebook.operationText, | ||
| 426 | + // style: TextStyle( | ||
| 427 | + // color: (notebook.status == "3" || | ||
| 428 | + // notebook.status == "4" || | ||
| 429 | + // notebook.status == "6") | ||
| 430 | + // ? MyColours.color_bfbfbf | ||
| 431 | + // : MyColours.color_2bb5b7, | ||
| 432 | + // // fontWeight: FontWeight.bold, | ||
| 433 | + // fontSize: ScreenUtil().setSp(30)), | ||
| 434 | + // ), | ||
| 435 | + // ), | ||
| 436 | + // ), | ||
| 437 | + // ], | ||
| 438 | + // ), | ||
| 439 | + // ), | ||
| 440 | + // notebook.orderInfo != null && notebook.orderInfo.status == '3' | ||
| 441 | + // ? Container( | ||
| 442 | + // alignment: Alignment.center, | ||
| 443 | + // width: ScreenUtil().setWidth(52 * 2), | ||
| 444 | + // height: ScreenUtil().setWidth(19 * 2), | ||
| 445 | + // decoration: BoxDecoration( | ||
| 446 | + // color: MyColours.color_F59A23, | ||
| 447 | + // borderRadius: BorderRadius.only( | ||
| 448 | + // bottomRight: Radius.circular(ScreenUtil().setWidth(10))), | ||
| 449 | + // ), | ||
| 450 | + // child: Text( | ||
| 451 | + // '已买单', | ||
| 452 | + // style: TextStyle( | ||
| 453 | + // fontSize: ScreenUtil().setSp(24), | ||
| 454 | + // color: MyColours.color_ffffff, | ||
| 455 | + // fontWeight: FontWeight.bold), | ||
| 456 | + // )) | ||
| 457 | + // : Container() | ||
| 458 | + // ], | ||
| 459 | + // ); | ||
| 460 | + } | ||
| 461 | +} |
| 1 | +import 'package:flutter/material.dart'; | ||
| 2 | +import 'package:flutter_screenutil/flutter_screenutil.dart'; | ||
| 3 | +import 'package:one_key/models/notebook.dart'; | ||
| 4 | +import 'package:one_key/res/colors.dart'; | ||
| 5 | +import 'package:one_key/route/navigator_util.dart'; | ||
| 6 | +import 'package:one_key/utils/utils.dart'; | ||
| 7 | +import 'package:one_key/widgets/MyDivider.dart'; | ||
| 8 | +import 'package:one_key/widgets/v_empty_view.dart'; | ||
| 9 | + | ||
| 10 | +/** | ||
| 11 | + * 简易模式 | ||
| 12 | +*/ | ||
| 13 | +class NoteBookItemSimple extends StatefulWidget { | ||
| 14 | + final num index; | ||
| 15 | + final Notebook notebook; | ||
| 16 | + | ||
| 17 | + NoteBookItemSimple(this.notebook, this.index); | ||
| 18 | + | ||
| 19 | + @override | ||
| 20 | + State<StatefulWidget> createState() { | ||
| 21 | + // TODO: implement createState | ||
| 22 | + return new NoteBookItemSimpleState(); | ||
| 23 | + } | ||
| 24 | +} | ||
| 25 | + | ||
| 26 | +class NoteBookItemSimpleState extends State<NoteBookItemSimple> { | ||
| 27 | + _onOperateClick() { | ||
| 28 | + if (widget.notebook.operationText == "通知客户") { | ||
| 29 | + // String _nameStr = ''; | ||
| 30 | + // String _tid = ''; | ||
| 31 | + // for (int i = 0; | ||
| 32 | + // i < | ||
| 33 | + // detailEntity | ||
| 34 | + // .tables.length; | ||
| 35 | + // i++) { | ||
| 36 | + // _nameStr += | ||
| 37 | + // '${detailEntity.tables[i].name},'; | ||
| 38 | + | ||
| 39 | + // _tid += | ||
| 40 | + // '${detailEntity.tables[i].id},'; | ||
| 41 | + // } | ||
| 42 | + // if (_tid.endsWith(',')) { | ||
| 43 | + // _tid = _tid.substring( | ||
| 44 | + // 0, _tid.length - 1); | ||
| 45 | + // } | ||
| 46 | + // if (_nameStr | ||
| 47 | + // .endsWith(',')) { | ||
| 48 | + // _nameStr = | ||
| 49 | + // _nameStr.substring( | ||
| 50 | + // 0, | ||
| 51 | + // _nameStr.length - | ||
| 52 | + // 1); | ||
| 53 | + // } | ||
| 54 | + NavigatorUtil.goInvicationPage( | ||
| 55 | + context, | ||
| 56 | + widget.notebook.id, | ||
| 57 | + widget.notebook.tableinfoStr, | ||
| 58 | + widget.notebook.ddate, | ||
| 59 | + widget.notebook.ddateStr, | ||
| 60 | + widget.notebook.phone, | ||
| 61 | + widget.notebook.ddate_solt, | ||
| 62 | + widget.notebook.rname == null ? '' : widget.notebook.rname, | ||
| 63 | + widget.notebook.sex == null ? '' : widget.notebook.sex, | ||
| 64 | + tid: widget.notebook.tid); | ||
| 65 | + } | ||
| 66 | + } | ||
| 67 | + | ||
| 68 | + @override | ||
| 69 | + Widget build(BuildContext context) { | ||
| 70 | + // TODO: implement build | ||
| 71 | + Notebook notebook = widget.notebook; | ||
| 72 | + | ||
| 73 | + Color textColor = (notebook.status == "3" || | ||
| 74 | + notebook.status == "4" || | ||
| 75 | + notebook.status == "6") | ||
| 76 | + ? MyColours.color_bfbfbf | ||
| 77 | + : MyColours.color_353535; | ||
| 78 | + | ||
| 79 | + return Stack( | ||
| 80 | + children: [ | ||
| 81 | + Container( | ||
| 82 | + width: double.infinity, | ||
| 83 | + // height: ScreenUtil().setWidth(120), | ||
| 84 | + color: (widget.index % 2 == 0) | ||
| 85 | + ? MyColours.color_f7fdfd | ||
| 86 | + : MyColours.color_ffffff, | ||
| 87 | + child: Row( | ||
| 88 | + children: <Widget>[ | ||
| 89 | + GestureDetector( | ||
| 90 | + behavior: HitTestBehavior.translucent, | ||
| 91 | + onTap: () { | ||
| 92 | + NavigatorUtil.goNotebookDetailPage( | ||
| 93 | + context, notebook.id, notebook.uid); | ||
| 94 | + }, | ||
| 95 | + child: Row( | ||
| 96 | + children: <Widget>[ | ||
| 97 | + Container( | ||
| 98 | + width: ScreenUtil().setWidth(86 * 2), | ||
| 99 | + padding: EdgeInsets.symmetric( | ||
| 100 | + horizontal: ScreenUtil().setWidth(14), | ||
| 101 | + vertical: ScreenUtil().setWidth(40)), | ||
| 102 | + alignment: Alignment.center, | ||
| 103 | + child: Column( | ||
| 104 | + children: [ | ||
| 105 | + Text( | ||
| 106 | + '${notebook.tableinfoStr?.trim()}', | ||
| 107 | + maxLines: 30, | ||
| 108 | + overflow: TextOverflow.ellipsis, | ||
| 109 | + style: TextStyle( | ||
| 110 | + color: textColor, | ||
| 111 | + // fontWeight: FontWeight.bold, | ||
| 112 | + fontSize: ScreenUtil().setSp(30)), | ||
| 113 | + ), | ||
| 114 | + notebook.type == '1' | ||
| 115 | + ? Text('online', | ||
| 116 | + style: TextStyle( | ||
| 117 | + color: Colors.blue, | ||
| 118 | + // fontWeight: FontWeight.bold, | ||
| 119 | + fontSize: ScreenUtil().setSp(26))) | ||
| 120 | + : SizedBox() | ||
| 121 | + ], | ||
| 122 | + ), | ||
| 123 | + ), | ||
| 124 | + MyDivider( | ||
| 125 | + ScreenUtil().setWidth(1), | ||
| 126 | + ScreenUtil().setHeight(90), | ||
| 127 | + color: MyColours.color_ededed, | ||
| 128 | + ), | ||
| 129 | + Container( | ||
| 130 | + width: ScreenUtil().setWidth(230), | ||
| 131 | + alignment: Alignment.center, | ||
| 132 | + child: Column( | ||
| 133 | + mainAxisSize: MainAxisSize.min, | ||
| 134 | + mainAxisAlignment: MainAxisAlignment.center, | ||
| 135 | + children: <Widget>[ | ||
| 136 | + Text( | ||
| 137 | + notebook.rnameStr, | ||
| 138 | + // 'nnnnnnnnnnnnnn', | ||
| 139 | + maxLines: 1, | ||
| 140 | + overflow: TextOverflow.ellipsis, | ||
| 141 | + style: TextStyle( | ||
| 142 | + color: textColor, | ||
| 143 | + // fontWeight: FontWeight.bold, | ||
| 144 | + fontSize: ScreenUtil().setSp(30)), | ||
| 145 | + ), | ||
| 146 | + notebook.phoneStr.isNotEmpty | ||
| 147 | + ? Padding( | ||
| 148 | + padding: EdgeInsets.only( | ||
| 149 | + top: ScreenUtil().setWidth(10)), | ||
| 150 | + child: Text( | ||
| 151 | + notebook.phoneStr, | ||
| 152 | + maxLines: 1, | ||
| 153 | + overflow: TextOverflow.ellipsis, | ||
| 154 | + style: TextStyle( | ||
| 155 | + color: textColor, | ||
| 156 | + // fontWeight: FontWeight.bold, | ||
| 157 | + fontSize: ScreenUtil().setSp(26)), | ||
| 158 | + )) | ||
| 159 | + : Container() | ||
| 160 | + ], | ||
| 161 | + ), | ||
| 162 | + ), | ||
| 163 | + MyDivider( | ||
| 164 | + ScreenUtil().setWidth(1), | ||
| 165 | + ScreenUtil().setHeight(90), | ||
| 166 | + color: MyColours.color_ededed, | ||
| 167 | + ), | ||
| 168 | + Container( | ||
| 169 | + width: ScreenUtil().setWidth(159), | ||
| 170 | + alignment: Alignment.center, | ||
| 171 | + child: Text( | ||
| 172 | + notebook.ddateStr, | ||
| 173 | + style: TextStyle( | ||
| 174 | + color: textColor, | ||
| 175 | + // fontWeight: FontWeight.bold, | ||
| 176 | + fontSize: ScreenUtil().setSp(30)), | ||
| 177 | + ), | ||
| 178 | + ), | ||
| 179 | + ], | ||
| 180 | + ), | ||
| 181 | + ), | ||
| 182 | + MyDivider( | ||
| 183 | + ScreenUtil().setWidth(1), | ||
| 184 | + ScreenUtil().setHeight(90), | ||
| 185 | + color: MyColours.color_ededed, | ||
| 186 | + ), | ||
| 187 | + GestureDetector( | ||
| 188 | + onTap: _onOperateClick, | ||
| 189 | + behavior: HitTestBehavior.opaque, | ||
| 190 | + child: Container( | ||
| 191 | + padding: | ||
| 192 | + EdgeInsets.symmetric(vertical: ScreenUtil().setWidth(20)), | ||
| 193 | + width: ScreenUtil().setWidth(184), | ||
| 194 | + // color: Colors.red, | ||
| 195 | + alignment: Alignment.center, | ||
| 196 | + child: Text( | ||
| 197 | + notebook.operationText, | ||
| 198 | + style: TextStyle( | ||
| 199 | + color: (notebook.status == "3" || | ||
| 200 | + notebook.status == "4" || | ||
| 201 | + notebook.status == "6") | ||
| 202 | + ? MyColours.color_bfbfbf | ||
| 203 | + : MyColours.color_2bb5b7, | ||
| 204 | + // fontWeight: FontWeight.bold, | ||
| 205 | + fontSize: ScreenUtil().setSp(30)), | ||
| 206 | + ), | ||
| 207 | + ), | ||
| 208 | + ), | ||
| 209 | + ], | ||
| 210 | + ), | ||
| 211 | + ), | ||
| 212 | + notebook.orderInfo != null && notebook.orderInfo.status == '3' | ||
| 213 | + ? Container( | ||
| 214 | + alignment: Alignment.center, | ||
| 215 | + width: ScreenUtil().setWidth(52 * 2), | ||
| 216 | + height: ScreenUtil().setWidth(19 * 2), | ||
| 217 | + decoration: BoxDecoration( | ||
| 218 | + color: MyColours.color_F59A23, | ||
| 219 | + borderRadius: BorderRadius.only( | ||
| 220 | + bottomRight: Radius.circular(ScreenUtil().setWidth(10))), | ||
| 221 | + ), | ||
| 222 | + child: Text( | ||
| 223 | + '已买单', | ||
| 224 | + style: TextStyle( | ||
| 225 | + fontSize: ScreenUtil().setSp(24), | ||
| 226 | + color: MyColours.color_ffffff, | ||
| 227 | + fontWeight: FontWeight.bold), | ||
| 228 | + )) | ||
| 229 | + : Container() | ||
| 230 | + ], | ||
| 231 | + ); | ||
| 232 | + } | ||
| 233 | +} |
| @@ -4,6 +4,7 @@ import 'package:flutter/material.dart'; | @@ -4,6 +4,7 @@ import 'package:flutter/material.dart'; | ||
| 4 | import 'package:flutter_easyrefresh/easy_refresh.dart'; | 4 | import 'package:flutter_easyrefresh/easy_refresh.dart'; |
| 5 | import 'package:flutter_screenutil/flutter_screenutil.dart'; | 5 | import 'package:flutter_screenutil/flutter_screenutil.dart'; |
| 6 | import 'package:one_key/constant/state.dart'; | 6 | import 'package:one_key/constant/state.dart'; |
| 7 | +import 'package:one_key/pages/notebook/notebook_item_f.dart'; | ||
| 7 | import 'package:one_key/pages/notebook/notebook_item_widget.dart'; | 8 | import 'package:one_key/pages/notebook/notebook_item_widget.dart'; |
| 8 | import 'package:one_key/provider/notebook_model.dart'; | 9 | import 'package:one_key/provider/notebook_model.dart'; |
| 9 | import 'package:one_key/provider/update_model.dart'; | 10 | import 'package:one_key/provider/update_model.dart'; |
| @@ -16,10 +17,12 @@ import 'package:one_key/utils/utils.dart'; | @@ -16,10 +17,12 @@ import 'package:one_key/utils/utils.dart'; | ||
| 16 | import 'package:one_key/widgets/MyDivider.dart'; | 17 | import 'package:one_key/widgets/MyDivider.dart'; |
| 17 | import 'package:one_key/widgets/app_bar.dart'; | 18 | import 'package:one_key/widgets/app_bar.dart'; |
| 18 | import 'package:one_key/widgets/common_button.dart'; | 19 | import 'package:one_key/widgets/common_button.dart'; |
| 20 | +import 'package:one_key/widgets/common_button_flat.dart'; | ||
| 19 | import 'package:one_key/widgets/h_empty_view.dart'; | 21 | import 'package:one_key/widgets/h_empty_view.dart'; |
| 20 | import 'package:one_key/widgets/page_error.dart'; | 22 | import 'package:one_key/widgets/page_error.dart'; |
| 21 | import 'package:one_key/widgets/page_exception.dart'; | 23 | import 'package:one_key/widgets/page_exception.dart'; |
| 22 | import 'package:one_key/widgets/round_button.dart'; | 24 | import 'package:one_key/widgets/round_button.dart'; |
| 25 | +import 'package:one_key/widgets/v_empty_view.dart'; | ||
| 23 | import 'package:provider/provider.dart'; | 26 | import 'package:provider/provider.dart'; |
| 24 | import 'package:table_calendar/table_calendar.dart'; | 27 | import 'package:table_calendar/table_calendar.dart'; |
| 25 | 28 | ||
| @@ -503,16 +506,30 @@ class NoteBookPageState extends State<NoteBookPage> { | @@ -503,16 +506,30 @@ class NoteBookPageState extends State<NoteBookPage> { | ||
| 503 | Widget build(BuildContext context) { | 506 | Widget build(BuildContext context) { |
| 504 | // TODO: implement build | 507 | // TODO: implement build |
| 505 | userModel = Provider.of<UserModel>(context, listen: false); | 508 | userModel = Provider.of<UserModel>(context, listen: false); |
| 509 | + int sum = 3; | ||
| 510 | + int hide = 0; | ||
| 511 | + int btnNum = 0; | ||
| 512 | + if (morning == "00:00-00:00") { | ||
| 513 | + hide++; | ||
| 514 | + } | ||
| 515 | + if (noon == "00:00-00:00") { | ||
| 516 | + hide++; | ||
| 517 | + } | ||
| 518 | + if (night == "00:00-00:00") { | ||
| 519 | + hide++; | ||
| 520 | + } | ||
| 521 | + btnNum = sum - hide; | ||
| 506 | return Scaffold( | 522 | return Scaffold( |
| 507 | body: Container( | 523 | body: Container( |
| 508 | color: MyColours.color_ffffff, | 524 | color: MyColours.color_ffffff, |
| 509 | - padding: EdgeInsets.symmetric( | ||
| 510 | - horizontal: ScreenUtil().setWidth(24), | ||
| 511 | - vertical: ScreenUtil().setWidth(32)), | 525 | + padding: EdgeInsets.only(top: ScreenUtil().setWidth(32)), |
| 512 | child: Column( | 526 | child: Column( |
| 513 | children: [ | 527 | children: [ |
| 514 | Container( | 528 | Container( |
| 515 | color: MyColours.color_ffffff, | 529 | color: MyColours.color_ffffff, |
| 530 | + padding: EdgeInsets.only( | ||
| 531 | + right: ScreenUtil().setWidth(24), | ||
| 532 | + ), | ||
| 516 | child: Row( | 533 | child: Row( |
| 517 | children: [ | 534 | children: [ |
| 518 | Expanded( | 535 | Expanded( |
| @@ -530,9 +547,9 @@ class NoteBookPageState extends State<NoteBookPage> { | @@ -530,9 +547,9 @@ class NoteBookPageState extends State<NoteBookPage> { | ||
| 530 | dateTimeNow = day; | 547 | dateTimeNow = day; |
| 531 | clearSel = false; | 548 | clearSel = false; |
| 532 | setState(() { | 549 | setState(() { |
| 533 | - dateText = '更多\n日期'; | 550 | + dateText = '更多\n日期'; |
| 534 | }); | 551 | }); |
| 535 | - | 552 | + |
| 536 | // _currTimeIndex(); | 553 | // _currTimeIndex(); |
| 537 | // _getSellerTableClass(); | 554 | // _getSellerTableClass(); |
| 538 | } | 555 | } |
| @@ -745,6 +762,213 @@ class NoteBookPageState extends State<NoteBookPage> { | @@ -745,6 +762,213 @@ class NoteBookPageState extends State<NoteBookPage> { | ||
| 745 | )), | 762 | )), |
| 746 | ], | 763 | ], |
| 747 | )), | 764 | )), |
| 765 | + VEmptyView(20), | ||
| 766 | + Padding( | ||
| 767 | + padding: EdgeInsets.only( | ||
| 768 | + bottom: ScreenUtil().setWidth(8), | ||
| 769 | + left: ScreenUtil().setWidth(24), | ||
| 770 | + right: ScreenUtil().setWidth(24)), | ||
| 771 | + child: Row( | ||
| 772 | + mainAxisAlignment: MainAxisAlignment.spaceBetween, | ||
| 773 | + children: [ | ||
| 774 | + Container( | ||
| 775 | + width: btnNum == 3 && | ||
| 776 | + (currTimeIndex == 3 || currTimeIndex == 1) | ||
| 777 | + ? ScreenUtil().setWidth(240 * 2) + | ||
| 778 | + ScreenUtil().setWidth(4) | ||
| 779 | + : ScreenUtil().setWidth(240 * 2), | ||
| 780 | + height: ScreenUtil().setWidth(80), | ||
| 781 | + decoration: BoxDecoration( | ||
| 782 | + color: Color.fromRGBO(232, 232, 232, 1), | ||
| 783 | + borderRadius: BorderRadius.circular( | ||
| 784 | + ScreenUtil().setWidth(20), | ||
| 785 | + )), | ||
| 786 | + child: Row( | ||
| 787 | + // mainAxisAlignment: MainAxisAlignment.spaceEvenly, | ||
| 788 | + // crossAxisAlignment: CrossAxisAlignment.center, | ||
| 789 | + children: <Widget>[ | ||
| 790 | + Offstage( | ||
| 791 | + offstage: | ||
| 792 | + morning == "00:00-00:00" ? true : false, | ||
| 793 | + child: Selector<NoteBookModel, String>( | ||
| 794 | + selector: (context, model) => | ||
| 795 | + model.totalmorning, | ||
| 796 | + builder: (context, total, child) { | ||
| 797 | + return CommonButtonFlat( | ||
| 798 | + content: "早餐" + total, | ||
| 799 | + state: currTimeIndex == 1 ? 1 : 0, | ||
| 800 | + fontSize: 28, | ||
| 801 | + padding: EdgeInsets.symmetric( | ||
| 802 | + vertical: | ||
| 803 | + ScreenUtil().setWidth(20)), | ||
| 804 | + right: noon == "00:00-00:00" && | ||
| 805 | + night == "00:00-00:00" | ||
| 806 | + ? true | ||
| 807 | + : false, | ||
| 808 | + width: ScreenUtil().setWidth(240 * 2) / | ||
| 809 | + btnNum, | ||
| 810 | + onPress: () { | ||
| 811 | + if (currTimeIndex == 1) return; | ||
| 812 | + setState(() { | ||
| 813 | + currTimeIndex = 1; | ||
| 814 | + }); | ||
| 815 | + | ||
| 816 | + _getReserveList(); | ||
| 817 | + }, | ||
| 818 | + ); | ||
| 819 | + })), | ||
| 820 | + btnNum == 3 && currTimeIndex == 3 | ||
| 821 | + ? MyDivider( | ||
| 822 | + ScreenUtil().setWidth(4), | ||
| 823 | + ScreenUtil().setWidth(46), | ||
| 824 | + color: MyColours.color_dfdfdf, | ||
| 825 | + ) | ||
| 826 | + : SizedBox(), | ||
| 827 | + Offstage( | ||
| 828 | + offstage: noon == "00:00-00:00" ? true : false, | ||
| 829 | + child: Selector<NoteBookModel, String>( | ||
| 830 | + selector: (context, model) => | ||
| 831 | + model.totalnoon, | ||
| 832 | + builder: (context, total, child) { | ||
| 833 | + return CommonButtonFlat( | ||
| 834 | + content: "午餐" + total, | ||
| 835 | + state: currTimeIndex == 2 ? 1 : 0, | ||
| 836 | + fontSize: 28, | ||
| 837 | + width: ScreenUtil().setWidth(240 * 2) / | ||
| 838 | + btnNum, | ||
| 839 | + padding: EdgeInsets.symmetric( | ||
| 840 | + vertical: | ||
| 841 | + ScreenUtil().setWidth(20)), | ||
| 842 | + left: morning == "00:00-00:00" | ||
| 843 | + ? true | ||
| 844 | + : false, | ||
| 845 | + right: night == "00:00-00:00" | ||
| 846 | + ? true | ||
| 847 | + : false, | ||
| 848 | + onPress: () { | ||
| 849 | + if (currTimeIndex == 2) return; | ||
| 850 | + setState(() { | ||
| 851 | + currTimeIndex = 2; | ||
| 852 | + }); | ||
| 853 | + _getReserveList(); | ||
| 854 | + }, | ||
| 855 | + ); | ||
| 856 | + })), | ||
| 857 | + btnNum == 3 && currTimeIndex == 1 | ||
| 858 | + ? MyDivider( | ||
| 859 | + ScreenUtil().setWidth(4), | ||
| 860 | + ScreenUtil().setWidth(46), | ||
| 861 | + color: MyColours.color_dfdfdf, | ||
| 862 | + ) | ||
| 863 | + : SizedBox(), | ||
| 864 | + Offstage( | ||
| 865 | + offstage: night == "00:00-00:00" ? true : false, | ||
| 866 | + child: Container( | ||
| 867 | + child: Selector<NoteBookModel, String>( | ||
| 868 | + selector: (context, model) => | ||
| 869 | + model.totalnight, | ||
| 870 | + builder: (context, total, child) { | ||
| 871 | + return CommonButtonFlat( | ||
| 872 | + content: "晚餐" + total, | ||
| 873 | + left: morning == "00:00-00:00" && | ||
| 874 | + noon == "00:00-00:00" | ||
| 875 | + ? true | ||
| 876 | + : false, | ||
| 877 | + state: currTimeIndex == 3 ? 1 : 0, | ||
| 878 | + fontSize: 28, | ||
| 879 | + width: | ||
| 880 | + ScreenUtil().setWidth(240 * 2) / | ||
| 881 | + btnNum, | ||
| 882 | + onPress: () { | ||
| 883 | + if (currTimeIndex == 3) return; | ||
| 884 | + setState(() { | ||
| 885 | + currTimeIndex = 3; | ||
| 886 | + }); | ||
| 887 | + | ||
| 888 | + _getReserveList(); | ||
| 889 | + }, | ||
| 890 | + ); | ||
| 891 | + })), | ||
| 892 | + ), | ||
| 893 | + ], | ||
| 894 | + ), | ||
| 895 | + ), | ||
| 896 | + Column( | ||
| 897 | + children: [ | ||
| 898 | + Text( | ||
| 899 | + '我录入的', | ||
| 900 | + style: TextStyle( | ||
| 901 | + fontSize: ScreenUtil().setSp(20), | ||
| 902 | + fontWeight: FontWeight.bold, | ||
| 903 | + color: MyColours.color_515151), | ||
| 904 | + ), | ||
| 905 | + VEmptyView(16), | ||
| 906 | + Image.asset( | ||
| 907 | + Utils.getImgPath( | ||
| 908 | + true ? 'f_swich_on' : 'f_swich_off'), | ||
| 909 | + width: ScreenUtil().setWidth(24 * 2)) | ||
| 910 | + ], | ||
| 911 | + ), | ||
| 912 | + Column( | ||
| 913 | + children: [ | ||
| 914 | + Text( | ||
| 915 | + '简易模式', | ||
| 916 | + style: TextStyle( | ||
| 917 | + fontSize: ScreenUtil().setSp(20), | ||
| 918 | + fontWeight: FontWeight.bold, | ||
| 919 | + color: MyColours.color_515151), | ||
| 920 | + ), | ||
| 921 | + VEmptyView(16), | ||
| 922 | + Image.asset( | ||
| 923 | + Utils.getImgPath( | ||
| 924 | + true ? 'f_swich_on' : 'f_swich_off'), | ||
| 925 | + width: ScreenUtil().setWidth(24 * 2)) | ||
| 926 | + ], | ||
| 927 | + ), | ||
| 928 | + ], | ||
| 929 | + )), | ||
| 930 | + Expanded(child: Consumer<NoteBookModel>( | ||
| 931 | + builder: (context, model, _) { | ||
| 932 | + if (model.pageState != PageState.Success) { | ||
| 933 | + return ExceptionPage( | ||
| 934 | + pageState: model.pageState, | ||
| 935 | + callback: () { | ||
| 936 | + _getReserveList(); | ||
| 937 | + _reserveCountDay(); | ||
| 938 | + }, | ||
| 939 | + emptyMsg: "暂时没有预订哦", | ||
| 940 | + emptyImg: "empty_search", | ||
| 941 | + showMsg: "加载中,请稍后...", | ||
| 942 | + ); | ||
| 943 | + } else { | ||
| 944 | + return Container( | ||
| 945 | + color: MyColours.color_F8F9FD, | ||
| 946 | + padding: EdgeInsets.symmetric( | ||
| 947 | + horizontal: ScreenUtil().setWidth(20), | ||
| 948 | + vertical: ScreenUtil().setWidth(24)), | ||
| 949 | + child: EasyRefresh.custom( | ||
| 950 | + controller: _controller, | ||
| 951 | + slivers: [ | ||
| 952 | + SliverList( | ||
| 953 | + delegate: SliverChildBuilderDelegate( | ||
| 954 | + (BuildContext context, int index) { | ||
| 955 | + return Container( | ||
| 956 | + margin: EdgeInsets.only( | ||
| 957 | + bottom: ScreenUtil().setWidth(24)), | ||
| 958 | + child: NoteBookItemF( | ||
| 959 | + model.notebooks[index], index), | ||
| 960 | + ); | ||
| 961 | + }, childCount: model.notebooks.length), | ||
| 962 | + // itemExtent: ScreenUtil().setWidth(112), | ||
| 963 | + ) | ||
| 964 | + ], | ||
| 965 | + onRefresh: () async { | ||
| 966 | + _getReserveList(); | ||
| 967 | + }, | ||
| 968 | + )); | ||
| 969 | + } | ||
| 970 | + }, | ||
| 971 | + )) | ||
| 748 | ], | 972 | ], |
| 749 | )), | 973 | )), |
| 750 | ); | 974 | ); |
| @@ -862,24 +1086,24 @@ class NoteBookPageState extends State<NoteBookPage> { | @@ -862,24 +1086,24 @@ class NoteBookPageState extends State<NoteBookPage> { | ||
| 862 | ], | 1086 | ], |
| 863 | ), | 1087 | ), |
| 864 | ), | 1088 | ), |
| 865 | - Selector<NoteBookModel, String>( | ||
| 866 | - selector: (context, model) => model.total, | ||
| 867 | - builder: (context, total, child) { | ||
| 868 | - return Container( | ||
| 869 | - width: double.infinity, | ||
| 870 | - alignment: Alignment.centerLeft, | ||
| 871 | - padding: EdgeInsets.only(left: ScreenUtil().setWidth(38)), | ||
| 872 | - height: ScreenUtil().setHeight(72), | ||
| 873 | - color: MyColours.color_f5f5f5, | ||
| 874 | - child: Text( | ||
| 875 | - total, | ||
| 876 | - style: TextStyle( | ||
| 877 | - color: MyColours.color_353535, | ||
| 878 | - fontSize: ScreenUtil().setSp(26)), | ||
| 879 | - ), | ||
| 880 | - ); | ||
| 881 | - }, | ||
| 882 | - ), | 1089 | + // Selector<NoteBookModel, String>( |
| 1090 | + // selector: (context, model) => model.total, | ||
| 1091 | + // builder: (context, total, child) { | ||
| 1092 | + // return Container( | ||
| 1093 | + // width: double.infinity, | ||
| 1094 | + // alignment: Alignment.centerLeft, | ||
| 1095 | + // padding: EdgeInsets.only(left: ScreenUtil().setWidth(38)), | ||
| 1096 | + // height: ScreenUtil().setHeight(72), | ||
| 1097 | + // color: MyColours.color_f5f5f5, | ||
| 1098 | + // child: Text( | ||
| 1099 | + // total, | ||
| 1100 | + // style: TextStyle( | ||
| 1101 | + // color: MyColours.color_353535, | ||
| 1102 | + // fontSize: ScreenUtil().setSp(26)), | ||
| 1103 | + // ), | ||
| 1104 | + // ); | ||
| 1105 | + // }, | ||
| 1106 | + // ), | ||
| 883 | _buildListTitle(), | 1107 | _buildListTitle(), |
| 884 | Expanded(child: Consumer<NoteBookModel>( | 1108 | Expanded(child: Consumer<NoteBookModel>( |
| 885 | builder: (context, model, _) { | 1109 | builder: (context, model, _) { |
| @@ -13,7 +13,9 @@ import 'package:provider/provider.dart'; | @@ -13,7 +13,9 @@ import 'package:provider/provider.dart'; | ||
| 13 | class NoteBookModel extends ChangeNotifier { | 13 | class NoteBookModel extends ChangeNotifier { |
| 14 | List<Notebook> notebooks = []; //订单列表 | 14 | List<Notebook> notebooks = []; //订单列表 |
| 15 | 15 | ||
| 16 | - String total = ""; //一天统计 | 16 | + String totalmorning = ""; //一天统计 |
| 17 | + String totalnoon = ""; //一天统计 | ||
| 18 | + String totalnight = ""; //一天统计 | ||
| 17 | 19 | ||
| 18 | PageState pageState = PageState.Loading; | 20 | PageState pageState = PageState.Loading; |
| 19 | 21 | ||
| @@ -79,15 +81,15 @@ class NoteBookModel extends ChangeNotifier { | @@ -79,15 +81,15 @@ class NoteBookModel extends ChangeNotifier { | ||
| 79 | int noon = int.parse(baseResp.data["noon"].toString()); | 81 | int noon = int.parse(baseResp.data["noon"].toString()); |
| 80 | int night = int.parse(baseResp.data["night"].toString()); | 82 | int night = int.parse(baseResp.data["night"].toString()); |
| 81 | UserModel userModel = Provider.of<UserModel>(context, listen: false); | 83 | UserModel userModel = Provider.of<UserModel>(context, listen: false); |
| 82 | - total = "已订" + (morning + noon + night).toString(); | 84 | + // total = "已订" + (morning + noon + night).toString(); |
| 83 | if (userModel.user.morning.isNotEmpty) { | 85 | if (userModel.user.morning.isNotEmpty) { |
| 84 | - total += " 早市" + morning.toString(); | 86 | + totalmorning += "($morning"; |
| 85 | } | 87 | } |
| 86 | if (userModel.user.noon.isNotEmpty) { | 88 | if (userModel.user.noon.isNotEmpty) { |
| 87 | - total += " 午市" + noon.toString(); | 89 | + totalmorning += "($noon"; |
| 88 | } | 90 | } |
| 89 | if (userModel.user.night.isNotEmpty) { | 91 | if (userModel.user.night.isNotEmpty) { |
| 90 | - total += " 晚市" + night.toString(); | 92 | + totalmorning += "($night"; |
| 91 | } | 93 | } |
| 92 | notifyListeners(); | 94 | notifyListeners(); |
| 93 | } | 95 | } |
| 1 | import 'package:flutter/material.dart'; | 1 | import 'package:flutter/material.dart'; |
| 2 | 2 | ||
| 3 | class MyColours { | 3 | class MyColours { |
| 4 | + static const Color color_A78E44 = Color(0xffA78E44); | ||
| 5 | + static const Color color_260101 = Color(0xff260101); | ||
| 4 | static const Color color_ED7B2F = Color(0xffED7B2F); | 6 | static const Color color_ED7B2F = Color(0xffED7B2F); |
| 5 | static const Color color_DBDBDB = Color(0xffDBDBDB); | 7 | static const Color color_DBDBDB = Color(0xffDBDBDB); |
| 6 | static const Color color_F8F9FD = Color(0xffF8F9FD); | 8 | static const Color color_F8F9FD = Color(0xffF8F9FD); |
| @@ -835,6 +835,10 @@ class Utils { | @@ -835,6 +835,10 @@ class Utils { | ||
| 835 | return phone.replaceFirst(new RegExp(r'\d{4}'), '****', 3); | 835 | return phone.replaceFirst(new RegExp(r'\d{4}'), '****', 3); |
| 836 | } | 836 | } |
| 837 | 837 | ||
| 838 | + static String showEndPhone(String phone) { | ||
| 839 | + return '*' + phone.substring(phone.length - 4); | ||
| 840 | + } | ||
| 841 | + | ||
| 838 | static List<String> stringToList(String str) { | 842 | static List<String> stringToList(String str) { |
| 839 | List<String> list = <String>[]; | 843 | List<String> list = <String>[]; |
| 840 | // for (var value in JsonDecoder().convert(str)) { | 844 | // for (var value in JsonDecoder().convert(str)) { |
| @@ -12,6 +12,7 @@ class CommonButtonFlat extends StatelessWidget { | @@ -12,6 +12,7 @@ class CommonButtonFlat extends StatelessWidget { | ||
| 12 | final FontWeight fontWeight; | 12 | final FontWeight fontWeight; |
| 13 | final bool left; | 13 | final bool left; |
| 14 | final bool right; | 14 | final bool right; |
| 15 | + final EdgeInsets padding; | ||
| 15 | CommonButtonFlat( | 16 | CommonButtonFlat( |
| 16 | {this.onPress, | 17 | {this.onPress, |
| 17 | this.content, | 18 | this.content, |
| @@ -21,7 +22,8 @@ class CommonButtonFlat extends StatelessWidget { | @@ -21,7 +22,8 @@ class CommonButtonFlat extends StatelessWidget { | ||
| 21 | this.fontSize = 18, | 22 | this.fontSize = 18, |
| 22 | this.fontWeight = FontWeight.normal, | 23 | this.fontWeight = FontWeight.normal, |
| 23 | this.left = true, | 24 | this.left = true, |
| 24 | - this.right = true}); | 25 | + this.right = true, |
| 26 | + this.padding = EdgeInsets.zero}); | ||
| 25 | 27 | ||
| 26 | @override | 28 | @override |
| 27 | Widget build(BuildContext context) { | 29 | Widget build(BuildContext context) { |
| @@ -157,6 +159,7 @@ class CommonButtonFlat extends StatelessWidget { | @@ -157,6 +159,7 @@ class CommonButtonFlat extends StatelessWidget { | ||
| 157 | onTap: onPress, | 159 | onTap: onPress, |
| 158 | child: Container( | 160 | child: Container( |
| 159 | width: width, | 161 | width: width, |
| 162 | + padding: padding, | ||
| 160 | // height: ScreenUtil().setWidth(height), | 163 | // height: ScreenUtil().setWidth(height), |
| 161 | 164 | ||
| 162 | decoration: boxDecoration, | 165 | decoration: boxDecoration, |
-
Please register or login to post a comment