Commit 718ad81f91801abd8f3a305ce75d564142e2a294

Authored by “gaiyaguang”
1 parent 665052e5

推

1 -83b3ddec6f4d9a6ed2f11de1a0a1915e  
  1 +7babc7873f8d177769b987ba4c6c2911
  1 +///桌位区域
  2 +class SetTime {
  3 + String start;
  4 + String end;
  5 +
  6 + SetTime();
  7 +
  8 + factory SetTime.fromJson(Map<String, dynamic> json) => SetTime()
  9 + ..start = json["start"]
  10 + ..end = json["end"];
  11 +
  12 + Map<String, dynamic> toJson() =>
  13 + <String, dynamic>{"start": start, "end": end};
  14 +}
  1 +import 'package:common_utils/common_utils.dart';
  2 +import 'package:flutter/material.dart';
  3 +import 'package:flutter_screenutil/screenutil.dart';
  4 +import 'package:one_key/models/settime.dart';
  5 +import 'package:one_key/res/colors.dart';
  6 +import 'package:one_key/utils/dialog_util.dart';
  7 +import 'package:one_key/utils/utils.dart';
  8 +import 'package:one_key/widgets/MyDivider.dart';
  9 +import 'package:one_key/widgets/app_bar.dart';
  10 +import 'package:one_key/widgets/h_empty_view.dart';
  11 +import 'package:one_key/widgets/v_empty_view.dart';
  12 +
  13 +typedef BookTimeSetCallback = void Function(bool needChange);
  14 +
  15 +class BookTimeSetPage extends StatefulWidget {
  16 + BookTimeSetPage({Key key}) : super(key: key);
  17 +
  18 + @override
  19 + _BookTimeSetPageState createState() => _BookTimeSetPageState();
  20 +}
  21 +
  22 +class _BookTimeSetPageState extends State<BookTimeSetPage> {
  23 + List swichState;
  24 + final GlobalKey<ScaffoldState> _scaffoldKey = GlobalKey<ScaffoldState>();
  25 + List dateData;
  26 + SetTime morning = SetTime();
  27 + SetTime noon = SetTime();
  28 + SetTime night = SetTime();
  29 +
  30 + @override
  31 + void initState() {
  32 + super.initState();
  33 + morning.start = '07:00';
  34 + morning.end = '10:00';
  35 + noon.start = '11:00';
  36 + noon.end = '14:30';
  37 + night.start = '16:00';
  38 + night.end = '21:00';
  39 + swichState = [
  40 + {
  41 + 'on': false,
  42 + },
  43 + {
  44 + 'on': true,
  45 + },
  46 + {
  47 + 'on': true,
  48 + }
  49 + ];
  50 +
  51 + dateData = [
  52 + {
  53 + '深夜00时': [00, 30]
  54 + },
  55 + {
  56 + '深夜01时': [00, 30]
  57 + },
  58 + {
  59 + '深夜02时': [00, 30]
  60 + },
  61 + {
  62 + '深夜03时': [00, 30]
  63 + },
  64 + {
  65 + '深夜04时': [00, 30]
  66 + },
  67 + {
  68 + '深夜05时': [00, 30]
  69 + },
  70 + {
  71 + '早上06时': [00, 30]
  72 + },
  73 + {
  74 + '早上07时': [00, 30]
  75 + },
  76 + {
  77 + '早上08时': [00, 30]
  78 + },
  79 + {
  80 + '早上09时': [00, 30]
  81 + },
  82 + {
  83 + '中午10时': [00, 30]
  84 + },
  85 + {
  86 + '中午11时': [00, 30]
  87 + },
  88 + {
  89 + '中午12时': [00, 30]
  90 + },
  91 + {
  92 + '中午13时': [00, 30]
  93 + },
  94 + {
  95 + '中午14时': [00, 30]
  96 + },
  97 + {
  98 + '下午15时': [00, 30]
  99 + },
  100 + {
  101 + '下午16时': [00, 30]
  102 + },
  103 + {
  104 + '下午17时': [00, 30]
  105 + },
  106 + {
  107 + '下午18时': [00, 30]
  108 + },
  109 + {
  110 + '晚上19时': [00, 30]
  111 + },
  112 + {
  113 + '晚上20时': [00, 30]
  114 + },
  115 + {
  116 + '晚上21时': [00, 30]
  117 + },
  118 + {
  119 + '晚上22时': [00, 30]
  120 + },
  121 + {
  122 + '晚上23时': [00, 30]
  123 + }
  124 + ];
  125 + }
  126 +
  127 + ///item
  128 + Widget _itemWidget(String title, String startTime, String endTime, int tag) {
  129 + return Container(
  130 + color: MyColours.color_ffffff,
  131 + child: Column(
  132 + children: [
  133 + Padding(
  134 + padding:
  135 + EdgeInsets.symmetric(horizontal: ScreenUtil().setWidth(40)),
  136 + child: Container(
  137 + height: ScreenUtil().setWidth(124),
  138 + child: Row(
  139 + crossAxisAlignment: CrossAxisAlignment.center,
  140 + mainAxisAlignment: MainAxisAlignment.spaceBetween,
  141 + children: [
  142 + Text(title,
  143 + style: TextStyle(
  144 + color: MyColours.color_353535,
  145 + fontSize: ScreenUtil().setSp(32),
  146 + fontWeight: FontWeight.bold)),
  147 + InkWell(
  148 + onTap: () {
  149 + setState(() {
  150 + swichState[tag]["on"] = !swichState[tag]["on"];
  151 + });
  152 + },
  153 + child: Image.asset(
  154 + swichState[tag]["on"]
  155 + ? Utils.getImgPath('swich_on')
  156 + : Utils.getImgPath('swich_off'),
  157 + width: ScreenUtil().setWidth(122),
  158 + height: ScreenUtil().setWidth(82),
  159 + ),
  160 + )
  161 + ],
  162 + ),
  163 + )),
  164 + MyDivider(
  165 + double.infinity,
  166 + ScreenUtil().setWidth(2),
  167 + color: MyColours.color_f3f3f3,
  168 + ),
  169 + _timeWidget('开始时间', startTime, highted: swichState[tag]["on"],
  170 + onTap: () {
  171 + if (swichState[tag]["on"]) {
  172 + List data = dateData;
  173 + if (tag == 0) {
  174 + //早市
  175 + data = dateData;
  176 + } else if (tag == 1) {
  177 + //午市
  178 + data = _getPickerData(morning.end);
  179 + } else if (tag == 2) {
  180 + //晚市
  181 + data = _getPickerData(noon.end);
  182 + }
  183 +
  184 + DialogUtil.showSelectCusmanDialog(context, data, (value) {
  185 + if (value != null) {
  186 + String temp;
  187 + if (value[1] == 0) {
  188 + temp = '00';
  189 + } else {
  190 + temp = '30';
  191 + }
  192 + print(data[value[0]].keys.first);
  193 + String time = _getTimeString(
  194 + _getHourFromTitle(data[value[0]].keys.first), temp);
  195 + setState(() {
  196 + if (tag == 0) {
  197 + //早市
  198 + morning.start = time;
  199 + } else if (tag == 1) {
  200 + //午市
  201 + noon.start = time;
  202 + } else if (tag == 2) {
  203 + //晚市
  204 + night.start = time;
  205 + }
  206 + });
  207 + print(value);
  208 + _compare(time);
  209 + }
  210 + }, selecteds: [
  211 + _getFirSelected(startTime, data),
  212 + _getSecSelected(startTime)
  213 + ]).then((value) {
  214 + print(value);
  215 + });
  216 + }
  217 + }),
  218 + Padding(
  219 + padding:
  220 + EdgeInsets.symmetric(horizontal: ScreenUtil().setWidth(40)),
  221 + child: MyDivider(
  222 + double.infinity,
  223 + ScreenUtil().setWidth(2),
  224 + color: MyColours.color_f3f3f3,
  225 + )),
  226 + _timeWidget('结束时间', endTime, highted: swichState[tag]["on"],
  227 + onTap: () {
  228 + if (swichState[tag]["on"]) {
  229 + List data = dateData;
  230 + if (tag == 0) {
  231 + //早市
  232 + data = _getPickerData(morning.start);
  233 + } else if (tag == 1) {
  234 + //午市
  235 + data = _getPickerData(noon.start);
  236 + } else if (tag == 2) {
  237 + //晚市
  238 + data = _getPickerData(night.start);
  239 + }
  240 + DialogUtil.showSelectCusmanDialog(context, data, (value) {
  241 + if (value != null) {
  242 + String temp;
  243 + if (value[1] == 0) {
  244 + temp = '00';
  245 + } else {
  246 + temp = '30';
  247 + }
  248 + String time = _getTimeString(
  249 + _getHourFromTitle(data[value[0]].keys.first), temp);
  250 + setState(() {
  251 + if (tag == 0) {
  252 + //早市
  253 + morning.end = time;
  254 + } else if (tag == 1) {
  255 + //午市
  256 + noon.end = time;
  257 + } else if (tag == 2) {
  258 + //晚市
  259 + night.end = time;
  260 + }
  261 + });
  262 + print(value);
  263 + _compare(time);
  264 + }
  265 + }, selecteds: [
  266 + _getFirSelected(endTime, data),
  267 + _getSecSelected(endTime)
  268 + ]).then((value) {
  269 + print(value);
  270 + });
  271 + }
  272 + })
  273 + ],
  274 + ));
  275 + }
  276 +
  277 + /// 开始时间和结束时间widget
  278 + _timeWidget(String title, String time,
  279 + {bool highted = true, GestureTapCallback onTap}) {
  280 + return InkWell(
  281 + onTap: onTap,
  282 + child: Padding(
  283 + padding:
  284 + EdgeInsets.symmetric(horizontal: ScreenUtil().setWidth(40)),
  285 + child: Container(
  286 + height: ScreenUtil().setWidth(124),
  287 + child: Row(
  288 + crossAxisAlignment: CrossAxisAlignment.center,
  289 + mainAxisAlignment: MainAxisAlignment.spaceBetween,
  290 + children: [
  291 + Text(title,
  292 + style: TextStyle(
  293 + color: highted
  294 + ? MyColours.color_353535
  295 + : MyColours.color_999999,
  296 + fontSize: ScreenUtil().setSp(30),
  297 + )),
  298 + Spacer(),
  299 + Text(time,
  300 + style: TextStyle(
  301 + color: highted
  302 + ? MyColours.color_353535
  303 + : MyColours.color_999999,
  304 + fontSize: ScreenUtil().setSp(30),
  305 + )),
  306 + HEmptyView(20),
  307 + Image.asset(
  308 + Utils.getImgPath('arrow_right_new'),
  309 + width: ScreenUtil().setWidth(16),
  310 + height: ScreenUtil().setWidth(28),
  311 + )
  312 + ],
  313 + ),
  314 + )));
  315 + }
  316 +
  317 + ///工具
  318 + /// 组装成07:00
  319 + _getTimeString(dynamic hour, String minute) {
  320 + return '${hour}:${minute}';
  321 + }
  322 +
  323 + /// 从07:00中获取07
  324 + _getHourFromhourAndMinute(String hourAndMinute) {
  325 + return hourAndMinute.substring(0, 2);
  326 + }
  327 +
  328 + ///从深夜00时中获取00
  329 + _getHourFromTitle(String title) {
  330 + return title.substring(2, 4);
  331 + }
  332 +
  333 + // 第一列当前选中第几个
  334 + _getFirSelected(String hourAndMinute, List data) {
  335 + String hour = _getHourFromhourAndMinute(hourAndMinute);
  336 + for (int i = 0; i < data.length; i++) {
  337 + Map map = data[i];
  338 + String key = map.keys.first;
  339 + if (key.contains(hour)) {
  340 + return i;
  341 + }
  342 + }
  343 + return 0;
  344 + }
  345 +
  346 + // 第二列当前选中第几个
  347 + _getSecSelected(String hourAndMinute) {
  348 + String minute = _getMinuteFromhourAndMinute(hourAndMinute);
  349 + if (minute == '00') {
  350 + return 0;
  351 + }
  352 + return 1;
  353 + }
  354 +
  355 + /// 0 还是 30
  356 + /// 从07:00中获取0 或者 30
  357 + _getMinuteFromhourAndMinute(String hourAndMinute) {
  358 + return hourAndMinute.substring(3, 5);
  359 + }
  360 +
  361 + ///获取选择器数据
  362 + _getPickerData(String lastTime) {
  363 + String hour = _getHourFromhourAndMinute(lastTime);
  364 + String minute = _getMinuteFromhourAndMinute(lastTime);
  365 + if (minute == '30') {
  366 + hour = '${int.parse(hour) + 1}';
  367 + }
  368 + List tempList = List();
  369 + tempList.addAll(dateData);
  370 + tempList.removeRange(0, int.parse(hour));
  371 + return tempList;
  372 + }
  373 +
  374 + ///判断时间大小
  375 + /// a > b
  376 + _compareDateTime(String a, String b, BookTimeSetCallback callback) {
  377 + String tempa = '${DateUtil.getNowDateStr().substring(0, 10)} ${a}:00';
  378 + String tempb = '${DateUtil.getNowDateStr().substring(0, 10)} ${b}:00';
  379 + int aMs = DateUtil.getDateMsByTimeStr(tempa);
  380 + int bMs = DateUtil.getDateMsByTimeStr(tempb);
  381 + if (aMs < bMs) {
  382 + a = b;
  383 + callback(true);
  384 + } else {
  385 + callback(false);
  386 + }
  387 + }
  388 +
  389 + _compare(String time) {
  390 + setState(() {
  391 + _compareDateTime(morning.start, time, (needChange) {
  392 + if (needChange) {
  393 + morning.start = time;
  394 + }
  395 + });
  396 + _compareDateTime(morning.end, time, (needChange) {
  397 + if (needChange) {
  398 + morning.end = time;
  399 + }
  400 + });
  401 + _compareDateTime(noon.start, time, (needChange) {
  402 + if (needChange) {
  403 + noon.start = time;
  404 + }
  405 + });
  406 + _compareDateTime(noon.end, time, (needChange) {
  407 + if (needChange) {
  408 + noon.end = time;
  409 + }
  410 + });
  411 + _compareDateTime(night.start, time, (needChange) {
  412 + if (needChange) {
  413 + night.start = time;
  414 + }
  415 + });
  416 + _compareDateTime(night.end, time, (needChange) {
  417 + if (needChange) {
  418 + night.end = time;
  419 + }
  420 + });
  421 + });
  422 + }
  423 +
  424 + @override
  425 + Widget build(BuildContext context) {
  426 + return Scaffold(
  427 + key: _scaffoldKey,
  428 + body: SafeArea(
  429 + child: SingleChildScrollView(
  430 + child: Column(
  431 + children: [
  432 + MyAppBar(
  433 + "可订时段",
  434 + showBack: true,
  435 + ),
  436 + _itemWidget('早市', morning.start, morning.end, 0),
  437 + VEmptyView(20),
  438 + _itemWidget('午市', noon.start, noon.end, 1),
  439 + VEmptyView(20),
  440 + _itemWidget('晚市', night.start, night.end, 2),
  441 + ],
  442 + ),
  443 + )),
  444 + );
  445 + }
  446 +}
@@ -6,6 +6,7 @@ import 'package:one_key/provider/my_model.dart'; @@ -6,6 +6,7 @@ import 'package:one_key/provider/my_model.dart';
6 import 'package:one_key/provider/update_model.dart'; 6 import 'package:one_key/provider/update_model.dart';
7 import 'package:one_key/provider/user_model.dart'; 7 import 'package:one_key/provider/user_model.dart';
8 import 'package:one_key/res/colors.dart'; 8 import 'package:one_key/res/colors.dart';
  9 +import 'package:one_key/utils/navigator_util.dart';
9 import 'package:one_key/utils/utils.dart'; 10 import 'package:one_key/utils/utils.dart';
10 import 'package:one_key/widgets/MyDivider.dart'; 11 import 'package:one_key/widgets/MyDivider.dart';
11 import 'package:one_key/widgets/app_bar.dart'; 12 import 'package:one_key/widgets/app_bar.dart';
@@ -28,11 +29,13 @@ class MyPageState extends State<MyPage> with WidgetsBindingObserver { @@ -28,11 +29,13 @@ class MyPageState extends State<MyPage> with WidgetsBindingObserver {
28 String cur_version = ""; 29 String cur_version = "";
29 bool newVersion = false; 30 bool newVersion = false;
30 MyModel myModel; 31 MyModel myModel;
  32 + ScrollController controller;
31 33
32 @override 34 @override
33 void initState() { 35 void initState() {
34 // TODO: implement initState 36 // TODO: implement initState
35 super.initState(); 37 super.initState();
  38 + controller = ScrollController(initialScrollOffset: 0.0);
36 WidgetsBinding.instance.addObserver(this); 39 WidgetsBinding.instance.addObserver(this);
37 Utils.getCurrVersion().then((version) { 40 Utils.getCurrVersion().then((version) {
38 setState(() { 41 setState(() {
@@ -87,357 +90,240 @@ class MyPageState extends State<MyPage> with WidgetsBindingObserver { @@ -87,357 +90,240 @@ class MyPageState extends State<MyPage> with WidgetsBindingObserver {
87 @override 90 @override
88 Widget build(BuildContext context) { 91 Widget build(BuildContext context) {
89 myModel = Provider.of<MyModel>(context, listen: true); 92 myModel = Provider.of<MyModel>(context, listen: true);
90 - return Stack(  
91 - children: <Widget>[  
92 - Padding(  
93 - padding: EdgeInsets.only(top: ScreenUtil().setHeight(242 + 121)),  
94 - child: Column(  
95 - children: <Widget>[  
96 - VEmptyView(40),  
97 - MyItem(  
98 - title: "短信管理",  
99 - content:  
100 - myModel.smsInfo.isNotEmpty ? '剩余${myModel.smsInfo}条' : '',  
101 - callback: () {  
102 - Utils.goMiniProgramZm(context, "setting/sms");  
103 - },  
104 - ),  
105 - MyDivider(  
106 - double.infinity,  
107 - ScreenUtil().setHeight(1),  
108 - color: MyColours.color_f3f3f3,  
109 - ),  
110 - MyItem(  
111 - title: "包间类型置满管理",  
112 - content: "",  
113 - callback: () {  
114 - Utils.goMiniProgramZm(context, "roomtype/roomtype");  
115 - },  
116 - ),  
117 - VEmptyView(40),  
118 - MyItem(  
119 - title: "联系客服",  
120 - content: "09:00~21:00",  
121 - callback: () {  
122 - Utils.goPhone("400-000-9690");  
123 - },  
124 - ),  
125 - MyDivider(  
126 - double.infinity,  
127 - ScreenUtil().setHeight(1),  
128 - color: MyColours.color_f3f3f3,  
129 - ),  
130 - MyItem(  
131 - title: "帮助与反馈",  
132 - content: "",  
133 - callback: () {  
134 - Utils.goHelp(context);  
135 - },  
136 - ),  
137 - MyDivider(double.infinity, ScreenUtil().setHeight(1),  
138 - color: MyColours.color_f3f3f3),  
139 - GestureDetector(  
140 - onTap: checkUpdate,  
141 - child: Container(  
142 - width: double.infinity,  
143 - height: ScreenUtil().setHeight(122),  
144 - color: MyColours.color_ffffff,  
145 - padding: EdgeInsets.symmetric(  
146 - horizontal: ScreenUtil().setWidth(40)),  
147 - alignment: Alignment.center,  
148 - child: Row(  
149 - children: <Widget>[  
150 - Text(  
151 - "版本更新",  
152 - style: TextStyle(  
153 - fontSize: ScreenUtil().setSp(30),  
154 - color: MyColours.color_353535),  
155 - ),  
156 - Spacer(),  
157 - newVersion  
158 - ? Container(  
159 - width: ScreenUtil().setWidth(120),  
160 - height: ScreenUtil().setWidth(34),  
161 - decoration: BoxDecoration(  
162 - color: MyColours.color_E14553,  
163 - borderRadius: BorderRadius.all(  
164 - Radius.circular(  
165 - ScreenUtil().setWidth(6))),  
166 - ),  
167 - child: Center(  
168 - child: Text(  
169 - "发现新版本",  
170 - style: TextStyle(  
171 - fontSize: ScreenUtil().setSp(24),  
172 - color: MyColours.color_ffffff),  
173 - ),  
174 - ),  
175 - )  
176 - : Text(  
177 - cur_version,  
178 - style: TextStyle(  
179 - fontSize: ScreenUtil().setSp(28),  
180 - color: MyColours.color_666666),  
181 - ),  
182 - HEmptyView(20),  
183 - Image.asset(  
184 - "assets/arr_right_gray.png",  
185 - width: ScreenUtil().setWidth(14),  
186 - height: ScreenUtil().setWidth(22),  
187 - )  
188 - ],  
189 - ),  
190 - ),  
191 - ),  
192 - MyDivider(  
193 - double.infinity,  
194 - ScreenUtil().setHeight(1),  
195 - color: MyColours.color_f3f3f3,  
196 - ),  
197 - VEmptyView(40),  
198 - Consumer<UserModel>(  
199 - builder:  
200 - (BuildContext context, UserModel model, Widget child) {  
201 - return GestureDetector(  
202 - onTap: () {  
203 - model.showLoginOutDialog(context);  
204 - },  
205 - child: Container(  
206 - height: ScreenUtil().setHeight(122),  
207 - color: MyColours.color_ffffff,  
208 - child: Center(  
209 - child: Row(  
210 - mainAxisSize: MainAxisSize.min,  
211 - crossAxisAlignment: CrossAxisAlignment.center,  
212 - children: <Widget>[  
213 - Image.asset(  
214 - "assets/icon_exist.png",  
215 - width: ScreenUtil().setWidth(30),  
216 - height: ScreenUtil().setWidth(30),  
217 - ),  
218 - HEmptyView(18),  
219 - Text("退出登录",  
220 - style: TextStyle(  
221 - color: MyColours.color_199095,  
222 - fontSize: ScreenUtil().setSp(34),  
223 - ))  
224 - ],  
225 - ),  
226 - ),  
227 - ),  
228 - );  
229 - },  
230 - )  
231 - ], 93 + return Scaffold(
  94 + appBar: AppBar(
  95 + backgroundColor: MyColours.color_199095, //把appbar的背景色改成透明
  96 + elevation: 0, //appbar的阴影
  97 + centerTitle: true, // 标题居中
  98 + title: Text(
  99 + '我的',
  100 + style: TextStyle(
  101 + color: MyColours.color_fefefe,
  102 + fontSize: ScreenUtil().setSp(34),
  103 + fontWeight: FontWeight.normal,
  104 + decoration: TextDecoration.none),
232 )), 105 )),
233 - Container(  
234 - width: double.infinity,  
235 - height: ScreenUtil().setHeight(242 + 121),  
236 - alignment: Alignment.centerLeft,  
237 - color: MyColours.color_199095,  
238 - child: Scaffold(  
239 - backgroundColor: Colors.transparent, //把scaffold的背景色改成透明  
240 - appBar: AppBar(  
241 - backgroundColor: Colors.transparent, //把appbar的背景色改成透明  
242 - elevation: 0, //appbar的阴影  
243 - centerTitle: true, // 标题居中  
244 - title: Text(  
245 - '我的',  
246 - style: TextStyle(  
247 - color: MyColours.color_fefefe,  
248 - fontSize: ScreenUtil().setSp(34),  
249 - fontWeight: FontWeight.normal,  
250 - decoration: TextDecoration.none),  
251 - )),  
252 - body: Consumer<UserModel>(  
253 - builder:  
254 - (BuildContext context, UserModel model, Widget child) {  
255 - return Padding(  
256 - padding:  
257 - EdgeInsets.only(left: ScreenUtil().setWidth(40)),  
258 - child: Column(  
259 - crossAxisAlignment: CrossAxisAlignment.start,  
260 - children: <Widget>[  
261 - VEmptyView(38),  
262 - Text(  
263 - model.user.sellername,  
264 - style: TextStyle(  
265 - color: MyColours.color_ffffff,  
266 - fontSize: ScreenUtil().setSp(36)),  
267 - ),  
268 - VEmptyView(38),  
269 - Text(  
270 - model.user.account +  
271 - " | " +  
272 - model.user.role_name,  
273 - style: TextStyle(  
274 - color: MyColours.color_ffffff,  
275 - fontSize: ScreenUtil().setSp(30)), 106 + body: NestedScrollView(
  107 + controller: controller,
  108 + headerSliverBuilder:
  109 + (BuildContext context, bool innerBoxIsScrolled) {
  110 + return <Widget>[
  111 + SliverAppBar(
  112 + pinned: false,
  113 + floating: true,
  114 + expandedHeight: ScreenUtil().setWidth(242),
  115 + flexibleSpace: FlexibleSpaceBar(
  116 + collapseMode: CollapseMode.pin,
  117 + background: Container(
  118 + //头部整个背景颜色
  119 + // height: ScreenUtil().getAdapterSize(800),
  120 + child: Consumer<UserModel>(builder:
  121 + (BuildContext context, UserModel model,
  122 + Widget child) {
  123 + return Stack(
  124 + children: [
  125 + Container(
  126 + width: double.infinity,
  127 + height: ScreenUtil().setHeight(242 + 121),
  128 + alignment: Alignment.centerLeft,
  129 + color: MyColours.color_199095,
276 ), 130 ),
  131 + Padding(
  132 + padding: EdgeInsets.only(
  133 + left: ScreenUtil().setWidth(40)),
  134 + child: Column(
  135 + crossAxisAlignment: CrossAxisAlignment.start,
  136 + children: [
  137 + VEmptyView(38),
  138 + Text(
  139 + model.user.sellername,
  140 + style: TextStyle(
  141 + color: MyColours.color_ffffff,
  142 + fontSize: ScreenUtil().setSp(36)),
  143 + ),
  144 + VEmptyView(38),
  145 + Text(
  146 + model.user.account +
  147 + " | " +
  148 + model.user.role_name,
  149 + style: TextStyle(
  150 + color: MyColours.color_ffffff,
  151 + fontSize: ScreenUtil().setSp(30)),
  152 + ),
  153 + ],
  154 + ))
277 ], 155 ],
278 - ));  
279 - },  
280 - )))  
281 - ],  
282 - );  
283 - // TODO: implement build  
284 - /* 原来的  
285 - return Container(  
286 - width: double.infinity,  
287 - height: double.infinity,  
288 - color: MyColours.color_f5f5f5,  
289 - child: Column(  
290 - children: <Widget>[  
291 - MyAppBar(  
292 - "我的",  
293 - showBack: false,  
294 - backgroundColor: MyColours.color_199095,  
295 - fontColor: MyColours.color_fefefe,  
296 - ),  
297 - Container(  
298 - width: double.infinity,  
299 - height: ScreenUtil().setHeight(242),  
300 - alignment: Alignment.centerLeft,  
301 - padding: EdgeInsets.only(left: ScreenUtil().setWidth(40)),  
302 - color: MyColours.color_199095,  
303 - child: Consumer<UserModel>( 156 + );
  157 + }))),
  158 + )
  159 + ];
  160 + },
  161 + body: Consumer<UserModel>(
304 builder: (BuildContext context, UserModel model, Widget child) { 162 builder: (BuildContext context, UserModel model, Widget child) {
305 - return Column(  
306 - crossAxisAlignment: CrossAxisAlignment.start, 163 + return SingleChildScrollView(
  164 + physics: NeverScrollableScrollPhysics(),
  165 + child: Column(
307 children: <Widget>[ 166 children: <Widget>[
308 - VEmptyView(38),  
309 - Text(  
310 - model.user.sellername,  
311 - style: TextStyle(  
312 - color: MyColours.color_ffffff,  
313 - fontSize: ScreenUtil().setSp(36)), 167 + VEmptyView(40),
  168 + MyItem(
  169 + title: "短信管理",
  170 + content: myModel.smsInfo.isNotEmpty
  171 + ? '剩余${myModel.smsInfo}条'
  172 + : '',
  173 + callback: () {
  174 + Utils.goMiniProgramZm(context, "setting/sms");
  175 + },
314 ), 176 ),
315 - VEmptyView(38),  
316 - Text(  
317 - model.user.account + " | " + model.user.role_name,  
318 - style: TextStyle(  
319 - color: MyColours.color_ffffff,  
320 - fontSize: ScreenUtil().setSp(30)), 177 + MyDivider(
  178 + double.infinity,
  179 + ScreenUtil().setHeight(1),
  180 + color: MyColours.color_f3f3f3,
321 ), 181 ),
322 - ],  
323 - );  
324 - },  
325 - )),  
326 - VEmptyView(44),  
327 - MyItem(  
328 - title: "联系客服",  
329 - content: "09:00~21:00",  
330 - callback: () {  
331 - Utils.goPhone("400-000-9690");  
332 - },  
333 - ),  
334 - MyDivider(  
335 - double.infinity,  
336 - ScreenUtil().setHeight(1),  
337 - color: MyColours.color_f3f3f3,  
338 - ),  
339 - MyItem(  
340 - title: "帮助与反馈",  
341 - content: "",  
342 - callback: () {  
343 - Utils.goHelp(context);  
344 - },  
345 - ),  
346 - MyDivider(double.infinity, ScreenUtil().setHeight(1),  
347 - color: MyColours.color_f3f3f3),  
348 - GestureDetector(  
349 - onTap: checkUpdate,  
350 - child: Container(  
351 - width: double.infinity,  
352 - height: ScreenUtil().setHeight(122),  
353 - color: MyColours.color_ffffff,  
354 - padding:  
355 - EdgeInsets.symmetric(horizontal: ScreenUtil().setWidth(40)),  
356 - alignment: Alignment.center,  
357 - child: Row(  
358 - children: <Widget>[  
359 - Text(  
360 - "版本更新",  
361 - style: TextStyle(  
362 - fontSize: ScreenUtil().setSp(30),  
363 - color: MyColours.color_353535),  
364 - ),  
365 - Spacer(),  
366 - newVersion  
367 - ? Container(  
368 - width: ScreenUtil().setWidth(120),  
369 - height: ScreenUtil().setWidth(34),  
370 - decoration: BoxDecoration(  
371 - color: MyColours.color_E14553,  
372 - borderRadius: BorderRadius.all(  
373 - Radius.circular(ScreenUtil().setWidth(6))),  
374 - ),  
375 - child: Center(  
376 - child: Text(  
377 - "发现新版本",  
378 - style: TextStyle(  
379 - fontSize: ScreenUtil().setSp(24),  
380 - color: MyColours.color_ffffff),  
381 - ), 182 + MyItem(
  183 + title: "包间类型置满管理",
  184 + content: "",
  185 + callback: () {
  186 + Utils.goMiniProgramZm(context, "roomtype/roomtype");
  187 + },
  188 + ),
  189 + MyDivider(
  190 + double.infinity,
  191 + ScreenUtil().setHeight(1),
  192 + color: MyColours.color_f3f3f3,
  193 + ),
  194 + MyItem(
  195 + title: "可订时段管理",
  196 + content: "",
  197 + callback: () {
  198 + NavigatorUtil.goBookTimeSetPage(context);
  199 + },
  200 + ),
  201 + MyDivider(
  202 + double.infinity,
  203 + ScreenUtil().setHeight(1),
  204 + color: MyColours.color_f3f3f3,
  205 + ),
  206 + MyItem(
  207 + title: "接单时间管理",
  208 + content: "",
  209 + callback: () {},
  210 + ),
  211 + VEmptyView(40),
  212 + MyItem(
  213 + title: "联系客服",
  214 + content: "09:00~21:00",
  215 + callback: () {
  216 + Utils.goPhone("400-000-9690");
  217 + },
  218 + ),
  219 + MyDivider(
  220 + double.infinity,
  221 + ScreenUtil().setHeight(1),
  222 + color: MyColours.color_f3f3f3,
  223 + ),
  224 + MyItem(
  225 + title: "帮助与反馈",
  226 + content: "",
  227 + callback: () {
  228 + Utils.goHelp(context);
  229 + },
  230 + ),
  231 + MyDivider(double.infinity, ScreenUtil().setHeight(1),
  232 + color: MyColours.color_f3f3f3),
  233 + GestureDetector(
  234 + onTap: checkUpdate,
  235 + child: Container(
  236 + width: double.infinity,
  237 + height: ScreenUtil().setHeight(122),
  238 + color: MyColours.color_ffffff,
  239 + padding: EdgeInsets.symmetric(
  240 + horizontal: ScreenUtil().setWidth(40)),
  241 + alignment: Alignment.center,
  242 + child: Row(
  243 + children: <Widget>[
  244 + Text(
  245 + "版本更新",
  246 + style: TextStyle(
  247 + fontSize: ScreenUtil().setSp(30),
  248 + color: MyColours.color_353535),
  249 + ),
  250 + Spacer(),
  251 + newVersion
  252 + ? Container(
  253 + width: ScreenUtil().setWidth(120),
  254 + height: ScreenUtil().setWidth(34),
  255 + decoration: BoxDecoration(
  256 + color: MyColours.color_E14553,
  257 + borderRadius: BorderRadius.all(
  258 + Radius.circular(
  259 + ScreenUtil().setWidth(6))),
  260 + ),
  261 + child: Center(
  262 + child: Text(
  263 + "发现新版本",
  264 + style: TextStyle(
  265 + fontSize: ScreenUtil().setSp(24),
  266 + color: MyColours.color_ffffff),
  267 + ),
  268 + ),
  269 + )
  270 + : Text(
  271 + cur_version,
  272 + style: TextStyle(
  273 + fontSize: ScreenUtil().setSp(28),
  274 + color: MyColours.color_666666),
  275 + ),
  276 + HEmptyView(20),
  277 + Image.asset(
  278 + "assets/arr_right_gray.png",
  279 + width: ScreenUtil().setWidth(14),
  280 + height: ScreenUtil().setWidth(22),
  281 + )
  282 + ],
382 ), 283 ),
383 - )  
384 - : Text(  
385 - cur_version,  
386 - style: TextStyle(  
387 - fontSize: ScreenUtil().setSp(28),  
388 - color: MyColours.color_666666),  
389 ), 284 ),
390 - HEmptyView(20),  
391 - Image.asset(  
392 - "assets/arr_right_gray.png",  
393 - width: ScreenUtil().setWidth(14),  
394 - height: ScreenUtil().setWidth(22),  
395 - )  
396 - ],  
397 - ),  
398 - ),  
399 - ),  
400 - MyDivider(  
401 - double.infinity,  
402 - ScreenUtil().setHeight(1),  
403 - color: MyColours.color_f3f3f3,  
404 - ),  
405 - VEmptyView(40),  
406 - Consumer<UserModel>(  
407 - builder: (BuildContext context, UserModel model, Widget child) {  
408 - return GestureDetector(  
409 - onTap: () {  
410 - model.showLoginOutDialog(context);  
411 - },  
412 - child: Container(  
413 - height: ScreenUtil().setHeight(122),  
414 - color: MyColours.color_ffffff,  
415 - child: Center(  
416 - child: Row(  
417 - mainAxisSize: MainAxisSize.min,  
418 - crossAxisAlignment: CrossAxisAlignment.center,  
419 - children: <Widget>[  
420 - Image.asset(  
421 - "assets/icon_exist.png",  
422 - width: ScreenUtil().setWidth(30),  
423 - height: ScreenUtil().setWidth(30),  
424 - ),  
425 - HEmptyView(18),  
426 - Text("退出登录",  
427 - style: TextStyle(  
428 - color: MyColours.color_199095,  
429 - fontSize: ScreenUtil().setSp(34),  
430 - ))  
431 - ],  
432 - ),  
433 - ),  
434 - ),  
435 - );  
436 - },  
437 - )  
438 - ],  
439 - ),  
440 - );  
441 - */ 285 + ),
  286 + MyDivider(
  287 + double.infinity,
  288 + ScreenUtil().setHeight(1),
  289 + color: MyColours.color_f3f3f3,
  290 + ),
  291 + VEmptyView(40),
  292 + Consumer<UserModel>(
  293 + builder: (BuildContext context, UserModel model,
  294 + Widget child) {
  295 + return GestureDetector(
  296 + onTap: () {
  297 + model.showLoginOutDialog(context);
  298 + },
  299 + child: Container(
  300 + height: ScreenUtil().setHeight(122),
  301 + color: MyColours.color_ffffff,
  302 + child: Center(
  303 + child: Row(
  304 + mainAxisSize: MainAxisSize.min,
  305 + crossAxisAlignment: CrossAxisAlignment.center,
  306 + children: <Widget>[
  307 + Image.asset(
  308 + "assets/icon_exist.png",
  309 + width: ScreenUtil().setWidth(30),
  310 + height: ScreenUtil().setWidth(30),
  311 + ),
  312 + HEmptyView(18),
  313 + Text("退出登录",
  314 + style: TextStyle(
  315 + color: MyColours.color_199095,
  316 + fontSize: ScreenUtil().setSp(34),
  317 + ))
  318 + ],
  319 + ),
  320 + ),
  321 + ),
  322 + );
  323 + },
  324 + )
  325 + ],
  326 + ));
  327 + })));
442 } 328 }
443 } 329 }
@@ -12,6 +12,7 @@ import 'package:one_key/pages/login/login_page.dart'; @@ -12,6 +12,7 @@ import 'package:one_key/pages/login/login_page.dart';
12 import 'package:one_key/pages/detail/handle_online_page.dart'; 12 import 'package:one_key/pages/detail/handle_online_page.dart';
13 import 'package:one_key/pages/detail/notebook_detail_page.dart'; 13 import 'package:one_key/pages/detail/notebook_detail_page.dart';
14 import 'package:one_key/pages/login/web_page.dart'; 14 import 'package:one_key/pages/login/web_page.dart';
  15 +import 'package:one_key/pages/my/book_time_set.dart';
15 import 'package:one_key/pages/sms/sms_page.dart'; 16 import 'package:one_key/pages/sms/sms_page.dart';
16 import 'package:one_key/pages/table/select_table_page.dart'; 17 import 'package:one_key/pages/table/select_table_page.dart';
17 import 'package:one_key/pages/webview/webview_page.dart'; 18 import 'package:one_key/pages/webview/webview_page.dart';
@@ -97,8 +98,8 @@ var handleInvicationHandler = new Handler( @@ -97,8 +98,8 @@ var handleInvicationHandler = new Handler(
97 String ddate = params["ddate"].first; 98 String ddate = params["ddate"].first;
98 String ddateStr = 99 String ddateStr =
99 FluroConvertUtils.fluroCnParamsDecode(params["ddateStr"].first); 100 FluroConvertUtils.fluroCnParamsDecode(params["ddateStr"].first);
100 - String phone=params["phone"].first;  
101 - return InvicationPage(rid, tableInfo, ddate, ddateStr,phone); 101 + String phone = params["phone"].first;
  102 + return InvicationPage(rid, tableInfo, ddate, ddateStr, phone);
102 }); 103 });
103 104
104 // 发短信 105 // 发短信
@@ -134,3 +135,9 @@ var handleChangeDetailHandler = new Handler( @@ -134,3 +135,9 @@ var handleChangeDetailHandler = new Handler(
134 create: (_) => NotebookDetailChangeModel(detailEntity), 135 create: (_) => NotebookDetailChangeModel(detailEntity),
135 child: NoteBookChangePage(detailEntity: detailEntity, rid: rid)); 136 child: NoteBookChangePage(detailEntity: detailEntity, rid: rid));
136 }); 137 });
  138 +
  139 +// 跳转可订时段管理页面
  140 +var handleBookTimeSetHandler = new Handler(
  141 + handlerFunc: (BuildContext context, Map<String, List<Object>> params) {
  142 + return BookTimeSetPage();
  143 +});
@@ -5,17 +5,17 @@ import 'package:one_key/pages/login/login_page.dart'; @@ -5,17 +5,17 @@ import 'package:one_key/pages/login/login_page.dart';
5 import 'route_handles.dart'; 5 import 'route_handles.dart';
6 6
7 class Routes { 7 class Routes {
8 - static String login = "/";//登录页  
9 - static String home = "/home";//主页  
10 - static String handle_online_page="/handle_online_page";//处理在线预订  
11 - static String reserve_detail="/reserve_detail";//预订详情  
12 - static String select_table="/select_table";//选择桌位  
13 - static String invication="/invication";//邀请函  
14 - static String sms="/sms";//发短信  
15 - static String webview="/webview";//网页 8 + static String login = "/"; //登录页
  9 + static String home = "/home"; //主页
  10 + static String handle_online_page = "/handle_online_page"; //处理在线预订
  11 + static String reserve_detail = "/reserve_detail"; //预订详情
  12 + static String select_table = "/select_table"; //选择桌位
  13 + static String invication = "/invication"; //邀请函
  14 + static String sms = "/sms"; //发短信
  15 + static String webview = "/webview"; //网页
16 static String web_page = '/web_page'; //隐私协议 16 static String web_page = '/web_page'; //隐私协议
17 - static String change_detail="/change_detail";//变更预订  
18 - 17 + static String change_detail = "/change_detail"; //变更预订
  18 + static String book_time_set = "/book_time_set"; //可订时段管理
19 19
20 static void configureRoutes(Router router) { 20 static void configureRoutes(Router router) {
21 router.notFoundHandler = new Handler( 21 router.notFoundHandler = new Handler(
@@ -33,5 +33,6 @@ class Routes { @@ -33,5 +33,6 @@ class Routes {
33 router.define(webview, handler: handleWebviewHandler); 33 router.define(webview, handler: handleWebviewHandler);
34 router.define(web_page, handler: webPageHandler); 34 router.define(web_page, handler: webPageHandler);
35 router.define(change_detail, handler: handleChangeDetailHandler); 35 router.define(change_detail, handler: handleChangeDetailHandler);
  36 + router.define(book_time_set, handler: handleBookTimeSetHandler);
36 } 37 }
37 } 38 }
@@ -654,15 +654,18 @@ class DialogUtil { @@ -654,15 +654,18 @@ class DialogUtil {
654 654
655 //显示选择客户经理弹框 655 //显示选择客户经理弹框
656 static Future<List<int>> showSelectCusmanDialog( 656 static Future<List<int>> showSelectCusmanDialog(
657 - BuildContext context, List<String> data, ValueChanged valueChanged) { 657 + BuildContext context, List<dynamic> data, ValueChanged valueChanged,
  658 + {List<int> selecteds}) {
658 return Picker( 659 return Picker(
  660 + selecteds: selecteds,
659 adapter: PickerDataAdapter<String>(pickerdata: data), 661 adapter: PickerDataAdapter<String>(pickerdata: data),
  662 + height: ScreenUtil().setWidth(480),
660 hideHeader: false, 663 hideHeader: false,
661 cancelText: "取消", 664 cancelText: "取消",
662 cancelTextStyle: TextStyle( 665 cancelTextStyle: TextStyle(
663 color: MyColours.color_828282, fontSize: ScreenUtil().setSp(36)), 666 color: MyColours.color_828282, fontSize: ScreenUtil().setSp(36)),
664 confirmText: "确定", 667 confirmText: "确定",
665 - itemExtent: ScreenUtil().setWidth(80), 668 + itemExtent: ScreenUtil().setWidth(90),
666 confirmTextStyle: TextStyle( 669 confirmTextStyle: TextStyle(
667 color: MyColours.color_2bb5b7, fontSize: ScreenUtil().setSp(36)), 670 color: MyColours.color_2bb5b7, fontSize: ScreenUtil().setSp(36)),
668 selectedTextStyle: TextStyle( 671 selectedTextStyle: TextStyle(
@@ -38,14 +38,17 @@ class NavigatorUtil { @@ -38,14 +38,17 @@ class NavigatorUtil {
38 38
39 /// 订单详情 39 /// 订单详情
40 static void goNotebookDetailPage(BuildContext context, String rid, 40 static void goNotebookDetailPage(BuildContext context, String rid,
41 - {String mid="",bool fromNotify=false,replace = false}) {  
42 - _navigateTo(context, "${Routes.reserve_detail}?rid=$rid&mid=$mid&fromNotify=$fromNotify", replace: replace); 41 + {String mid = "", bool fromNotify = false, replace = false}) {
  42 + _navigateTo(context,
  43 + "${Routes.reserve_detail}?rid=$rid&mid=$mid&fromNotify=$fromNotify",
  44 + replace: replace);
43 } 45 }
44 46
45 /// 处理在线预订 47 /// 处理在线预订
46 static void goHandleOnlinePage(BuildContext context, String rid, String mid, 48 static void goHandleOnlinePage(BuildContext context, String rid, String mid,
47 - {fromNotify=false,replace = false}) {  
48 - _navigateTo(context, "${Routes.handle_online_page}?rid=$rid&mid=$mid&fromNotify=$fromNotify", 49 + {fromNotify = false, replace = false}) {
  50 + _navigateTo(context,
  51 + "${Routes.handle_online_page}?rid=$rid&mid=$mid&fromNotify=$fromNotify",
49 replace: replace); 52 replace: replace);
50 } 53 }
51 54
@@ -64,7 +67,7 @@ class NavigatorUtil { @@ -64,7 +67,7 @@ class NavigatorUtil {
64 67
65 /// 邀请函 68 /// 邀请函
66 static void goInvicationPage(BuildContext context, String rid, 69 static void goInvicationPage(BuildContext context, String rid,
67 - String tableInfo, String ddate, String ddateStr,String phone, 70 + String tableInfo, String ddate, String ddateStr, String phone,
68 {bool replace = false}) { 71 {bool replace = false}) {
69 _navigateTo(context, 72 _navigateTo(context,
70 "${Routes.invication}?rid=$rid&tableInfo=${FluroConvertUtils.fluroCnParamsEncode(tableInfo)}&ddate=$ddate&ddateStr=${FluroConvertUtils.fluroCnParamsEncode(ddateStr)}&phone=$phone", 73 "${Routes.invication}?rid=$rid&tableInfo=${FluroConvertUtils.fluroCnParamsEncode(tableInfo)}&ddate=$ddate&ddateStr=${FluroConvertUtils.fluroCnParamsEncode(ddateStr)}&phone=$phone",
@@ -94,19 +97,17 @@ class NavigatorUtil { @@ -94,19 +97,17 @@ class NavigatorUtil {
94 static void goNoteBookChangePage( 97 static void goNoteBookChangePage(
95 BuildContext context, NotebookDetail detailEntity, String rid, 98 BuildContext context, NotebookDetail detailEntity, String rid,
96 {replace = false}) { 99 {replace = false}) {
97 - if(detailEntity.type=="0"){//内部预订  
98 - detailEntity.is_set_ddate="1"; 100 + if (detailEntity.type == "0") {
  101 + //内部预订
  102 + detailEntity.is_set_ddate = "1";
99 } 103 }
100 _navigateTo(context, 104 _navigateTo(context,
101 "${Routes.change_detail}?detail=${FluroConvertUtils.object2string(detailEntity)}&rid=$rid", 105 "${Routes.change_detail}?detail=${FluroConvertUtils.object2string(detailEntity)}&rid=$rid",
102 replace: replace); 106 replace: replace);
103 } 107 }
104 - // /// 变更预订  
105 - // static void goNoteBookChangePage(  
106 - // BuildContext context, NotebookDetail detailEntity, String rid,  
107 - // {replace = false}) {  
108 - // _navigateTo(context,  
109 - // "${Routes.change_detail}?detail=${FluroConvertUtils.object2string(detailEntity)}&rid=$rid",  
110 - // replace: replace);  
111 - // } 108 +
  109 + /// 可订时段管理
  110 + static void goBookTimeSetPage(BuildContext context) {
  111 + _navigateTo(context, "${Routes.book_time_set}");
  112 + }
112 } 113 }