Showing
14 changed files
with
214 additions
and
38 deletions
assets/tablemanage_default.png
0 → 100644
2.06 KB
assets/tablemanage_selected.png
0 → 100644
2.52 KB
| @@ -103,7 +103,6 @@ class _NoteBookChangePageState extends State<NoteBookChangePage> { | @@ -103,7 +103,6 @@ class _NoteBookChangePageState extends State<NoteBookChangePage> { | ||
| 103 | value['title']) { | 103 | value['title']) { |
| 104 | _notebookDetailChangeModel.dateList[j]['select'] = | 104 | _notebookDetailChangeModel.dateList[j]['select'] = |
| 105 | true; | 105 | true; |
| 106 | - | ||
| 107 | if (j == 0 || j == 1) { | 106 | if (j == 0 || j == 1) { |
| 108 | _notebookDetailChangeModel.dateList[2]['title'] = | 107 | _notebookDetailChangeModel.dateList[2]['title'] = |
| 109 | '其他'; | 108 | '其他'; |
| @@ -121,6 +120,7 @@ class _NoteBookChangePageState extends State<NoteBookChangePage> { | @@ -121,6 +120,7 @@ class _NoteBookChangePageState extends State<NoteBookChangePage> { | ||
| 121 | } | 120 | } |
| 122 | } | 121 | } |
| 123 | } | 122 | } |
| 123 | + _notebookDetailChangeModel.initHourAndMinuteSelect(); | ||
| 124 | //选完今天明天刷新页面 | 124 | //选完今天明天刷新页面 |
| 125 | int ddate = Utils.getDdate(_notebookDetailChangeModel.dateList); | 125 | int ddate = Utils.getDdate(_notebookDetailChangeModel.dateList); |
| 126 | String ddateSolt = | 126 | String ddateSolt = |
| @@ -155,11 +155,11 @@ class _NoteBookChangePageState extends State<NoteBookChangePage> { | @@ -155,11 +155,11 @@ class _NoteBookChangePageState extends State<NoteBookChangePage> { | ||
| 155 | child: CustomButton( | 155 | child: CustomButton( |
| 156 | onTap: () { | 156 | onTap: () { |
| 157 | FocusScope.of(context).requestFocus(FocusNode()); //点击空白处隐藏键盘 | 157 | FocusScope.of(context).requestFocus(FocusNode()); //点击空白处隐藏键盘 |
| 158 | + String key = ''; | ||
| 158 | for (var item in _notebookDetailChangeModel.sunDateList) { | 159 | for (var item in _notebookDetailChangeModel.sunDateList) { |
| 159 | item['isSelect'] = false; | 160 | item['isSelect'] = false; |
| 160 | if (item['dateText'] == value['dateText']) { | 161 | if (item['dateText'] == value['dateText']) { |
| 161 | item['isSelect'] = true; | 162 | item['isSelect'] = true; |
| 162 | - String key = ''; | ||
| 163 | 163 | ||
| 164 | if (item['ddateSolt'] == 1) { | 164 | if (item['ddateSolt'] == 1) { |
| 165 | //早市 | 165 | //早市 |
| @@ -171,18 +171,19 @@ class _NoteBookChangePageState extends State<NoteBookChangePage> { | @@ -171,18 +171,19 @@ class _NoteBookChangePageState extends State<NoteBookChangePage> { | ||
| 171 | //晚市 | 171 | //晚市 |
| 172 | key = 'night'; | 172 | key = 'night'; |
| 173 | } | 173 | } |
| 174 | - if (key != '') { | ||
| 175 | - for (var sunitem | ||
| 176 | - in _notebookDetailChangeModel.dailyMap[key]) { | ||
| 177 | - if (sunitem['select'] == true) { | ||
| 178 | - _notebookDetailChangeModel.ddateStr = | ||
| 179 | - sunitem['title']; | ||
| 180 | - } | ||
| 181 | - } | 174 | + } |
| 175 | + } | ||
| 176 | + _notebookDetailChangeModel.initHourAndMinuteSelect(); | ||
| 177 | + if (key != '') { | ||
| 178 | + for (var sunitem | ||
| 179 | + in _notebookDetailChangeModel.dailyMap[key]) { | ||
| 180 | + if (sunitem['select'] == true) { | ||
| 181 | + _notebookDetailChangeModel.ddateStr = | ||
| 182 | + sunitem['title']; | ||
| 182 | } | 183 | } |
| 183 | - _notebookDetailChangeModel.notifyListeners(); | ||
| 184 | } | 184 | } |
| 185 | } | 185 | } |
| 186 | + _notebookDetailChangeModel.notifyListeners(); | ||
| 186 | int ddate = Utils.getDdate(_notebookDetailChangeModel.dateList); | 187 | int ddate = Utils.getDdate(_notebookDetailChangeModel.dateList); |
| 187 | String pnum = Utils.getPnum(_notebookDetailChangeModel.personNumList); | 188 | String pnum = Utils.getPnum(_notebookDetailChangeModel.personNumList); |
| 188 | String ddateSolt = Utils.getDdateSolt(_notebookDetailChangeModel.sunDateList); | 189 | String ddateSolt = Utils.getDdateSolt(_notebookDetailChangeModel.sunDateList); |
| @@ -284,6 +285,7 @@ class _NoteBookChangePageState extends State<NoteBookChangePage> { | @@ -284,6 +285,7 @@ class _NoteBookChangePageState extends State<NoteBookChangePage> { | ||
| 284 | } else { | 285 | } else { |
| 285 | _notebookDetailChangeModel.dateList[2]['title'] = '其他'; | 286 | _notebookDetailChangeModel.dateList[2]['title'] = '其他'; |
| 286 | } | 287 | } |
| 288 | + _notebookDetailChangeModel.initHourAndMinuteSelect(); | ||
| 287 | // 选完日历刷新页面 | 289 | // 选完日历刷新页面 |
| 288 | String ddateSolt = Utils.getDdateSolt(_notebookDetailChangeModel.sunDateList); | 290 | String ddateSolt = Utils.getDdateSolt(_notebookDetailChangeModel.sunDateList); |
| 289 | String pnum = Utils.getPnum(_notebookDetailChangeModel.personNumList); | 291 | String pnum = Utils.getPnum(_notebookDetailChangeModel.personNumList); |
| @@ -793,6 +795,7 @@ class _NoteBookChangePageState extends State<NoteBookChangePage> { | @@ -793,6 +795,7 @@ class _NoteBookChangePageState extends State<NoteBookChangePage> { | ||
| 793 | print('成功'); | 795 | print('成功'); |
| 794 | // _notebookDetailChangeModel.clearData(); | 796 | // _notebookDetailChangeModel.clearData(); |
| 795 | bus.emit("refresh_detail"); | 797 | bus.emit("refresh_detail"); |
| 798 | + bus.emit("refresh_book_list");//刷新已预订列表 | ||
| 796 | String ddate_solt = ''; | 799 | String ddate_solt = ''; |
| 797 | if (_model.row.isSetDdate == '1') { | 800 | if (_model.row.isSetDdate == '1') { |
| 798 | String createtime = _model.row.ddate.toString() + '000'; | 801 | String createtime = _model.row.ddate.toString() + '000'; |
| @@ -819,7 +822,7 @@ class _NoteBookChangePageState extends State<NoteBookChangePage> { | @@ -819,7 +822,7 @@ class _NoteBookChangePageState extends State<NoteBookChangePage> { | ||
| 819 | } | 822 | } |
| 820 | LogUtil.v(_nameStr); | 823 | LogUtil.v(_nameStr); |
| 821 | NavigatorUtil.goInvicationPage(context, _model.row.id, | 824 | NavigatorUtil.goInvicationPage(context, _model.row.id, |
| 822 | - _nameStr, _model.row.ddate, ddate_solt, | 825 | + _nameStr, _model.row.ddate, ddate_solt,_model.row.phone, |
| 823 | replace: true); | 826 | replace: true); |
| 824 | EventBus().emit("refresh_tablemanager");//刷新桌位 | 827 | EventBus().emit("refresh_tablemanager");//刷新桌位 |
| 825 | } else { | 828 | } else { |
| @@ -713,7 +713,9 @@ class NotebookDetailPageState extends State<NotebookDetailPage> { | @@ -713,7 +713,9 @@ class NotebookDetailPageState extends State<NotebookDetailPage> { | ||
| 713 | detailEntity.id, | 713 | detailEntity.id, |
| 714 | detailEntity.tableinfoStr, | 714 | detailEntity.tableinfoStr, |
| 715 | detailEntity.ddate, | 715 | detailEntity.ddate, |
| 716 | - detailEntity.ddateStr); | 716 | + detailEntity.ddateStr, |
| 717 | + detailEntity.phone | ||
| 718 | + ); | ||
| 717 | break; | 719 | break; |
| 718 | case 2: //短信 | 720 | case 2: //短信 |
| 719 | NavigatorUtil.goSmsPage( | 721 | NavigatorUtil.goSmsPage( |
| @@ -818,7 +818,7 @@ class _EnterPageState extends State<EnterPage> { | @@ -818,7 +818,7 @@ class _EnterPageState extends State<EnterPage> { | ||
| 818 | _nameStr = _model.row.name + '等${tableinfo.length}桌'; | 818 | _nameStr = _model.row.name + '等${tableinfo.length}桌'; |
| 819 | } | 819 | } |
| 820 | NavigatorUtil.goInvicationPage(context, _model.row.id, | 820 | NavigatorUtil.goInvicationPage(context, _model.row.id, |
| 821 | - _nameStr, _model.row.ddate, ddate_solt, | 821 | + _nameStr, _model.row.ddate, ddate_solt,_model.row.phone, |
| 822 | replace: true); | 822 | replace: true); |
| 823 | } else { | 823 | } else { |
| 824 | Utils.showToast("录入预订订单失败,请重试!"); | 824 | Utils.showToast("录入预订订单失败,请重试!"); |
| @@ -365,12 +365,12 @@ class HomePageState extends State<HomePage> with WidgetsBindingObserver { | @@ -365,12 +365,12 @@ class HomePageState extends State<HomePage> with WidgetsBindingObserver { | ||
| 365 | ), | 365 | ), |
| 366 | BottomNavigationBarItem( | 366 | BottomNavigationBarItem( |
| 367 | icon: Image( | 367 | icon: Image( |
| 368 | - image: AssetImage("assets/notebook_default.png"), | 368 | + image: AssetImage("assets/tablemanage_default.png"), |
| 369 | width: ScreenUtil().setWidth(48), | 369 | width: ScreenUtil().setWidth(48), |
| 370 | height: ScreenUtil().setWidth(48), | 370 | height: ScreenUtil().setWidth(48), |
| 371 | ), | 371 | ), |
| 372 | activeIcon: Image( | 372 | activeIcon: Image( |
| 373 | - image: AssetImage("assets/notebook_selected.png"), | 373 | + image: AssetImage("assets/tablemanage_selected.png"), |
| 374 | width: ScreenUtil().setWidth(48), | 374 | width: ScreenUtil().setWidth(48), |
| 375 | height: ScreenUtil().setWidth(48), | 375 | height: ScreenUtil().setWidth(48), |
| 376 | ), | 376 | ), |
| @@ -13,8 +13,9 @@ class InvicationPage extends StatefulWidget { | @@ -13,8 +13,9 @@ class InvicationPage extends StatefulWidget { | ||
| 13 | final String tableInfo; //桌位信息 | 13 | final String tableInfo; //桌位信息 |
| 14 | final String ddate; | 14 | final String ddate; |
| 15 | final String ddateStr; | 15 | final String ddateStr; |
| 16 | + final String phone; | ||
| 16 | 17 | ||
| 17 | - InvicationPage(this.rid, this.tableInfo, this.ddate, this.ddateStr); | 18 | + InvicationPage(this.rid, this.tableInfo, this.ddate, this.ddateStr, this.phone); |
| 18 | 19 | ||
| 19 | @override | 20 | @override |
| 20 | State<StatefulWidget> createState() { | 21 | State<StatefulWidget> createState() { |
| @@ -210,6 +211,10 @@ class InvicationPageState extends State<InvicationPage> { | @@ -210,6 +211,10 @@ class InvicationPageState extends State<InvicationPage> { | ||
| 210 | children: <Widget>[ | 211 | children: <Widget>[ |
| 211 | GestureDetector( | 212 | GestureDetector( |
| 212 | onTap: () { | 213 | onTap: () { |
| 214 | + if(widget.phone.isEmpty){ | ||
| 215 | + Utils.showToast("没有预订人电话信息"); | ||
| 216 | + return; | ||
| 217 | + } | ||
| 213 | NavigatorUtil.goSmsPage(context, widget.rid); | 218 | NavigatorUtil.goSmsPage(context, widget.rid); |
| 214 | }, | 219 | }, |
| 215 | child: Container( | 220 | child: Container( |
| @@ -27,7 +27,9 @@ class NotebookItemState extends State<NoteBookItem> { | @@ -27,7 +27,9 @@ class NotebookItemState extends State<NoteBookItem> { | ||
| 27 | widget.notebook.id, | 27 | widget.notebook.id, |
| 28 | widget.notebook.tableinfoStr, | 28 | widget.notebook.tableinfoStr, |
| 29 | widget.notebook.ddate, | 29 | widget.notebook.ddate, |
| 30 | - widget.notebook.ddateStr); | 30 | + widget.notebook.ddateStr, |
| 31 | + widget.notebook.phone | ||
| 32 | + ); | ||
| 31 | } | 33 | } |
| 32 | } | 34 | } |
| 33 | 35 |
| @@ -38,8 +38,8 @@ class TableManagerPageState extends State<TableManagerPage> { | @@ -38,8 +38,8 @@ class TableManagerPageState extends State<TableManagerPage> { | ||
| 38 | // TODO: implement initState | 38 | // TODO: implement initState |
| 39 | super.initState(); | 39 | super.initState(); |
| 40 | LogUtil.v("table_manager_page initState"); | 40 | LogUtil.v("table_manager_page initState"); |
| 41 | + tableManagerModel=Provider.of<TableManagerModel>(context,listen: true); | ||
| 41 | WidgetsBinding.instance.addPostFrameCallback((_) { | 42 | WidgetsBinding.instance.addPostFrameCallback((_) { |
| 42 | - tableManagerModel=Provider.of<TableManagerModel>(context,listen: true); | ||
| 43 | tableManagerModel.initTime(context); | 43 | tableManagerModel.initTime(context); |
| 44 | EventBus().on("refresh_tablemanager", (arg) {//订座-完成预订 刷新管理桌位 | 44 | EventBus().on("refresh_tablemanager", (arg) {//订座-完成预订 刷新管理桌位 |
| 45 | tableManagerModel.getReserveList(context); | 45 | tableManagerModel.getReserveList(context); |
| @@ -24,6 +24,9 @@ class NotebookDetailChangeModel with ChangeNotifier { | @@ -24,6 +24,9 @@ class NotebookDetailChangeModel with ChangeNotifier { | ||
| 24 | TextEditingController customController = TextEditingController(); //客户要求 | 24 | TextEditingController customController = TextEditingController(); //客户要求 |
| 25 | List sexList = []; // 先生、女士、公司 | 25 | List sexList = []; // 先生、女士、公司 |
| 26 | Map dailyMap = {}; // 早市对应半点钟,午市对应半点钟、晚市对应半点钟 | 26 | Map dailyMap = {}; // 早市对应半点钟,午市对应半点钟、晚市对应半点钟 |
| 27 | + List<String> mornings=[];//早市时间段 | ||
| 28 | + List<String> noons=[];//午市时间段 | ||
| 29 | + List<String> nights=[];//晚市时间段 | ||
| 27 | String ddateStr = ''; //16:30 | 30 | String ddateStr = ''; //16:30 |
| 28 | NotebookDetail detailEntity; | 31 | NotebookDetail detailEntity; |
| 29 | List<TableList> tableList = []; | 32 | List<TableList> tableList = []; |
| @@ -141,10 +144,11 @@ class NotebookDetailChangeModel with ChangeNotifier { | @@ -141,10 +144,11 @@ class NotebookDetailChangeModel with ChangeNotifier { | ||
| 141 | 'isSelect': ddateSolt == '3' ? true : false | 144 | 'isSelect': ddateSolt == '3' ? true : false |
| 142 | }); | 145 | }); |
| 143 | } | 146 | } |
| 147 | + initHourAndMinuteSelect(); | ||
| 144 | notifyListeners(); | 148 | notifyListeners(); |
| 145 | } | 149 | } |
| 146 | 150 | ||
| 147 | -//人数 | 151 | + //人数 |
| 148 | _initPersonNumList() { | 152 | _initPersonNumList() { |
| 149 | String pnum = detailEntity.pnum; | 153 | String pnum = detailEntity.pnum; |
| 150 | if (int.parse(pnum) < 6 || int.parse(pnum) > 10) { | 154 | if (int.parse(pnum) < 6 || int.parse(pnum) > 10) { |
| @@ -229,25 +233,26 @@ class NotebookDetailChangeModel with ChangeNotifier { | @@ -229,25 +233,26 @@ class NotebookDetailChangeModel with ChangeNotifier { | ||
| 229 | 233 | ||
| 230 | /// 早市、午市、晚市对应的半个小时间隔时间段 | 234 | /// 早市、午市、晚市对应的半个小时间隔时间段 |
| 231 | initDateHourMinuteList(BuildContext context) async { | 235 | initDateHourMinuteList(BuildContext context) async { |
| 232 | - SunSellerInfoModel model = await getManagersInfo(context); | ||
| 233 | - model.daily.morning == '' | 236 | + UserModel userModel=Provider.of<UserModel>(context); |
| 237 | + userModel.user.morning == '' | ||
| 234 | ? dailyMap.putIfAbsent('morning', () => '') | 238 | ? dailyMap.putIfAbsent('morning', () => '') |
| 235 | : dailyMap.putIfAbsent( | 239 | : dailyMap.putIfAbsent( |
| 236 | - 'morning', () => _getHourAndMinute(model.daily.morning, 1, model)); | ||
| 237 | - model.daily.noon == '' | 240 | + 'morning', () => _getHourAndMinute(userModel.user.morning, 1)); |
| 241 | + userModel.user.noon == '' | ||
| 238 | ? dailyMap.putIfAbsent('noon', () => '') | 242 | ? dailyMap.putIfAbsent('noon', () => '') |
| 239 | : dailyMap.putIfAbsent( | 243 | : dailyMap.putIfAbsent( |
| 240 | - 'noon', () => _getHourAndMinute(model.daily.noon, 2, model)); | ||
| 241 | - model.daily.night == '' | 244 | + 'noon', () => _getHourAndMinute(userModel.user.noon, 2)); |
| 245 | + userModel.user.night == '' | ||
| 242 | ? dailyMap.putIfAbsent('night', () => '') | 246 | ? dailyMap.putIfAbsent('night', () => '') |
| 243 | : dailyMap.putIfAbsent( | 247 | : dailyMap.putIfAbsent( |
| 244 | - 'night', () => _getHourAndMinute(model.daily.night, 3, model)); | ||
| 245 | - _initSunDateList(model.daily.morning, model.daily.noon, model.daily.night); | 248 | + 'night', () => _getHourAndMinute(userModel.user.night, 3)); |
| 249 | + | ||
| 250 | + _initSunDateList(userModel.user.morning, userModel.user.noon, userModel.user.night); | ||
| 246 | } | 251 | } |
| 247 | 252 | ||
| 248 | //根据获取时间 11:00-12:30 获取30分钟间隔组装的数组 | 253 | //根据获取时间 11:00-12:30 获取30分钟间隔组装的数组 |
| 249 | _getHourAndMinute( | 254 | _getHourAndMinute( |
| 250 | - String hourAndMinuteStr, int mnd, SunSellerInfoModel model) { | 255 | + String hourAndMinuteStr, int mnd) { |
| 251 | List tempDate = hourAndMinuteStr.split("-"); | 256 | List tempDate = hourAndMinuteStr.split("-"); |
| 252 | String beginDate = tempDate[0]; | 257 | String beginDate = tempDate[0]; |
| 253 | String endDate = tempDate[1]; | 258 | String endDate = tempDate[1]; |
| @@ -262,6 +267,13 @@ class NotebookDetailChangeModel with ChangeNotifier { | @@ -262,6 +267,13 @@ class NotebookDetailChangeModel with ChangeNotifier { | ||
| 262 | bool tempLimit = true; | 267 | bool tempLimit = true; |
| 263 | while (tempLimit) { | 268 | while (tempLimit) { |
| 264 | String temp = _dealTime(beginHour, beginMinute); | 269 | String temp = _dealTime(beginHour, beginMinute); |
| 270 | + if(mnd==1){//早市 | ||
| 271 | + mornings.add(temp); | ||
| 272 | + }else if(mnd==2){//午市 | ||
| 273 | + noons.add(temp); | ||
| 274 | + }else if(mnd==3){//晚市 | ||
| 275 | + nights.add(temp); | ||
| 276 | + } | ||
| 265 | bool tempSelect = false; | 277 | bool tempSelect = false; |
| 266 | if (int.parse(isSetDate) == 1) //设置预订时间 | 278 | if (int.parse(isSetDate) == 1) //设置预订时间 |
| 267 | { | 279 | { |
| @@ -283,7 +295,6 @@ class NotebookDetailChangeModel with ChangeNotifier { | @@ -283,7 +295,6 @@ class NotebookDetailChangeModel with ChangeNotifier { | ||
| 283 | } | 295 | } |
| 284 | } | 296 | } |
| 285 | } | 297 | } |
| 286 | - | ||
| 287 | Map tempMap = {'title': temp, 'select': tempSelect}; | 298 | Map tempMap = {'title': temp, 'select': tempSelect}; |
| 288 | res.add(tempMap); | 299 | res.add(tempMap); |
| 289 | if (temp == endDate) { | 300 | if (temp == endDate) { |
| @@ -301,6 +312,77 @@ class NotebookDetailChangeModel with ChangeNotifier { | @@ -301,6 +312,77 @@ class NotebookDetailChangeModel with ChangeNotifier { | ||
| 301 | return res; | 312 | return res; |
| 302 | } | 313 | } |
| 303 | 314 | ||
| 315 | + //初始化早市午市晚市选中时间 | ||
| 316 | + initHourAndMinuteSelect(){ | ||
| 317 | + int timeMillsNow=DateTime.now().millisecondsSinceEpoch; | ||
| 318 | + //当前选中 月 日string | ||
| 319 | + String mdStr = ''; | ||
| 320 | + //今天 明天 其他天 | ||
| 321 | + for (var item in dateList) { | ||
| 322 | + if (item['select'] == true) { | ||
| 323 | + mdStr = item['title']; | ||
| 324 | + } | ||
| 325 | + } | ||
| 326 | + String timeNowYear = DateUtil.formatDate(DateTime.now(), format: 'yyyy'); | ||
| 327 | + String ymyStr = timeNowYear + '-' + mdStr; //年月日 | ||
| 328 | + String timeStr = ymyStr+' 00:00:00'; | ||
| 329 | + LogUtil.v(timeStr); | ||
| 330 | + DateTime dateTime=DateUtil.getDateTime(timeStr);//当前年月日 | ||
| 331 | + for(var sunDate in sunDateList){ | ||
| 332 | + if(sunDate['isSelect']==false)continue; | ||
| 333 | + switch(sunDate['key']){ | ||
| 334 | + case "morning"://选中早市 | ||
| 335 | + bool select=false; | ||
| 336 | + for(var temp in dailyMap['morning']){//早市选中距离当前时间最近 | ||
| 337 | + temp['select']=false; | ||
| 338 | + if(select)continue;//只选中第一个 | ||
| 339 | + if(timeMillsNow<=DateUtil.getDateMsByTimeStr(DateUtil.formatDate(dateTime).replaceRange(11,19, "${temp['title']}:00"))){ | ||
| 340 | + temp['select']=true; | ||
| 341 | + select=true; | ||
| 342 | + } | ||
| 343 | + } | ||
| 344 | + break; | ||
| 345 | + case "noon"://选中午市 | ||
| 346 | + bool select=false; | ||
| 347 | + for(var temp in dailyMap['noon']){//午市选中12:30 | ||
| 348 | + temp['select']=false; | ||
| 349 | + if(select)continue; | ||
| 350 | + if(noons.contains("12:30")&&timeMillsNow<=DateUtil.getDateMsByTimeStr(DateUtil.formatDate(dateTime).replaceRange(11,19, "12:30:00"))){ | ||
| 351 | + if(temp['title']=="12:30"){ | ||
| 352 | + temp['select']=true; | ||
| 353 | + select=true; | ||
| 354 | + } | ||
| 355 | + }else{ | ||
| 356 | + if(timeMillsNow<=DateUtil.getDateMsByTimeStr(DateUtil.formatDate(dateTime).replaceRange(11,19, "${temp['title']}:00"))){ | ||
| 357 | + temp['select']=true; | ||
| 358 | + select=true; | ||
| 359 | + } | ||
| 360 | + } | ||
| 361 | + } | ||
| 362 | + break; | ||
| 363 | + case "night"://选中晚市 | ||
| 364 | + bool select=false; | ||
| 365 | + for(var temp in dailyMap['night']){//晚市选中18:30 | ||
| 366 | + temp['select']=false; | ||
| 367 | + if(select)continue; | ||
| 368 | + if(nights.contains("18:30")&&timeMillsNow<=DateUtil.getDateMsByTimeStr(DateUtil.formatDate(dateTime).replaceRange(11,19, "18:30:00"))){ | ||
| 369 | + if(temp['title']=="18:30"){ | ||
| 370 | + temp['select']=true; | ||
| 371 | + select=true; | ||
| 372 | + } | ||
| 373 | + }else{ | ||
| 374 | + if(timeMillsNow<=DateUtil.getDateMsByTimeStr(DateUtil.formatDate(dateTime).replaceRange(11,19, "${temp['title']}:00"))){ | ||
| 375 | + temp['select']=true; | ||
| 376 | + select=true; | ||
| 377 | + } | ||
| 378 | + } | ||
| 379 | + } | ||
| 380 | + break; | ||
| 381 | + } | ||
| 382 | + } | ||
| 383 | + LogUtil.v(dailyMap); | ||
| 384 | + } | ||
| 385 | + | ||
| 304 | /// 根据时间和分钟组装 格式:11:00 | 386 | /// 根据时间和分钟组装 格式:11:00 |
| 305 | _dealTime(int begin, int mm) { | 387 | _dealTime(int begin, int mm) { |
| 306 | String sb = ''; | 388 | String sb = ''; |
| @@ -559,6 +641,7 @@ class NotebookDetailChangeModel with ChangeNotifier { | @@ -559,6 +641,7 @@ class NotebookDetailChangeModel with ChangeNotifier { | ||
| 559 | 'type':"0",//内部预订 | 641 | 'type':"0",//内部预订 |
| 560 | "rdate": rdate, //预定用餐时间范围:时间戳 开始时间戳(time)-结束时间戳(time) | 642 | "rdate": rdate, //预定用餐时间范围:时间戳 开始时间戳(time)-结束时间戳(time) |
| 561 | "ddate": '${ddate}'.substring(0, 10), //到店时间 | 643 | "ddate": '${ddate}'.substring(0, 10), //到店时间 |
| 644 | + 'is_set_ddate':"1" | ||
| 562 | }; | 645 | }; |
| 563 | if(detailEntity.id.isNotEmpty&&detailEntity.id!="-1"){ | 646 | if(detailEntity.id.isNotEmpty&&detailEntity.id!="-1"){ |
| 564 | params['rid']=detailEntity.id; | 647 | params['rid']=detailEntity.id; |
| @@ -662,6 +745,7 @@ class NotebookDetailChangeModel with ChangeNotifier { | @@ -662,6 +745,7 @@ class NotebookDetailChangeModel with ChangeNotifier { | ||
| 662 | } | 745 | } |
| 663 | } | 746 | } |
| 664 | Map<String, String> params = { | 747 | Map<String, String> params = { |
| 748 | + "rid":detailEntity.id, | ||
| 665 | 'is_set_ddate': isSetDate, | 749 | 'is_set_ddate': isSetDate, |
| 666 | "sid": userModel.user.sellerid, //商家ID | 750 | "sid": userModel.user.sellerid, //商家ID |
| 667 | "tid": tableSelectInfo, //桌子ID: 格式 2,3,4 | 751 | "tid": tableSelectInfo, //桌子ID: 格式 2,3,4 |
| @@ -670,7 +754,7 @@ class NotebookDetailChangeModel with ChangeNotifier { | @@ -670,7 +754,7 @@ class NotebookDetailChangeModel with ChangeNotifier { | ||
| 670 | "sex": sex, //预订人姓名:1:男 2:女 | 754 | "sex": sex, //预订人姓名:1:男 2:女 |
| 671 | "phone": phoneController.text, //预订人电话 | 755 | "phone": phoneController.text, //预订人电话 |
| 672 | "cusdem": customController.text, //预订人需求:25汉字 | 756 | "cusdem": customController.text, //预订人需求:25汉字 |
| 673 | - 'type':"1",//在线预订 | 757 | + "type":"0", |
| 674 | "rdate": rdate, //预定用餐时间范围:时间戳 开始时间戳(time)-结束时间戳(time) | 758 | "rdate": rdate, //预定用餐时间范围:时间戳 开始时间戳(time)-结束时间戳(time) |
| 675 | "ddate": '${ddate}'.substring(0, 10), //到店时间 | 759 | "ddate": '${ddate}'.substring(0, 10), //到店时间 |
| 676 | "ddate_solt": ddateSolt | 760 | "ddate_solt": ddateSolt |
| @@ -45,6 +45,8 @@ class TableManagerModel with ChangeNotifier{ | @@ -45,6 +45,8 @@ class TableManagerModel with ChangeNotifier{ | ||
| 45 | 45 | ||
| 46 | PageState pageState = PageState.Loading; | 46 | PageState pageState = PageState.Loading; |
| 47 | 47 | ||
| 48 | + Map dailyMap = {}; // 早市对应半点钟,午市对应半点钟、晚市对应半点钟 | ||
| 49 | + | ||
| 48 | //初始化时间 | 50 | //初始化时间 |
| 49 | initTime(BuildContext context) async { | 51 | initTime(BuildContext context) async { |
| 50 | userModel = Provider.of<UserModel>(context, listen: false); | 52 | userModel = Provider.of<UserModel>(context, listen: false); |
| @@ -58,6 +60,9 @@ class TableManagerModel with ChangeNotifier{ | @@ -58,6 +60,9 @@ class TableManagerModel with ChangeNotifier{ | ||
| 58 | userModel.user.morning.isEmpty ? "00:00-00:00" : userModel.user.morning; | 60 | userModel.user.morning.isEmpty ? "00:00-00:00" : userModel.user.morning; |
| 59 | noon = userModel.user.noon.isEmpty ? "00:00-00:00" : userModel.user.noon; | 61 | noon = userModel.user.noon.isEmpty ? "00:00-00:00" : userModel.user.noon; |
| 60 | night = userModel.user.night.isEmpty ? "00:00-00:00" : userModel.user.night; | 62 | night = userModel.user.night.isEmpty ? "00:00-00:00" : userModel.user.night; |
| 63 | + userModel.user.morning.isEmpty?dailyMap.putIfAbsent("morning", ()=>""):dailyMap.putIfAbsent("morning", () => _getHourAndMinute(morning,1)); | ||
| 64 | + userModel.user.noon.isEmpty?dailyMap.putIfAbsent("noon", ()=>""):dailyMap.putIfAbsent("noon", () => _getHourAndMinute(noon,2)); | ||
| 65 | + userModel.user.night.isEmpty?dailyMap.putIfAbsent("night", ()=>""):dailyMap.putIfAbsent("night", () => _getHourAndMinute(night,3)); | ||
| 61 | if (dateTime.isBefore(DateTime.parse(dateTime.year.toString() + | 66 | if (dateTime.isBefore(DateTime.parse(dateTime.year.toString() + |
| 62 | "-" + | 67 | "-" + |
| 63 | Utils.addZeroNumber(dateTime.month) + | 68 | Utils.addZeroNumber(dateTime.month) + |
| @@ -114,17 +119,91 @@ class TableManagerModel with ChangeNotifier{ | @@ -114,17 +119,91 @@ class TableManagerModel with ChangeNotifier{ | ||
| 114 | 119 | ||
| 115 | getCurrDdateStr(){ | 120 | getCurrDdateStr(){ |
| 116 | String currSelectTime=""; | 121 | String currSelectTime=""; |
| 122 | + int timeMillsNow=DateTime.now().millisecondsSinceEpoch; | ||
| 117 | if(currTimeIndex==1){ | 123 | if(currTimeIndex==1){ |
| 118 | - currSelectTime=morning.split("-")[0]; | 124 | + List<String> mornings=_getHourAndMinute(morning, 1); |
| 125 | + for(String temp in mornings){ | ||
| 126 | + if(timeMillsNow<=DateUtil.getDateMsByTimeStr(DateUtil.formatDate(dateTime).replaceRange(11,19, "$temp:00"))){ | ||
| 127 | + currSelectTime=temp; | ||
| 128 | + break; | ||
| 129 | + } | ||
| 130 | + } | ||
| 119 | }else if(currTimeIndex==2){ | 131 | }else if(currTimeIndex==2){ |
| 120 | - currSelectTime=noon.split("-")[0]; | 132 | + List<String> noons=_getHourAndMinute(noon, 2); |
| 133 | + for(String temp in noons){ | ||
| 134 | + if(timeMillsNow<=DateUtil.getDateMsByTimeStr(DateUtil.formatDate(dateTime).replaceRange(11,19, "$temp:00"))){ | ||
| 135 | + currSelectTime=temp; | ||
| 136 | + if(noons.contains("12:30")&&DateUtil.getDateMsByTimeStr(DateUtil.formatDate(dateTime).replaceRange(11,19, "$temp:00"))<DateUtil.getDateMsByTimeStr(DateUtil.formatDate(dateTime).replaceRange(11,19, "12:30:00"))){ | ||
| 137 | + currSelectTime="12:30"; | ||
| 138 | + } | ||
| 139 | + break; | ||
| 140 | + } | ||
| 141 | + } | ||
| 121 | }else{ | 142 | }else{ |
| 122 | - currSelectTime=night.split("-")[0]; | 143 | + List<String> nights=_getHourAndMinute(night, 3); |
| 144 | + for(String temp in nights){ | ||
| 145 | + if(timeMillsNow<=DateUtil.getDateMsByTimeStr(DateUtil.formatDate(dateTime).replaceRange(11,19, "$temp:00"))){ | ||
| 146 | + currSelectTime=temp; | ||
| 147 | + if(nights.contains("18:30")&&DateUtil.getDateMsByTimeStr(DateUtil.formatDate(dateTime).replaceRange(11,19, "$temp:00"))<DateUtil.getDateMsByTimeStr(DateUtil.formatDate(dateTime).replaceRange(11,19, "18:30:00"))){ | ||
| 148 | + currSelectTime="18:30"; | ||
| 149 | + } | ||
| 150 | + break; | ||
| 151 | + } | ||
| 152 | + } | ||
| 123 | } | 153 | } |
| 154 | + LogUtil.v("currSelectTime:$currSelectTime"); | ||
| 124 | String ddateStr=DateUtil.getDateMsByTimeStr(DateUtil.formatDate(dateTime).replaceRange(11,19, "$currSelectTime:00")).toString(); | 155 | String ddateStr=DateUtil.getDateMsByTimeStr(DateUtil.formatDate(dateTime).replaceRange(11,19, "$currSelectTime:00")).toString(); |
| 125 | return ddateStr.substring(0,10); | 156 | return ddateStr.substring(0,10); |
| 126 | } | 157 | } |
| 127 | 158 | ||
| 159 | + //根据获取时间 11:00-12:30 获取30分钟间隔组装的数组 | ||
| 160 | + _getHourAndMinute( | ||
| 161 | + String hourAndMinuteStr, int mnd) { | ||
| 162 | + List tempDate = hourAndMinuteStr.split("-"); | ||
| 163 | + String beginDate = tempDate[0]; | ||
| 164 | + String endDate = tempDate[1]; | ||
| 165 | + List tempHour = beginDate.split(':'); | ||
| 166 | + /*获取开始小时*/ | ||
| 167 | + int beginHour = int.parse(tempHour[0]); | ||
| 168 | + /*获取开始分钟*/ | ||
| 169 | + int beginMinute = int.parse(tempHour[1]); | ||
| 170 | + List<String> res = []; | ||
| 171 | + bool tempLimit = true; | ||
| 172 | + while (tempLimit) { | ||
| 173 | + String temp = _dealTime(beginHour, beginMinute); | ||
| 174 | + res.add(temp); | ||
| 175 | + if (temp == endDate) { | ||
| 176 | + tempLimit = false; | ||
| 177 | + break; | ||
| 178 | + } | ||
| 179 | + if (beginMinute == 30) { | ||
| 180 | + beginHour++; | ||
| 181 | + if (beginHour >= 24) { | ||
| 182 | + beginHour = 0; | ||
| 183 | + } | ||
| 184 | + } | ||
| 185 | + beginMinute = (beginMinute + 30) % 60; | ||
| 186 | + } | ||
| 187 | + return res; | ||
| 188 | + } | ||
| 189 | + | ||
| 190 | + /// 根据时间和分钟组装 格式:11:00 | ||
| 191 | + _dealTime(int begin, int mm) { | ||
| 192 | + String sb = ''; | ||
| 193 | + if (begin < 10) { | ||
| 194 | + sb = '0$begin'; | ||
| 195 | + } else { | ||
| 196 | + sb = '$begin'; | ||
| 197 | + } | ||
| 198 | + sb = '$sb:'; | ||
| 199 | + if (mm < 10) { | ||
| 200 | + sb = '${sb}0${mm}'; | ||
| 201 | + } else { | ||
| 202 | + sb = '${sb}${mm}'; | ||
| 203 | + } | ||
| 204 | + return sb; | ||
| 205 | + } | ||
| 206 | + | ||
| 128 | //获取桌位数据 | 207 | //获取桌位数据 |
| 129 | Future<List<TableOuter>> getTableList(BuildContext context) async { | 208 | Future<List<TableOuter>> getTableList(BuildContext context) async { |
| 130 | pageState = PageState.Loading; | 209 | pageState = PageState.Loading; |
| @@ -97,7 +97,8 @@ var handleInvicationHandler = new Handler( | @@ -97,7 +97,8 @@ var handleInvicationHandler = new Handler( | ||
| 97 | String ddate = params["ddate"].first; | 97 | String ddate = params["ddate"].first; |
| 98 | String ddateStr = | 98 | String ddateStr = |
| 99 | FluroConvertUtils.fluroCnParamsDecode(params["ddateStr"].first); | 99 | FluroConvertUtils.fluroCnParamsDecode(params["ddateStr"].first); |
| 100 | - return InvicationPage(rid, tableInfo, ddate, ddateStr); | 100 | + String phone=params["phone"].first; |
| 101 | + return InvicationPage(rid, tableInfo, ddate, ddateStr,phone); | ||
| 101 | }); | 102 | }); |
| 102 | 103 | ||
| 103 | // 发短信 | 104 | // 发短信 |
| @@ -64,10 +64,10 @@ class NavigatorUtil { | @@ -64,10 +64,10 @@ class NavigatorUtil { | ||
| 64 | 64 | ||
| 65 | /// 邀请函 | 65 | /// 邀请函 |
| 66 | static void goInvicationPage(BuildContext context, String rid, | 66 | static void goInvicationPage(BuildContext context, String rid, |
| 67 | - String tableInfo, String ddate, String ddateStr, | 67 | + String tableInfo, String ddate, String ddateStr,String phone, |
| 68 | {bool replace = false}) { | 68 | {bool replace = false}) { |
| 69 | _navigateTo(context, | 69 | _navigateTo(context, |
| 70 | - "${Routes.invication}?rid=$rid&tableInfo=${FluroConvertUtils.fluroCnParamsEncode(tableInfo)}&ddate=$ddate&ddateStr=${FluroConvertUtils.fluroCnParamsEncode(ddateStr)}", | 70 | + "${Routes.invication}?rid=$rid&tableInfo=${FluroConvertUtils.fluroCnParamsEncode(tableInfo)}&ddate=$ddate&ddateStr=${FluroConvertUtils.fluroCnParamsEncode(ddateStr)}&phone=$phone", |
| 71 | replace: replace); | 71 | replace: replace); |
| 72 | } | 72 | } |
| 73 | 73 |
-
Please register or login to post a comment