Commit cdc6147ae5d286e01a53f8f950c21fbe94321e18

Authored by wdn127929
1 parent 2484126a

-点击单个桌位切换简易模式

@@ -50,6 +50,7 @@ class Notebook { @@ -50,6 +50,7 @@ class Notebook {
50 String name; 50 String name;
51 OrderInfo orderInfo; 51 OrderInfo orderInfo;
52 String nick_name; 52 String nick_name;
  53 + bool issimple;
53 54
54 // String get tableinfoStr { 55 // String get tableinfoStr {
55 // return name + 56 // return name +
@@ -10,6 +10,29 @@ import 'package:one_key/widgets/v_empty_view.dart'; @@ -10,6 +10,29 @@ import 'package:one_key/widgets/v_empty_view.dart';
10 /** 10 /**
11 * 简易模式 11 * 简易模式
12 */ 12 */
  13 +import 'dart:convert';
  14 +import 'dart:ui';
  15 +
  16 +import 'package:flutter/material.dart';
  17 +import 'package:flutter_screenutil/flutter_screenutil.dart';
  18 +import 'package:one_key/models/notebook.dart';
  19 +import 'package:one_key/pages/notebook/spread_widget.dart';
  20 +import 'package:one_key/provider/notebook_detail_model.dart';
  21 +import 'package:one_key/provider/user_model.dart';
  22 +import 'package:one_key/res/colors.dart';
  23 +import 'package:one_key/route/navigator_util.dart';
  24 +import 'package:one_key/utils/event_bus.dart';
  25 +import 'package:one_key/utils/utils.dart';
  26 +import 'package:one_key/widgets/MyDivider.dart';
  27 +import 'package:one_key/widgets/h_empty_view.dart';
  28 +import 'package:one_key/widgets/loading.dart';
  29 +import 'package:one_key/widgets/round_button.dart';
  30 +import 'package:one_key/widgets/v_empty_view.dart';
  31 +import 'package:provider/provider.dart';
  32 +
  33 +/**
  34 + * 详细模式
  35 + */
13 class NoteBookItemSimple extends StatefulWidget { 36 class NoteBookItemSimple extends StatefulWidget {
14 final num index; 37 final num index;
15 final Notebook notebook; 38 final Notebook notebook;
@@ -23,7 +46,19 @@ class NoteBookItemSimple extends StatefulWidget { @@ -23,7 +46,19 @@ class NoteBookItemSimple extends StatefulWidget {
23 } 46 }
24 } 47 }
25 48
26 -class NoteBookItemSimpleState extends State<NoteBookItemSimple> { 49 +class NoteBookItemSimpleState extends State<NoteBookItemSimple>
  50 + with SingleTickerProviderStateMixin {
  51 + bool _large = false;
  52 + List cancelReasonList = [];
  53 + bool isShowTF = false;
  54 + // int paddingBottom;
  55 + int paddingTop = 138;
  56 + FocusNode _cancelNode = FocusNode();
  57 + TextEditingController _cancelController = TextEditingController();
  58 + StateSetter _cancelState;
  59 +
  60 + ScrollController _scrollController;
  61 +
27 _onOperateClick() { 62 _onOperateClick() {
28 if (widget.notebook.operationText == "通知客户") { 63 if (widget.notebook.operationText == "通知客户") {
29 // String _nameStr = ''; 64 // String _nameStr = '';
@@ -65,169 +100,837 @@ class NoteBookItemSimpleState extends State<NoteBookItemSimple> { @@ -65,169 +100,837 @@ class NoteBookItemSimpleState extends State<NoteBookItemSimple> {
65 } 100 }
66 } 101 }
67 102
  103 + /// 初始化取消原因数据
  104 + _initCancel() {
  105 + // isShowTF = false;
  106 + // paddingBottom = ScreenUtil.screenHeightDp.ceil() - 138 - 340;
  107 + cancelReasonList = [
  108 + {'title': '顾客取消', 'select': false},
  109 + {'title': '顾客行程有变', 'select': false},
  110 + {'title': '信息填写有误', 'select': false},
  111 + {'title': '操作失误', 'select': false},
  112 + {'title': '其他原因', 'select': false},
  113 + ];
  114 + }
  115 +
  116 + _updateSize(bool cando) {
  117 + if (!cando) {
  118 + return;
  119 + }
  120 + setState(() {
  121 + _large = !_large;
  122 + });
  123 + }
  124 +
  125 + ///处理在线预订
  126 + setReserveStatus(String status, {String desc}) async {
  127 + // bus.emit("remove_untreated_message",widget.mid);
  128 + UserModel userModel = Provider.of<UserModel>(context, listen: false);
  129 +
  130 + Map<String, String> params = {
  131 + "rid": widget.notebook.id,
  132 + "status": status, //5安排包间 2:确认到店(到店),3:用餐完成(离店),4:取消预定,5:分配包间:6:拒单
  133 + "uid": userModel.user.openid,
  134 + };
  135 + if (status == '4') {
  136 + Map<String, String> causeMap = {
  137 + "uid": userModel.user.openid,
  138 + "uname": userModel.user.account,
  139 + "desc": desc,
  140 + };
  141 + params["cause"] = json.encode(causeMap);
  142 + }
  143 + NotebookDetailModel detailModel =
  144 + Provider.of<NotebookDetailModel>(context, listen: false);
  145 + bool success =
  146 + await detailModel.setReserveStatus(context, params, ifPush: false);
  147 + if (success) {
  148 + bus.emit("refresh_book_list");
  149 + // if (status == "4") {
  150 + // //取消预订
  151 + // bus.emit("refresh_tablemanager"); //刷新桌位
  152 + // }
  153 + // _getReserveDetail();
  154 + }
  155 + }
  156 +
  157 + ///取消预订弹框
  158 + _showCancelWidget(context) {
  159 + _scrollController = ScrollController();
  160 + _initCancel();
  161 + showGeneralDialog(
  162 + context: context,
  163 + barrierDismissible: false,
  164 + barrierLabel:
  165 + MaterialLocalizations.of(context).modalBarrierDismissLabel,
  166 + transitionDuration: const Duration(milliseconds: 150),
  167 + barrierColor: Color.fromRGBO(0, 0, 0, 0.25),
  168 + pageBuilder: (BuildContext context, Animation animation,
  169 + Animation secondaryAnimation) {
  170 + return Scaffold(
  171 + backgroundColor: Color.fromRGBO(0, 0, 0, 0.25),
  172 + body: StatefulBuilder(builder: (context, state) {
  173 + _cancelState = state;
  174 + return GestureDetector(
  175 + behavior: HitTestBehavior.opaque,
  176 + // onTap: () {
  177 + // Navigator.of(context).pop();
  178 + // },
  179 + child: Center(
  180 + child: Container(
  181 + margin: EdgeInsets.symmetric(
  182 + horizontal: ScreenUtil().setWidth(28 * 2)),
  183 + padding: EdgeInsets.symmetric(
  184 + horizontal: ScreenUtil().setWidth(32)),
  185 + decoration: BoxDecoration(
  186 + color: Colors.white,
  187 + borderRadius:
  188 + BorderRadius.circular(ScreenUtil().setWidth(10)),
  189 + ),
  190 + height: ScreenUtil().setWidth(355 * 2),
  191 + child: Column(
  192 + // mainAxisSize: MainAxisSize.min,
  193 + children: [
  194 + // Stack(
  195 + // children: [
  196 + VEmptyView(48),
  197 + Container(
  198 + height: ScreenUtil().setWidth(48),
  199 + child: Text(
  200 + '是否确定取消预订',
  201 + style: TextStyle(
  202 + fontSize: ScreenUtil().setSp(32),
  203 + fontWeight: FontWeight.bold,
  204 + decoration: TextDecoration.none,
  205 + color: Color.fromRGBO(0, 0, 0, 0.9)),
  206 + ),
  207 + ),
  208 + // Positioned(
  209 + // top: ScreenUtil().setWidth(8),
  210 + // right: ScreenUtil().setWidth(0),
  211 + // child: GestureDetector(
  212 + // onTap: () {
  213 + // _initCancel();
  214 + // Navigator.of(context).pop();
  215 + // },
  216 + // child: Container(
  217 + // padding: EdgeInsets.only(left: 20),
  218 + // child: Image.asset(
  219 + // 'assets/close.png',
  220 + // width: ScreenUtil().setWidth(32),
  221 + // height: ScreenUtil().setWidth(32),
  222 + // ),
  223 + // )))
  224 + // ],
  225 + // ),
  226 + VEmptyView(40),
  227 + Container(
  228 + child: Column(
  229 + // mainAxisSize: MainAxisSize.min,
  230 + children: cancelReasonList.map((value) {
  231 + return value['title'] == '其他原因'
  232 + ? SizedBox()
  233 + : GestureDetector(
  234 + onTap: () {
  235 + for (var item in cancelReasonList) {
  236 + item['select'] = false;
  237 + // isShowTF = false;
  238 + // paddingBottom =
  239 + // ScreenUtil.screenHeightDp.ceil() -
  240 + // 138 -
  241 + // 340;
  242 + if (item['title'] ==
  243 + value['title']) {
  244 + item['select'] = true;
  245 + // if (item['title'] == '其他原因') {
  246 + // // isShowTF = true;
  247 + // // paddingBottom = 130;
  248 + // // paddingBottom =
  249 + // // ScreenUtil.screenHeightDp.ceil() -
  250 + // // 138 -
  251 + // // 340 -
  252 + // // 46;
  253 + // }
  254 + }
  255 + }
  256 + state(() {});
  257 + },
  258 + child: Container(
  259 + height: ScreenUtil().setWidth(48),
  260 + margin: EdgeInsets.only(
  261 + bottom:
  262 + ScreenUtil().setWidth(40)),
  263 + child: Row(
  264 + children: [
  265 + Image.asset(
  266 + value['select']
  267 + ? 'assets/select.png'
  268 + : 'assets/unselect.png',
  269 + width: ScreenUtil()
  270 + .setWidth(42)),
  271 + HEmptyView(20),
  272 + Container(
  273 + child: Text(value['title'],
  274 + style: TextStyle(
  275 + fontSize: ScreenUtil()
  276 + .setSp(32),
  277 + fontWeight:
  278 + FontWeight.normal,
  279 + decoration:
  280 + TextDecoration
  281 + .none,
  282 + color: MyColours
  283 + .color_333333)))
  284 + ],
  285 + ),
  286 + ),
  287 + );
  288 + }).toList(),
  289 + )),
  290 + Material(
  291 + child: Container(
  292 + color: Colors.white,
  293 + height: ScreenUtil().setWidth(42 * 2),
  294 + child: Row(children: [
  295 + InkWell(
  296 + onTap: () {
  297 + for (var item in cancelReasonList) {
  298 + item['select'] = false;
  299 + }
  300 + cancelReasonList[4]['select'] =
  301 + true;
  302 + state(() {});
  303 + },
  304 + child: Padding(
  305 + padding: EdgeInsets.only(
  306 + right: ScreenUtil()
  307 + .setWidth(20)),
  308 + child: Image.asset(
  309 + cancelReasonList[4]['select']
  310 + ? 'assets/select.png'
  311 + : 'assets/unselect.png',
  312 + width: ScreenUtil()
  313 + .setWidth(44)))),
  314 + Expanded(
  315 + child: Container(
  316 + decoration: BoxDecoration(
  317 + color: Color.fromRGBO(
  318 + 240, 240, 240, 1),
  319 + borderRadius: BorderRadius.circular(
  320 + ScreenUtil().setWidth(8))),
  321 + // height: ScreenUtil().setWidth(42 * 2),
  322 + padding: EdgeInsets.symmetric(
  323 + horizontal:
  324 + ScreenUtil().setWidth(16)),
  325 + child: TextField(
  326 + maxLines: 1,
  327 + controller: _cancelController,
  328 + focusNode: _cancelNode,
  329 + style: TextStyle(
  330 + textBaseline:
  331 + TextBaseline.alphabetic),
  332 + textAlignVertical:
  333 + TextAlignVertical.center,
  334 + decoration: InputDecoration(
  335 + contentPadding: EdgeInsets.zero,
  336 + hintText: "其他",
  337 + // focusColor: Color.fromRGBO(0, 0, 0, 0.4),
  338 + hintStyle: TextStyle(
  339 + color:
  340 + Color.fromRGBO(0, 0, 0, 0.4),
  341 + fontSize: ScreenUtil().setSp(32),
  342 + ),
  343 + enabledBorder: OutlineInputBorder(
  344 + borderSide: BorderSide(
  345 + width: 0,
  346 + color: Colors.transparent)),
  347 + border: OutlineInputBorder(
  348 + borderSide: BorderSide(
  349 + width: 0,
  350 + color: Colors.transparent)),
  351 + focusedBorder: OutlineInputBorder(
  352 + borderSide: BorderSide(
  353 + width: 0,
  354 + color: Colors.transparent)),
  355 + ),
  356 +
  357 + // border: InputBorder.none,
  358 +
  359 + onChanged: (_) {
  360 + setState(() {});
  361 + },
  362 + onEditingComplete: () {
  363 + print('fff');
  364 + _cancelNode.unfocus();
  365 + },
  366 + // keyboardType: TextInputType.number,
  367 + ),
  368 + ))
  369 + ]))),
  370 +
  371 + VEmptyView(15),
  372 + Material(
  373 + child: RoundButton(
  374 + onPressed: () {
  375 + String desc = '';
  376 + for (var value in cancelReasonList) {
  377 + if (value['select'] == true) {
  378 + desc = value['title'];
  379 + if (value['title'] == '其他原因') {
  380 + desc = _cancelController.text.trim();
  381 + if (desc.isEmpty) {
  382 + Utils.showToast("请填写原因");
  383 + return;
  384 + }
  385 + }
  386 + }
  387 + }
  388 +
  389 + if (desc == '') {
  390 + Utils.showToast('请选择原因');
  391 + return;
  392 + }
  393 +
  394 + Navigator.of(context).pop();
  395 + Loading.showLoading(context);
  396 +
  397 + setReserveStatus('4', desc: desc);
  398 + },
  399 + text: '确认',
  400 + height: ScreenUtil().setWidth(80),
  401 + width: ScreenUtil().setWidth(300),
  402 + radius: ScreenUtil().setWidth(10),
  403 + ),
  404 + )
  405 + ],
  406 + ),
  407 + ),
  408 + ));
  409 + }));
  410 + });
  411 + }
  412 +
68 @override 413 @override
69 Widget build(BuildContext context) { 414 Widget build(BuildContext context) {
70 // TODO: implement build 415 // TODO: implement build
71 Notebook notebook = widget.notebook; 416 Notebook notebook = widget.notebook;
  417 + UserModel userModel = Provider.of<UserModel>(context, listen: false);
  418 + bool canDo = true;
  419 + if (userModel.user.role_name != '管理员' &&
  420 + userModel.user.role_name != '店长' &&
  421 + notebook.uid != "null" &&
  422 + notebook.uid != userModel.user.openid) {
  423 + canDo = false;
  424 + } else {
  425 + if (notebook.status == '0' ||
  426 + notebook.status == '1' ||
  427 + notebook.status == '2' ||
  428 + notebook.status == '5') {
  429 + canDo = true;
  430 + } else {
  431 + canDo = false;
  432 + }
  433 + }
72 434
73 - Color textColor = (notebook.status == "3" ||  
74 - notebook.status == "4" ||  
75 - notebook.status == "6")  
76 - ? MyColours.color_bfbfbf  
77 - : MyColours.color_353535; 435 + Color bgColor = notebook.status == '0' ||
  436 + notebook.status == "2" ||
  437 + notebook.status == "1" ||
  438 + notebook.status == '5'
  439 + ? MyColours.color_438E93
  440 + : MyColours.color_BFC4D4;
78 441
  442 + String detail = '';
  443 + if (notebook.tid.split(",").length >= 2) {
  444 + //连台
  445 + detail += '[连台]:${notebook.tableinfoStr};';
  446 + }
  447 + if (notebook.cusdem != null && notebook.cusdem != '') {
  448 + //有备注
  449 + detail += '[备注]:${notebook.cusdem};';
  450 + }
  451 + if (notebook.aname != null) {
  452 + //有优惠
  453 + detail += '[优惠]:${notebook.aname}';
  454 + }
  455 + if (detail.endsWith(';')) {
  456 + detail = detail.substring(0, detail.length - 1);
  457 + }
  458 + double widthBtn = 464.0;
  459 + if (notebook.status == '2') {
  460 + widthBtn = 208.0;
  461 + }
79 return Stack( 462 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 - ), 463 + clipBehavior: Clip.none,
  464 + alignment: Alignment.centerRight,
  465 + children: [
  466 + Container(
  467 + padding: EdgeInsets.only(
  468 + left: ScreenUtil().setWidth(16),
  469 + top: ScreenUtil().setWidth(16),
  470 + bottom: ScreenUtil().setWidth(16),
  471 + right: ScreenUtil().setWidth(44),
  472 + ),
  473 + margin: EdgeInsets.only(right: ScreenUtil().setWidth(48)),
  474 + decoration: BoxDecoration(
  475 + color: MyColours.color_ffffff,
  476 + borderRadius: BorderRadius.circular(ScreenUtil().setWidth(32)),
  477 + border: Border.all(
  478 + color: Color.fromRGBO(191, 196, 212, 0.2),
  479 + width: ScreenUtil().setWidth(1)),
  480 + ),
  481 + child: Row(
  482 + children: [
  483 + Column(
  484 + crossAxisAlignment: CrossAxisAlignment.center,
  485 + children: [
129 Container( 486 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), 487 + width: ScreenUtil().setWidth(82 * 2),
  488 + margin:
  489 + EdgeInsets.only(bottom: ScreenUtil().setWidth(9 * 2)),
170 alignment: Alignment.center, 490 alignment: Alignment.center,
171 child: Text( 491 child: Text(
172 - notebook.ddateStr, 492 + notebook.name,
  493 + maxLines: 1,
  494 + overflow: TextOverflow.ellipsis,
173 style: TextStyle( 495 style: TextStyle(
174 - color: textColor,  
175 - // fontWeight: FontWeight.bold,  
176 - fontSize: ScreenUtil().setSp(30)), 496 + color: bgColor,
  497 + fontWeight: FontWeight.bold,
  498 + fontSize: ScreenUtil().setSp(32)),
177 ), 499 ),
178 ), 500 ),
  501 + widget.notebook.operationText == ''
  502 + ? SizedBox()
  503 + : RoundButton(
  504 + text: widget.notebook.operationText,
  505 + gradientStart: bgColor,
  506 + gradientEnd: bgColor,
  507 + textColor: MyColours.color_ffffff,
  508 + radius: ScreenUtil().setWidth(6),
  509 + fontSize: 24,
  510 + width: ScreenUtil().setWidth(42 * 2),
  511 + height: ScreenUtil().setWidth(17 * 2),
  512 + )
179 ], 513 ],
180 ), 514 ),
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 - ), 515 + HEmptyView(24),
  516 + MyDivider(
  517 + ScreenUtil().setWidth(2),
  518 + ScreenUtil().setWidth(66 * 2),
  519 + color: Color.fromRGBO(191, 196, 212, 0.2),
207 ), 520 ),
208 - ),  
209 - ], 521 + HEmptyView(32),
  522 + Expanded(
  523 + child: GestureDetector(
  524 + behavior: HitTestBehavior.translucent,
  525 + onTap: () {
  526 + NavigatorUtil.goNotebookDetailPage(
  527 + context, notebook.id, notebook.uid);
  528 + },
  529 + child: Column(
  530 + crossAxisAlignment: CrossAxisAlignment.start,
  531 + children: [
  532 + Row(
  533 + children: [
  534 + notebook.rnameStr == ''
  535 + ? SizedBox()
  536 + : Container(
  537 + child: Text(
  538 + notebook.rnameStr,
  539 + maxLines: 1,
  540 + overflow: TextOverflow.ellipsis,
  541 + style: TextStyle(
  542 + color: MyColours.color_260101,
  543 + fontWeight: FontWeight.bold,
  544 + fontSize: ScreenUtil().setSp(24)),
  545 + ),
  546 + ),
  547 + notebook.phoneStr.isNotEmpty
  548 + ? Text(
  549 + '(' +
  550 + Utils.showEndPhone(
  551 + '${notebook.phoneStr}') +
  552 + ')',
  553 + maxLines: 1,
  554 + overflow: TextOverflow.ellipsis,
  555 + style: TextStyle(
  556 + color: MyColours.color_260101,
  557 + fontWeight: FontWeight.bold,
  558 + fontSize: ScreenUtil().setSp(24)),
  559 + )
  560 + : SizedBox(),
  561 + notebook.rnameStr == '' &&
  562 + notebook.phoneStr.isEmpty
  563 + ? SizedBox()
  564 + : HEmptyView(8),
  565 + Text(
  566 + notebook.actual_pnum == null
  567 + ? notebook.ddateStr
  568 + : notebook.actual_pnum +
  569 + '人' +
  570 + ' ' +
  571 + notebook.ddateStr,
  572 + maxLines: 1,
  573 + overflow: TextOverflow.ellipsis,
  574 + style: TextStyle(
  575 + color: MyColours.color_260101,
  576 + fontWeight: FontWeight.bold,
  577 + fontSize: ScreenUtil().setSp(24)),
  578 + ),
  579 + ],
  580 + ),
  581 + VEmptyView(8),
  582 + notebook.nick_name == null &&
  583 + notebook.tid.split(",").length < 2 &&
  584 + (notebook.cusdem == null ||
  585 + notebook.cusdem == '') &&
  586 + notebook.aname == null
  587 + ? SizedBox()
  588 + : Row(
  589 + children: [
  590 + notebook.nick_name == null
  591 + ? SizedBox()
  592 + : Text(
  593 + notebook.nick_name + '订',
  594 + maxLines: 1,
  595 + overflow: TextOverflow.ellipsis,
  596 + style: TextStyle(
  597 + color: MyColours.color_999999,
  598 + fontSize:
  599 + ScreenUtil().setSp(24)),
  600 + ),
  601 + Row(
  602 + mainAxisAlignment:
  603 + MainAxisAlignment.spaceEvenly,
  604 + children: [
  605 + Offstage(
  606 + offstage: notebook.tid
  607 + .split(",")
  608 + .length <
  609 + 2,
  610 + child: Image.asset(
  611 + Utils.getImgPath(
  612 + 'ordered_lian'),
  613 + width: ScreenUtil()
  614 + .setWidth(18 * 2),
  615 + ),
  616 + ),
  617 + notebook.cusdem == null ||
  618 + notebook.cusdem == ''
  619 + ? SizedBox()
  620 + : HEmptyView(8),
  621 + Offstage(
  622 + offstage:
  623 + notebook.cusdem == null ||
  624 + notebook.cusdem == '',
  625 + child: Image.asset(
  626 + Utils.getImgPath(
  627 + 'ordered_bei'),
  628 + width: ScreenUtil()
  629 + .setWidth(18 * 2),
  630 + ),
  631 + ),
  632 + false
  633 + ? SizedBox()
  634 + : HEmptyView(8),
  635 + Offstage(
  636 + offstage:
  637 + notebook.aname == null,
  638 + child: Image.asset(
  639 + Utils.getImgPath(
  640 + 'ordered_hui'),
  641 + width: ScreenUtil()
  642 + .setWidth(18 * 2),
  643 + ),
  644 + )
  645 + ],
  646 + ),
  647 + ],
  648 + )
  649 + ],
  650 + )))
  651 + ],
  652 + ),
210 ), 653 ),
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 - ); 654 +
  655 + Positioned(
  656 + right: ScreenUtil().setWidth(8),
  657 + child: AnimatedSize(
  658 + curve: Curves.easeIn,
  659 + duration: Duration(microseconds: 30000),
  660 + vsync: this,
  661 + child: InkWell(
  662 + onTap: () => _updateSize(canDo),
  663 + child: _large
  664 + ? Stack(
  665 + children: [
  666 + Container(
  667 + width:
  668 + ScreenUtil().setWidth(widthBtn + 8 * 2),
  669 + height: ScreenUtil().setWidth(80),
  670 + decoration: BoxDecoration(
  671 + color: Color.fromRGBO(67, 142, 147, 0.2),
  672 + borderRadius: BorderRadius.circular(
  673 + ScreenUtil().setWidth(16)),
  674 + )),
  675 + Positioned(
  676 + top: ScreenUtil().setWidth(8),
  677 + left: ScreenUtil().setWidth(8),
  678 + child: Container(
  679 + width: ScreenUtil().setWidth(widthBtn),
  680 + height: ScreenUtil().setWidth(32 * 2),
  681 + decoration: BoxDecoration(
  682 + color: Color.fromRGBO(125, 174, 177, 1),
  683 + borderRadius: BorderRadius.circular(
  684 + ScreenUtil().setWidth(8)),
  685 + ),
  686 + padding: EdgeInsets.symmetric(
  687 + horizontal:
  688 + ScreenUtil().setWidth(16)),
  689 + child: Row(
  690 + children: [
  691 + Image.asset(
  692 + Utils.getImgPath(
  693 + 'ordered_arrow_right'),
  694 + width:
  695 + ScreenUtil().setWidth(24 * 2),
  696 + ),
  697 + HEmptyView(32),
  698 + notebook.status == '2'
  699 + ? SizedBox()
  700 + : RoundButton(
  701 + text: '到店',
  702 + width: ScreenUtil()
  703 + .setWidth(36 * 2),
  704 + height: ScreenUtil()
  705 + .setWidth(24 * 2),
  706 + gradientStart:
  707 + MyColours.color_ffffff,
  708 + gradientEnd:
  709 + MyColours.color_ffffff,
  710 + textColor:
  711 + MyColours.color_260101,
  712 + isBold: true,
  713 + fontSize: 28,
  714 + radius:
  715 + ScreenUtil().setWidth(8),
  716 + onPressed: () {
  717 + Loading.showLoading(
  718 + context);
  719 + setReserveStatus('2');
  720 + },
  721 + ),
  722 + notebook.status == '2'
  723 + ? SizedBox()
  724 + : HEmptyView(44),
  725 + RoundButton(
  726 + text: '离店',
  727 + width:
  728 + ScreenUtil().setWidth(36 * 2),
  729 + height:
  730 + ScreenUtil().setWidth(24 * 2),
  731 + gradientStart:
  732 + MyColours.color_ffffff,
  733 + gradientEnd: MyColours.color_ffffff,
  734 + textColor: MyColours.color_260101,
  735 + isBold: true,
  736 + fontSize: 28,
  737 + radius: ScreenUtil().setWidth(8),
  738 + onPressed: () {
  739 + Loading.showLoading(context);
  740 + setReserveStatus('3');
  741 + },
  742 + ),
  743 + notebook.status == '2'
  744 + ? SizedBox()
  745 + : HEmptyView(44),
  746 + notebook.status == '2'
  747 + ? SizedBox()
  748 + : InkWell(
  749 + onTap: () {
  750 + _showCancelWidget(context);
  751 + },
  752 + child: Text(
  753 + '取消预订',
  754 + style: TextStyle(
  755 + decoration:
  756 + TextDecoration
  757 + .underline,
  758 + color: MyColours
  759 + .color_ffffff,
  760 + fontSize: ScreenUtil()
  761 + .setSp(28),
  762 + fontWeight:
  763 + FontWeight.bold),
  764 + ))
  765 + ],
  766 + ),
  767 + ))
  768 + ],
  769 + )
  770 + : Image.asset(
  771 + Utils.getImgPath(
  772 + canDo ? 'ordered_open' : 'ordered_off'),
  773 + width: ScreenUtil().setWidth(80),
  774 + ))))
  775 + // Positioned(
  776 + // right: ScreenUtil().setWidth(8),
  777 + // child: Image.asset(
  778 + // Utils.getImgPath(true ? 'ordered_open' : 'ordered_off'),
  779 + // width: ScreenUtil().setWidth(80),
  780 + // ))
  781 + ]);
  782 + // return Stack(
  783 + // children: [
  784 + // Container(
  785 + // width: double.infinity,
  786 + // // height: ScreenUtil().setWidth(120),
  787 + // color: (widget.index % 2 == 0)
  788 + // ? MyColours.color_f7fdfd
  789 + // : MyColours.color_ffffff,
  790 + // child: Row(
  791 + // children: <Widget>[
  792 + // GestureDetector(
  793 + // behavior: HitTestBehavior.translucent,
  794 + // onTap: () {
  795 + // NavigatorUtil.goNotebookDetailPage(
  796 + // context, notebook.id, notebook.uid);
  797 + // },
  798 + // child: Row(
  799 + // children: <Widget>[
  800 + // Container(
  801 + // width: ScreenUtil().setWidth(86 * 2),
  802 + // padding: EdgeInsets.symmetric(
  803 + // horizontal: ScreenUtil().setWidth(14),
  804 + // vertical: ScreenUtil().setWidth(40)),
  805 + // alignment: Alignment.center,
  806 + // child: Column(
  807 + // children: [
  808 + // Text(
  809 + // '${notebook.tableinfoStr?.trim()}',
  810 + // maxLines: 30,
  811 + // overflow: TextOverflow.ellipsis,
  812 + // style: TextStyle(
  813 + // color: textColor,
  814 + // // fontWeight: FontWeight.bold,
  815 + // fontSize: ScreenUtil().setSp(30)),
  816 + // ),
  817 + // notebook.type == '1'
  818 + // ? Text('online',
  819 + // style: TextStyle(
  820 + // color: Colors.blue,
  821 + // // fontWeight: FontWeight.bold,
  822 + // fontSize: ScreenUtil().setSp(26)))
  823 + // : SizedBox()
  824 + // ],
  825 + // ),
  826 + // ),
  827 + // MyDivider(
  828 + // ScreenUtil().setWidth(1),
  829 + // ScreenUtil().setHeight(90),
  830 + // color: MyColours.color_ededed,
  831 + // ),
  832 + // Container(
  833 + // width: ScreenUtil().setWidth(230),
  834 + // alignment: Alignment.center,
  835 + // child: Column(
  836 + // mainAxisSize: MainAxisSize.min,
  837 + // mainAxisAlignment: MainAxisAlignment.center,
  838 + // children: <Widget>[
  839 + // Text(
  840 + // notebook.rnameStr,
  841 + // // 'nnnnnnnnnnnnnn',
  842 + // maxLines: 1,
  843 + // overflow: TextOverflow.ellipsis,
  844 + // style: TextStyle(
  845 + // color: textColor,
  846 + // // fontWeight: FontWeight.bold,
  847 + // fontSize: ScreenUtil().setSp(30)),
  848 + // ),
  849 + // notebook.phoneStr.isNotEmpty
  850 + // ? Padding(
  851 + // padding: EdgeInsets.only(
  852 + // top: ScreenUtil().setWidth(10)),
  853 + // child: Text(
  854 + // notebook.phoneStr,
  855 + // maxLines: 1,
  856 + // overflow: TextOverflow.ellipsis,
  857 + // style: TextStyle(
  858 + // color: textColor,
  859 + // // fontWeight: FontWeight.bold,
  860 + // fontSize: ScreenUtil().setSp(26)),
  861 + // ))
  862 + // : Container()
  863 + // ],
  864 + // ),
  865 + // ),
  866 + // MyDivider(
  867 + // ScreenUtil().setWidth(1),
  868 + // ScreenUtil().setHeight(90),
  869 + // color: MyColours.color_ededed,
  870 + // ),
  871 + // Container(
  872 + // width: ScreenUtil().setWidth(159),
  873 + // alignment: Alignment.center,
  874 + // child: Text(
  875 + // notebook.ddateStr,
  876 + // style: TextStyle(
  877 + // color: textColor,
  878 + // // fontWeight: FontWeight.bold,
  879 + // fontSize: ScreenUtil().setSp(30)),
  880 + // ),
  881 + // ),
  882 + // ],
  883 + // ),
  884 + // ),
  885 + // MyDivider(
  886 + // ScreenUtil().setWidth(1),
  887 + // ScreenUtil().setHeight(90),
  888 + // color: MyColours.color_ededed,
  889 + // ),
  890 + // GestureDetector(
  891 + // onTap: _onOperateClick,
  892 + // behavior: HitTestBehavior.opaque,
  893 + // child: Container(
  894 + // padding:
  895 + // EdgeInsets.symmetric(vertical: ScreenUtil().setWidth(20)),
  896 + // width: ScreenUtil().setWidth(184),
  897 + // // color: Colors.red,
  898 + // alignment: Alignment.center,
  899 + // child: Text(
  900 + // notebook.operationText,
  901 + // style: TextStyle(
  902 + // color: (notebook.status == "3" ||
  903 + // notebook.status == "4" ||
  904 + // notebook.status == "6")
  905 + // ? MyColours.color_bfbfbf
  906 + // : MyColours.color_2bb5b7,
  907 + // // fontWeight: FontWeight.bold,
  908 + // fontSize: ScreenUtil().setSp(30)),
  909 + // ),
  910 + // ),
  911 + // ),
  912 + // ],
  913 + // ),
  914 + // ),
  915 + // notebook.orderInfo != null && notebook.orderInfo.status == '3'
  916 + // ? Container(
  917 + // alignment: Alignment.center,
  918 + // width: ScreenUtil().setWidth(52 * 2),
  919 + // height: ScreenUtil().setWidth(19 * 2),
  920 + // decoration: BoxDecoration(
  921 + // color: MyColours.color_F59A23,
  922 + // borderRadius: BorderRadius.only(
  923 + // bottomRight: Radius.circular(ScreenUtil().setWidth(10))),
  924 + // ),
  925 + // child: Text(
  926 + // '已买单',
  927 + // style: TextStyle(
  928 + // fontSize: ScreenUtil().setSp(24),
  929 + // color: MyColours.color_ffffff,
  930 + // fontWeight: FontWeight.bold),
  931 + // ))
  932 + // : Container()
  933 + // ],
  934 + // );
232 } 935 }
233 } 936 }
@@ -4,7 +4,9 @@ import 'package:flutter/material.dart'; @@ -4,7 +4,9 @@ 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/models/notebook.dart';
7 import 'package:one_key/pages/notebook/notebook_item_f.dart'; 8 import 'package:one_key/pages/notebook/notebook_item_f.dart';
  9 +import 'package:one_key/pages/notebook/notebook_item_f_simple.dart';
8 import 'package:one_key/pages/notebook/notebook_item_widget.dart'; 10 import 'package:one_key/pages/notebook/notebook_item_widget.dart';
9 import 'package:one_key/provider/notebook_model.dart'; 11 import 'package:one_key/provider/notebook_model.dart';
10 import 'package:one_key/provider/update_model.dart'; 12 import 'package:one_key/provider/update_model.dart';
@@ -59,6 +61,8 @@ class NoteBookPageState extends State<NoteBookPage> { @@ -59,6 +61,8 @@ class NoteBookPageState extends State<NoteBookPage> {
59 StartingDayOfWeek startingDayOfWeek; 61 StartingDayOfWeek startingDayOfWeek;
60 bool clearSel = false; 62 bool clearSel = false;
61 bool isall = true; 63 bool isall = true;
  64 + bool isSimple = true;
  65 + NoteBookModel noteBookModel;
62 66
63 @override 67 @override
64 void initState() { 68 void initState() {
@@ -195,8 +199,7 @@ class NoteBookPageState extends State<NoteBookPage> { @@ -195,8 +199,7 @@ class NoteBookPageState extends State<NoteBookPage> {
195 } 199 }
196 200
197 //获取已预订列表 201 //获取已预订列表
198 - _getReserveList() {  
199 - NoteBookModel model = Provider.of<NoteBookModel>(context, listen: false); 202 + _getReserveList() async {
200 Map<String, String> params = { 203 Map<String, String> params = {
201 "sid": userModel.user.sellerid, 204 "sid": userModel.user.sellerid,
202 "rdate": _getRdate(), 205 "rdate": _getRdate(),
@@ -210,7 +213,8 @@ class NoteBookPageState extends State<NoteBookPage> { @@ -210,7 +213,8 @@ class NoteBookPageState extends State<NoteBookPage> {
210 params["account"] = userModel.user.account; 213 params["account"] = userModel.user.account;
211 } 214 }
212 215
213 - model.getReserveList(context, params); 216 + await noteBookModel.getReserveList(context, params);
  217 + _simpleState();
214 } 218 }
215 219
216 //解析返回显示的日期 220 //解析返回显示的日期
@@ -503,10 +507,25 @@ class NoteBookPageState extends State<NoteBookPage> { @@ -503,10 +507,25 @@ class NoteBookPageState extends State<NoteBookPage> {
503 return container; 507 return container;
504 } 508 }
505 509
  510 + _simpleState() {
  511 + if (noteBookModel.notebooks.length > 0) {
  512 + if (isSimple) {
  513 + for (Notebook item in noteBookModel.notebooks) {
  514 + item.issimple = true;
  515 + }
  516 + } else {
  517 + for (Notebook item in noteBookModel.notebooks) {
  518 + item.issimple = false;
  519 + }
  520 + }
  521 + }
  522 + }
  523 +
506 @override 524 @override
507 Widget build(BuildContext context) { 525 Widget build(BuildContext context) {
508 // TODO: implement build 526 // TODO: implement build
509 userModel = Provider.of<UserModel>(context, listen: false); 527 userModel = Provider.of<UserModel>(context, listen: false);
  528 + noteBookModel = Provider.of<NoteBookModel>(context, listen: true);
510 int sum = 3; 529 int sum = 3;
511 int hide = 0; 530 int hide = 0;
512 int btnNum = 0; 531 int btnNum = 0;
@@ -917,22 +936,29 @@ class NoteBookPageState extends State<NoteBookPage> { @@ -917,22 +936,29 @@ class NoteBookPageState extends State<NoteBookPage> {
917 width: ScreenUtil().setWidth(24 * 2)) 936 width: ScreenUtil().setWidth(24 * 2))
918 ], 937 ],
919 )), 938 )),
920 - Column(  
921 - children: [  
922 - Text(  
923 - '简易模式',  
924 - style: TextStyle(  
925 - fontSize: ScreenUtil().setSp(20),  
926 - fontWeight: FontWeight.bold,  
927 - color: MyColours.color_515151),  
928 - ),  
929 - VEmptyView(16),  
930 - Image.asset(  
931 - Utils.getImgPath(  
932 - true ? 'f_swich_on' : 'f_swich_off'),  
933 - width: ScreenUtil().setWidth(24 * 2))  
934 - ],  
935 - ), 939 + InkWell(
  940 + onTap: () {
  941 + setState(() {
  942 + isSimple = !isSimple;
  943 + });
  944 + _simpleState();
  945 + },
  946 + child: Column(
  947 + children: [
  948 + Text(
  949 + '简易模式',
  950 + style: TextStyle(
  951 + fontSize: ScreenUtil().setSp(20),
  952 + fontWeight: FontWeight.bold,
  953 + color: MyColours.color_515151),
  954 + ),
  955 + VEmptyView(16),
  956 + Image.asset(
  957 + Utils.getImgPath(
  958 + isSimple ? 'f_swich_on' : 'f_swich_off'),
  959 + width: ScreenUtil().setWidth(24 * 2))
  960 + ],
  961 + )),
936 ], 962 ],
937 )), 963 )),
938 Expanded(child: Consumer<NoteBookModel>( 964 Expanded(child: Consumer<NoteBookModel>(
@@ -963,8 +989,11 @@ class NoteBookPageState extends State<NoteBookPage> { @@ -963,8 +989,11 @@ class NoteBookPageState extends State<NoteBookPage> {
963 return Container( 989 return Container(
964 margin: EdgeInsets.only( 990 margin: EdgeInsets.only(
965 bottom: ScreenUtil().setWidth(24)), 991 bottom: ScreenUtil().setWidth(24)),
966 - child: NoteBookItemF(  
967 - model.notebooks[index], index), 992 + child: model.notebooks[index].issimple
  993 + ? NoteBookItemSimple(
  994 + model.notebooks[index], index)
  995 + : NoteBookItemF(
  996 + model.notebooks[index], index),
968 ); 997 );
969 }, childCount: model.notebooks.length), 998 }, childCount: model.notebooks.length),
970 // itemExtent: ScreenUtil().setWidth(112), 999 // itemExtent: ScreenUtil().setWidth(112),