Showing
15 changed files
with
3154 additions
and
2822 deletions
| 1 | +import 'dart:convert'; | ||
| 2 | +import 'dart:io'; | ||
| 3 | +import 'dart:ui'; | ||
| 4 | + | ||
| 5 | +import 'package:call_log/call_log.dart'; | ||
| 6 | +import 'package:common_utils/common_utils.dart'; | ||
| 7 | + | ||
| 8 | +// import 'package:contacts_service/contacts_service.dart'; | ||
| 9 | +import 'package:flutter/material.dart'; | ||
| 10 | +import 'package:flutter/services.dart'; | ||
| 11 | +import 'package:flutter_screenutil/flutter_screenutil.dart'; | ||
| 12 | +import 'package:one_key/models/notebook_detail.dart'; | ||
| 13 | +import 'package:one_key/models/remark.dart'; | ||
| 14 | +import 'package:one_key/models/reserve_info_model.dart'; | ||
| 15 | +import 'package:one_key/provider/notebook_detail_change_model.dart'; | ||
| 16 | + | ||
| 17 | +import 'package:one_key/provider/remark_manager_model.dart'; | ||
| 18 | +import 'package:one_key/provider/user_model.dart'; | ||
| 19 | +import 'package:one_key/res/colors.dart'; | ||
| 20 | +import 'package:one_key/utils/dialog_util.dart'; | ||
| 21 | +import 'package:one_key/utils/event_bus.dart'; | ||
| 22 | +import 'package:one_key/utils/misc.dart'; | ||
| 23 | +import 'package:one_key/route/navigator_util.dart'; | ||
| 24 | +import 'package:one_key/utils/triangle_custom_painter.dart'; | ||
| 25 | +import 'package:one_key/utils/utils.dart'; | ||
| 26 | +import 'package:one_key/widgets/MyDivider.dart'; | ||
| 27 | +import 'package:one_key/widgets/app_bar.dart'; | ||
| 28 | +import 'package:one_key/widgets/common_button.dart'; | ||
| 29 | +import 'package:one_key/widgets/common_button_flat.dart'; | ||
| 30 | +import 'package:one_key/widgets/h_empty_view.dart'; | ||
| 31 | +import 'package:one_key/widgets/new_table_item.dart'; | ||
| 32 | +import 'package:one_key/widgets/round_button.dart'; | ||
| 33 | +import 'package:one_key/widgets/system_app_bar.dart'; | ||
| 34 | +import 'package:one_key/widgets/v_empty_view.dart'; | ||
| 35 | +import 'package:permission_handler/permission_handler.dart'; | ||
| 36 | +import 'package:provider/provider.dart'; | ||
| 37 | +import 'package:one_key/models/table_list.dart' as t; | ||
| 38 | +import 'dart:convert' as convert; | ||
| 39 | +import 'package:easy_contact_picker/easy_contact_picker.dart'; | ||
| 40 | +import '../../app.dart'; | ||
| 41 | +import '../../models/tableOuter.dart'; | ||
| 42 | +import '../../models/table_or_reserve_model.dart'; | ||
| 43 | +import '../../models/user.dart'; | ||
| 44 | +import '../../models/user_history_entity.dart'; | ||
| 45 | +import '../../provider/marketing_center_provider.dart'; | ||
| 46 | +import '../../provider/notebook_detail_change_model_only.dart'; | ||
| 47 | +import '../../utils/call_log_utils.dart'; | ||
| 48 | +import '../../utils/common_utils.dart'; | ||
| 49 | +import '../../utils/screen_util.dart'; | ||
| 50 | +import '../../widgets/special_text/my_extended_text_selection_controls.dart'; | ||
| 51 | +import 'package:flutter_picker/flutter_picker.dart' as Picker; | ||
| 52 | + | ||
| 53 | +typedef clickCallback = void Function(String value); | ||
| 54 | + | ||
| 55 | +class NoteBookChangeFPageOnly extends StatefulWidget { | ||
| 56 | + final NotebookDetail detailEntity; | ||
| 57 | + final String rid; | ||
| 58 | + final bool back; | ||
| 59 | + | ||
| 60 | + const NoteBookChangeFPageOnly( | ||
| 61 | + {Key key, this.detailEntity, this.rid, this.back}) | ||
| 62 | + : super(key: key); | ||
| 63 | + | ||
| 64 | + @override | ||
| 65 | + _NoteBookChangeFPageOnlyState createState() => | ||
| 66 | + _NoteBookChangeFPageOnlyState(); | ||
| 67 | +} | ||
| 68 | + | ||
| 69 | +class _NoteBookChangeFPageOnlyState extends State<NoteBookChangeFPageOnly> { | ||
| 70 | + NotebookDetailChangeModelOnly _notebookDetailChangeModel; | ||
| 71 | + FocusNode _phoneNode = FocusNode(); | ||
| 72 | + FocusNode _nameNode = FocusNode(); | ||
| 73 | + | ||
| 74 | + | ||
| 75 | + EasyContactPicker _contactPicker = EasyContactPicker(); | ||
| 76 | + RemarkManagerModel remarkManagerModel; | ||
| 77 | + String currentRemark = ''; | ||
| 78 | + | ||
| 79 | + bool showPhoneHistory = false; //显示客户历史记录 | ||
| 80 | + | ||
| 81 | + | ||
| 82 | + | ||
| 83 | + ScrollController _controller = ScrollController(); | ||
| 84 | + String nameStr = ''; | ||
| 85 | + | ||
| 86 | + FocusNode _cusdemNode = FocusNode(); | ||
| 87 | + MyTextSelectionControls _myExtendedMaterialTextSelectionControls = | ||
| 88 | + MyTextSelectionControls(); | ||
| 89 | + ScrollController _scrollCrl = ScrollController(); | ||
| 90 | + | ||
| 91 | + MarketingCenterProvider marketingCenterProvider; | ||
| 92 | + | ||
| 93 | + DateTime dateTime = DateTime.now(); | ||
| 94 | + | ||
| 95 | + String dateText = ""; //当前显示日期时间 | ||
| 96 | + | ||
| 97 | + int currTimeIndex = 1; | ||
| 98 | + String morning; //早市时间段 | ||
| 99 | + String noon; //午市时间段 | ||
| 100 | + String night; //晚市时间段 | ||
| 101 | + | ||
| 102 | + @override | ||
| 103 | + void initState() { | ||
| 104 | + super.initState(); | ||
| 105 | + | ||
| 106 | + | ||
| 107 | + | ||
| 108 | + _initDateList( widget.detailEntity); | ||
| 109 | + if (App.sp.containsKey('user')) { | ||
| 110 | + String s = App.sp.getString('user'); | ||
| 111 | + User _user = User.fromJson(json.decode(s)); | ||
| 112 | + morning = _user.morning.isEmpty ? "00:00-00:00" : _user.morning; | ||
| 113 | + noon = _user.noon.isEmpty ? "00:00-00:00" : _user.noon; | ||
| 114 | + night = _user.night.isEmpty ? "00:00-00:00" : _user.night; | ||
| 115 | + } | ||
| 116 | + currTimeIndex = int.parse(widget.detailEntity.ddate_solt); | ||
| 117 | + _nameNode.addListener(() { | ||
| 118 | + if (_nameNode.hasFocus) { | ||
| 119 | + print('得到焦点'); | ||
| 120 | + } else { | ||
| 121 | + print('失去焦点'); | ||
| 122 | + // _homeEnterModel.nameController.text = nameStr + _nameSuffix(); | ||
| 123 | + _addNameSuffix(nameStr, _nameSuffix()); | ||
| 124 | + } | ||
| 125 | + setState(() {}); | ||
| 126 | + }); | ||
| 127 | + WidgetsBinding.instance.addPostFrameCallback((timeStamp) { | ||
| 128 | + _myExtendedMaterialTextSelectionControls = | ||
| 129 | + MyTextSelectionControls(callback: (value) { | ||
| 130 | + _notebookDetailChangeModel.phoneController.value = TextEditingValue( | ||
| 131 | + text: value, | ||
| 132 | + selection: TextSelection.fromPosition(TextPosition( | ||
| 133 | + affinity: TextAffinity.downstream, | ||
| 134 | + offset: value.toString().length))); | ||
| 135 | + }); | ||
| 136 | + _initDateList( _notebookDetailChangeModel.detailEntity); | ||
| 137 | + | ||
| 138 | + // _notebookDetailChangeModel = | ||
| 139 | + // Provider.of<NotebookDetailChangeModelOnly>(context, listen: false); | ||
| 140 | + // sid = Provider.of<UserModel>(context, listen: false).user.sellerid; | ||
| 141 | + // initDateHourMinuteList(context); | ||
| 142 | + _notebookDetailChangeModel.getNewTableList( | ||
| 143 | + context, | ||
| 144 | + widget.detailEntity.ddate.toString() + '000', | ||
| 145 | + widget.detailEntity.ddate_solt, | ||
| 146 | + widget.detailEntity.pnum, | ||
| 147 | + widget.detailEntity.tables); | ||
| 148 | + getDzSellerConf(); | ||
| 149 | + _initData(); | ||
| 150 | + }); | ||
| 151 | + } | ||
| 152 | + | ||
| 153 | + /// 早市、午市、晚市对应的半个小时间隔时间段 | ||
| 154 | + // initDateHourMinuteList(BuildContext context) async { | ||
| 155 | + // UserModel userModel = Provider.of<UserModel>(context, listen: false); | ||
| 156 | + // morning = | ||
| 157 | + // userModel.user.morning.isEmpty ? "00:00-00:00" : userModel.user.morning; | ||
| 158 | + // noon = userModel.user.noon.isEmpty ? "00:00-00:00" : userModel.user.noon; | ||
| 159 | + // night = userModel.user.night.isEmpty ? "00:00-00:00" : userModel.user.night; | ||
| 160 | + // } | ||
| 161 | + | ||
| 162 | + ///初始化 日期选择 月-日 某天 | ||
| 163 | + _initDateList(NotebookDetail notebookDetail) | ||
| 164 | +{ String createtime = | ||
| 165 | + notebookDetail.ddate.toString() + '000'; | ||
| 166 | + dateTime = DateTime.fromMillisecondsSinceEpoch(int.parse(createtime)); | ||
| 167 | + | ||
| 168 | + dateText = _returnDate(dateTime); | ||
| 169 | + // String dateTimeSelect = DateUtil.formatDateMs( | ||
| 170 | + // dateTime.millisecondsSinceEpoch, | ||
| 171 | + // format: 'yyyy-MM-dd'); | ||
| 172 | + } | ||
| 173 | + | ||
| 174 | + //生成日期文本 | ||
| 175 | + createDateText(BuildContext context, DateTime day) { | ||
| 176 | + if (Utils.isOneDay(day, dateTime)) return; //日期没变 | ||
| 177 | + // dateTimeSelect = day; | ||
| 178 | + dateText = _returnDate(day); | ||
| 179 | + dateTime = day; | ||
| 180 | + // getReserveList(context, needLoading: false); | ||
| 181 | + } | ||
| 182 | + | ||
| 183 | + _returnDate(DateTime day) { | ||
| 184 | + // String time = Utils.lunarCalendarHolidays(day); | ||
| 185 | + String date = _returnDayDateWeek(day); | ||
| 186 | + // date += ' ${time}'; | ||
| 187 | + return date; | ||
| 188 | + } | ||
| 189 | + | ||
| 190 | + String _returnDayDateWeek(DateTime day) { | ||
| 191 | + String date = ''; | ||
| 192 | + DateTime dateNow = DateTime.now(); | ||
| 193 | + String ymd = "${day.year}-" + | ||
| 194 | + Utils.addZeroNumber(day.month) + | ||
| 195 | + "-" + | ||
| 196 | + Utils.addZeroNumber(day.day); | ||
| 197 | + | ||
| 198 | + if (Utils.isOneDay(day, dateNow)) { | ||
| 199 | + date += "今天 "; | ||
| 200 | + } else if (Utils.isOneDay(day, dateNow.add(Duration(days: 1)))) { | ||
| 201 | + date += "明天 "; | ||
| 202 | + } else if (Utils.isOneDay(day, dateNow.add(Duration(days: 2)))) { | ||
| 203 | + date += "后天 "; | ||
| 204 | + } | ||
| 205 | + date += ymd; | ||
| 206 | + date += " 星期${Utils.formatWeekDayNum(day.weekday)}"; | ||
| 207 | + return date; | ||
| 208 | + } | ||
| 209 | + | ||
| 210 | + @override | ||
| 211 | + void dispose() { | ||
| 212 | + _nameNode.unfocus(); | ||
| 213 | + _phoneNode.unfocus(); | ||
| 214 | + super.dispose(); | ||
| 215 | + } | ||
| 216 | + | ||
| 217 | + getDzSellerConf() async { | ||
| 218 | + | ||
| 219 | + await marketingCenterProvider.getDzSellerConf(context,showLoading: false,selfDismiss: true); | ||
| 220 | + } | ||
| 221 | + | ||
| 222 | + _initData() async { | ||
| 223 | + print(widget.detailEntity); | ||
| 224 | + for (var item in widget.detailEntity.tables) { | ||
| 225 | + item.selected = true; | ||
| 226 | + } | ||
| 227 | + nameStr = _notebookDetailChangeModel.nameController.text; | ||
| 228 | + if (nameStr != '' && nameStr != null) { | ||
| 229 | + _addNameSuffix(nameStr, _nameSuffix()); | ||
| 230 | + } | ||
| 231 | + | ||
| 232 | + Map<String, String> params = { | ||
| 233 | + "uid": Provider.of<UserModel>(context, listen: false).user.openid | ||
| 234 | + }; | ||
| 235 | + await remarkManagerModel.getRemarks(context, params,selfDismiss:true); | ||
| 236 | + } | ||
| 237 | + | ||
| 238 | + //姓名后缀 | ||
| 239 | + _nameSuffix() { | ||
| 240 | + for (var item in _notebookDetailChangeModel.sexList) { | ||
| 241 | + if (item['select'] == true) { | ||
| 242 | + return item['title']; | ||
| 243 | + } | ||
| 244 | + } | ||
| 245 | + } | ||
| 246 | + | ||
| 247 | + _addNameSuffix(String name, String suffix) { | ||
| 248 | + if (name == _notebookDetailChangeModel.nameController.text && | ||
| 249 | + _notebookDetailChangeModel.nameController.text.endsWith(suffix)) { | ||
| 250 | + return; | ||
| 251 | + } | ||
| 252 | + if (name != '' && name != null) { | ||
| 253 | + _notebookDetailChangeModel.nameController.text = name + suffix ?? ''; | ||
| 254 | + } | ||
| 255 | + } | ||
| 256 | + | ||
| 257 | + _refreshRemark(List<Remark> remark, int index) { | ||
| 258 | + if (remark[index].selected) { | ||
| 259 | + if (currentRemark.length == 0) { | ||
| 260 | + currentRemark += '${remark[index].custom}'; | ||
| 261 | + } else { | ||
| 262 | + if (!currentRemark.contains(remark[index].custom)) { | ||
| 263 | + if (currentRemark.endsWith('、')) { | ||
| 264 | + currentRemark += '${remark[index].custom}'; | ||
| 265 | + } else { | ||
| 266 | + currentRemark += '、${remark[index].custom}'; | ||
| 267 | + } | ||
| 268 | + } | ||
| 269 | + } | ||
| 270 | + } else { | ||
| 271 | + if (currentRemark.contains(remark[index].custom)) { | ||
| 272 | + int start = currentRemark.indexOf(remark[index].custom); | ||
| 273 | + int end = start + remark[index].custom.length; | ||
| 274 | + currentRemark = currentRemark.replaceRange(start, end, ''); | ||
| 275 | + if (currentRemark.endsWith('、')) { | ||
| 276 | + currentRemark = currentRemark.substring(0, currentRemark.length - 1); | ||
| 277 | + } | ||
| 278 | + if (currentRemark.startsWith('、')) { | ||
| 279 | + currentRemark = currentRemark.substring(1, currentRemark.length); | ||
| 280 | + } | ||
| 281 | + if (currentRemark.contains('、、')) { | ||
| 282 | + currentRemark = currentRemark.replaceRange( | ||
| 283 | + currentRemark.indexOf('、、'), | ||
| 284 | + currentRemark.indexOf('、、') + 2, | ||
| 285 | + '、'); | ||
| 286 | + } | ||
| 287 | + } | ||
| 288 | + } | ||
| 289 | + if (currentRemark.length > 100) { | ||
| 290 | + currentRemark = currentRemark.substring(0, 100); | ||
| 291 | + } | ||
| 292 | + setState(() { | ||
| 293 | + _notebookDetailChangeModel.customController.text = currentRemark; | ||
| 294 | + }); | ||
| 295 | + | ||
| 296 | + // setState(() { | ||
| 297 | + // // _notebookDetailChangeModel.customController.text = currentRemark; | ||
| 298 | + // }); | ||
| 299 | + } | ||
| 300 | + | ||
| 301 | + Widget _callButton( | ||
| 302 | + {GestureTapCallback onPress, | ||
| 303 | + content, | ||
| 304 | + hasLeftBorder = true, | ||
| 305 | + isSelect = false}) { | ||
| 306 | + return InkWell( | ||
| 307 | + onTap: onPress, | ||
| 308 | + child: Container( | ||
| 309 | + width: ScreenUtil().setWidth(84), | ||
| 310 | + height: ScreenUtil().setHeight(48), | ||
| 311 | + decoration: BoxDecoration( | ||
| 312 | + color: isSelect ? MyColours.color_199095 : MyColours.color_fefefe, | ||
| 313 | + border: Border( | ||
| 314 | + bottom: BorderSide( | ||
| 315 | + color: MyColours.color_6AB6B9, | ||
| 316 | + width: ScreenUtil().setWidth(2)), | ||
| 317 | + top: BorderSide( | ||
| 318 | + color: MyColours.color_6AB6B9, | ||
| 319 | + width: ScreenUtil().setWidth(2)), | ||
| 320 | + left: hasLeftBorder | ||
| 321 | + ? BorderSide( | ||
| 322 | + color: MyColours.color_6AB6B9, | ||
| 323 | + width: ScreenUtil().setWidth(2)) | ||
| 324 | + : BorderSide.none, | ||
| 325 | + right: BorderSide( | ||
| 326 | + color: MyColours.color_6AB6B9, | ||
| 327 | + width: ScreenUtil().setWidth(2)))), | ||
| 328 | + child: Align( | ||
| 329 | + alignment: Alignment.center, | ||
| 330 | + child: Text( | ||
| 331 | + content, | ||
| 332 | + style: TextStyle( | ||
| 333 | + color: isSelect ? Colors.white : MyColours.color_353535, | ||
| 334 | + fontSize: ScreenUtil().setSp(28)), | ||
| 335 | + ), | ||
| 336 | + ), | ||
| 337 | + ), | ||
| 338 | + ); | ||
| 339 | + } | ||
| 340 | + | ||
| 341 | + _getCallLog() async { | ||
| 342 | + List<Picker.PickerItem<dynamic>> data = []; | ||
| 343 | + | ||
| 344 | + Iterable<CallLogEntry> result = await CallLogUtils.getCallLog(context); | ||
| 345 | + if (result != null) { | ||
| 346 | + _notebookDetailChangeModel.userHistorys = []; | ||
| 347 | + | ||
| 348 | + List<CallLogEntry> object = Utils.removeDuplicates(result.toList()); | ||
| 349 | + | ||
| 350 | + print(object); | ||
| 351 | + | ||
| 352 | + _notebookDetailChangeModel.userHistorys = []; | ||
| 353 | + showPhoneHistory = false; | ||
| 354 | + // setState(() {}); | ||
| 355 | + | ||
| 356 | + object.forEach((element) { | ||
| 357 | + _notebookDetailChangeModel.userHistorys.add(UserHistoryEntity( | ||
| 358 | + '', '', element.name ?? '', '1', element.number, '', '', '')); | ||
| 359 | + | ||
| 360 | + String title = ''; | ||
| 361 | + title += ' ${element.number ?? ''}'; | ||
| 362 | + if (element.name != null && element.name != '') { | ||
| 363 | + title += ' ${element.name}'; | ||
| 364 | + } | ||
| 365 | + | ||
| 366 | + String stateStr = ''; //状态 | ||
| 367 | + | ||
| 368 | + if (element.callType.name == 'incoming' || | ||
| 369 | + element.callType.name == 'wifiIncoming' || | ||
| 370 | + element.callType.name == 'answeredExternally') { | ||
| 371 | + stateStr = ' 呼入'; | ||
| 372 | + } else if (element.callType.name == 'outgoing' || | ||
| 373 | + element.callType.name == 'wifiOutgoing' || | ||
| 374 | + element.callType.name == 'voiceMail') { | ||
| 375 | + stateStr = ' 呼出'; | ||
| 376 | + } else if (element.callType.name == 'missed') { | ||
| 377 | + stateStr = ' 未接'; | ||
| 378 | + } else if (element.callType.name == 'rejected') { | ||
| 379 | + stateStr = ' 拒接'; | ||
| 380 | + } else if (element.callType.name == 'blocked') { | ||
| 381 | + stateStr = ' 拦截'; | ||
| 382 | + } | ||
| 383 | + | ||
| 384 | + String sunString = | ||
| 385 | + Utils.formatCallLogFromMill(element.timestamp.toString()); | ||
| 386 | + | ||
| 387 | + data.add(Picker.PickerItem( | ||
| 388 | + text: Row( | ||
| 389 | + mainAxisAlignment: MainAxisAlignment.spaceBetween, | ||
| 390 | + children: [ | ||
| 391 | + Expanded( | ||
| 392 | + child: Row( | ||
| 393 | + children: [ | ||
| 394 | + HEmptyView(30), | ||
| 395 | + Text(title ?? '', | ||
| 396 | + style: TextStyle( | ||
| 397 | + fontSize: font(16), color: MyColours.color_515151)), | ||
| 398 | + Expanded( | ||
| 399 | + child: Text(stateStr ?? '', | ||
| 400 | + style: TextStyle( | ||
| 401 | + fontSize: font(16), | ||
| 402 | + color: MyColours.color_26000000))), | ||
| 403 | + ], | ||
| 404 | + )), | ||
| 405 | + Container( | ||
| 406 | + margin: EdgeInsets.only(right: w(15)), | ||
| 407 | + child: Text(sunString ?? '', | ||
| 408 | + style: TextStyle( | ||
| 409 | + fontSize: font(16), color: MyColours.color_515151))) | ||
| 410 | + ], | ||
| 411 | + ))); | ||
| 412 | + }); | ||
| 413 | + if (data.length > 0) { | ||
| 414 | + //有记录,底部弹窗展示 | ||
| 415 | + // showPhoneHistory = true; | ||
| 416 | + // setState(() {}); | ||
| 417 | + DialogUtil.showSelectCusmanWidgetDialog(context, data, (value) { | ||
| 418 | + if (value != null) { | ||
| 419 | + _byValueToReqeust(value[0]); | ||
| 420 | + } | ||
| 421 | + }, title: '从通话记录选择客人电话', selecteds: [ | ||
| 422 | + // _getFirSelected(hourAndMinute, data), | ||
| 423 | + // _getSecSelected(hourAndMinute) | ||
| 424 | + ]).then((value) { | ||
| 425 | + print(value); | ||
| 426 | + }); | ||
| 427 | + } else { | ||
| 428 | + Utils.showToast('暂无通话记录!'); | ||
| 429 | + } | ||
| 430 | + } | ||
| 431 | + } | ||
| 432 | + | ||
| 433 | + _byValueToReqeust(int index) { | ||
| 434 | + setState(() { | ||
| 435 | + showPhoneHistory = false; | ||
| 436 | + UserHistoryEntity userHistoryEntity = | ||
| 437 | + _notebookDetailChangeModel.userHistorys[index]; | ||
| 438 | + _notebookDetailChangeModel.phoneController.text = userHistoryEntity.phone; | ||
| 439 | + // if (userHistoryEntity.sex == null || userHistoryEntity.sex == '') { | ||
| 440 | + // userHistoryEntity.sex = '1'; | ||
| 441 | + // } | ||
| 442 | + // _homeEnterModel.nameController.text = | ||
| 443 | + // _homeEnterModel | ||
| 444 | + // .userHistorys[index].rname + | ||
| 445 | + // _nameSuffix(); | ||
| 446 | + for (var item in _notebookDetailChangeModel.sexList) { | ||
| 447 | + item['select'] = false; | ||
| 448 | + if (item['title'] == userHistoryEntity.sexStr) { | ||
| 449 | + item['select'] = true; | ||
| 450 | + } | ||
| 451 | + } | ||
| 452 | + _addNameSuffix(userHistoryEntity.rname, _nameSuffix()); | ||
| 453 | + if (userHistoryEntity.rname == null || userHistoryEntity.rname == '') { | ||
| 454 | + nameStr = _notebookDetailChangeModel.nameController.text; | ||
| 455 | + if (nameStr.endsWith('女士')) { | ||
| 456 | + nameStr = nameStr.replaceAll('女士', ''); | ||
| 457 | + } | ||
| 458 | + if (nameStr.endsWith('先生')) { | ||
| 459 | + nameStr = nameStr.replaceAll('先生', ''); | ||
| 460 | + } | ||
| 461 | + if (nameStr.endsWith('公司')) { | ||
| 462 | + nameStr = nameStr.replaceAll('公司', ''); | ||
| 463 | + } | ||
| 464 | + } else { | ||
| 465 | + nameStr = userHistoryEntity.rname; | ||
| 466 | + } | ||
| 467 | + | ||
| 468 | + _phoneNode.unfocus(); | ||
| 469 | + _notebookDetailChangeModel.userHistorys.clear(); | ||
| 470 | + }); | ||
| 471 | + } | ||
| 472 | + | ||
| 473 | + _openAddressBook() async { | ||
| 474 | + if (!(await checkContactPermission())) { | ||
| 475 | + PermissionStatus permissionStatus = await contactPermissionStatus(); | ||
| 476 | + if (permissionStatus == PermissionStatus.permanentlyDenied) { | ||
| 477 | + //用户选择不在弹出权限提示框 | ||
| 478 | + print('never'); | ||
| 479 | + DialogUtil.openAlertDialog( | ||
| 480 | + context, '未获得通讯录权限', "请在手机的权限管理里,将通讯录权限开启", '去设置', 340.0, | ||
| 481 | + onTap: () { | ||
| 482 | + openSetting(); | ||
| 483 | + Navigator.pop(context, ''); | ||
| 484 | + }); | ||
| 485 | + } else { | ||
| 486 | + // 申请权限 | ||
| 487 | + bool canContacts = await requestContactPermission(); | ||
| 488 | + if (canContacts) { | ||
| 489 | + _getContactData(); | ||
| 490 | + } else { | ||
| 491 | + //拒绝通讯录权限 , 苹果拒绝权限后,不再提示权限框,进入此处 | ||
| 492 | + DialogUtil.openAlertDialog( | ||
| 493 | + context, '未获得通讯录权限', "请在手机的权限管理里,将通讯录权限开启。", '去设置', 340.0, | ||
| 494 | + onTap: () { | ||
| 495 | + openSetting(); | ||
| 496 | + Navigator.pop(context, ''); | ||
| 497 | + }); | ||
| 498 | + } | ||
| 499 | + } | ||
| 500 | + } else { | ||
| 501 | + _getContactData(); | ||
| 502 | + } | ||
| 503 | + } | ||
| 504 | + | ||
| 505 | + _getContactData() async { | ||
| 506 | + Contact contact = await _contactPicker.selectContactWithNative(); | ||
| 507 | + setState(() { | ||
| 508 | + String fullName = | ||
| 509 | + contact.fullName.replaceAll(new RegExp(r"\s+\b|\b\s"), ""); | ||
| 510 | + String phone = | ||
| 511 | + contact.phoneNumber.replaceAll(new RegExp(r"\s+\b|\b\s"), ""); | ||
| 512 | + if (fullName.compareTo(phone) == 0) { | ||
| 513 | + fullName = ''; | ||
| 514 | + } else { | ||
| 515 | + fullName = contact.fullName; | ||
| 516 | + } | ||
| 517 | + _notebookDetailChangeModel.phoneController.text = | ||
| 518 | + contact.phoneNumber.replaceAll(new RegExp(r"\s+"), ""); | ||
| 519 | + // _notebookDetailChangeModel.nameController.text = fullName; | ||
| 520 | + nameStr = fullName; | ||
| 521 | + _addNameSuffix(fullName, _nameSuffix()); | ||
| 522 | + }); | ||
| 523 | + } | ||
| 524 | + | ||
| 525 | + ///早餐、午餐、晚餐点击方法 | ||
| 526 | + _clickMorAndNoonAndNig() { | ||
| 527 | + FocusScope.of(context).requestFocus(FocusNode()); //点击空白处隐藏键盘 | ||
| 528 | + int ddate = dateTime.millisecondsSinceEpoch; | ||
| 529 | + String ddateSolt = currTimeIndex.toString(); | ||
| 530 | + _notebookDetailChangeModel.getNewTableList( | ||
| 531 | + context, | ||
| 532 | + '${ddate}', | ||
| 533 | + '${ddateSolt}', | ||
| 534 | + widget.detailEntity.pnum, | ||
| 535 | + _notebookDetailChangeModel.tableListOrReserve); | ||
| 536 | + } | ||
| 537 | + | ||
| 538 | + List<Widget> _tableWidget(List<TableListReserve> tables) { | ||
| 539 | + List<Widget> list = []; | ||
| 540 | + tables.forEach((element) { | ||
| 541 | + list.add(Container( | ||
| 542 | + // height: ScreenUtil().setWidth(50), | ||
| 543 | + padding: EdgeInsets.symmetric( | ||
| 544 | + horizontal: ScreenUtil().setWidth(20), | ||
| 545 | + vertical: ScreenUtil().setWidth(18)), | ||
| 546 | + margin: EdgeInsets.only( | ||
| 547 | + right: tables.length > 0 ? ScreenUtil().setWidth(10) : 0), | ||
| 548 | + decoration: BoxDecoration( | ||
| 549 | + borderRadius: BorderRadius.circular(ScreenUtil().setWidth(10)), | ||
| 550 | + color: MyColours.color_199095), | ||
| 551 | + child: Text( | ||
| 552 | + element.name, | ||
| 553 | + style: TextStyle( | ||
| 554 | + color: MyColours.color_ffffff, fontSize: ScreenUtil().setSp(30)), | ||
| 555 | + ), | ||
| 556 | + )); | ||
| 557 | + }); | ||
| 558 | + return list; | ||
| 559 | + } | ||
| 560 | + | ||
| 561 | + _listWidget(List<Remark> remarks, CustomCallBack callback) { | ||
| 562 | + List<Widget> lists = remarks.map((item) { | ||
| 563 | + return remarkButton( | ||
| 564 | + content: item.custom, | ||
| 565 | + isSelect: item.selected, | ||
| 566 | + onPress: () { | ||
| 567 | + setState(() { | ||
| 568 | + item.selected = !item.selected; | ||
| 569 | + }); | ||
| 570 | + callback(item); | ||
| 571 | + }); | ||
| 572 | + }).toList(); | ||
| 573 | + return lists; | ||
| 574 | + } | ||
| 575 | + | ||
| 576 | + @override | ||
| 577 | + Widget build(BuildContext context) { | ||
| 578 | + _notebookDetailChangeModel = | ||
| 579 | + Provider.of<NotebookDetailChangeModelOnly>(context, listen: true); | ||
| 580 | + remarkManagerModel = Provider.of<RemarkManagerModel>(context, listen: true); | ||
| 581 | + marketingCenterProvider = | ||
| 582 | + Provider.of<MarketingCenterProvider>(context, listen: true); | ||
| 583 | + int sum = 3; | ||
| 584 | + int hide = 0; | ||
| 585 | + int btnNum = 0; | ||
| 586 | + if (morning == "00:00-00:00") { | ||
| 587 | + hide++; | ||
| 588 | + } | ||
| 589 | + if (noon == "00:00-00:00") { | ||
| 590 | + hide++; | ||
| 591 | + } | ||
| 592 | + if (night == "00:00-00:00") { | ||
| 593 | + hide++; | ||
| 594 | + } | ||
| 595 | + btnNum = sum - hide; | ||
| 596 | + return GestureDetector( | ||
| 597 | + behavior: HitTestBehavior.translucent, | ||
| 598 | + onTap: () { | ||
| 599 | + FocusScope.of(context).requestFocus(FocusNode()); //点击空白处隐藏键盘 | ||
| 600 | + if (showPhoneHistory) { | ||
| 601 | + setState(() { | ||
| 602 | + showPhoneHistory = false; | ||
| 603 | + // _notebookDetailChangeModel.userHistorys.clear(); | ||
| 604 | + }); | ||
| 605 | + } | ||
| 606 | + }, | ||
| 607 | + child: Scaffold( | ||
| 608 | + backgroundColor: Colors.white, | ||
| 609 | + appBar: SystemAppBar( | ||
| 610 | + widget.detailEntity.id == "-1" ? "录入订座信息" : "变更预订", onTap: () { | ||
| 611 | + Navigator.pop(context); | ||
| 612 | + }), | ||
| 613 | + body: SingleChildScrollView( | ||
| 614 | + controller: _controller, | ||
| 615 | + child: Column( | ||
| 616 | + children: [ | ||
| 617 | + Container( | ||
| 618 | + color: MyColours.color_ffffff, | ||
| 619 | + padding: EdgeInsets.symmetric( | ||
| 620 | + horizontal: ScreenUtil().setWidth(15)), | ||
| 621 | + child: Row( | ||
| 622 | + children: <Widget>[ | ||
| 623 | + Expanded( | ||
| 624 | + child: GestureDetector( | ||
| 625 | + onTap: () { | ||
| 626 | + DialogUtil.showCalendarDialog(context, dateTime) | ||
| 627 | + .then((day) { | ||
| 628 | + if (day != null) { | ||
| 629 | + createDateText(context, day); | ||
| 630 | + int dateTimeMill = day.millisecondsSinceEpoch; | ||
| 631 | + dateTime = day; | ||
| 632 | + _notebookDetailChangeModel.getNewTableList( | ||
| 633 | + context, | ||
| 634 | + '${dateTimeMill}', | ||
| 635 | + currTimeIndex.toString(), | ||
| 636 | + widget.detailEntity.pnum, | ||
| 637 | + _notebookDetailChangeModel | ||
| 638 | + .tableListOrReserve); | ||
| 639 | + } | ||
| 640 | + }); | ||
| 641 | + }, | ||
| 642 | + child: Container( | ||
| 643 | + // height: ScreenUtil().setWidth(80), | ||
| 644 | + padding: EdgeInsets.symmetric( | ||
| 645 | + horizontal: ScreenUtil().setWidth(15), | ||
| 646 | + vertical: ScreenUtil().setWidth(20)), | ||
| 647 | + decoration: BoxDecoration( | ||
| 648 | + color: MyColours.color_199095, | ||
| 649 | + borderRadius: BorderRadius.circular( | ||
| 650 | + ScreenUtil().setWidth(20))), | ||
| 651 | + child: Row( | ||
| 652 | + mainAxisAlignment: MainAxisAlignment.center, | ||
| 653 | + children: [ | ||
| 654 | + Expanded( | ||
| 655 | + child: Text( | ||
| 656 | + dateText, | ||
| 657 | + textAlign: TextAlign.center, | ||
| 658 | + style: TextStyle( | ||
| 659 | + color: MyColours.color_ffffff, | ||
| 660 | + fontSize: ScreenUtil().setSp(28)), | ||
| 661 | + )), | ||
| 662 | + // HEmptyView(10), | ||
| 663 | + Image.asset( | ||
| 664 | + Utils.getImgPath('f_arrow_right'), | ||
| 665 | + width: ScreenUtil().setWidth(25), | ||
| 666 | + // height: ScreenUtil().setWidth(10), | ||
| 667 | + ) | ||
| 668 | + ], | ||
| 669 | + )), | ||
| 670 | + )), | ||
| 671 | + | ||
| 672 | + // MyDivider( | ||
| 673 | + // ScreenUtil().setWidth(2), | ||
| 674 | + // ScreenUtil().setHeight(68), | ||
| 675 | + // color: MyColours.color_E0E0E0, | ||
| 676 | + // ), | ||
| 677 | + HEmptyView(20), | ||
| 678 | + Container( | ||
| 679 | + width: btnNum == 3 && | ||
| 680 | + (currTimeIndex == 3 || currTimeIndex == 1) | ||
| 681 | + ? ScreenUtil().setWidth(300) + | ||
| 682 | + ScreenUtil().setWidth(4) | ||
| 683 | + : ScreenUtil().setWidth(300), | ||
| 684 | + height: ScreenUtil().setWidth(74), | ||
| 685 | + decoration: BoxDecoration( | ||
| 686 | + color: Color.fromRGBO(232, 232, 232, 1), | ||
| 687 | + borderRadius: BorderRadius.circular( | ||
| 688 | + ScreenUtil().setWidth(20), | ||
| 689 | + )), | ||
| 690 | + child: Row( | ||
| 691 | + // mainAxisAlignment: MainAxisAlignment.spaceEvenly, | ||
| 692 | + // crossAxisAlignment: CrossAxisAlignment.center, | ||
| 693 | + children: <Widget>[ | ||
| 694 | + Offstage( | ||
| 695 | + offstage: | ||
| 696 | + morning == "00:00-00:00" ? true : false, | ||
| 697 | + child: CommonButtonFlat( | ||
| 698 | + content: "早餐", | ||
| 699 | + state: currTimeIndex == 1 ? 1 : 0, | ||
| 700 | + fontSize: 28, | ||
| 701 | + right: noon == "00:00-00:00" && | ||
| 702 | + night == "00:00-00:00" | ||
| 703 | + ? true | ||
| 704 | + : false, | ||
| 705 | + width: ScreenUtil().setWidth(300) / btnNum, | ||
| 706 | + onPress: () { | ||
| 707 | + if (currTimeIndex == 1) return; | ||
| 708 | + currTimeIndex = 1; | ||
| 709 | + _clickMorAndNoonAndNig(); | ||
| 710 | + }, | ||
| 711 | + )), | ||
| 712 | + btnNum == 3 && currTimeIndex == 3 | ||
| 713 | + ? MyDivider( | ||
| 714 | + ScreenUtil().setWidth(4), | ||
| 715 | + ScreenUtil().setWidth(46), | ||
| 716 | + color: MyColours.color_dfdfdf, | ||
| 717 | + ) | ||
| 718 | + : SizedBox(), | ||
| 719 | + Offstage( | ||
| 720 | + offstage: | ||
| 721 | + noon == "00:00-00:00" ? true : false, | ||
| 722 | + child: CommonButtonFlat( | ||
| 723 | + content: "午餐", | ||
| 724 | + state: currTimeIndex == 2 ? 1 : 0, | ||
| 725 | + fontSize: 28, | ||
| 726 | + width: ScreenUtil().setWidth(300) / btnNum, | ||
| 727 | + left: | ||
| 728 | + morning == "00:00-00:00" ? true : false, | ||
| 729 | + right: | ||
| 730 | + night == "00:00-00:00" ? true : false, | ||
| 731 | + onPress: () { | ||
| 732 | + if (currTimeIndex == 2) return; | ||
| 733 | + currTimeIndex = 2; | ||
| 734 | + _clickMorAndNoonAndNig(); | ||
| 735 | + }, | ||
| 736 | + )), | ||
| 737 | + btnNum == 3 && currTimeIndex == 1 | ||
| 738 | + ? MyDivider( | ||
| 739 | + ScreenUtil().setWidth(4), | ||
| 740 | + ScreenUtil().setWidth(46), | ||
| 741 | + color: MyColours.color_dfdfdf, | ||
| 742 | + ) | ||
| 743 | + : SizedBox(), | ||
| 744 | + Offstage( | ||
| 745 | + offstage: night == "00:00-00:00" ? true : false, | ||
| 746 | + child: Container( | ||
| 747 | + child: CommonButtonFlat( | ||
| 748 | + content: "晚餐", | ||
| 749 | + left: morning == "00:00-00:00" && | ||
| 750 | + noon == "00:00-00:00" | ||
| 751 | + ? true | ||
| 752 | + : false, | ||
| 753 | + state: currTimeIndex == 3 ? 1 : 0, | ||
| 754 | + fontSize: 28, | ||
| 755 | + width: ScreenUtil().setWidth(300) / btnNum, | ||
| 756 | + onPress: () { | ||
| 757 | + if (currTimeIndex == 3) return; | ||
| 758 | + currTimeIndex = 3; | ||
| 759 | + _clickMorAndNoonAndNig(); | ||
| 760 | + }, | ||
| 761 | + )), | ||
| 762 | + ), | ||
| 763 | + ], | ||
| 764 | + ), | ||
| 765 | + ), | ||
| 766 | + ], | ||
| 767 | + ), | ||
| 768 | + ), | ||
| 769 | + VEmptyView(15), | ||
| 770 | + Container( | ||
| 771 | + color: MyColours.color_ffffff, | ||
| 772 | + width: double.infinity, | ||
| 773 | + padding: EdgeInsets.symmetric( | ||
| 774 | + horizontal: ScreenUtil().setWidth(20), | ||
| 775 | + vertical: ScreenUtil().setWidth(25)), | ||
| 776 | + alignment: Alignment.center, | ||
| 777 | + child: Row( | ||
| 778 | + crossAxisAlignment: CrossAxisAlignment.center, | ||
| 779 | + mainAxisAlignment: MainAxisAlignment.spaceBetween, | ||
| 780 | + children: <Widget>[ | ||
| 781 | + Text( | ||
| 782 | + '预订桌位', | ||
| 783 | + style: TextStyle( | ||
| 784 | + color: MyColours.color_333333, | ||
| 785 | + fontSize: ScreenUtil().setSp(30)), | ||
| 786 | + ), | ||
| 787 | + Spacer(), | ||
| 788 | + _notebookDetailChangeModel.tableListOrReserve.length < 3 | ||
| 789 | + ? Row( | ||
| 790 | + children: _tableWidget( | ||
| 791 | + _notebookDetailChangeModel | ||
| 792 | + .tableListOrReserve), | ||
| 793 | + ) | ||
| 794 | + : InkWell( | ||
| 795 | + onTap: () { | ||
| 796 | + DialogUtil.openFTablesChangeDialogOnly( | ||
| 797 | + context, | ||
| 798 | + _notebookDetailChangeModel | ||
| 799 | + .tableListOrReserve); | ||
| 800 | + }, | ||
| 801 | + child: Container( | ||
| 802 | + // height: ScreenUtil() | ||
| 803 | + // .setWidth( | ||
| 804 | + // 50), | ||
| 805 | + padding: EdgeInsets.symmetric( | ||
| 806 | + horizontal: ScreenUtil().setWidth(20), | ||
| 807 | + vertical: ScreenUtil().setWidth(18)), | ||
| 808 | + decoration: BoxDecoration( | ||
| 809 | + borderRadius: BorderRadius.circular( | ||
| 810 | + ScreenUtil().setWidth(10)), | ||
| 811 | + color: MyColours.color_199095), | ||
| 812 | + child: Text( | ||
| 813 | + '${_notebookDetailChangeModel.tableListOrReserve.length}桌 查看', | ||
| 814 | + style: TextStyle( | ||
| 815 | + color: MyColours.color_ffffff, | ||
| 816 | + fontSize: ScreenUtil().setSp(30)), | ||
| 817 | + ), | ||
| 818 | + ), | ||
| 819 | + ), | ||
| 820 | + HEmptyView(10), | ||
| 821 | + InkWell( | ||
| 822 | + onTap: () async { | ||
| 823 | + FocusScope.of(context) | ||
| 824 | + .requestFocus(FocusNode()); //点击空白处隐藏键盘 | ||
| 825 | + int ddate = dateTime.millisecondsSinceEpoch; | ||
| 826 | + String ddateSolt = currTimeIndex.toString(); | ||
| 827 | + Map temp = await NavigatorUtil | ||
| 828 | + .goSelectTableFPageOrRerserve( | ||
| 829 | + context, widget.rid, ddate, ddateSolt, | ||
| 830 | + canChoose: true, | ||
| 831 | + object: { | ||
| 832 | + 'object': _notebookDetailChangeModel | ||
| 833 | + .tableListOrReserve | ||
| 834 | + }); | ||
| 835 | + // if (temp['tid'] != null) { | ||
| 836 | + // setReserveStatus("5", tid: temp['tid']); | ||
| 837 | + // } | ||
| 838 | + if (temp == null) { | ||
| 839 | + // if (_notebookDetailChangeModel | ||
| 840 | + // .tableList.length == | ||
| 841 | + // 0) { | ||
| 842 | + // _notebookDetailgoSelectTablePagChangeModel | ||
| 843 | + // .isRecommend = true; | ||
| 844 | + // _notebookDetailChangeModel.tableListOrReserve = | ||
| 845 | + // []; | ||
| 846 | + // for (t.TableList item | ||
| 847 | + // in _notebookDetailChangeModel | ||
| 848 | + // .recommendList) { | ||
| 849 | + // item.selected = false; | ||
| 850 | + // } | ||
| 851 | + // setState(() {}); | ||
| 852 | + // } | ||
| 853 | + } else if (temp['object'].length == 0) { | ||
| 854 | + // _notebookDetailChangeModel.isRecommend = | ||
| 855 | + // true; | ||
| 856 | + // _notebookDetailChangeModel.tableListOrReserve = []; | ||
| 857 | + // for (t.TableList item | ||
| 858 | + // in _notebookDetailChangeModel | ||
| 859 | + // .recommendList) { | ||
| 860 | + // item.selected = false; | ||
| 861 | + // } | ||
| 862 | + // setState(() {}); | ||
| 863 | + } else { | ||
| 864 | + _notebookDetailChangeModel.tableListOrReserve = | ||
| 865 | + temp['object']; | ||
| 866 | + // if (_notebookDetailChangeModel.tableListOrReserve.length == 0) { | ||
| 867 | + // isRecommend = true; | ||
| 868 | + // } | ||
| 869 | + for (TableListReserve item | ||
| 870 | + in _notebookDetailChangeModel | ||
| 871 | + .tableListOrReserve) { | ||
| 872 | + item.selected = true; | ||
| 873 | + } | ||
| 874 | + // setState(() {}); | ||
| 875 | + int dateTimeMill = | ||
| 876 | + dateTime.millisecondsSinceEpoch; | ||
| 877 | + | ||
| 878 | + await _notebookDetailChangeModel | ||
| 879 | + .getNewTableList( | ||
| 880 | + context, | ||
| 881 | + '${dateTimeMill}', | ||
| 882 | + currTimeIndex.toString(), | ||
| 883 | + widget.detailEntity.pnum, | ||
| 884 | + _notebookDetailChangeModel | ||
| 885 | + .tableListOrReserve); | ||
| 886 | + _notebookDetailChangeModel.notifyListeners(); | ||
| 887 | + } | ||
| 888 | + | ||
| 889 | + // _notebookDetailChangeModel.notifyListeners(); | ||
| 890 | + }, | ||
| 891 | + child: Text('更多桌位', | ||
| 892 | + style: TextStyle( | ||
| 893 | + color: MyColours.color_199095, | ||
| 894 | + fontSize: ScreenUtil().setSp(28), | ||
| 895 | + decoration: TextDecoration.underline))), | ||
| 896 | + ], | ||
| 897 | + ), | ||
| 898 | + ), | ||
| 899 | + Padding( | ||
| 900 | + padding: EdgeInsets.symmetric( | ||
| 901 | + horizontal: ScreenUtil().setWidth(20)), | ||
| 902 | + child: Column(children: [ | ||
| 903 | + Stack( | ||
| 904 | + children: [ | ||
| 905 | + Column( | ||
| 906 | + children: [ | ||
| 907 | + Row( | ||
| 908 | + mainAxisAlignment: | ||
| 909 | + MainAxisAlignment.spaceBetween, | ||
| 910 | + crossAxisAlignment: CrossAxisAlignment.center, | ||
| 911 | + children: [ | ||
| 912 | + Expanded( | ||
| 913 | + child: Container( | ||
| 914 | + height: ScreenUtil().setWidth(60), | ||
| 915 | + decoration: BoxDecoration( | ||
| 916 | + border: Border( | ||
| 917 | + bottom: BorderSide( | ||
| 918 | + width: ScreenUtil() | ||
| 919 | + .setWidth(2), | ||
| 920 | + color: MyColours | ||
| 921 | + .color_efefef))), | ||
| 922 | + child: TextField( | ||
| 923 | + maxLines: 1, | ||
| 924 | + | ||
| 925 | + //输入文本的样式 | ||
| 926 | + style: TextStyle( | ||
| 927 | + fontSize: ScreenUtil().setSp(30), | ||
| 928 | + color: MyColours.color_353535), | ||
| 929 | + controller: _notebookDetailChangeModel | ||
| 930 | + .nameController, | ||
| 931 | + focusNode: _nameNode, | ||
| 932 | + // textAlignVertical: TextAlignVertical.top, | ||
| 933 | + decoration: InputDecoration( | ||
| 934 | + hintText: "客人姓名", | ||
| 935 | + hintStyle: TextStyle( | ||
| 936 | + color: MyColours.color_999999, | ||
| 937 | + fontSize: ScreenUtil().setSp(30), | ||
| 938 | + ), | ||
| 939 | + // contentPadding: | ||
| 940 | + // EdgeInsets.only(bottom: ScreenUtil().setWidth(17)), | ||
| 941 | + contentPadding: EdgeInsets.zero, | ||
| 942 | + border: OutlineInputBorder( | ||
| 943 | + borderSide: BorderSide.none), | ||
| 944 | + ), | ||
| 945 | + onChanged: (value) { | ||
| 946 | + print('ggg'); | ||
| 947 | + | ||
| 948 | + if (value.endsWith('先生') || | ||
| 949 | + value.endsWith('女士') || | ||
| 950 | + value.endsWith('公司')) { | ||
| 951 | + nameStr = value.substring( | ||
| 952 | + 0, value.length - 2); | ||
| 953 | + } else { | ||
| 954 | + nameStr = value; | ||
| 955 | + } | ||
| 956 | + | ||
| 957 | + if (_notebookDetailChangeModel | ||
| 958 | + .phoneController | ||
| 959 | + .text | ||
| 960 | + .length == | ||
| 961 | + 0 && | ||
| 962 | + value.length > 0) { | ||
| 963 | + if (marketingCenterProvider | ||
| 964 | + .nameSwich) { | ||
| 965 | + setState(() { | ||
| 966 | + showPhoneHistory = true; | ||
| 967 | + }); | ||
| 968 | + Map<String, String> params = { | ||
| 969 | + "keywords": value, | ||
| 970 | + "sid": Provider.of<UserModel>( | ||
| 971 | + context, | ||
| 972 | + listen: false) | ||
| 973 | + .user | ||
| 974 | + .sellerid, | ||
| 975 | + }; | ||
| 976 | + JhCommonUtils.debounce(() => | ||
| 977 | + _notebookDetailChangeModel | ||
| 978 | + .getUserHistorys( | ||
| 979 | + context, params)); | ||
| 980 | + } | ||
| 981 | + } else { | ||
| 982 | + setState(() { | ||
| 983 | + showPhoneHistory = false; | ||
| 984 | + }); | ||
| 985 | + } | ||
| 986 | + }, | ||
| 987 | + onTap: () { | ||
| 988 | + // setState(() { | ||
| 989 | + // showPhoneHistory = true; | ||
| 990 | + // }); | ||
| 991 | + // Future.delayed(Duration(milliseconds: 300), () { | ||
| 992 | + // _controller.jumpTo(_controller.position.maxScrollExtent); | ||
| 993 | + // }); | ||
| 994 | + }, | ||
| 995 | + onEditingComplete: () { | ||
| 996 | + print('fff'); | ||
| 997 | + _nameNode.unfocus(); | ||
| 998 | + // _homeEnterModel.nameController.text = | ||
| 999 | + // nameStr + _nameSuffix(); | ||
| 1000 | + _addNameSuffix( | ||
| 1001 | + nameStr, _nameSuffix()); | ||
| 1002 | + }, | ||
| 1003 | + keyboardType: TextInputType.text, | ||
| 1004 | + ), | ||
| 1005 | + ), | ||
| 1006 | + ), | ||
| 1007 | + // HEmptyView(40), | ||
| 1008 | + Row( | ||
| 1009 | + children: _notebookDetailChangeModel | ||
| 1010 | + .sexList | ||
| 1011 | + .map((value) { | ||
| 1012 | + return _callButton( | ||
| 1013 | + onPress: () { | ||
| 1014 | + for (var item | ||
| 1015 | + in _notebookDetailChangeModel | ||
| 1016 | + .sexList) { | ||
| 1017 | + item['select'] = false; | ||
| 1018 | + if (item['title'] == | ||
| 1019 | + value['title']) { | ||
| 1020 | + item['select'] = true; | ||
| 1021 | + // _homeEnterModel.nameController.text = | ||
| 1022 | + // nameStr + item['title']; | ||
| 1023 | + if (nameStr != null && | ||
| 1024 | + nameStr != '') { | ||
| 1025 | + _addNameSuffix( | ||
| 1026 | + nameStr, item['title']); | ||
| 1027 | + } | ||
| 1028 | + } | ||
| 1029 | + } | ||
| 1030 | + _notebookDetailChangeModel | ||
| 1031 | + .notifyListeners(); | ||
| 1032 | + }, | ||
| 1033 | + content: value['title'], | ||
| 1034 | + hasLeftBorder: value['hasLeftBorder'], | ||
| 1035 | + isSelect: value['select']); | ||
| 1036 | + }).toList()), | ||
| 1037 | + ], | ||
| 1038 | + ), | ||
| 1039 | + // VEmptyView(30), | ||
| 1040 | + // MyDivider(double.infinity, | ||
| 1041 | + // ScreenUtil().setWidth(2), | ||
| 1042 | + // color: | ||
| 1043 | + // MyColours.color_efefef), | ||
| 1044 | + //电话 | ||
| 1045 | + VEmptyView(20), | ||
| 1046 | + | ||
| 1047 | + Row( | ||
| 1048 | + mainAxisAlignment: | ||
| 1049 | + MainAxisAlignment.spaceBetween, | ||
| 1050 | + crossAxisAlignment: CrossAxisAlignment.center, | ||
| 1051 | + children: [ | ||
| 1052 | + Expanded( | ||
| 1053 | + child: Container( | ||
| 1054 | + height: ScreenUtil().setWidth(60), | ||
| 1055 | + decoration: BoxDecoration( | ||
| 1056 | + border: Border( | ||
| 1057 | + bottom: BorderSide( | ||
| 1058 | + width: ScreenUtil() | ||
| 1059 | + .setWidth(2), | ||
| 1060 | + color: MyColours | ||
| 1061 | + .color_efefef))), | ||
| 1062 | + child: TextField( | ||
| 1063 | + selectionControls: | ||
| 1064 | + _myExtendedMaterialTextSelectionControls, | ||
| 1065 | + maxLines: 1, | ||
| 1066 | + //输入文本的样式 | ||
| 1067 | + style: TextStyle( | ||
| 1068 | + fontSize: | ||
| 1069 | + ScreenUtil().setSp(30), | ||
| 1070 | + color: MyColours.color_353535), | ||
| 1071 | + controller: | ||
| 1072 | + _notebookDetailChangeModel | ||
| 1073 | + .phoneController, | ||
| 1074 | + focusNode: _phoneNode, | ||
| 1075 | + inputFormatters: < | ||
| 1076 | + TextInputFormatter>[ | ||
| 1077 | + LengthLimitingTextInputFormatter( | ||
| 1078 | + 11) //限制长度 | ||
| 1079 | + ], | ||
| 1080 | + // textAlignVertical: TextAlignVertical.top, | ||
| 1081 | + decoration: InputDecoration( | ||
| 1082 | + hintText: "电话", | ||
| 1083 | + hintStyle: TextStyle( | ||
| 1084 | + color: MyColours.color_999999, | ||
| 1085 | + fontSize: | ||
| 1086 | + ScreenUtil().setSp(30), | ||
| 1087 | + ), | ||
| 1088 | + // contentPadding: | ||
| 1089 | + // EdgeInsets.only(bottom: ScreenUtil().setWidth(17)), | ||
| 1090 | + contentPadding: EdgeInsets.zero, | ||
| 1091 | + border: OutlineInputBorder( | ||
| 1092 | + borderSide: BorderSide.none), | ||
| 1093 | + ), | ||
| 1094 | + onChanged: (value) { | ||
| 1095 | + LogUtil.v("value:$value"); | ||
| 1096 | + if (value.isEmpty || | ||
| 1097 | + value.length > 11) { | ||
| 1098 | + //内容为空,或 超过11位 | ||
| 1099 | + setState(() { | ||
| 1100 | + _notebookDetailChangeModel | ||
| 1101 | + .userHistorys | ||
| 1102 | + .clear(); | ||
| 1103 | + }); | ||
| 1104 | + return; | ||
| 1105 | + } | ||
| 1106 | + | ||
| 1107 | + if (value.isEmpty || | ||
| 1108 | + value.length > 0) { | ||
| 1109 | + if (marketingCenterProvider | ||
| 1110 | + .phoneSwich) { | ||
| 1111 | + setState(() { | ||
| 1112 | + showPhoneHistory = true; | ||
| 1113 | + }); | ||
| 1114 | + Map<String, String> params = { | ||
| 1115 | + "keywords": value, | ||
| 1116 | + "sid": | ||
| 1117 | + Provider.of<UserModel>( | ||
| 1118 | + context, | ||
| 1119 | + listen: false) | ||
| 1120 | + .user | ||
| 1121 | + .sellerid, | ||
| 1122 | + }; | ||
| 1123 | + | ||
| 1124 | + JhCommonUtils.debounce(() => | ||
| 1125 | + _notebookDetailChangeModel | ||
| 1126 | + .getUserHistorys( | ||
| 1127 | + context, params)); | ||
| 1128 | + } | ||
| 1129 | + } else { | ||
| 1130 | + setState(() { | ||
| 1131 | + showPhoneHistory = false; | ||
| 1132 | + }); | ||
| 1133 | + } | ||
| 1134 | + }, | ||
| 1135 | + onEditingComplete: () { | ||
| 1136 | + _phoneNode.unfocus(); | ||
| 1137 | + }, | ||
| 1138 | + onTap: () { | ||
| 1139 | + // setState(() { | ||
| 1140 | + // showPhoneHistory = true; | ||
| 1141 | + // }); | ||
| 1142 | + // Future.delayed(Duration(milliseconds: 300), () { | ||
| 1143 | + // _controller.jumpTo(_controller.position.maxScrollExtent); | ||
| 1144 | + // }); | ||
| 1145 | + }, | ||
| 1146 | + keyboardType: | ||
| 1147 | + TextInputType.numberWithOptions( | ||
| 1148 | + decimal: true), | ||
| 1149 | + )), | ||
| 1150 | + ), | ||
| 1151 | + InkWell( | ||
| 1152 | + onTap: () async { | ||
| 1153 | + _openAddressBook(); | ||
| 1154 | + // var result = await CallLogUtil.getCallLog(); | ||
| 1155 | + // print(result); | ||
| 1156 | + }, | ||
| 1157 | + child: Container( | ||
| 1158 | + // color: Colors.red, | ||
| 1159 | + width: ScreenUtil().setWidth(64) * 2, | ||
| 1160 | + height: ScreenUtil().setWidth(48), | ||
| 1161 | + alignment: Alignment.centerRight, | ||
| 1162 | + child: Text('电话簿', | ||
| 1163 | + style: TextStyle( | ||
| 1164 | + color: MyColours.color_199095, | ||
| 1165 | + fontSize: | ||
| 1166 | + ScreenUtil().setSp(28), | ||
| 1167 | + decoration: | ||
| 1168 | + TextDecoration.underline)), | ||
| 1169 | + ), | ||
| 1170 | + ), | ||
| 1171 | + if (Platform.isAndroid) | ||
| 1172 | + Row( | ||
| 1173 | + children: [ | ||
| 1174 | + HEmptyView(20), | ||
| 1175 | + MyDivider( | ||
| 1176 | + 1.0, ScreenUtil().setWidth(40)), | ||
| 1177 | + HEmptyView(20), | ||
| 1178 | + InkWell( | ||
| 1179 | + onTap: () async { | ||
| 1180 | + _getCallLog(); | ||
| 1181 | + }, | ||
| 1182 | + child: Container( | ||
| 1183 | + // color: Colors.red, | ||
| 1184 | + // width: ScreenUtil().setWidth(64) * 2, | ||
| 1185 | + height: ScreenUtil().setWidth(48), | ||
| 1186 | + alignment: Alignment.centerLeft, | ||
| 1187 | + child: Text('通话记录', | ||
| 1188 | + style: TextStyle( | ||
| 1189 | + color: MyColours | ||
| 1190 | + .color_199095, | ||
| 1191 | + fontSize: ScreenUtil() | ||
| 1192 | + .setSp(28), | ||
| 1193 | + decoration: TextDecoration | ||
| 1194 | + .underline)), | ||
| 1195 | + ), | ||
| 1196 | + ), | ||
| 1197 | + ], | ||
| 1198 | + ) | ||
| 1199 | + ], | ||
| 1200 | + ), | ||
| 1201 | + ], | ||
| 1202 | + ), | ||
| 1203 | + ], | ||
| 1204 | + ), | ||
| 1205 | + ])), | ||
| 1206 | + VEmptyView(40), | ||
| 1207 | + Stack( | ||
| 1208 | + children: [ | ||
| 1209 | + Column( | ||
| 1210 | + crossAxisAlignment: CrossAxisAlignment.start, | ||
| 1211 | + children: [ | ||
| 1212 | + Align( | ||
| 1213 | + alignment: Alignment.centerLeft, | ||
| 1214 | + child: Padding( | ||
| 1215 | + padding: EdgeInsets.symmetric( | ||
| 1216 | + horizontal: ScreenUtil().setWidth(20)), | ||
| 1217 | + child: Text( | ||
| 1218 | + '备注', | ||
| 1219 | + style: TextStyle( | ||
| 1220 | + color: MyColours.color_333333, | ||
| 1221 | + fontSize: ScreenUtil().setSp(30)), | ||
| 1222 | + ), | ||
| 1223 | + )), | ||
| 1224 | + VEmptyView(30), | ||
| 1225 | + //输入框 | ||
| 1226 | + Container( | ||
| 1227 | + width: double.infinity, | ||
| 1228 | + margin: EdgeInsets.symmetric( | ||
| 1229 | + horizontal: ScreenUtil().setWidth(20)), | ||
| 1230 | + padding: EdgeInsets.symmetric( | ||
| 1231 | + horizontal: ScreenUtil().setWidth(20), | ||
| 1232 | + vertical: ScreenUtil().setWidth(20)), | ||
| 1233 | + alignment: Alignment.topLeft, | ||
| 1234 | + decoration: BoxDecoration( | ||
| 1235 | + color: MyColours.color_ffffff, | ||
| 1236 | + border: Border.all( | ||
| 1237 | + color: MyColours.color_cccccc, | ||
| 1238 | + width: ScreenUtil().setWidth(2)), | ||
| 1239 | + borderRadius: BorderRadius.circular( | ||
| 1240 | + ScreenUtil().setWidth(10))), | ||
| 1241 | + child: TextField( | ||
| 1242 | + controller: | ||
| 1243 | + _notebookDetailChangeModel.customController, | ||
| 1244 | + focusNode: _cusdemNode, | ||
| 1245 | + style: TextStyle( | ||
| 1246 | + color: MyColours.color_333333, | ||
| 1247 | + fontSize: ScreenUtil().setSp(28), | ||
| 1248 | + textBaseline: TextBaseline.alphabetic), | ||
| 1249 | + textAlignVertical: TextAlignVertical.center, | ||
| 1250 | + maxLines: 5, | ||
| 1251 | + maxLength: 100, | ||
| 1252 | + decoration: InputDecoration( | ||
| 1253 | + hintText: "请输入备注或点击快捷选择标签", | ||
| 1254 | + hintStyle: TextStyle( | ||
| 1255 | + color: MyColours.color_979797, | ||
| 1256 | + fontSize: ScreenUtil().setSp(28), | ||
| 1257 | + ), | ||
| 1258 | + contentPadding: EdgeInsets.zero, | ||
| 1259 | + border: OutlineInputBorder( | ||
| 1260 | + borderSide: BorderSide.none), | ||
| 1261 | + ), | ||
| 1262 | + keyboardType: TextInputType.text, | ||
| 1263 | + onChanged: (value) { | ||
| 1264 | + setState(() { | ||
| 1265 | + currentRemark = value ?? ""; | ||
| 1266 | + }); | ||
| 1267 | + }), | ||
| 1268 | + ), | ||
| 1269 | + VEmptyView(40), | ||
| 1270 | + Container( | ||
| 1271 | + padding: EdgeInsets.only( | ||
| 1272 | + left: ScreenUtil().setWidth(20), | ||
| 1273 | + right: ScreenUtil().setWidth(20), | ||
| 1274 | + bottom: ScreenUtil().setWidth(40)), | ||
| 1275 | + child: Wrap( | ||
| 1276 | + children: _listWidget( | ||
| 1277 | + remarkManagerModel.ofenRemarks, (item) { | ||
| 1278 | + int index = remarkManagerModel.ofenRemarks | ||
| 1279 | + .indexOf(item); | ||
| 1280 | + _refreshRemark( | ||
| 1281 | + remarkManagerModel.ofenRemarks, index); | ||
| 1282 | + }), | ||
| 1283 | + spacing: ScreenUtil().setWidth(20), | ||
| 1284 | + runSpacing: ScreenUtil().setWidth(20), | ||
| 1285 | + // alignment: WrapAlignment.start, | ||
| 1286 | + // runAlignment: WrapAlignment.end, | ||
| 1287 | + ), | ||
| 1288 | + ), | ||
| 1289 | + ], | ||
| 1290 | + ), | ||
| 1291 | + Offstage( | ||
| 1292 | + offstage: !(showPhoneHistory && | ||
| 1293 | + _notebookDetailChangeModel.userHistorys.length > 0), | ||
| 1294 | + child: Container( | ||
| 1295 | + decoration: BoxDecoration( | ||
| 1296 | + borderRadius: BorderRadius.circular(8), | ||
| 1297 | + border: Border.all(color: Colors.white), | ||
| 1298 | + color: MyColours.color_ffffff, | ||
| 1299 | + boxShadow: [ | ||
| 1300 | + BoxShadow( | ||
| 1301 | + color: MyColours.color_e5e5e5, | ||
| 1302 | + blurRadius: ScreenUtil().setWidth(20)) | ||
| 1303 | + ]), | ||
| 1304 | + // width: ScreenUtil().setWidth(440), | ||
| 1305 | + // height: | ||
| 1306 | + // _notebookDetailChangeModel.userHistorys.length > 1 | ||
| 1307 | + // ? ScreenUtil().setWidth(208) | ||
| 1308 | + // : ScreenUtil().setWidth(104), | ||
| 1309 | + width: ScreenUtil().screenWidth - w(60), | ||
| 1310 | + // width: ScreenUtil().setWidth(350), | ||
| 1311 | + constraints: BoxConstraints(maxHeight: w(260)), | ||
| 1312 | + padding: EdgeInsets.symmetric( | ||
| 1313 | + horizontal: ScreenUtil().setWidth(30)), | ||
| 1314 | + child: Align( | ||
| 1315 | + alignment: Alignment.topCenter, | ||
| 1316 | + child: MediaQuery.removePadding( | ||
| 1317 | + context: context, | ||
| 1318 | + removeTop: true, | ||
| 1319 | + child: Scrollbar( | ||
| 1320 | + isAlwaysShown: true, //设置滚动条常亮 | ||
| 1321 | + controller: _scrollCrl, //必须设置一个controller | ||
| 1322 | + | ||
| 1323 | + ///添加进度条 | ||
| 1324 | + child: ListView.builder( | ||
| 1325 | + controller: _scrollCrl, | ||
| 1326 | + itemBuilder: (context, index) { | ||
| 1327 | + return GestureDetector( | ||
| 1328 | + onTap: () { | ||
| 1329 | + _byValueToReqeust(index); | ||
| 1330 | + }, | ||
| 1331 | + child: Container( | ||
| 1332 | + width: double.infinity, | ||
| 1333 | + height: | ||
| 1334 | + ScreenUtil().setWidth(102), | ||
| 1335 | + decoration: BoxDecoration( | ||
| 1336 | + border: Border( | ||
| 1337 | + bottom: (index != | ||
| 1338 | + (_notebookDetailChangeModel | ||
| 1339 | + .userHistorys | ||
| 1340 | + .length - | ||
| 1341 | + 1) && | ||
| 1342 | + _notebookDetailChangeModel | ||
| 1343 | + .userHistorys | ||
| 1344 | + .length > | ||
| 1345 | + 1) | ||
| 1346 | + ? BorderSide( | ||
| 1347 | + color: MyColours | ||
| 1348 | + .color_e5e5e5, | ||
| 1349 | + width: | ||
| 1350 | + ScreenUtil() | ||
| 1351 | + .setWidth( | ||
| 1352 | + 2)) | ||
| 1353 | + : BorderSide.none)), | ||
| 1354 | + child: Align( | ||
| 1355 | + alignment: | ||
| 1356 | + Alignment.centerLeft, | ||
| 1357 | + child: Text( | ||
| 1358 | + (_nameNode.hasFocus | ||
| 1359 | + ? (_notebookDetailChangeModel | ||
| 1360 | + .userHistorys[ | ||
| 1361 | + index] | ||
| 1362 | + .rnameStr == | ||
| 1363 | + null | ||
| 1364 | + ? '' | ||
| 1365 | + : _notebookDetailChangeModel | ||
| 1366 | + .userHistorys[ | ||
| 1367 | + index] | ||
| 1368 | + .rnameStr) | ||
| 1369 | + : (_notebookDetailChangeModel | ||
| 1370 | + .userHistorys[ | ||
| 1371 | + index] | ||
| 1372 | + .phone == | ||
| 1373 | + null | ||
| 1374 | + ? '' | ||
| 1375 | + : _notebookDetailChangeModel | ||
| 1376 | + .userHistorys[ | ||
| 1377 | + index] | ||
| 1378 | + .phone)) + | ||
| 1379 | + ' ' + | ||
| 1380 | + (_nameNode.hasFocus | ||
| 1381 | + ? (_notebookDetailChangeModel | ||
| 1382 | + .userHistorys[ | ||
| 1383 | + index] | ||
| 1384 | + .phone == | ||
| 1385 | + null | ||
| 1386 | + ? '' | ||
| 1387 | + : _notebookDetailChangeModel | ||
| 1388 | + .userHistorys[ | ||
| 1389 | + index] | ||
| 1390 | + .phone) | ||
| 1391 | + : (_notebookDetailChangeModel | ||
| 1392 | + .userHistorys[ | ||
| 1393 | + index] | ||
| 1394 | + .rnameStr == | ||
| 1395 | + null | ||
| 1396 | + ? '' | ||
| 1397 | + : _notebookDetailChangeModel | ||
| 1398 | + .userHistorys[ | ||
| 1399 | + index] | ||
| 1400 | + .rnameStr)) + | ||
| 1401 | + ' ' + | ||
| 1402 | + _notebookDetailChangeModel | ||
| 1403 | + .userHistorys[ | ||
| 1404 | + index] | ||
| 1405 | + .nickName, | ||
| 1406 | + style: TextStyle( | ||
| 1407 | + color: MyColours | ||
| 1408 | + .color_333333, | ||
| 1409 | + fontSize: ScreenUtil() | ||
| 1410 | + .setSp(32)), | ||
| 1411 | + ))), | ||
| 1412 | + ); | ||
| 1413 | + }, | ||
| 1414 | + itemExtent: ScreenUtil().setWidth(104), | ||
| 1415 | + itemCount: _notebookDetailChangeModel | ||
| 1416 | + .userHistorys.length, | ||
| 1417 | + )))), | ||
| 1418 | + ), | ||
| 1419 | + ) | ||
| 1420 | + ], | ||
| 1421 | + ), | ||
| 1422 | + VEmptyView(80), | ||
| 1423 | + Row( | ||
| 1424 | + mainAxisAlignment: MainAxisAlignment.spaceEvenly, | ||
| 1425 | + children: [ | ||
| 1426 | + HEmptyView(30), | ||
| 1427 | + RoundButton( | ||
| 1428 | + text: '返回', | ||
| 1429 | + fontSize: 28, | ||
| 1430 | + isBold: false, | ||
| 1431 | + height: ScreenUtil().setWidth(70), | ||
| 1432 | + width: ScreenUtil().setWidth(200), | ||
| 1433 | + radius: ScreenUtil().setWidth(10), | ||
| 1434 | + gradientStart: MyColours.color_ffffff, | ||
| 1435 | + textColor: MyColours.color_333333, | ||
| 1436 | + borderColor: MyColours.color_199095, | ||
| 1437 | + gradientEnd: MyColours.color_ffffff, | ||
| 1438 | + onPressed: () { | ||
| 1439 | + //返回 | ||
| 1440 | + | ||
| 1441 | + Navigator.pop(context); | ||
| 1442 | + }, | ||
| 1443 | + ), | ||
| 1444 | + RoundButton( | ||
| 1445 | + text: '确定变更', | ||
| 1446 | + fontSize: 28, | ||
| 1447 | + isBold: false, | ||
| 1448 | + height: ScreenUtil().setWidth(70), | ||
| 1449 | + width: ScreenUtil().setWidth(200), | ||
| 1450 | + radius: ScreenUtil().setWidth(10), | ||
| 1451 | + onPressed: () async { | ||
| 1452 | + // String name = | ||
| 1453 | + // _notebookDetailChangeModel.nameController.text.trim(); | ||
| 1454 | + // if (ObjectUtil.isEmpty(name)) { | ||
| 1455 | + // Utils.showToast("请填写客户姓名"); | ||
| 1456 | + // return; | ||
| 1457 | + // } | ||
| 1458 | + if (_notebookDetailChangeModel | ||
| 1459 | + .tableListOrReserve.length == | ||
| 1460 | + 0) { | ||
| 1461 | + Utils.showToast("请选择桌位"); | ||
| 1462 | + return; | ||
| 1463 | + } | ||
| 1464 | + if (_notebookDetailChangeModel.phoneController.text | ||
| 1465 | + .trim() | ||
| 1466 | + .length > | ||
| 1467 | + 0) { | ||
| 1468 | + if (!Utils.isInteger(_notebookDetailChangeModel | ||
| 1469 | + .phoneController.text | ||
| 1470 | + .replaceAll(' ', ''))) { | ||
| 1471 | + Utils.showToast('手机号错误,请修改正确'); | ||
| 1472 | + return; | ||
| 1473 | + } | ||
| 1474 | + } | ||
| 1475 | + FocusScope.of(context) | ||
| 1476 | + .requestFocus(FocusNode()); //点击空白处隐藏键盘 | ||
| 1477 | + print(widget.detailEntity.uid); | ||
| 1478 | + | ||
| 1479 | + SunReserveInfoModel _model = | ||
| 1480 | + _notebookDetailChangeModel.detailEntity.type == | ||
| 1481 | + "1" | ||
| 1482 | + ? //判断是否在线预订 | ||
| 1483 | + await _notebookDetailChangeModel | ||
| 1484 | + .updateOnlineReserveInfoOnly( | ||
| 1485 | + context, | ||
| 1486 | + nameStr, | ||
| 1487 | + widget.detailEntity.uid, | ||
| 1488 | + currTimeIndex, | ||
| 1489 | + dateTime, | ||
| 1490 | + morning, | ||
| 1491 | + noon, | ||
| 1492 | + night) | ||
| 1493 | + : await _notebookDetailChangeModel | ||
| 1494 | + .setReserveInfoOnly( | ||
| 1495 | + context, | ||
| 1496 | + nameStr, | ||
| 1497 | + widget.detailEntity.uid, | ||
| 1498 | + currTimeIndex, | ||
| 1499 | + dateTime, | ||
| 1500 | + morning, | ||
| 1501 | + noon, | ||
| 1502 | + night); | ||
| 1503 | + if (_model != null) { | ||
| 1504 | + if (ObjectUtil.isNotEmpty(_model.row) || | ||
| 1505 | + ObjectUtil.isNotEmpty(_model.row.id)) { | ||
| 1506 | + print('成功'); | ||
| 1507 | + // _notebookDetailChangeModel.clearData(); | ||
| 1508 | + bus.emit("refresh_detail"); | ||
| 1509 | + bus.emit("refresh_book_list"); //刷新已预订列表 | ||
| 1510 | + if (widget.back) { | ||
| 1511 | + EventBus() | ||
| 1512 | + .emit("refresh_invitaion_info"); //刷新预订安排页面 | ||
| 1513 | + Navigator.pop(context); | ||
| 1514 | + } else { | ||
| 1515 | + String ddate_solt = ''; | ||
| 1516 | + if (_model.row.isSetDdate == '1') { | ||
| 1517 | + String createtime = | ||
| 1518 | + _model.row.ddate.toString() + '000'; | ||
| 1519 | + DateTime createTime = | ||
| 1520 | + DateTime.fromMillisecondsSinceEpoch( | ||
| 1521 | + int.parse(createtime)); | ||
| 1522 | + ddate_solt = DateUtil.formatDate(createTime, | ||
| 1523 | + format: DateFormats.h_m); | ||
| 1524 | + } else { | ||
| 1525 | + if (_model.row.ddateSolt == '1') { | ||
| 1526 | + ddate_solt = '早餐'; | ||
| 1527 | + } else if (_model.row.ddateSolt == '2') { | ||
| 1528 | + ddate_solt = '午餐'; | ||
| 1529 | + } else if (_model.row.ddateSolt == '3') { | ||
| 1530 | + ddate_solt = '晚餐'; | ||
| 1531 | + } | ||
| 1532 | + } | ||
| 1533 | + List<dynamic> tableinfo = | ||
| 1534 | + convert.jsonDecode(_model.row.tableinfo); | ||
| 1535 | + print(tableinfo); | ||
| 1536 | + | ||
| 1537 | + // if (tableinfo.length > 1) { | ||
| 1538 | + // _nameStr = | ||
| 1539 | + // t.TableList.fromJson(tableinfo[0]).name + | ||
| 1540 | + // '等${tableinfo.length}桌'; | ||
| 1541 | + // } | ||
| 1542 | + String _nameStr = ''; | ||
| 1543 | + String _tid = ''; | ||
| 1544 | + for (int i = 0; i < tableinfo.length; i++) { | ||
| 1545 | + _nameStr += | ||
| 1546 | + '${t.TableList.fromJson(tableinfo[i]).name},'; | ||
| 1547 | + | ||
| 1548 | + _tid += | ||
| 1549 | + '${t.TableList.fromJson(tableinfo[i]).id},'; | ||
| 1550 | + } | ||
| 1551 | + if (_tid.endsWith(',')) { | ||
| 1552 | + _tid = _tid.substring(0, _tid.length - 1); | ||
| 1553 | + } | ||
| 1554 | + if (_nameStr.endsWith(',')) { | ||
| 1555 | + _nameStr = _nameStr.substring( | ||
| 1556 | + 0, _nameStr.length - 1); | ||
| 1557 | + } | ||
| 1558 | + LogUtil.v(_nameStr); | ||
| 1559 | + NavigatorUtil.goInvicationPage( | ||
| 1560 | + context, _model.row.id, | ||
| 1561 | + // _nameStr, | ||
| 1562 | + // _model.row.ddate, | ||
| 1563 | + // ddate_solt, | ||
| 1564 | + // _model.row.phone, | ||
| 1565 | + // _model.row.ddateSolt, | ||
| 1566 | + // _model.row.rname == null | ||
| 1567 | + // ? '' | ||
| 1568 | + // : _model.row.rname, | ||
| 1569 | + // _model.row.sex == null ? '' : _model.row.sex, | ||
| 1570 | + // _model.row.cusdem, | ||
| 1571 | + // tid: _tid, | ||
| 1572 | + replace: true); | ||
| 1573 | + } | ||
| 1574 | + EventBus().emit("refresh_tablemanager"); //刷新桌位 | ||
| 1575 | + EventBus().emit("refresh_detail"); //刷新订座详情页 | ||
| 1576 | + EventBus().emit("refresh_action_log"); //获取变更记录 | ||
| 1577 | + | ||
| 1578 | + } else { | ||
| 1579 | + Utils.showToast(widget.detailEntity.id == "-1" | ||
| 1580 | + ? "录入预订订单失败,请重试!" | ||
| 1581 | + : "变更预订订单失败,请重试!"); | ||
| 1582 | + } | ||
| 1583 | + } | ||
| 1584 | + }, | ||
| 1585 | + ), | ||
| 1586 | + HEmptyView(30), | ||
| 1587 | + ], | ||
| 1588 | + ), | ||
| 1589 | + VEmptyView(60) | ||
| 1590 | + ], | ||
| 1591 | + )), | ||
| 1592 | + )); | ||
| 1593 | + } | ||
| 1594 | +} | ||
| 1595 | + | ||
| 1596 | +Widget remarkButton({GestureTapCallback onPress, content, isSelect = false}) { | ||
| 1597 | + return InkWell( | ||
| 1598 | + onTap: onPress, | ||
| 1599 | + child: Container( | ||
| 1600 | + // height: ScreenUtil().setWidth(50), | ||
| 1601 | + // alignment: Alignment.center, | ||
| 1602 | + // margin: EdgeInsets.only(right: ScreenUtil().setWidth(16)), | ||
| 1603 | + padding: EdgeInsets.symmetric( | ||
| 1604 | + horizontal: ScreenUtil().setWidth(20), | ||
| 1605 | + vertical: ScreenUtil().setWidth(10)), | ||
| 1606 | + decoration: BoxDecoration( | ||
| 1607 | + borderRadius: BorderRadius.circular(ScreenUtil().setWidth(96)), | ||
| 1608 | + color: isSelect ? MyColours.color_515151 : MyColours.color_ffffff, | ||
| 1609 | + border: Border.all( | ||
| 1610 | + width: ScreenUtil().setWidth(2), | ||
| 1611 | + color: isSelect ? MyColours.color_FFF0E5 : MyColours.color_DBDBDB, | ||
| 1612 | + )), | ||
| 1613 | + child: Text( | ||
| 1614 | + content, | ||
| 1615 | + style: TextStyle( | ||
| 1616 | + color: isSelect ? Colors.white : MyColours.color_999999, | ||
| 1617 | + fontSize: ScreenUtil().setSp(24)), | ||
| 1618 | + ), | ||
| 1619 | + ), | ||
| 1620 | + ); | ||
| 1621 | +} |
This diff could not be displayed because it is too large.
| @@ -4751,7 +4751,7 @@ class NotebookDetailPageState extends State<NotebookDetailPage> { | @@ -4751,7 +4751,7 @@ class NotebookDetailPageState extends State<NotebookDetailPage> { | ||
| 4751 | detailEntity.role_name != | 4751 | detailEntity.role_name != |
| 4752 | '店长')) { | 4752 | '店长')) { |
| 4753 | NavigatorUtil | 4753 | NavigatorUtil |
| 4754 | - .goNoteBookChangeFPage( | 4754 | + .goNoteBookChangeFPageOnly( |
| 4755 | context, | 4755 | context, |
| 4756 | detailEntity, | 4756 | detailEntity, |
| 4757 | widget.rid); | 4757 | widget.rid); |
| 1 | -// import 'dart:ffi'; | ||
| 2 | - | ||
| 3 | -// import 'package:common_utils/common_utils.dart'; | ||
| 4 | -// import 'package:dotted_border/dotted_border.dart'; | ||
| 5 | -// import 'package:flutter/material.dart'; | ||
| 6 | -// import 'package:flutter_screenutil/flutter_screenutil.dart'; | ||
| 7 | -// import 'package:one_key/constant/state.dart'; | ||
| 8 | -// import 'package:one_key/models/area.dart'; | ||
| 9 | -// import 'package:one_key/models/notebook.dart'; | ||
| 10 | -// import 'package:one_key/models/tableOuter.dart'; | ||
| 11 | -// import 'package:one_key/models/table_list.dart'; | ||
| 12 | -// import 'package:one_key/pages/table/area_item_table.dart'; | ||
| 13 | -// import 'package:one_key/pages/table/area_item_table_or_reserve.dart'; | ||
| 14 | -// import 'package:one_key/provider/choose_table_model.dart'; | ||
| 15 | -// import 'package:one_key/provider/notebook_detail_change_model.dart'; | ||
| 16 | -// import 'package:one_key/provider/notebook_model.dart'; | ||
| 17 | -// import 'package:one_key/provider/user_model.dart'; | ||
| 18 | -// import 'package:one_key/res/colors.dart'; | ||
| 19 | -// import 'package:one_key/utils/dialog_util.dart'; | ||
| 20 | -// import 'package:one_key/utils/utils.dart'; | ||
| 21 | -// import 'package:one_key/widgets/MyDivider.dart'; | ||
| 22 | -// import 'package:one_key/widgets/app_bar.dart'; | ||
| 23 | -// import 'package:one_key/widgets/area_item.dart'; | ||
| 24 | -// import 'package:one_key/widgets/common_button.dart'; | ||
| 25 | -// import 'package:one_key/widgets/f_table_item.dart'; | ||
| 26 | -// import 'package:one_key/widgets/h_empty_view.dart'; | ||
| 27 | -// import 'package:one_key/widgets/page_exception.dart'; | ||
| 28 | -// import 'package:one_key/widgets/table_item.dart'; | ||
| 29 | -// import 'package:one_key/models/table.dart' as t; | ||
| 30 | -// import 'package:one_key/widgets/v_empty_view.dart'; | ||
| 31 | -// import 'package:provider/provider.dart'; | ||
| 32 | -// import 'dart:convert' as convert; | ||
| 33 | - | ||
| 34 | -// import '../../models/get_board_model.dart'; | ||
| 35 | -// import '../../models/table_or_reserve_model.dart'; | ||
| 36 | -// import '../../models/table_or_reserve_model.dart'; | ||
| 37 | -// import '../../models/table_or_reserve_model.dart'; | ||
| 38 | -// import '../../models/table_or_reserve_model.dart'; | ||
| 39 | -// import '../../provider/table_manage_model_or_reserve.dart'; | ||
| 40 | -// import '../table/table_item_or_reserve.dart'; | ||
| 41 | - | ||
| 42 | -// class SelectTableFPageOrReserve extends StatefulWidget { | ||
| 43 | -// final String rid; //预订id | ||
| 44 | -// final DateTime dateTime; //日期 | ||
| 45 | -// final String ddate_slot; //时段 | ||
| 46 | -// final bool canChoose; //变更预订可以取消原来已预订的选中状态 | ||
| 47 | -// final List<TableList> tableList; | ||
| 48 | -// final String fromPage; | ||
| 49 | -// final String tid; | ||
| 50 | -// final String hmS; | ||
| 51 | -// final String hmE; | ||
| 52 | -// final String source; | ||
| 53 | -// final String ridFeast; //宴会id | ||
| 54 | -// SelectTableFPageOrReserve(this.rid, this.dateTime, this.ddate_slot, | ||
| 55 | -// {this.canChoose = false, | ||
| 56 | -// this.tableList, | ||
| 57 | -// this.fromPage, | ||
| 58 | -// this.tid, | ||
| 59 | -// this.hmS, | ||
| 60 | -// this.hmE, | ||
| 61 | -// this.source = '0', | ||
| 62 | -// this.ridFeast}); | ||
| 63 | - | ||
| 64 | -// @override | ||
| 65 | -// State<StatefulWidget> createState() { | ||
| 66 | -// // TODO: implement createState | ||
| 67 | -// return new SelectTableFPageOrReserveState(); | ||
| 68 | -// } | ||
| 69 | -// } | ||
| 70 | - | ||
| 71 | -// class SelectTableFPageOrReserveState extends State<SelectTableFPageOrReserve> { | ||
| 72 | -// // List<Area> areas = []; //区域列表 | ||
| 73 | -// // List<t.Table> selectTables = []; //选择的桌位 | ||
| 74 | - | ||
| 75 | -// // List<TableOuter> tableOuterList = []; //区域-桌位列表 | ||
| 76 | - | ||
| 77 | -// // Map<String, List<t.Table>> areaTableMap = {}; //区域-桌位Map | ||
| 78 | - | ||
| 79 | -// ChooseTableModel _chooseTableModel; | ||
| 80 | - | ||
| 81 | -// // Map<String, Notebook> tableMap = {}; //记录已预订桌位对应的订单 | ||
| 82 | - | ||
| 83 | -// // String currentArea; //当前选中区域 | ||
| 84 | -// List<String> personNumList = []; | ||
| 85 | - | ||
| 86 | -// int selectNum = 0; | ||
| 87 | -// // bool isSelected = true; //全部按钮 | ||
| 88 | -// int _selectNumber; | ||
| 89 | -// // Map dailyMap = {}; // 早市对应半点钟,午市对应半点钟、晚市对应半点钟 | ||
| 90 | -// List<Notebook> noteBooks; | ||
| 91 | - | ||
| 92 | -// TableManagerModelOrReserve tableManagerModel; | ||
| 93 | - | ||
| 94 | -// @override | ||
| 95 | -// void initState() { | ||
| 96 | -// // TODO: implement initState | ||
| 97 | -// super.initState(); | ||
| 98 | -// for (int i = 1; i < 31; i++) { | ||
| 99 | -// personNumList.add(i.toString()); | ||
| 100 | -// } | ||
| 101 | -// // initDateHourMinuteList(context); | ||
| 102 | - | ||
| 103 | -// WidgetsBinding.instance.addPostFrameCallback((_) { | ||
| 104 | -// // getTableList(); | ||
| 105 | -// _getTableListOrReserve(); | ||
| 106 | -// }); | ||
| 107 | -// } | ||
| 108 | - | ||
| 109 | -// /// | ||
| 110 | -// _getTableListOrReserve() async { | ||
| 111 | -// await tableManagerModel.getTableListOrReserve( | ||
| 112 | -// context, | ||
| 113 | -// ); | ||
| 114 | -// tableManagerModel.tablesOrReserveDataShow.forEach((element) { | ||
| 115 | -// element.tableList.forEach((element) { | ||
| 116 | -// element.selected = false; | ||
| 117 | -// for (var table in widget.tableList) { | ||
| 118 | -// if (element.id == table.id) { | ||
| 119 | -// element.selected = true; | ||
| 120 | -// selectNum++; | ||
| 121 | -// tableManagerModel.selectTablesOrReserve.add(element); | ||
| 122 | -// } | ||
| 123 | -// } | ||
| 124 | -// }); | ||
| 125 | -// }); | ||
| 126 | -// tableManagerModel.notifyListeners(); | ||
| 127 | -// } | ||
| 128 | - | ||
| 129 | -// /// 早市、午市、晚市对应的半个小时间隔时间段 | ||
| 130 | -// // initDateHourMinuteList(BuildContext context) async { | ||
| 131 | -// // UserModel userModel = Provider.of<UserModel>(context, listen: false); | ||
| 132 | -// // String morning = | ||
| 133 | -// // userModel.user.morning.isEmpty ? "00:00-00:00" : userModel.user.morning; | ||
| 134 | -// // String noon = | ||
| 135 | -// // userModel.user.noon.isEmpty ? "00:00-00:00" : userModel.user.noon; | ||
| 136 | -// // String night = | ||
| 137 | -// // userModel.user.night.isEmpty ? "00:00-00:00" : userModel.user.night; | ||
| 138 | -// // userModel.user.morning == '' | ||
| 139 | -// // ? dailyMap.putIfAbsent('morning', () => '') | ||
| 140 | -// // : dailyMap.putIfAbsent( | ||
| 141 | -// // 'morning', () => _getHourAndMinute(userModel.user.morning, 1)); | ||
| 142 | -// // userModel.user.noon == '' | ||
| 143 | -// // ? dailyMap.putIfAbsent('noon', () => '') | ||
| 144 | -// // : dailyMap.putIfAbsent( | ||
| 145 | -// // 'noon', () => _getHourAndMinute(userModel.user.noon, 2)); | ||
| 146 | -// // userModel.user.night == '' | ||
| 147 | -// // ? dailyMap.putIfAbsent('night', () => '') | ||
| 148 | -// // : dailyMap.putIfAbsent( | ||
| 149 | -// // 'night', () => _getHourAndMinute(userModel.user.night, 3)); | ||
| 150 | -// // // _initSunDateList( | ||
| 151 | -// // // userModel.user.morning, userModel.user.noon, userModel.user.night); | ||
| 152 | -// // } | ||
| 153 | - | ||
| 154 | -// //根据获取时间 11:00-12:30 获取30分钟间隔组装的数组 | ||
| 155 | -// // _getHourAndMinute(String hourAndMinuteStr, int mnd) { | ||
| 156 | -// // List tempDate = hourAndMinuteStr.split("-"); | ||
| 157 | -// // String beginDate = tempDate[0]; | ||
| 158 | -// // String endDate = tempDate[1]; | ||
| 159 | -// // List tempHour = beginDate.split(':'); | ||
| 160 | - | ||
| 161 | -// // /*获取开始小时*/ | ||
| 162 | -// // int beginHour = int.parse(tempHour[0]); | ||
| 163 | -// // /*获取开始分钟*/ | ||
| 164 | -// // int beginMinute = int.parse(tempHour[1]); | ||
| 165 | -// // if (beginMinute == 15) { | ||
| 166 | -// // beginMinute = 30; | ||
| 167 | -// // } else if (beginMinute == 45) { | ||
| 168 | -// // beginHour++; | ||
| 169 | -// // beginMinute = 0; | ||
| 170 | -// // } | ||
| 171 | -// // List endTemp = endDate.split(':'); | ||
| 172 | -// // /*获取结束小时*/ | ||
| 173 | -// // int endHour = int.parse(endTemp[0]); | ||
| 174 | -// // /*获取结束分钟*/ | ||
| 175 | -// // int endMinute = int.parse(endTemp[1]); | ||
| 176 | -// // if (endMinute == 15) { | ||
| 177 | -// // endDate = '${endTemp[0]}:00'; | ||
| 178 | -// // } else if (endMinute == 45) { | ||
| 179 | -// // endDate = '${endTemp[0]}:30'; | ||
| 180 | -// // } | ||
| 181 | -// // List res = []; | ||
| 182 | -// // bool tempLimit = true; | ||
| 183 | -// // while (tempLimit) { | ||
| 184 | -// // String temp = _dealTime(beginHour, beginMinute); | ||
| 185 | - | ||
| 186 | -// // // bool tempSelect = false; | ||
| 187 | - | ||
| 188 | -// // // Map tempMap = {'title': temp, 'select': tempSelect}; | ||
| 189 | -// // res.add(temp); | ||
| 190 | -// // if (temp == endDate) { | ||
| 191 | -// // tempLimit = false; | ||
| 192 | -// // break; | ||
| 193 | -// // } | ||
| 194 | -// // if (beginMinute == 30) { | ||
| 195 | -// // beginHour++; | ||
| 196 | -// // if (beginHour >= 24) { | ||
| 197 | -// // beginHour = 0; | ||
| 198 | -// // } | ||
| 199 | -// // } | ||
| 200 | -// // beginMinute = (beginMinute + 30) % 60; | ||
| 201 | -// // } | ||
| 202 | -// // return res; | ||
| 203 | -// // } | ||
| 204 | - | ||
| 205 | -// /// 根据时间和分钟组装 格式:11:00 | ||
| 206 | -// // _dealTime(int begin, int mm) { | ||
| 207 | -// // String sb = ''; | ||
| 208 | -// // if (begin < 10) { | ||
| 209 | -// // sb = '0$begin'; | ||
| 210 | -// // } else { | ||
| 211 | -// // sb = '$begin'; | ||
| 212 | -// // } | ||
| 213 | -// // sb = '$sb:'; | ||
| 214 | -// // if (mm < 10) { | ||
| 215 | -// // sb = '${sb}0${mm}'; | ||
| 216 | -// // } else { | ||
| 217 | -// // sb = '${sb}${mm}'; | ||
| 218 | -// // } | ||
| 219 | -// // return sb; | ||
| 220 | -// // } | ||
| 221 | - | ||
| 222 | -// //获取桌位列表 | ||
| 223 | -// // getTableList({needLoading = true}) async { | ||
| 224 | -// // UserModel userModel = Provider.of<UserModel>(context, listen: false); | ||
| 225 | -// // Map<String, String> params = {"sellerid": userModel.user.sellerid}; | ||
| 226 | -// // tableOuterList = await _chooseTableModel.getTableList(context, params, | ||
| 227 | -// // needLoading: needLoading); | ||
| 228 | -// // _chooseTableModel.tablesAll = []; | ||
| 229 | -// // selectTables = []; | ||
| 230 | -// // for (TableOuter item in tableOuterList) { | ||
| 231 | -// // // if (item.name == "推荐") { | ||
| 232 | -// // // itemModelList.remove(item); | ||
| 233 | -// // // } | ||
| 234 | -// // for (var item1 in item.list) { | ||
| 235 | -// // item1.selected = false; | ||
| 236 | -// // for (var table in widget.tableList) { | ||
| 237 | -// // if (item1.id == table.id) { | ||
| 238 | -// // item1.selected = true; | ||
| 239 | -// // selectNum++; | ||
| 240 | -// // selectTables.add(item1); | ||
| 241 | -// // // if (!tableList.contains(item)) { | ||
| 242 | -// // // tableList.add(item); | ||
| 243 | -// // // } | ||
| 244 | -// // } | ||
| 245 | -// // } | ||
| 246 | -// // } | ||
| 247 | -// // _chooseTableModel.tablesAll.addAll(item.list); | ||
| 248 | -// // } | ||
| 249 | - | ||
| 250 | -// // if (tableOuterList.isEmpty) { | ||
| 251 | -// // _chooseTableModel.pageState = PageState.Success; | ||
| 252 | -// // _chooseTableModel.notifyListeners(); | ||
| 253 | -// // } else { | ||
| 254 | -// // _getReserveList(userModel.user.sellerid, needLoading: needLoading); | ||
| 255 | -// // } | ||
| 256 | -// // // if (_chooseTableModel.pageState == PageState.Success) { | ||
| 257 | - | ||
| 258 | -// // // } | ||
| 259 | -// // } | ||
| 260 | - | ||
| 261 | -// // refreshTable(context) async { | ||
| 262 | -// // await getTableList(needLoading: false); | ||
| 263 | -// // // if (temp.length > 0) { | ||
| 264 | -// // // _getReserveList(context, needLoading: false); | ||
| 265 | -// // // } else { | ||
| 266 | -// // // // pageState = PageState.Empty; | ||
| 267 | -// // // _chooseTableModel.pageState = PageState.Success; | ||
| 268 | -// // // _chooseTableModel.notifyListeners(); | ||
| 269 | -// // // } | ||
| 270 | -// // } | ||
| 271 | - | ||
| 272 | -// // //获取预订(原来普通预订和宴会预订) | ||
| 273 | -// // _getReserveListAndFeastData(context, params, showloading) async { | ||
| 274 | -// // UserModel userModel = Provider.of<UserModel>(context, listen: false); | ||
| 275 | -// // String timeStrStart = ''; | ||
| 276 | -// // String timeStrEnd = ''; | ||
| 277 | - | ||
| 278 | -// // String hmsS = " ${widget.hmS}:00"; //起始 | ||
| 279 | -// // String hmsE = " ${widget.hmE}:59"; //结束 | ||
| 280 | - | ||
| 281 | -// // if (widget.hmS == 'null' || widget.hmE == 'null') { | ||
| 282 | -// // //用餐段对应的时间段作为起始时间 | ||
| 283 | -// // String keys = ''; | ||
| 284 | - | ||
| 285 | -// // if (widget.ddate_slot == '1') { | ||
| 286 | -// // //早市 | ||
| 287 | -// // keys = 'morning'; | ||
| 288 | -// // } else if (widget.ddate_slot == '2') { | ||
| 289 | -// // //午市 | ||
| 290 | -// // keys = 'noon'; | ||
| 291 | -// // } else if (widget.ddate_slot == '3') { | ||
| 292 | -// // //晚市 | ||
| 293 | -// // keys = 'night'; | ||
| 294 | -// // } | ||
| 295 | -// // String ymd = | ||
| 296 | -// // DateUtil.formatDate(widget.dateTime, format: DateFormats.y_mo_d); | ||
| 297 | -// // if (keys != '') { | ||
| 298 | -// // List temp = dailyMap[keys]; | ||
| 299 | -// // timeStrStart = ymd + ' ' + temp.first + ':00'; | ||
| 300 | -// // timeStrEnd = ymd + ' ' + temp.last + ':00'; | ||
| 301 | -// // } else { | ||
| 302 | -// // hmsS = " 00:00:00"; | ||
| 303 | -// // hmsE = " 23:59:59"; | ||
| 304 | -// // timeStrStart = widget.dateTime.year.toString() + | ||
| 305 | -// // "-" + | ||
| 306 | -// // Utils.addZeroNumber(widget.dateTime.month) + | ||
| 307 | -// // "-" + | ||
| 308 | -// // Utils.addZeroNumber(widget.dateTime.day) + | ||
| 309 | -// // hmsS; | ||
| 310 | -// // timeStrEnd = widget.dateTime.year.toString() + | ||
| 311 | -// // "-" + | ||
| 312 | -// // Utils.addZeroNumber(widget.dateTime.month) + | ||
| 313 | -// // "-" + | ||
| 314 | -// // Utils.addZeroNumber(widget.dateTime.day) + | ||
| 315 | -// // hmsE; | ||
| 316 | -// // } | ||
| 317 | -// // } else { | ||
| 318 | -// // hmsS = " ${widget.hmS}:00"; //起始 | ||
| 319 | -// // hmsE = " ${widget.hmE}:59"; //结束 | ||
| 320 | -// // timeStrStart = widget.dateTime.year.toString() + | ||
| 321 | -// // "-" + | ||
| 322 | -// // Utils.addZeroNumber(widget.dateTime.month) + | ||
| 323 | -// // "-" + | ||
| 324 | -// // Utils.addZeroNumber(widget.dateTime.day) + | ||
| 325 | -// // hmsS; | ||
| 326 | -// // timeStrEnd = widget.dateTime.year.toString() + | ||
| 327 | -// // "-" + | ||
| 328 | -// // Utils.addZeroNumber(widget.dateTime.month) + | ||
| 329 | -// // "-" + | ||
| 330 | -// // Utils.addZeroNumber(widget.dateTime.day) + | ||
| 331 | -// // hmsE; | ||
| 332 | -// // } | ||
| 333 | - | ||
| 334 | -// // String start = | ||
| 335 | -// // (DateUtil.getDateMsByTimeStr(timeStrStart) / 1000).floor().toString(); | ||
| 336 | -// // String end = | ||
| 337 | -// // (DateUtil.getDateMsByTimeStr(timeStrEnd) / 1000).floor().toString(); | ||
| 338 | - | ||
| 339 | -// // Map<String, String> banquetmap = { | ||
| 340 | -// // 'sid': userModel.user.sellerid, | ||
| 341 | -// // 'rdate': '${start}', | ||
| 342 | -// // 'edate': '${end}', | ||
| 343 | -// // // 'ddate_interval': widget.ddate_slot | ||
| 344 | -// // }; | ||
| 345 | -// // return await Future.wait<bool>([ | ||
| 346 | -// // _getOldReserve(context, params, showloading), | ||
| 347 | -// // _chooseTableModel.getBanquetByDate(context, banquetmap, | ||
| 348 | -// // showLoading: showloading) | ||
| 349 | -// // ]).then((results) { | ||
| 350 | -// // if (results[0] && results[1]) { | ||
| 351 | -// // //成功 | ||
| 352 | -// // return true; | ||
| 353 | -// // } else { | ||
| 354 | -// // if (!results[0]) { | ||
| 355 | -// // // Utils.showToast(''); | ||
| 356 | -// // } else { | ||
| 357 | -// // // Utils.showToast(''); | ||
| 358 | -// // } | ||
| 359 | -// // return false; | ||
| 360 | -// // } | ||
| 361 | -// // }).catchError((e) { | ||
| 362 | -// // print(e); | ||
| 363 | -// // return false; | ||
| 364 | -// // }); | ||
| 365 | -// // } | ||
| 366 | - | ||
| 367 | -// // Future<bool> _getOldReserve(context, params, showloading) async { | ||
| 368 | -// // NoteBookModel model = new NoteBookModel(); | ||
| 369 | -// // noteBooks = | ||
| 370 | -// // await model.getReserveList(context, params, needLoading: showloading); | ||
| 371 | -// // return true; | ||
| 372 | -// // } | ||
| 373 | - | ||
| 374 | -// // //获取已预订列表 | ||
| 375 | -// // _getReserveList(String sid, {needLoading = true}) async { | ||
| 376 | -// // NoteBookModel model = new NoteBookModel(); | ||
| 377 | -// // Map<String, String> params = { | ||
| 378 | -// // "sid": sid, | ||
| 379 | -// // "rdate": _getRdate(), | ||
| 380 | -// // // "ddate_solt": widget.ddate_slot, | ||
| 381 | -// // "y": "200", | ||
| 382 | -// // "x": "1", | ||
| 383 | -// // "keywords": "", | ||
| 384 | -// // "sort": "1" | ||
| 385 | -// // }; | ||
| 386 | -// // if (widget.source == '1') { | ||
| 387 | -// // params['source'] = '1'; | ||
| 388 | -// // } | ||
| 389 | -// // // List<Notebook> noteBooks = | ||
| 390 | -// // // await model.getReserveList(context, params, needLoading: needLoading); | ||
| 391 | -// // bool success = | ||
| 392 | -// // await _getReserveListAndFeastData(context, params, needLoading); | ||
| 393 | -// // if (success) { | ||
| 394 | -// // List<FeastBoardModel> banquetByDateDataTemp = []; //转换为桌子id为key,data为value | ||
| 395 | -// // _chooseTableModel.banquetByDateData.forEach((element) { | ||
| 396 | -// // _chooseTableModel.tablesAll.forEach((table) { | ||
| 397 | -// // if (table.name == element.title) { | ||
| 398 | -// // FeastBoardModel feastBoardModel = FeastBoardModel(); | ||
| 399 | -// // feastBoardModel.title = table.id; | ||
| 400 | -// // feastBoardModel.data = element.data; | ||
| 401 | -// // banquetByDateDataTemp.add(feastBoardModel); | ||
| 402 | -// // } | ||
| 403 | -// // }); | ||
| 404 | -// // }); | ||
| 405 | -// // // banquetByDateData.map((e) => null) | ||
| 406 | -// // // String banquetKey = ''; | ||
| 407 | -// // // if (widget.ddate_slot == '1') { | ||
| 408 | -// // // banquetKey = '早餐'; | ||
| 409 | -// // // } else if (widget.ddate_slot == '2') { | ||
| 410 | -// // // banquetKey = '午餐'; | ||
| 411 | -// // // } else if (widget.ddate_slot == '3') { | ||
| 412 | -// // // banquetKey = '晚餐'; | ||
| 413 | -// // // } | ||
| 414 | - | ||
| 415 | -// // Map<String, List<FeastBoardSunModel>> banquetData = {}; | ||
| 416 | -// // banquetByDateDataTemp.forEach((element) { | ||
| 417 | -// // List<FeastBoardSunModel> data = []; | ||
| 418 | - | ||
| 419 | -// // if (element.data['其他'].length > 0) { | ||
| 420 | -// // // FeastBoardSunModel feastBoardSunModel = element.data['其他'][0]; | ||
| 421 | -// // element.data['其他'].forEach((feastBoardSunModel) { | ||
| 422 | -// // if (feastBoardSunModel.lost == null || | ||
| 423 | -// // feastBoardSunModel.lost == '') { | ||
| 424 | -// // data.add(feastBoardSunModel); //未丢单宴会合集 | ||
| 425 | -// // } | ||
| 426 | -// // }); | ||
| 427 | -// // } | ||
| 428 | -// // if (element.data['早餐'].length > 0) { | ||
| 429 | -// // // FeastBoardSunModel feastBoardSunModel = element.data['早餐'][0]; | ||
| 430 | -// // element.data['早餐'].forEach((feastBoardSunModel) { | ||
| 431 | -// // if (feastBoardSunModel.lost == null || | ||
| 432 | -// // feastBoardSunModel.lost == '') { | ||
| 433 | -// // data.add(feastBoardSunModel); //未丢单宴会合集 | ||
| 434 | -// // } | ||
| 435 | -// // }); | ||
| 436 | -// // } | ||
| 437 | -// // if (element.data['午餐'].length > 0) { | ||
| 438 | -// // // FeastBoardSunModel feastBoardSunModel = element.data['午餐'][0]; | ||
| 439 | -// // element.data['午餐'].forEach((feastBoardSunModel) { | ||
| 440 | -// // if (feastBoardSunModel.lost == null || | ||
| 441 | -// // feastBoardSunModel.lost == '') { | ||
| 442 | -// // data.add(feastBoardSunModel); //未丢单宴会合集 | ||
| 443 | -// // } | ||
| 444 | -// // }); | ||
| 445 | -// // } | ||
| 446 | -// // if (element.data['晚餐'].length > 0) { | ||
| 447 | -// // // FeastBoardSunModel feastBoardSunModel = element.data['晚餐'][0]; | ||
| 448 | -// // element.data['晚餐'].forEach((feastBoardSunModel) { | ||
| 449 | -// // if (feastBoardSunModel.lost == null || | ||
| 450 | -// // feastBoardSunModel.lost == '') { | ||
| 451 | -// // data.add(feastBoardSunModel); //未丢单宴会合集 | ||
| 452 | -// // } | ||
| 453 | -// // }); | ||
| 454 | -// // } | ||
| 455 | -// // // 不是丢单宴会&&不是当前宴会 | ||
| 456 | -// // // 移除当前宴会订单 | ||
| 457 | -// // if (widget.ridFeast != null) { | ||
| 458 | -// // print(data); | ||
| 459 | -// // data.removeWhere((element) => element.rid == widget.ridFeast); | ||
| 460 | -// // print(data); | ||
| 461 | -// // } | ||
| 462 | - | ||
| 463 | -// // if (!banquetData.containsKey(element.title) && data.length > 0) { | ||
| 464 | -// // banquetData[element.title] = data; | ||
| 465 | -// // } | ||
| 466 | -// // }); | ||
| 467 | - | ||
| 468 | -// // List<String> tidsWidget = | ||
| 469 | -// // widget.tableList.map((element) => element.id).toList(); | ||
| 470 | -// // print(tidsWidget); | ||
| 471 | -// // banquetData.forEach((key, value) { | ||
| 472 | -// // value.forEach((element) { | ||
| 473 | -// // //未丢单的宴会 | ||
| 474 | - | ||
| 475 | -// // if (!tidsWidget.contains(key)) { | ||
| 476 | -// // //带过来的桌子,不能标记已预订,或者已经有宴会 | ||
| 477 | -// // Notebook notebook = Notebook(); | ||
| 478 | -// // notebook.tid = key; | ||
| 479 | -// // notebook.status = '10'; //宴会类型 | ||
| 480 | -// // notebook.className = element.className; | ||
| 481 | -// // notebook.id = element.rid; | ||
| 482 | -// // notebook.rname = element.rname; | ||
| 483 | -// // notebook.nick_name = element.nickName ?? element.account; | ||
| 484 | -// // noteBooks.add(notebook); | ||
| 485 | -// // } | ||
| 486 | - | ||
| 487 | -// // print(noteBooks); | ||
| 488 | - | ||
| 489 | -// // // banquetByDateDataTemp.forEach((element) { | ||
| 490 | -// // // FeastBoardSunModel feastBoardSunModel = element.data[banquetKey][0]; | ||
| 491 | -// // // if (feastBoardSunModel.lost == null || feastBoardSunModel.lost == '') { | ||
| 492 | -// // //未丢单的宴会 | ||
| 493 | -// // // Notebook notebook = Notebook(); | ||
| 494 | -// // // notebook.tid = element.title; | ||
| 495 | -// // // notebook.status = '10'; //宴会类型 | ||
| 496 | -// // // notebook.className = feastBoardSunModel.className; | ||
| 497 | -// // // notebook.id = feastBoardSunModel.rid; | ||
| 498 | -// // // notebook.rname = feastBoardSunModel.rname; | ||
| 499 | -// // // notebook.nick_name = | ||
| 500 | -// // // feastBoardSunModel.nickName ?? feastBoardSunModel.account; | ||
| 501 | -// // // noteBooks.add(notebook); | ||
| 502 | -// // // } | ||
| 503 | -// // }); | ||
| 504 | -// // }); | ||
| 505 | -// // for (Notebook notebook in noteBooks) { | ||
| 506 | -// // if (notebook.tid.isEmpty) continue; | ||
| 507 | -// // if (notebook.status == "1" || | ||
| 508 | -// // notebook.status == "2" || | ||
| 509 | -// // notebook.status == "5" || | ||
| 510 | -// // notebook.status == "10") { | ||
| 511 | -// // //已预订,用餐中,已安排 | ||
| 512 | -// // List<String> tids = notebook.tid.split(","); | ||
| 513 | -// // for (String tid in tids) { | ||
| 514 | -// // tableMap["$tid"] = notebook; | ||
| 515 | -// // } | ||
| 516 | -// // } | ||
| 517 | -// // } | ||
| 518 | - | ||
| 519 | -// // // List<Notebook> noteBooks = | ||
| 520 | -// // // await newGetReserveList(context, params, showLoading: showloading); | ||
| 521 | -// // // List<t.Table> tempSelectTables = []; | ||
| 522 | -// // // tempSelectTables.addAll(selectTables); | ||
| 523 | -// // // String msg = ''; | ||
| 524 | -// // // for (Notebook notebook in noteBooks) { | ||
| 525 | -// // // if (notebook.tid.isEmpty) continue; | ||
| 526 | - | ||
| 527 | -// // // //已预订,用餐中,已安排 | ||
| 528 | -// // // List<String> tids = notebook.tid.split(","); | ||
| 529 | -// // // for (String tid in tids) { | ||
| 530 | -// // // if (notebook.status == "1" || | ||
| 531 | -// // // notebook.status == "2" || | ||
| 532 | -// // // notebook.status == "5" || | ||
| 533 | -// // // notebook.status == "10") { | ||
| 534 | -// // // tableMap["$tid"] = notebook; | ||
| 535 | - | ||
| 536 | -// // // ///预订按钮点击的时候提醒已经被预订的桌子 | ||
| 537 | -// // // /// | ||
| 538 | -// // // if (showMsg && selectTables.length > 0) { | ||
| 539 | -// // // for (t.Table item in selectTables) { | ||
| 540 | -// // // if (item.id == tid) { | ||
| 541 | -// // // msg += '${item.name},'; | ||
| 542 | -// // // tempSelectTables.remove(item); | ||
| 543 | -// // // } | ||
| 544 | -// // // } | ||
| 545 | -// // // } | ||
| 546 | -// // // } | ||
| 547 | -// // // } | ||
| 548 | -// // // } | ||
| 549 | -// // // if (showMsg && msg != '' && selectTables.length > 0) { | ||
| 550 | -// // // if (msg.endsWith(',')) { | ||
| 551 | -// // // msg = msg.substring(0, msg.length - 1); | ||
| 552 | -// // // } | ||
| 553 | -// // // selectTables = tempSelectTables; | ||
| 554 | -// // // Utils.showToast('${msg}已被预订,请选择其他桌位!'); | ||
| 555 | -// // // print(tableMap); | ||
| 556 | -// // // initData(needKeep: needKeep); | ||
| 557 | -// // // // notifyListeners(); | ||
| 558 | -// // // return false; | ||
| 559 | -// // // } | ||
| 560 | - | ||
| 561 | -// // // print(tableMap); | ||
| 562 | -// // // initData(needKeep: needKeep); | ||
| 563 | -// // // return true; | ||
| 564 | -// // } | ||
| 565 | - | ||
| 566 | -// // print(tableMap); | ||
| 567 | -// // if (needLoading) { | ||
| 568 | -// // initData(); | ||
| 569 | -// // } else { | ||
| 570 | -// // initData(needRetain: true); | ||
| 571 | -// // } | ||
| 572 | -// // } | ||
| 573 | - | ||
| 574 | -// //初始桌位数据 | ||
| 575 | -// // initData({bool needRetain = false}) { | ||
| 576 | -// // areas.clear(); | ||
| 577 | -// // areaTableMap.clear(); | ||
| 578 | -// // List<t.Table> tempTableAll = []; | ||
| 579 | -// // tempTableAll.addAll(_chooseTableModel.tablesAll); | ||
| 580 | -// // for (TableOuter outer in tableOuterList) { | ||
| 581 | -// // int count = 0; | ||
| 582 | -// // List<t.Table> tempList = []; | ||
| 583 | -// // tempList.addAll(outer.list); | ||
| 584 | -// // for (t.Table table in outer.list) { | ||
| 585 | -// // // table.selected = false; | ||
| 586 | -// // if (widget.tid != '' && table.id == widget.tid) { | ||
| 587 | -// // table.selected = true; | ||
| 588 | -// // currentArea = outer.name; | ||
| 589 | -// // } | ||
| 590 | -// // if (table.tablestatus == "0") { | ||
| 591 | -// // //没有用餐中 | ||
| 592 | -// // if (tableMap["${table.id}"] != null) { | ||
| 593 | -// // Notebook notebook = tableMap["${table.id}"]; | ||
| 594 | -// // table.sign = notebook.status; | ||
| 595 | -// // table.notebookId = notebook.id; | ||
| 596 | -// // table.reserver = notebook.rnameStr; | ||
| 597 | -// // table.pnum = notebook.actual_pnum; | ||
| 598 | -// // table.nickName = notebook.nick_name; | ||
| 599 | -// // table.noteName = notebook.note_name; | ||
| 600 | -// // table.label = notebook.className; | ||
| 601 | -// // //(不能移除自己定的桌子) | ||
| 602 | -// // String idNow = ''; | ||
| 603 | -// // if (tableMap.containsKey('${table.id}')) { | ||
| 604 | -// // //包含,证明该桌子已经被预订了 | ||
| 605 | -// // idNow = tableMap['${table.id}'].id; | ||
| 606 | -// // if (idNow != widget.rid) { | ||
| 607 | -// // //不是自己的当前订单 | ||
| 608 | -// // //剔除已经预订的桌子,剩下空桌子(仅看空座) | ||
| 609 | -// // tempList.remove(table); | ||
| 610 | -// // //全部 | ||
| 611 | -// // tempTableAll.remove(table); | ||
| 612 | -// // } | ||
| 613 | -// // } | ||
| 614 | -// // } else { | ||
| 615 | -// // table.sign = ""; | ||
| 616 | -// // table.notebookId = ""; | ||
| 617 | -// // if (table.enable == "1") { | ||
| 618 | -// // count++; | ||
| 619 | -// // } | ||
| 620 | -// // } | ||
| 621 | -// // } else { | ||
| 622 | -// // table.sign = "2"; | ||
| 623 | -// // table.notebookId = ""; | ||
| 624 | -// // } | ||
| 625 | -// // } | ||
| 626 | - | ||
| 627 | -// // areaTableMap["${outer.name}"] = outer.list; | ||
| 628 | -// // _chooseTableModel.areaTableMapCanNote["${outer.name}"] = tempList; | ||
| 629 | -// // Area area = Area(); | ||
| 630 | -// // area.name = outer.name; | ||
| 631 | -// // area.count = outer.list.length == 0 ? -1 : count; | ||
| 632 | -// // area.rid = outer.list.length == 0 ? outer.rid : outer.list[0].rid; | ||
| 633 | -// // area.orderId = outer.orderId; | ||
| 634 | -// // areas.add(area); | ||
| 635 | -// // } | ||
| 636 | -// // _chooseTableModel.tablesCanNote = tempTableAll; | ||
| 637 | -// // if (_chooseTableModel.swichState) { | ||
| 638 | -// // _chooseTableModel.areaTableMapShow = | ||
| 639 | -// // _chooseTableModel.areaTableMapCanNote; | ||
| 640 | -// // _chooseTableModel.tablesShow = _chooseTableModel.tablesCanNote; | ||
| 641 | -// // } else { | ||
| 642 | -// // _chooseTableModel.areaTableMapShow = areaTableMap; | ||
| 643 | -// // _chooseTableModel.tablesShow = _chooseTableModel.tablesAll; | ||
| 644 | -// // } | ||
| 645 | -// // print(currentArea); | ||
| 646 | -// // if (widget.tid == '') { | ||
| 647 | -// // if (!needRetain) { | ||
| 648 | -// // // currentArea = areaTableMap.keys.first; | ||
| 649 | -// // currentArea = '全部'; | ||
| 650 | -// // _chooseTableModel.currentTables = _chooseTableModel.tablesAll; | ||
| 651 | -// // } | ||
| 652 | -// // // if (areas.length == 1) { | ||
| 653 | -// // // currentArea = areaTableMap.keys.first; | ||
| 654 | -// // // } | ||
| 655 | -// // } | ||
| 656 | - | ||
| 657 | -// // _chooseTableModel.pageState = PageState.Success; | ||
| 658 | -// // _chooseTableModel.notifyListeners(); | ||
| 659 | -// // } | ||
| 660 | - | ||
| 661 | -// //获取一天开始-结束时间字符串 | ||
| 662 | -// // String _getRdate() { | ||
| 663 | -// // String timeStrStart = ''; | ||
| 664 | -// // String timeStrEnd = ''; | ||
| 665 | -// // //一天开始时间 | ||
| 666 | -// // double startDay; | ||
| 667 | -// // //一天结束时间 | ||
| 668 | -// // double endDay; | ||
| 669 | - | ||
| 670 | -// // String hmsS = " ${widget.hmS}:00"; //起始 | ||
| 671 | -// // String hmsE = " ${widget.hmE}:59"; //结束 | ||
| 672 | - | ||
| 673 | -// // if (widget.hmS == 'null' || widget.hmE == 'null') { | ||
| 674 | -// // //用餐段对应的时间段作为起始时间 | ||
| 675 | -// // String keys = ''; | ||
| 676 | - | ||
| 677 | -// // if (widget.ddate_slot == '1') { | ||
| 678 | -// // //早市 | ||
| 679 | -// // keys = 'morning'; | ||
| 680 | -// // } else if (widget.ddate_slot == '2') { | ||
| 681 | -// // //午市 | ||
| 682 | -// // keys = 'noon'; | ||
| 683 | -// // } else if (widget.ddate_slot == '3') { | ||
| 684 | -// // //晚市 | ||
| 685 | -// // keys = 'night'; | ||
| 686 | -// // } | ||
| 687 | -// // String ymd = | ||
| 688 | -// // DateUtil.formatDate(widget.dateTime, format: DateFormats.y_mo_d); | ||
| 689 | -// // if (keys != '') { | ||
| 690 | -// // List temp = dailyMap[keys]; | ||
| 691 | -// // timeStrStart = ymd + ' ' + temp.first + ':00'; | ||
| 692 | -// // timeStrEnd = ymd + ' ' + temp.last + ':00'; | ||
| 693 | -// // } else { | ||
| 694 | -// // hmsS = " 00:00:00"; | ||
| 695 | -// // hmsE = " 23:59:59"; | ||
| 696 | -// // timeStrStart = widget.dateTime.year.toString() + | ||
| 697 | -// // "-" + | ||
| 698 | -// // Utils.addZeroNumber(widget.dateTime.month) + | ||
| 699 | -// // "-" + | ||
| 700 | -// // Utils.addZeroNumber(widget.dateTime.day) + | ||
| 701 | -// // hmsS; | ||
| 702 | -// // timeStrEnd = widget.dateTime.year.toString() + | ||
| 703 | -// // "-" + | ||
| 704 | -// // Utils.addZeroNumber(widget.dateTime.month) + | ||
| 705 | -// // "-" + | ||
| 706 | -// // Utils.addZeroNumber(widget.dateTime.day) + | ||
| 707 | -// // hmsE; | ||
| 708 | -// // } | ||
| 709 | -// // } else { | ||
| 710 | -// // hmsS = " ${widget.hmS}:00"; //起始 | ||
| 711 | -// // hmsE = " ${widget.hmE}:59"; //结束 | ||
| 712 | -// // timeStrStart = widget.dateTime.year.toString() + | ||
| 713 | -// // "-" + | ||
| 714 | -// // Utils.addZeroNumber(widget.dateTime.month) + | ||
| 715 | -// // "-" + | ||
| 716 | -// // Utils.addZeroNumber(widget.dateTime.day) + | ||
| 717 | -// // hmsS; | ||
| 718 | -// // timeStrEnd = widget.dateTime.year.toString() + | ||
| 719 | -// // "-" + | ||
| 720 | -// // Utils.addZeroNumber(widget.dateTime.month) + | ||
| 721 | -// // "-" + | ||
| 722 | -// // Utils.addZeroNumber(widget.dateTime.day) + | ||
| 723 | -// // hmsE; | ||
| 724 | -// // } | ||
| 725 | - | ||
| 726 | -// // // } | ||
| 727 | -// // startDay = (DateTime.parse(timeStrStart).millisecondsSinceEpoch) / 1000; | ||
| 728 | -// // endDay = (DateTime.parse(timeStrEnd).millisecondsSinceEpoch) / 1000; | ||
| 729 | -// // return startDay.floor().toString() + "-" + endDay.floor().toString(); | ||
| 730 | -// // } | ||
| 731 | - | ||
| 732 | -// Widget item(int i) { | ||
| 733 | -// return GridView.builder( | ||
| 734 | -// // controller: _areaController, | ||
| 735 | -// // physics: NeverScrollableScrollPhysics(), | ||
| 736 | -// padding: EdgeInsets.symmetric( | ||
| 737 | -// vertical: ScreenUtil().setWidth(20), | ||
| 738 | -// horizontal: ScreenUtil().setWidth(10)), | ||
| 739 | -// shrinkWrap: true, | ||
| 740 | - | ||
| 741 | -// itemCount: | ||
| 742 | -// tableManagerModel.tablesOrReserveDataShow[i].tableList.length == 0 | ||
| 743 | -// ? 1 | ||
| 744 | -// : tableManagerModel.tablesOrReserveDataShow[i].tableList.length + | ||
| 745 | -// 1, | ||
| 746 | -// gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( | ||
| 747 | -// crossAxisCount: 4, | ||
| 748 | -// childAspectRatio: 1, | ||
| 749 | -// mainAxisSpacing: ScreenUtil().setWidth(30), | ||
| 750 | -// crossAxisSpacing: ScreenUtil().setWidth(12), | ||
| 751 | -// ), | ||
| 752 | - | ||
| 753 | -// itemBuilder: (BuildContext context, int index) { | ||
| 754 | -// if (index == | ||
| 755 | -// tableManagerModel.tablesOrReserveDataShow[i].tableList.length || | ||
| 756 | -// tableManagerModel.tablesOrReserveDataShow[i].tableList.length == | ||
| 757 | -// 0) { | ||
| 758 | -// return InkWell( | ||
| 759 | -// onTap: () async { | ||
| 760 | -// List<String> areasTemp = []; | ||
| 761 | - | ||
| 762 | -// for (int i = 0; | ||
| 763 | -// i < tableManagerModel.tablesOrReserveDataShow.length; | ||
| 764 | -// i++) { | ||
| 765 | -// areasTemp | ||
| 766 | -// .add(tableManagerModel.tablesOrReserveDataShow[i].name); | ||
| 767 | -// } | ||
| 768 | - | ||
| 769 | -// //添加桌位弹框 | ||
| 770 | -// await DialogUtil.openCreateTableDialog( | ||
| 771 | -// context, areasTemp, i, personNumList, | ||
| 772 | -// onTap: (Map<String, String> value) async { | ||
| 773 | -// print(value); | ||
| 774 | -// // 'areaname': | ||
| 775 | -// // areas[currentAreaIndex], | ||
| 776 | -// // 'name': controller.text, | ||
| 777 | -// // 'pnumMin': pnumMin, | ||
| 778 | -// // 'pnumMax': pnumMax | ||
| 779 | -// //添加桌位 接口参数带整合??? | ||
| 780 | -// // 以下是旧的不去,明天添加桌位接口 | ||
| 781 | -// String rid; | ||
| 782 | -// for (TableListReseveSunModel item | ||
| 783 | -// in tableManagerModel.tablesOrReserveDataShow) { | ||
| 784 | -// if (item.name == value['areaname']) { | ||
| 785 | -// rid = item.id; | ||
| 786 | -// } | ||
| 787 | -// } | ||
| 788 | -// Map<String, String> params = { | ||
| 789 | -// 'rid': rid, | ||
| 790 | -// 'name': value['name'], | ||
| 791 | -// }; | ||
| 792 | -// if (value['pnumMin'] != '') { | ||
| 793 | -// params['pnum'] = value['pnumMin']; | ||
| 794 | -// } | ||
| 795 | -// if (value['pnumMax'] != '') { | ||
| 796 | -// params['most_pnum'] = value['pnumMax']; | ||
| 797 | -// } | ||
| 798 | -// bool success = | ||
| 799 | -// await _chooseTableModel.addTable(context, params); | ||
| 800 | -// print(success); | ||
| 801 | -// if (success) { | ||
| 802 | -// Utils.showToast('添加成功!'); | ||
| 803 | - | ||
| 804 | -// _getTableListOrReserve(); | ||
| 805 | -// } | ||
| 806 | -// }); | ||
| 807 | -// }, | ||
| 808 | -// child: Container( | ||
| 809 | -// child: DottedBorder( | ||
| 810 | -// dashPattern: [5, 5, 5, 5], | ||
| 811 | -// borderType: BorderType.RRect, | ||
| 812 | -// radius: Radius.circular(ScreenUtil().setWidth(20)), | ||
| 813 | -// // padding: EdgeInsets.all(ScreenUtil().setWidth(70)), | ||
| 814 | -// color: MyColours.color_E0E0E0, | ||
| 815 | -// strokeWidth: ScreenUtil().setWidth(2), | ||
| 816 | -// child: ClipRRect( | ||
| 817 | -// borderRadius: BorderRadius.all( | ||
| 818 | -// Radius.circular(ScreenUtil().setWidth(20))), | ||
| 819 | -// child: Container( | ||
| 820 | -// height: ScreenUtil().screenWidth - | ||
| 821 | -// ScreenUtil().setWidth(12 * 3 - 10 * 2), | ||
| 822 | -// width: ScreenUtil().screenWidth - | ||
| 823 | -// ScreenUtil().setWidth(12 * 3 - 10 * 2), | ||
| 824 | -// child: Column( | ||
| 825 | -// mainAxisAlignment: MainAxisAlignment.center, | ||
| 826 | -// children: [ | ||
| 827 | -// Image.asset(Utils.getImgPath('add_store'), | ||
| 828 | -// width: ScreenUtil().setWidth(32)), | ||
| 829 | -// ], | ||
| 830 | -// ), | ||
| 831 | -// ), | ||
| 832 | -// ), | ||
| 833 | -// ))); | ||
| 834 | -// } else { | ||
| 835 | -// TableListReserve data = | ||
| 836 | -// tableManagerModel.tablesOrReserveDataShow[i].tableList[index]; | ||
| 837 | -// return Selector<TableManagerModelOrReserve, TableListReserve>( | ||
| 838 | -// shouldRebuild: (pre, next) => true, | ||
| 839 | -// selector: (context, model) => data, | ||
| 840 | -// builder: (context, table, _) { | ||
| 841 | -// return TableItemOrReserve(table, | ||
| 842 | -// canSelected: true, | ||
| 843 | -// selectTables: tableManagerModel.selectTablesOrReserve, | ||
| 844 | -// onSelected: (tableListReserve) { | ||
| 845 | -// if (widget.fromPage == 'tablePhoto') { | ||
| 846 | -// for (TableListReseveSunModel item | ||
| 847 | -// in tableManagerModel.tablesOrReserveDataShow) { | ||
| 848 | -// for (TableListReserve element in item.tableList) { | ||
| 849 | -// element.selected = false; | ||
| 850 | -// selectNum = 0; | ||
| 851 | -// if (table.id == item.id) { | ||
| 852 | -// element.selected = true; | ||
| 853 | -// tableManagerModel.selectTablesOrReserve = []; | ||
| 854 | -// selectNum++; | ||
| 855 | -// tableManagerModel.selectTablesOrReserve.add(table); | ||
| 856 | -// } | ||
| 857 | -// } | ||
| 858 | -// } | ||
| 859 | - | ||
| 860 | -// setState(() {}); | ||
| 861 | -// } else { | ||
| 862 | -// if ((table as t.Table).selected) { | ||
| 863 | -// tableManagerModel.selectTablesOrReserve.add(table); | ||
| 864 | -// selectNum++; | ||
| 865 | -// widget.tableList.add(tableToTableList(table)); | ||
| 866 | -// } else { | ||
| 867 | -// widget.tableList.removeWhere((t) => t.id == table.id); | ||
| 868 | -// selectNum--; | ||
| 869 | -// tableManagerModel.selectTablesOrReserve | ||
| 870 | -// .removeWhere((t) => t.id == table.id); | ||
| 871 | -// } | ||
| 872 | -// setState(() {}); | ||
| 873 | -// } | ||
| 874 | -// }, fromPage: widget.fromPage, rid: widget.rid); | ||
| 875 | -// }, | ||
| 876 | -// ); | ||
| 877 | -// } | ||
| 878 | -// }, | ||
| 879 | -// ); | ||
| 880 | -// } | ||
| 881 | - | ||
| 882 | -// @override | ||
| 883 | -// Widget build(BuildContext context) { | ||
| 884 | -// _chooseTableModel = Provider.of<ChooseTableModel>(context); | ||
| 885 | -// tableManagerModel = | ||
| 886 | -// Provider.of<TableManagerModelOrReserve>(context, listen: true); | ||
| 887 | -// return Scaffold( | ||
| 888 | -// body: SafeArea( | ||
| 889 | -// child: Column( | ||
| 890 | -// children: <Widget>[ | ||
| 891 | -// MyAppBar( | ||
| 892 | -// "选择桌位", | ||
| 893 | -// showBack: true, | ||
| 894 | -// ), | ||
| 895 | -// Expanded( | ||
| 896 | -// child: Consumer<TableManagerModelOrReserve>( | ||
| 897 | -// builder: (context, model, child) { | ||
| 898 | -// if (model.pageStateOrReserve != PageState.Success) { | ||
| 899 | -// Expanded( | ||
| 900 | -// child: ExceptionPage( | ||
| 901 | -// pageState: model.pageStateOrReserve, | ||
| 902 | -// callback: () { | ||
| 903 | -// tableManagerModel.getTableListOrReserve(context, | ||
| 904 | -// showLoading: true); | ||
| 905 | -// }, | ||
| 906 | -// emptyMsg: "暂时没有桌位哦", | ||
| 907 | -// emptyImg: "empty_search", | ||
| 908 | -// showMsg: "加载中,请稍后...", | ||
| 909 | -// )); | ||
| 910 | -// } else { | ||
| 911 | -// return Column( | ||
| 912 | -// // crossAxisAlignment: CrossAxisAlignment.center, | ||
| 913 | -// children: [ | ||
| 914 | -// Container( | ||
| 915 | -// color: MyColours.color_ffffff, | ||
| 916 | -// height: ScreenUtil().setWidth(92), | ||
| 917 | -// margin: | ||
| 918 | -// EdgeInsets.only(bottom: ScreenUtil().setWidth(30)), | ||
| 919 | -// child: Row( | ||
| 920 | -// children: [ | ||
| 921 | -// HEmptyView(20), | ||
| 922 | -// Expanded( | ||
| 923 | -// child: ListView.builder( | ||
| 924 | -// itemCount: tableManagerModel | ||
| 925 | -// .tablesOrReserveDataShow | ||
| 926 | -// .length == | ||
| 927 | -// 0 | ||
| 928 | -// ? 1 | ||
| 929 | -// : tableManagerModel | ||
| 930 | -// .tablesOrReserveDataShow | ||
| 931 | -// .length + | ||
| 932 | -// 1, | ||
| 933 | -// shrinkWrap: true, | ||
| 934 | -// scrollDirection: Axis.horizontal, | ||
| 935 | -// itemBuilder: | ||
| 936 | -// (BuildContext contxt, int index) { | ||
| 937 | -// if (index == | ||
| 938 | -// tableManagerModel | ||
| 939 | -// .tablesOrReserveDataShow | ||
| 940 | -// .length || | ||
| 941 | -// tableManagerModel | ||
| 942 | -// .tablesOrReserveDataShow | ||
| 943 | -// .length == | ||
| 944 | -// 0) { | ||
| 945 | -// return InkWell( | ||
| 946 | -// onTap: () async { | ||
| 947 | -// //添加区域弹框 | ||
| 948 | -// await DialogUtil | ||
| 949 | -// .openCreateAreaDialog(context, | ||
| 950 | -// onTap: (value) async { | ||
| 951 | -// print(value); | ||
| 952 | -// //添加区域 | ||
| 953 | -// bool success = | ||
| 954 | -// await _chooseTableModel | ||
| 955 | -// .addTableAreas( | ||
| 956 | -// context, value); | ||
| 957 | -// print(success); | ||
| 958 | -// if (success) { | ||
| 959 | -// Utils.showToast('添加成功!'); | ||
| 960 | -// tableManagerModel | ||
| 961 | -// .getTableListOrReserve( | ||
| 962 | -// context, | ||
| 963 | -// showLoading: true); | ||
| 964 | -// // UserModel userModel = | ||
| 965 | -// // Provider.of<UserModel>(context, | ||
| 966 | -// // listen: false); | ||
| 967 | -// // Map<String, String> params = { | ||
| 968 | -// // "sellerid": userModel.user.sellerid | ||
| 969 | -// // }; | ||
| 970 | -// // await _chooseTableModel.getTableList( | ||
| 971 | -// // context, params, | ||
| 972 | -// // needLoading: false); | ||
| 973 | -// // initData(); | ||
| 974 | - | ||
| 975 | -// } | ||
| 976 | -// }); | ||
| 977 | -// }, | ||
| 978 | -// child: Column( | ||
| 979 | -// children: [ | ||
| 980 | -// VEmptyView(20), | ||
| 981 | -// DottedBorder( | ||
| 982 | -// dashPattern: [5, 5, 5, 5], | ||
| 983 | -// borderType: BorderType.RRect, | ||
| 984 | -// radius: Radius.circular( | ||
| 985 | -// ScreenUtil().setWidth(10)), | ||
| 986 | -// // padding: EdgeInsets.all(ScreenUtil().setWidth(70)), | ||
| 987 | -// color: MyColours.color_199095, | ||
| 988 | -// strokeWidth: | ||
| 989 | -// ScreenUtil().setWidth(2), | ||
| 990 | -// child: ClipRRect( | ||
| 991 | -// borderRadius: BorderRadius | ||
| 992 | -// .all(Radius.circular( | ||
| 993 | -// ScreenUtil() | ||
| 994 | -// .setWidth(10))), | ||
| 995 | -// child: Container( | ||
| 996 | -// height: ScreenUtil() | ||
| 997 | -// .setWidth(25 * 2), | ||
| 998 | -// width: ScreenUtil() | ||
| 999 | -// .setWidth(104 * 2), | ||
| 1000 | -// child: Column( | ||
| 1001 | -// mainAxisAlignment: | ||
| 1002 | -// MainAxisAlignment | ||
| 1003 | -// .center, | ||
| 1004 | -// children: [ | ||
| 1005 | -// Image.asset( | ||
| 1006 | -// Utils.getImgPath( | ||
| 1007 | -// 'add_area'), | ||
| 1008 | -// width: ScreenUtil() | ||
| 1009 | -// .setWidth(24)), | ||
| 1010 | -// ], | ||
| 1011 | -// ), | ||
| 1012 | -// ), | ||
| 1013 | -// ), | ||
| 1014 | -// ) | ||
| 1015 | -// ], | ||
| 1016 | -// ), | ||
| 1017 | -// ); | ||
| 1018 | -// } else { | ||
| 1019 | -// return AreaItemTableOrReserve( | ||
| 1020 | -// tableManagerModel | ||
| 1021 | -// .tablesOrReserveDataShow[index], | ||
| 1022 | -// (area) { | ||
| 1023 | -// tableManagerModel | ||
| 1024 | -// .tablesOrReserveDataShow | ||
| 1025 | -// .forEach((element) { | ||
| 1026 | -// element.select = false; | ||
| 1027 | -// }); | ||
| 1028 | -// setState(() { | ||
| 1029 | -// // isSelected = false; | ||
| 1030 | -// area.select = true; | ||
| 1031 | -// tableManagerModel.selectNumber = | ||
| 1032 | -// index; | ||
| 1033 | -// }); | ||
| 1034 | -// }); | ||
| 1035 | -// } | ||
| 1036 | -// })), | ||
| 1037 | -// InkWell( | ||
| 1038 | -// onTap: () { | ||
| 1039 | -// setState(() { | ||
| 1040 | -// model.swichState = !model.swichState; | ||
| 1041 | -// }); | ||
| 1042 | -// if (model.swichState) { | ||
| 1043 | -// //把没有预订和宴会的桌子筛选出来显示 | ||
| 1044 | - | ||
| 1045 | -// model.tablesOrReserveData.forEach((element) { | ||
| 1046 | -// if (element.tableList != null && | ||
| 1047 | -// element.tableList.length > 0) { | ||
| 1048 | -// List<TableListReserve> tableList = []; | ||
| 1049 | -// element.tableList.forEach((element1) { | ||
| 1050 | -// if (element1.reserveList == null && | ||
| 1051 | -// element1.banquetList == null) { | ||
| 1052 | -// //空桌子 | ||
| 1053 | -// tableList.add(element1); | ||
| 1054 | -// } | ||
| 1055 | -// }); | ||
| 1056 | - | ||
| 1057 | -// model | ||
| 1058 | -// .tablesOrReserveDataShow[model | ||
| 1059 | -// .tablesOrReserveDataShow | ||
| 1060 | -// .indexWhere((elementShow) => | ||
| 1061 | -// elementShow.id == element.id)] | ||
| 1062 | -// .tableList = tableList; | ||
| 1063 | -// } | ||
| 1064 | -// }); | ||
| 1065 | -// } else { | ||
| 1066 | -// model.tablesOrReserveDataShow = | ||
| 1067 | -// model.tablesOrReserveData.toList(); | ||
| 1068 | -// } | ||
| 1069 | - | ||
| 1070 | -// setState(() {}); | ||
| 1071 | -// }, | ||
| 1072 | -// child: Container( | ||
| 1073 | -// margin: EdgeInsets.only( | ||
| 1074 | -// top: ScreenUtil().setWidth(20), | ||
| 1075 | -// ), | ||
| 1076 | -// child: Row( | ||
| 1077 | -// children: [ | ||
| 1078 | -// MyDivider(ScreenUtil().setWidth(15), | ||
| 1079 | -// ScreenUtil().setWidth(80), | ||
| 1080 | -// color: MyColours.color_F1F0F4), | ||
| 1081 | -// MyDivider(ScreenUtil().setWidth(2), | ||
| 1082 | -// ScreenUtil().setWidth(80), | ||
| 1083 | -// color: MyColours.color_9C9C9C), | ||
| 1084 | -// HEmptyView(30), | ||
| 1085 | -// Image.asset( | ||
| 1086 | -// model.swichState | ||
| 1087 | -// ? Utils.getImgPath('f_swich_on') | ||
| 1088 | -// : Utils.getImgPath('f_swich_off'), | ||
| 1089 | -// width: ScreenUtil().setWidth(90), | ||
| 1090 | -// // height: ScreenUtil().setWidth(82), | ||
| 1091 | -// ), | ||
| 1092 | -// HEmptyView(20), | ||
| 1093 | -// Text( | ||
| 1094 | -// '仅看\n空座', | ||
| 1095 | -// style: TextStyle( | ||
| 1096 | -// fontSize: ScreenUtil().setSp(28), | ||
| 1097 | -// color: MyColours.color_333333, | ||
| 1098 | -// ), | ||
| 1099 | -// ), | ||
| 1100 | -// HEmptyView(40) | ||
| 1101 | -// ], | ||
| 1102 | -// )), | ||
| 1103 | -// ) | ||
| 1104 | -// ], | ||
| 1105 | -// ), | ||
| 1106 | -// ), | ||
| 1107 | -// Expanded( | ||
| 1108 | -// flex: 2, | ||
| 1109 | -// child: Container( | ||
| 1110 | -// constraints: BoxConstraints( | ||
| 1111 | -// minHeight: ScreenUtil().setWidth(100)), | ||
| 1112 | -// color: Color.fromRGBO(249, 249, 249, 1), | ||
| 1113 | -// child: item(_selectNumber))), | ||
| 1114 | -// Container( | ||
| 1115 | -// width: double.infinity, | ||
| 1116 | -// height: ScreenUtil().setHeight(84), | ||
| 1117 | -// margin: EdgeInsets.only( | ||
| 1118 | -// bottom: ScreenUtil().setWidth(50)), | ||
| 1119 | -// padding: EdgeInsets.symmetric( | ||
| 1120 | -// horizontal: ScreenUtil().setWidth(31)), | ||
| 1121 | -// alignment: Alignment.center, | ||
| 1122 | -// color: MyColours.color_ffffff, | ||
| 1123 | -// child: CommonButton( | ||
| 1124 | -// // content: widget.fromPage == 'tablePhoto' | ||
| 1125 | -// // ? '确定' | ||
| 1126 | -// // : "已选${selectNum}个 确定", | ||
| 1127 | -// content: '确定', | ||
| 1128 | -// width: 300, | ||
| 1129 | -// height: 84, | ||
| 1130 | -// fontSize: 34, | ||
| 1131 | -// state: 1, | ||
| 1132 | -// onPress: () { | ||
| 1133 | -// if (widget.fromPage == "tablePhoto") { | ||
| 1134 | -// Map temp = { | ||
| 1135 | -// 'tid': tableManagerModel | ||
| 1136 | -// .selectTablesOrReserve.length > | ||
| 1137 | -// 0 | ||
| 1138 | -// ? tableManagerModel | ||
| 1139 | -// .selectTablesOrReserve[0].id | ||
| 1140 | -// : '', | ||
| 1141 | -// 'tname': tableManagerModel | ||
| 1142 | -// .selectTablesOrReserve.length > | ||
| 1143 | -// 0 | ||
| 1144 | -// ? tableManagerModel | ||
| 1145 | -// .selectTablesOrReserve[0].name | ||
| 1146 | -// : '' | ||
| 1147 | -// }; | ||
| 1148 | -// Navigator.of(context).pop(temp); | ||
| 1149 | -// } else { | ||
| 1150 | -// if (widget.canChoose) { | ||
| 1151 | -// // if (widget.tableList.length > 0) { | ||
| 1152 | -// String tid = ""; | ||
| 1153 | -// for (TableList table in widget.tableList) { | ||
| 1154 | -// tid += table.id + ","; | ||
| 1155 | -// } | ||
| 1156 | -// if (widget.tableList.length > 0) { | ||
| 1157 | -// tid = tid.substring(0, tid.length - 1); | ||
| 1158 | -// } | ||
| 1159 | - | ||
| 1160 | -// Map temp = { | ||
| 1161 | -// 'object': widget.tableList, | ||
| 1162 | -// 'tid': tid | ||
| 1163 | -// }; | ||
| 1164 | -// Navigator.of(context).pop(temp); | ||
| 1165 | -// // } | ||
| 1166 | -// } else { | ||
| 1167 | -// if (tableManagerModel | ||
| 1168 | -// .selectTablesOrReserve.length > | ||
| 1169 | -// 0) { | ||
| 1170 | -// String tid = ""; | ||
| 1171 | -// for (TableListReserve table | ||
| 1172 | -// in tableManagerModel | ||
| 1173 | -// .selectTablesOrReserve) { | ||
| 1174 | -// tid += table.id + ","; | ||
| 1175 | -// } | ||
| 1176 | -// if (tableManagerModel | ||
| 1177 | -// .selectTablesOrReserve.length > | ||
| 1178 | -// 0) { | ||
| 1179 | -// tid = tid.substring(0, tid.length - 1); | ||
| 1180 | -// } | ||
| 1181 | - | ||
| 1182 | -// Map temp = { | ||
| 1183 | -// 'object': widget.tableList, | ||
| 1184 | -// 'tid': tid | ||
| 1185 | -// }; | ||
| 1186 | -// Navigator.of(context).pop(temp); | ||
| 1187 | -// } | ||
| 1188 | -// } | ||
| 1189 | -// } | ||
| 1190 | -// }, | ||
| 1191 | -// )), | ||
| 1192 | -// ]); | ||
| 1193 | -// } | ||
| 1194 | -// }), | ||
| 1195 | -// ), | ||
| 1196 | -// ], | ||
| 1197 | -// ), | ||
| 1198 | -// )); | ||
| 1199 | -// } | ||
| 1200 | - | ||
| 1201 | -// tableToTableList(TableListReserve table) { | ||
| 1202 | -// TableList _tableList = TableList( | ||
| 1203 | -// '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', ''); | ||
| 1204 | -// _tableList.id = table.id; | ||
| 1205 | -// _tableList.rid = table.rid; | ||
| 1206 | -// _tableList.tid = table.tid; | ||
| 1207 | -// _tableList.name = table.name; | ||
| 1208 | -// _tableList.tablePnum = table.tablePnum; | ||
| 1209 | -// _tableList.sellerid = null; | ||
| 1210 | -// _tableList.qrcode = null; | ||
| 1211 | -// _tableList.mostPnum = table.mostPnum; | ||
| 1212 | -// _tableList.hot = null; | ||
| 1213 | -// _tableList.orderO = table.orderO; | ||
| 1214 | -// _tableList.status = table.status; | ||
| 1215 | -// _tableList.enable = table.enable; | ||
| 1216 | -// _tableList.spell = table.spell; | ||
| 1217 | -// _tableList.cdate = null; | ||
| 1218 | -// _tableList.rname = table.reserver; | ||
| 1219 | -// _tableList.regionName = table.reserver; | ||
| 1220 | -// _tableList.selected = true; | ||
| 1221 | -// return _tableList; | ||
| 1222 | -// } | ||
| 1223 | -// } | 1 | +import 'dart:ffi'; |
| 2 | + | ||
| 3 | +import 'package:common_utils/common_utils.dart'; | ||
| 4 | +import 'package:dotted_border/dotted_border.dart'; | ||
| 5 | +import 'package:flutter/material.dart'; | ||
| 6 | +import 'package:flutter_screenutil/flutter_screenutil.dart'; | ||
| 7 | +import 'package:one_key/constant/state.dart'; | ||
| 8 | +import 'package:one_key/models/area.dart'; | ||
| 9 | +import 'package:one_key/models/notebook.dart'; | ||
| 10 | +import 'package:one_key/models/tableOuter.dart'; | ||
| 11 | +import 'package:one_key/models/table_list.dart'; | ||
| 12 | +import 'package:one_key/pages/table/area_item_table.dart'; | ||
| 13 | +import 'package:one_key/pages/table/area_item_table_or_reserve.dart'; | ||
| 14 | +import 'package:one_key/provider/choose_table_model.dart'; | ||
| 15 | +import 'package:one_key/provider/notebook_detail_change_model.dart'; | ||
| 16 | +import 'package:one_key/provider/notebook_model.dart'; | ||
| 17 | +import 'package:one_key/provider/user_model.dart'; | ||
| 18 | +import 'package:one_key/res/colors.dart'; | ||
| 19 | +import 'package:one_key/utils/dialog_util.dart'; | ||
| 20 | +import 'package:one_key/utils/utils.dart'; | ||
| 21 | +import 'package:one_key/widgets/MyDivider.dart'; | ||
| 22 | +import 'package:one_key/widgets/app_bar.dart'; | ||
| 23 | +import 'package:one_key/widgets/area_item.dart'; | ||
| 24 | +import 'package:one_key/widgets/common_button.dart'; | ||
| 25 | +import 'package:one_key/widgets/f_table_item.dart'; | ||
| 26 | +import 'package:one_key/widgets/h_empty_view.dart'; | ||
| 27 | +import 'package:one_key/widgets/page_exception.dart'; | ||
| 28 | +import 'package:one_key/widgets/table_item.dart'; | ||
| 29 | + | ||
| 30 | +import 'package:one_key/widgets/v_empty_view.dart'; | ||
| 31 | +import 'package:provider/provider.dart'; | ||
| 32 | +import 'dart:convert' as convert; | ||
| 33 | + | ||
| 34 | +import '../../models/get_board_model.dart'; | ||
| 35 | +import '../../models/table_or_reserve_model.dart'; | ||
| 36 | +import '../../models/table_or_reserve_model.dart'; | ||
| 37 | +import '../../models/table_or_reserve_model.dart'; | ||
| 38 | +import '../../models/table_or_reserve_model.dart'; | ||
| 39 | +import '../../provider/table_manage_model_or_reserve.dart'; | ||
| 40 | +import '../table/table_item_or_reserve.dart'; | ||
| 41 | + | ||
| 42 | +class SelectTableFPageOrReserve extends StatefulWidget { | ||
| 43 | + final String rid; //预订id | ||
| 44 | + final DateTime dateTime; //日期 | ||
| 45 | + final String ddate_slot; //时段 | ||
| 46 | + final bool canChoose; //变更预订可以取消原来已预订的选中状态 | ||
| 47 | + final List<TableListReserve> tableList; | ||
| 48 | + final String fromPage; | ||
| 49 | + final String tid; | ||
| 50 | + final String hmS; | ||
| 51 | + final String hmE; | ||
| 52 | + final String source; | ||
| 53 | + final String ridFeast; //宴会id | ||
| 54 | + SelectTableFPageOrReserve(this.rid, this.dateTime, this.ddate_slot, | ||
| 55 | + {this.canChoose = false, | ||
| 56 | + this.tableList, | ||
| 57 | + this.fromPage, | ||
| 58 | + this.tid, | ||
| 59 | + this.hmS, | ||
| 60 | + this.hmE, | ||
| 61 | + this.source = '0', | ||
| 62 | + this.ridFeast}); | ||
| 63 | + | ||
| 64 | + @override | ||
| 65 | + State<StatefulWidget> createState() { | ||
| 66 | + // TODO: implement createState | ||
| 67 | + return new SelectTableFPageOrReserveState(); | ||
| 68 | + } | ||
| 69 | +} | ||
| 70 | + | ||
| 71 | +class SelectTableFPageOrReserveState extends State<SelectTableFPageOrReserve> { | ||
| 72 | + // List<Area> areas = []; //区域列表 | ||
| 73 | + // List<t.Table> selectTables = []; //选择的桌位 | ||
| 74 | + | ||
| 75 | + // List<TableOuter> tableOuterList = []; //区域-桌位列表 | ||
| 76 | + | ||
| 77 | + // Map<String, List<t.Table>> areaTableMap = {}; //区域-桌位Map | ||
| 78 | + | ||
| 79 | + ChooseTableModel _chooseTableModel; | ||
| 80 | + | ||
| 81 | + // Map<String, Notebook> tableMap = {}; //记录已预订桌位对应的订单 | ||
| 82 | + | ||
| 83 | + // String currentArea; //当前选中区域 | ||
| 84 | + List<String> personNumList = []; | ||
| 85 | + | ||
| 86 | + int selectNum = 0; | ||
| 87 | + // bool isSelected = true; //全部按钮 | ||
| 88 | + int _selectNumber = 0; | ||
| 89 | + // Map dailyMap = {}; // 早市对应半点钟,午市对应半点钟、晚市对应半点钟 | ||
| 90 | + List<Notebook> noteBooks; | ||
| 91 | + | ||
| 92 | + TableManagerModelOrReserve tableManagerModel; | ||
| 93 | + bool swichState = false; //仅看空座 | ||
| 94 | + | ||
| 95 | + @override | ||
| 96 | + void initState() { | ||
| 97 | + // TODO: implement initState | ||
| 98 | + super.initState(); | ||
| 99 | + for (int i = 1; i < 31; i++) { | ||
| 100 | + personNumList.add(i.toString()); | ||
| 101 | + } | ||
| 102 | + // initDateHourMinuteList(context); | ||
| 103 | + | ||
| 104 | + WidgetsBinding.instance.addPostFrameCallback((_) { | ||
| 105 | + // getTableList(); | ||
| 106 | + _getTableListOrReserve(); | ||
| 107 | + }); | ||
| 108 | + } | ||
| 109 | + | ||
| 110 | + /// | ||
| 111 | + _getTableListOrReserve() async { | ||
| 112 | + await tableManagerModel.getTableListOrReserve( | ||
| 113 | + context, int.parse(widget.ddate_slot), widget.dateTime, _selectNumber); | ||
| 114 | + tableManagerModel.tablesOrReserveDataShow.forEach((element) { | ||
| 115 | + element.tableList.forEach((element) { | ||
| 116 | + element.selected = false; | ||
| 117 | + for (var table in widget.tableList) { | ||
| 118 | + if (element.id == table.id) { | ||
| 119 | + element.selected = true; | ||
| 120 | + selectNum++; | ||
| 121 | + tableManagerModel.selectTablesOrReserve.add(element); | ||
| 122 | + } | ||
| 123 | + } | ||
| 124 | + }); | ||
| 125 | + }); | ||
| 126 | + tableManagerModel.notifyListeners(); | ||
| 127 | + } | ||
| 128 | + | ||
| 129 | + Widget item(int i) { | ||
| 130 | + return GridView.builder( | ||
| 131 | + // controller: _areaController, | ||
| 132 | + // physics: NeverScrollableScrollPhysics(), | ||
| 133 | + padding: EdgeInsets.symmetric( | ||
| 134 | + vertical: ScreenUtil().setWidth(20), | ||
| 135 | + horizontal: ScreenUtil().setWidth(10)), | ||
| 136 | + shrinkWrap: true, | ||
| 137 | + | ||
| 138 | + itemCount: | ||
| 139 | + tableManagerModel.tablesOrReserveDataShow[i].tableList.length == 0 | ||
| 140 | + ? 1 | ||
| 141 | + : tableManagerModel.tablesOrReserveDataShow[i].tableList.length + | ||
| 142 | + 1, | ||
| 143 | + gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( | ||
| 144 | + crossAxisCount: 4, | ||
| 145 | + childAspectRatio: 1, | ||
| 146 | + mainAxisSpacing: ScreenUtil().setWidth(30), | ||
| 147 | + crossAxisSpacing: ScreenUtil().setWidth(12), | ||
| 148 | + ), | ||
| 149 | + | ||
| 150 | + itemBuilder: (BuildContext context, int index) { | ||
| 151 | + if (index == | ||
| 152 | + tableManagerModel.tablesOrReserveDataShow[i].tableList.length || | ||
| 153 | + tableManagerModel.tablesOrReserveDataShow[i].tableList.length == | ||
| 154 | + 0) { | ||
| 155 | + return InkWell( | ||
| 156 | + onTap: () async { | ||
| 157 | + List<String> areasTemp = []; | ||
| 158 | + | ||
| 159 | + for (int i = 0; | ||
| 160 | + i < tableManagerModel.tablesOrReserveDataShow.length; | ||
| 161 | + i++) { | ||
| 162 | + areasTemp | ||
| 163 | + .add(tableManagerModel.tablesOrReserveDataShow[i].name); | ||
| 164 | + } | ||
| 165 | + | ||
| 166 | + //添加桌位弹框 | ||
| 167 | + await DialogUtil.openCreateTableDialog( | ||
| 168 | + context, areasTemp, i, personNumList, | ||
| 169 | + onTap: (Map<String, String> value) async { | ||
| 170 | + print(value); | ||
| 171 | + // 'areaname': | ||
| 172 | + // areas[currentAreaIndex], | ||
| 173 | + // 'name': controller.text, | ||
| 174 | + // 'pnumMin': pnumMin, | ||
| 175 | + // 'pnumMax': pnumMax | ||
| 176 | + //添加桌位 接口参数带整合??? | ||
| 177 | + // 以下是旧的不去,明天添加桌位接口 | ||
| 178 | + String rid; | ||
| 179 | + for (TableListReseveSunModel item | ||
| 180 | + in tableManagerModel.tablesOrReserveDataShow) { | ||
| 181 | + if (item.name == value['areaname']) { | ||
| 182 | + rid = item.id; | ||
| 183 | + } | ||
| 184 | + } | ||
| 185 | + Map<String, String> params = { | ||
| 186 | + 'rid': rid, | ||
| 187 | + 'name': value['name'], | ||
| 188 | + }; | ||
| 189 | + if (value['pnumMin'] != '') { | ||
| 190 | + params['pnum'] = value['pnumMin']; | ||
| 191 | + } | ||
| 192 | + if (value['pnumMax'] != '') { | ||
| 193 | + params['most_pnum'] = value['pnumMax']; | ||
| 194 | + } | ||
| 195 | + bool success = | ||
| 196 | + await _chooseTableModel.addTable(context, params); | ||
| 197 | + print(success); | ||
| 198 | + if (success) { | ||
| 199 | + Utils.showToast('添加成功!'); | ||
| 200 | + | ||
| 201 | + _getTableListOrReserve(); | ||
| 202 | + } | ||
| 203 | + }); | ||
| 204 | + }, | ||
| 205 | + child: Container( | ||
| 206 | + child: DottedBorder( | ||
| 207 | + dashPattern: [5, 5, 5, 5], | ||
| 208 | + borderType: BorderType.RRect, | ||
| 209 | + radius: Radius.circular(ScreenUtil().setWidth(20)), | ||
| 210 | + // padding: EdgeInsets.all(ScreenUtil().setWidth(70)), | ||
| 211 | + color: MyColours.color_E0E0E0, | ||
| 212 | + strokeWidth: ScreenUtil().setWidth(2), | ||
| 213 | + child: ClipRRect( | ||
| 214 | + borderRadius: BorderRadius.all( | ||
| 215 | + Radius.circular(ScreenUtil().setWidth(20))), | ||
| 216 | + child: Container( | ||
| 217 | + height: ScreenUtil().screenWidth - | ||
| 218 | + ScreenUtil().setWidth(12 * 3 - 10 * 2), | ||
| 219 | + width: ScreenUtil().screenWidth - | ||
| 220 | + ScreenUtil().setWidth(12 * 3 - 10 * 2), | ||
| 221 | + child: Column( | ||
| 222 | + mainAxisAlignment: MainAxisAlignment.center, | ||
| 223 | + children: [ | ||
| 224 | + Image.asset(Utils.getImgPath('add_store'), | ||
| 225 | + width: ScreenUtil().setWidth(32)), | ||
| 226 | + ], | ||
| 227 | + ), | ||
| 228 | + ), | ||
| 229 | + ), | ||
| 230 | + ))); | ||
| 231 | + } else { | ||
| 232 | + TableListReserve data = | ||
| 233 | + tableManagerModel.tablesOrReserveDataShow[i].tableList[index]; | ||
| 234 | + return Selector<TableManagerModelOrReserve, TableListReserve>( | ||
| 235 | + shouldRebuild: (pre, next) => true, | ||
| 236 | + selector: (context, model) => data, | ||
| 237 | + builder: (context, table, _) { | ||
| 238 | + return TableItemOrReserve(table, | ||
| 239 | + canSelected: true, | ||
| 240 | + selectTables: tableManagerModel.selectTablesOrReserve, | ||
| 241 | + onSelected: (tableListReserve) { | ||
| 242 | + if (widget.fromPage == 'tablePhoto') { | ||
| 243 | + for (TableListReseveSunModel item | ||
| 244 | + in tableManagerModel.tablesOrReserveDataShow) { | ||
| 245 | + for (TableListReserve element in item.tableList) { | ||
| 246 | + element.selected = false; | ||
| 247 | + selectNum = 0; | ||
| 248 | + if (table.id == item.id) { | ||
| 249 | + element.selected = true; | ||
| 250 | + tableManagerModel.selectTablesOrReserve = []; | ||
| 251 | + selectNum++; | ||
| 252 | + tableManagerModel.selectTablesOrReserve.add(table); | ||
| 253 | + } | ||
| 254 | + } | ||
| 255 | + } | ||
| 256 | + | ||
| 257 | + setState(() {}); | ||
| 258 | + } else { | ||
| 259 | + if ((table as TableListReserve).selected) { | ||
| 260 | + tableManagerModel.selectTablesOrReserve.add(table); | ||
| 261 | + selectNum++; | ||
| 262 | + widget.tableList.add(table); | ||
| 263 | + } else { | ||
| 264 | + widget.tableList.removeWhere((t) => t.id == table.id); | ||
| 265 | + selectNum--; | ||
| 266 | + tableManagerModel.selectTablesOrReserve | ||
| 267 | + .removeWhere((t) => t.id == table.id); | ||
| 268 | + } | ||
| 269 | + setState(() {}); | ||
| 270 | + } | ||
| 271 | + }, fromPage: widget.fromPage, rid: widget.rid); | ||
| 272 | + }, | ||
| 273 | + ); | ||
| 274 | + } | ||
| 275 | + }, | ||
| 276 | + ); | ||
| 277 | + } | ||
| 278 | + | ||
| 279 | + @override | ||
| 280 | + Widget build(BuildContext context) { | ||
| 281 | + _chooseTableModel = Provider.of<ChooseTableModel>(context); | ||
| 282 | + tableManagerModel = | ||
| 283 | + Provider.of<TableManagerModelOrReserve>(context, listen: true); | ||
| 284 | + return Scaffold( | ||
| 285 | + body: SafeArea( | ||
| 286 | + child: Column( | ||
| 287 | + children: <Widget>[ | ||
| 288 | + MyAppBar( | ||
| 289 | + "选择桌位", | ||
| 290 | + showBack: true, | ||
| 291 | + ), | ||
| 292 | + Expanded( | ||
| 293 | + child: Consumer<TableManagerModelOrReserve>( | ||
| 294 | + builder: (context, model, child) { | ||
| 295 | + if (model.pageStateOrReserve != PageState.Success) { | ||
| 296 | + Expanded( | ||
| 297 | + child: ExceptionPage( | ||
| 298 | + pageState: model.pageStateOrReserve, | ||
| 299 | + callback: () { | ||
| 300 | + tableManagerModel.getTableListOrReserve(context, | ||
| 301 | + int.parse(widget.ddate_slot), widget.dateTime, _selectNumber, | ||
| 302 | + showLoading: true); | ||
| 303 | + }, | ||
| 304 | + emptyMsg: "暂时没有桌位哦", | ||
| 305 | + emptyImg: "empty_search", | ||
| 306 | + showMsg: "加载中,请稍后...", | ||
| 307 | + )); | ||
| 308 | + } else { | ||
| 309 | + return Column( | ||
| 310 | + // crossAxisAlignment: CrossAxisAlignment.center, | ||
| 311 | + children: [ | ||
| 312 | + Container( | ||
| 313 | + color: MyColours.color_ffffff, | ||
| 314 | + height: ScreenUtil().setWidth(92), | ||
| 315 | + margin: | ||
| 316 | + EdgeInsets.only(bottom: ScreenUtil().setWidth(30)), | ||
| 317 | + child: Row( | ||
| 318 | + children: [ | ||
| 319 | + HEmptyView(20), | ||
| 320 | + Expanded( | ||
| 321 | + child: ListView.builder( | ||
| 322 | + itemCount: tableManagerModel | ||
| 323 | + .tablesOrReserveDataShow | ||
| 324 | + .length == | ||
| 325 | + 0 | ||
| 326 | + ? 1 | ||
| 327 | + : tableManagerModel | ||
| 328 | + .tablesOrReserveDataShow | ||
| 329 | + .length + | ||
| 330 | + 1, | ||
| 331 | + shrinkWrap: true, | ||
| 332 | + scrollDirection: Axis.horizontal, | ||
| 333 | + itemBuilder: | ||
| 334 | + (BuildContext contxt, int index) { | ||
| 335 | + if (index == | ||
| 336 | + tableManagerModel | ||
| 337 | + .tablesOrReserveDataShow | ||
| 338 | + .length || | ||
| 339 | + tableManagerModel | ||
| 340 | + .tablesOrReserveDataShow | ||
| 341 | + .length == | ||
| 342 | + 0) { | ||
| 343 | + return InkWell( | ||
| 344 | + onTap: () async { | ||
| 345 | + //添加区域弹框 | ||
| 346 | + await DialogUtil | ||
| 347 | + .openCreateAreaDialog(context, | ||
| 348 | + onTap: (value) async { | ||
| 349 | + print(value); | ||
| 350 | + //添加区域 | ||
| 351 | + bool success = | ||
| 352 | + await _chooseTableModel | ||
| 353 | + .addTableAreas( | ||
| 354 | + context, value); | ||
| 355 | + print(success); | ||
| 356 | + if (success) { | ||
| 357 | + Utils.showToast('添加成功!'); | ||
| 358 | + tableManagerModel | ||
| 359 | + .getTableListOrReserve( | ||
| 360 | + context, | ||
| 361 | + int.parse( | ||
| 362 | + widget.ddate_slot), | ||
| 363 | + widget.dateTime, | ||
| 364 | + _selectNumber, | ||
| 365 | + showLoading: true); | ||
| 366 | + // UserModel userModel = | ||
| 367 | + // Provider.of<UserModel>(context, | ||
| 368 | + // listen: false); | ||
| 369 | + // Map<String, String> params = { | ||
| 370 | + // "sellerid": userModel.user.sellerid | ||
| 371 | + // }; | ||
| 372 | + // await _chooseTableModel.getTableList( | ||
| 373 | + // context, params, | ||
| 374 | + // needLoading: false); | ||
| 375 | + // initData(); | ||
| 376 | + | ||
| 377 | + } | ||
| 378 | + }); | ||
| 379 | + }, | ||
| 380 | + child: Column( | ||
| 381 | + children: [ | ||
| 382 | + VEmptyView(20), | ||
| 383 | + DottedBorder( | ||
| 384 | + dashPattern: [5, 5, 5, 5], | ||
| 385 | + borderType: BorderType.RRect, | ||
| 386 | + radius: Radius.circular( | ||
| 387 | + ScreenUtil().setWidth(10)), | ||
| 388 | + // padding: EdgeInsets.all(ScreenUtil().setWidth(70)), | ||
| 389 | + color: MyColours.color_199095, | ||
| 390 | + strokeWidth: | ||
| 391 | + ScreenUtil().setWidth(2), | ||
| 392 | + child: ClipRRect( | ||
| 393 | + borderRadius: BorderRadius | ||
| 394 | + .all(Radius.circular( | ||
| 395 | + ScreenUtil() | ||
| 396 | + .setWidth(10))), | ||
| 397 | + child: Container( | ||
| 398 | + height: ScreenUtil() | ||
| 399 | + .setWidth(25 * 2), | ||
| 400 | + width: ScreenUtil() | ||
| 401 | + .setWidth(104 * 2), | ||
| 402 | + child: Column( | ||
| 403 | + mainAxisAlignment: | ||
| 404 | + MainAxisAlignment | ||
| 405 | + .center, | ||
| 406 | + children: [ | ||
| 407 | + Image.asset( | ||
| 408 | + Utils.getImgPath( | ||
| 409 | + 'add_area'), | ||
| 410 | + width: ScreenUtil() | ||
| 411 | + .setWidth(24)), | ||
| 412 | + ], | ||
| 413 | + ), | ||
| 414 | + ), | ||
| 415 | + ), | ||
| 416 | + ) | ||
| 417 | + ], | ||
| 418 | + ), | ||
| 419 | + ); | ||
| 420 | + } else { | ||
| 421 | + return AreaItemTableOrReserve( | ||
| 422 | + tableManagerModel | ||
| 423 | + .tablesOrReserveDataShow[index], | ||
| 424 | + (area) { | ||
| 425 | + tableManagerModel | ||
| 426 | + .tablesOrReserveDataShow | ||
| 427 | + .forEach((element) { | ||
| 428 | + element.select = false; | ||
| 429 | + }); | ||
| 430 | + setState(() { | ||
| 431 | + // isSelected = false; | ||
| 432 | + area.select = true; | ||
| 433 | + _selectNumber = index; | ||
| 434 | + }); | ||
| 435 | + }); | ||
| 436 | + } | ||
| 437 | + })), | ||
| 438 | + InkWell( | ||
| 439 | + onTap: () { | ||
| 440 | + setState(() { | ||
| 441 | + swichState = !swichState; | ||
| 442 | + }); | ||
| 443 | + if (swichState) { | ||
| 444 | + //把没有预订和宴会的桌子筛选出来显示 | ||
| 445 | + | ||
| 446 | + model.tablesOrReserveData.forEach((element) { | ||
| 447 | + if (element.tableList != null && | ||
| 448 | + element.tableList.length > 0) { | ||
| 449 | + List<TableListReserve> tableList = []; | ||
| 450 | + element.tableList.forEach((element1) { | ||
| 451 | + if (element1.reserveList == | ||
| 452 | + null && | ||
| 453 | + (element1.banquetList == | ||
| 454 | + null || | ||
| 455 | + element1.banquetList | ||
| 456 | + .length == | ||
| 457 | + 0)) { | ||
| 458 | + //空桌子 | ||
| 459 | + tableList.add(element1); | ||
| 460 | + } | ||
| 461 | + }); | ||
| 462 | + | ||
| 463 | + model | ||
| 464 | + .tablesOrReserveDataShow[model | ||
| 465 | + .tablesOrReserveDataShow | ||
| 466 | + .indexWhere((elementShow) => | ||
| 467 | + elementShow.id == element.id)] | ||
| 468 | + .tableList = tableList; | ||
| 469 | + } | ||
| 470 | + }); | ||
| 471 | + } else { | ||
| 472 | + // model.tablesOrReserveDataShow = | ||
| 473 | + // model.tablesOrReserveData.toList(); | ||
| 474 | + tableManagerModel.getTableListOrReserve( | ||
| 475 | + context, | ||
| 476 | + int.parse(widget.ddate_slot), | ||
| 477 | + widget.dateTime, | ||
| 478 | + _selectNumber, | ||
| 479 | + showLoading: true); | ||
| 480 | + } | ||
| 481 | + | ||
| 482 | + setState(() {}); | ||
| 483 | + }, | ||
| 484 | + child: Container( | ||
| 485 | + margin: EdgeInsets.only( | ||
| 486 | + top: ScreenUtil().setWidth(20), | ||
| 487 | + ), | ||
| 488 | + child: Row( | ||
| 489 | + children: [ | ||
| 490 | + MyDivider(ScreenUtil().setWidth(15), | ||
| 491 | + ScreenUtil().setWidth(80), | ||
| 492 | + color: MyColours.color_F1F0F4), | ||
| 493 | + MyDivider(ScreenUtil().setWidth(2), | ||
| 494 | + ScreenUtil().setWidth(80), | ||
| 495 | + color: MyColours.color_9C9C9C), | ||
| 496 | + HEmptyView(30), | ||
| 497 | + Image.asset( | ||
| 498 | + swichState | ||
| 499 | + ? Utils.getImgPath('f_swich_on') | ||
| 500 | + : Utils.getImgPath('f_swich_off'), | ||
| 501 | + width: ScreenUtil().setWidth(90), | ||
| 502 | + // height: ScreenUtil().setWidth(82), | ||
| 503 | + ), | ||
| 504 | + HEmptyView(20), | ||
| 505 | + Text( | ||
| 506 | + '仅看\n空座', | ||
| 507 | + style: TextStyle( | ||
| 508 | + fontSize: ScreenUtil().setSp(28), | ||
| 509 | + color: MyColours.color_333333, | ||
| 510 | + ), | ||
| 511 | + ), | ||
| 512 | + HEmptyView(40) | ||
| 513 | + ], | ||
| 514 | + )), | ||
| 515 | + ) | ||
| 516 | + ], | ||
| 517 | + ), | ||
| 518 | + ), | ||
| 519 | + Expanded( | ||
| 520 | + flex: 2, | ||
| 521 | + child: Container( | ||
| 522 | + constraints: BoxConstraints( | ||
| 523 | + minHeight: ScreenUtil().setWidth(100)), | ||
| 524 | + color: Color.fromRGBO(249, 249, 249, 1), | ||
| 525 | + child: item(_selectNumber))), | ||
| 526 | + Container( | ||
| 527 | + width: double.infinity, | ||
| 528 | + height: ScreenUtil().setHeight(84), | ||
| 529 | + margin: EdgeInsets.only( | ||
| 530 | + bottom: ScreenUtil().setWidth(50)), | ||
| 531 | + padding: EdgeInsets.symmetric( | ||
| 532 | + horizontal: ScreenUtil().setWidth(31)), | ||
| 533 | + alignment: Alignment.center, | ||
| 534 | + color: MyColours.color_ffffff, | ||
| 535 | + child: CommonButton( | ||
| 536 | + // content: widget.fromPage == 'tablePhoto' | ||
| 537 | + // ? '确定' | ||
| 538 | + // : "已选${selectNum}个 确定", | ||
| 539 | + content: '确定', | ||
| 540 | + width: 300, | ||
| 541 | + height: 84, | ||
| 542 | + fontSize: 34, | ||
| 543 | + state: 1, | ||
| 544 | + onPress: () { | ||
| 545 | + if (widget.fromPage == "tablePhoto") { | ||
| 546 | + Map temp = { | ||
| 547 | + 'tid': tableManagerModel | ||
| 548 | + .selectTablesOrReserve.length > | ||
| 549 | + 0 | ||
| 550 | + ? tableManagerModel | ||
| 551 | + .selectTablesOrReserve[0].id | ||
| 552 | + : '', | ||
| 553 | + 'tname': tableManagerModel | ||
| 554 | + .selectTablesOrReserve.length > | ||
| 555 | + 0 | ||
| 556 | + ? tableManagerModel | ||
| 557 | + .selectTablesOrReserve[0].name | ||
| 558 | + : '' | ||
| 559 | + }; | ||
| 560 | + Navigator.of(context).pop(temp); | ||
| 561 | + } else { | ||
| 562 | + if (widget.canChoose) { | ||
| 563 | + // if (widget.tableList.length > 0) { | ||
| 564 | + String tid = ""; | ||
| 565 | + for (TableListReserve table | ||
| 566 | + in widget.tableList) { | ||
| 567 | + tid += table.id + ","; | ||
| 568 | + } | ||
| 569 | + if (widget.tableList.length > 0) { | ||
| 570 | + tid = tid.substring(0, tid.length - 1); | ||
| 571 | + } | ||
| 572 | + | ||
| 573 | + Map temp = { | ||
| 574 | + 'object': widget.tableList, | ||
| 575 | + 'tid': tid | ||
| 576 | + }; | ||
| 577 | + Navigator.of(context).pop(temp); | ||
| 578 | + // } | ||
| 579 | + } else { | ||
| 580 | + if (tableManagerModel | ||
| 581 | + .selectTablesOrReserve.length > | ||
| 582 | + 0) { | ||
| 583 | + String tid = ""; | ||
| 584 | + for (TableListReserve table | ||
| 585 | + in tableManagerModel | ||
| 586 | + .selectTablesOrReserve) { | ||
| 587 | + tid += table.id + ","; | ||
| 588 | + } | ||
| 589 | + if (tableManagerModel | ||
| 590 | + .selectTablesOrReserve.length > | ||
| 591 | + 0) { | ||
| 592 | + tid = tid.substring(0, tid.length - 1); | ||
| 593 | + } | ||
| 594 | + | ||
| 595 | + Map temp = { | ||
| 596 | + 'object': widget.tableList, | ||
| 597 | + 'tid': tid | ||
| 598 | + }; | ||
| 599 | + Navigator.of(context).pop(temp); | ||
| 600 | + } | ||
| 601 | + } | ||
| 602 | + } | ||
| 603 | + }, | ||
| 604 | + )), | ||
| 605 | + ]); | ||
| 606 | + } | ||
| 607 | + }), | ||
| 608 | + ), | ||
| 609 | + ], | ||
| 610 | + ), | ||
| 611 | + )); | ||
| 612 | + } | ||
| 613 | + | ||
| 614 | + // tableToTableList(TableListReserve table) { | ||
| 615 | + // TableList _tableList = TableList( | ||
| 616 | + // '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', ''); | ||
| 617 | + // _tableList.id = table.id; | ||
| 618 | + // _tableList.rid = table.rid; | ||
| 619 | + // _tableList.tid = table.tid; | ||
| 620 | + // _tableList.name = table.name; | ||
| 621 | + // _tableList.tablePnum = table.tablePnum; | ||
| 622 | + // _tableList.sellerid = null; | ||
| 623 | + // _tableList.qrcode = null; | ||
| 624 | + // _tableList.mostPnum = table.mostPnum; | ||
| 625 | + // _tableList.hot = null; | ||
| 626 | + // _tableList.orderO = table.orderO; | ||
| 627 | + // _tableList.status = table.status; | ||
| 628 | + // _tableList.enable = table.enable; | ||
| 629 | + // _tableList.spell = table.spell; | ||
| 630 | + // _tableList.cdate = null; | ||
| 631 | + // _tableList.rname = table.reserver; | ||
| 632 | + // _tableList.regionName = table.reserver; | ||
| 633 | + // _tableList.selected = true; | ||
| 634 | + // return _tableList; | ||
| 635 | + // } | ||
| 636 | +} |
| @@ -373,7 +373,7 @@ class _InvicationAdditionPageState extends State<InvicationAdditionPage> { | @@ -373,7 +373,7 @@ class _InvicationAdditionPageState extends State<InvicationAdditionPage> { | ||
| 373 | ), | 373 | ), |
| 374 | // textAlignVertical: TextAlignVertical.center, | 374 | // textAlignVertical: TextAlignVertical.center, |
| 375 | maxLines: 5, | 375 | maxLines: 5, |
| 376 | - maxLength: 50, | 376 | + maxLength: 200, |
| 377 | // inputFormatters: [ | 377 | // inputFormatters: [ |
| 378 | // LengthLimitingTextInputFormatter(10), // 设置输入长度限制 | 378 | // LengthLimitingTextInputFormatter(10), // 设置输入长度限制 |
| 379 | // ], | 379 | // ], |
| @@ -563,10 +563,10 @@ class _InvicationAdditionPageState extends State<InvicationAdditionPage> { | @@ -563,10 +563,10 @@ class _InvicationAdditionPageState extends State<InvicationAdditionPage> { | ||
| 563 | maxLines: 1, | 563 | maxLines: 1, |
| 564 | inputFormatters: [ | 564 | inputFormatters: [ |
| 565 | LengthLimitingTextInputFormatter( | 565 | LengthLimitingTextInputFormatter( |
| 566 | - 10), // 设置输入长度限制 | 566 | + 15), // 设置输入长度限制 |
| 567 | ], | 567 | ], |
| 568 | decoration: InputDecoration( | 568 | decoration: InputDecoration( |
| 569 | - hintText: "点击输入区域标题(不超过10个字)", | 569 | + hintText: "点击输入区域标题(不超过15个字)", |
| 570 | hintStyle: TextStyle( | 570 | hintStyle: TextStyle( |
| 571 | color: MyColours.color_999999, | 571 | color: MyColours.color_999999, |
| 572 | fontSize: ScreenUtil().setSp(32), | 572 | fontSize: ScreenUtil().setSp(32), |
| @@ -3251,7 +3251,7 @@ class InvicationPageState extends State<InvicationPage> | @@ -3251,7 +3251,7 @@ class InvicationPageState extends State<InvicationPage> | ||
| 3251 | Provider.of<UserModel>(context, listen: false); | 3251 | Provider.of<UserModel>(context, listen: false); |
| 3252 | if (Utils.getAuthority(context, '变更预订') || | 3252 | if (Utils.getAuthority(context, '变更预订') || |
| 3253 | detailEntity.uid == userModel.user.openid) { | 3253 | detailEntity.uid == userModel.user.openid) { |
| 3254 | - NavigatorUtil.goNoteBookChangeFPage( | 3254 | + NavigatorUtil.goNoteBookChangeFPageOnly( |
| 3255 | context, detailEntity, widget.rid, | 3255 | context, detailEntity, widget.rid, |
| 3256 | back: true); | 3256 | back: true); |
| 3257 | } | 3257 | } |
| @@ -155,7 +155,7 @@ class TableItemOrReserveState extends State<TableItemOrReserve> { | @@ -155,7 +155,7 @@ class TableItemOrReserveState extends State<TableItemOrReserve> { | ||
| 155 | return; | 155 | return; |
| 156 | } | 156 | } |
| 157 | //从变更页面进来 canChoose = true | 157 | //从变更页面进来 canChoose = true |
| 158 | - if (widget.canSelected && table.signStr.isEmpty) { | 158 | + if (widget.canSelected && table.signStr== null) { |
| 159 | setState(() { | 159 | setState(() { |
| 160 | table.selected = !(table.selected ?? false); | 160 | table.selected = !(table.selected ?? false); |
| 161 | }); | 161 | }); |
| @@ -185,7 +185,7 @@ class TableItemOrReserveState extends State<TableItemOrReserve> { | @@ -185,7 +185,7 @@ class TableItemOrReserveState extends State<TableItemOrReserve> { | ||
| 185 | } | 185 | } |
| 186 | } else if (widget.fromPage == 'new' && | 186 | } else if (widget.fromPage == 'new' && |
| 187 | widget.canSelected && | 187 | widget.canSelected && |
| 188 | - table.signStr.isEmpty) { | 188 | + table.signStr == null) { |
| 189 | if (islock && table.signStr != '已预订') { | 189 | if (islock && table.signStr != '已预订') { |
| 190 | return; | 190 | return; |
| 191 | } | 191 | } |
| @@ -3905,8 +3905,11 @@ class TableManagerPageState extends State<TableManagerPage> { | @@ -3905,8 +3905,11 @@ class TableManagerPageState extends State<TableManagerPage> { | ||
| 3905 | .forEach((element1) { | 3905 | .forEach((element1) { |
| 3906 | if (element1.reserveList == | 3906 | if (element1.reserveList == |
| 3907 | null && | 3907 | null && |
| 3908 | - element1.banquetList == | ||
| 3909 | - null) { | 3908 | + (element1.banquetList == |
| 3909 | + null || | ||
| 3910 | + element1.banquetList | ||
| 3911 | + .length == | ||
| 3912 | + 0)) { | ||
| 3910 | //空桌子 | 3913 | //空桌子 |
| 3911 | tableList.add(element1); | 3914 | tableList.add(element1); |
| 3912 | } | 3915 | } |
| @@ -3921,12 +3924,23 @@ class TableManagerPageState extends State<TableManagerPage> { | @@ -3921,12 +3924,23 @@ class TableManagerPageState extends State<TableManagerPage> { | ||
| 3921 | .tableList = tableList; | 3924 | .tableList = tableList; |
| 3922 | } | 3925 | } |
| 3923 | }); | 3926 | }); |
| 3927 | + setState(() {}); | ||
| 3924 | } else { | 3928 | } else { |
| 3925 | - model.tablesOrReserveDataShow = | ||
| 3926 | - model.tablesOrReserveData.toList(); | 3929 | + tableManagerModel.getTableListOrReserve( |
| 3930 | + context, | ||
| 3931 | + currTimeIndex, | ||
| 3932 | + dateTime, | ||
| 3933 | + selectNumber); | ||
| 3934 | + // model.tablesOrReserveDataShow = []; | ||
| 3935 | + // model.tablesOrReserveData | ||
| 3936 | + // .forEach((element) { | ||
| 3937 | + // model.tablesOrReserveDataShow.add( TableListReseveSunModel.fromJson( | ||
| 3938 | + // element.toJson())); | ||
| 3939 | + // }); | ||
| 3940 | + // model.tablesOrReserveDataShow = | ||
| 3941 | + // model.tablesOrReserveData.toList(); | ||
| 3927 | } | 3942 | } |
| 3928 | - | ||
| 3929 | - setState(() {}); | 3943 | + // print(model.tablesOrReserveDataShow); |
| 3930 | }, | 3944 | }, |
| 3931 | child: Container( | 3945 | child: Container( |
| 3932 | margin: EdgeInsets.only( | 3946 | margin: EdgeInsets.only( |
| @@ -345,13 +345,13 @@ class MarketingCenterProvider extends ChangeNotifier { | @@ -345,13 +345,13 @@ class MarketingCenterProvider extends ChangeNotifier { | ||
| 345 | 345 | ||
| 346 | // 获取商家订座配置 | 346 | // 获取商家订座配置 |
| 347 | Future<bool> getDzSellerConf(BuildContext context, | 347 | Future<bool> getDzSellerConf(BuildContext context, |
| 348 | - {bool showLoading = true}) async { | 348 | + {bool showLoading = true,bool selfDismiss = false}) async { |
| 349 | Map<String, String> params = { | 349 | Map<String, String> params = { |
| 350 | 'sid': Provider.of<UserModel>(context, listen: false).user.sellerid | 350 | 'sid': Provider.of<UserModel>(context, listen: false).user.sellerid |
| 351 | }; | 351 | }; |
| 352 | BaseResp<dynamic> baseResp = await DioUtil() | 352 | BaseResp<dynamic> baseResp = await DioUtil() |
| 353 | .request<dynamic>(context, Method.post, HttpUrl.get_dz_seller_conf, | 353 | .request<dynamic>(context, Method.post, HttpUrl.get_dz_seller_conf, |
| 354 | - data: params, showLoading: showLoading) | 354 | + data: params, showLoading: showLoading,selfDismiss: selfDismiss) |
| 355 | .catchError((error) { | 355 | .catchError((error) { |
| 356 | print(error.toString()); | 356 | print(error.toString()); |
| 357 | Utils.showToast('请求失败,请重试'); | 357 | Utils.showToast('请求失败,请重试'); |
| 1 | +import 'dart:convert'; | ||
| 2 | + | ||
| 3 | +import 'package:common_utils/common_utils.dart'; | ||
| 4 | +import 'package:flutter/material.dart'; | ||
| 5 | +import 'package:one_key/app.dart'; | ||
| 6 | +import 'package:one_key/constant/constant.dart'; | ||
| 7 | +import 'package:one_key/models/notebook_detail.dart'; | ||
| 8 | +import 'package:one_key/models/reserve_info_model.dart'; | ||
| 9 | +import 'package:one_key/models/seller_info.dart'; | ||
| 10 | +import 'package:one_key/models/table_list.dart'; | ||
| 11 | +import 'package:one_key/models/user_history_entity.dart'; | ||
| 12 | +import 'package:one_key/net/base_resp.dart'; | ||
| 13 | +import 'package:one_key/net/dio_util.dart'; | ||
| 14 | +import 'package:one_key/net/http_url.dart'; | ||
| 15 | +import 'package:one_key/provider/customer_provider.dart'; | ||
| 16 | +import 'package:one_key/provider/notebook_detail_model.dart'; | ||
| 17 | +import 'package:one_key/provider/user_model.dart'; | ||
| 18 | +import 'package:one_key/utils/utils.dart'; | ||
| 19 | +import 'package:provider/provider.dart'; | ||
| 20 | +import 'package:one_key/models/table.dart' as t; | ||
| 21 | + | ||
| 22 | +import '../constant/error.dart'; | ||
| 23 | +import '../models/is_exist_order_model.dart'; | ||
| 24 | +import '../models/tableOuter.dart'; | ||
| 25 | +import '../models/table_or_reserve_model.dart'; | ||
| 26 | + | ||
| 27 | +class NotebookDetailChangeModelOnly with ChangeNotifier { | ||
| 28 | + TextEditingController phoneController = TextEditingController(); //电话 | ||
| 29 | + TextEditingController nameController = TextEditingController(); //客户姓名 | ||
| 30 | + TextEditingController customController = TextEditingController(); //客户要求 | ||
| 31 | + List sexList = []; // 先生、女士、公司 | ||
| 32 | + | ||
| 33 | + NotebookDetail detailEntity; | ||
| 34 | + | ||
| 35 | + List<TableListReserve> tableListOrReserve = []; | ||
| 36 | + | ||
| 37 | + List<TableList> recommendList = []; //推荐列表 | ||
| 38 | + // bool isRecommend = false; //是否展示推荐 | ||
| 39 | + List oldTableList = []; | ||
| 40 | + | ||
| 41 | + List<UserHistoryEntity> userHistorys = []; //历史录入 | ||
| 42 | + | ||
| 43 | + clearData() { | ||
| 44 | + phoneController = TextEditingController(); //电话 | ||
| 45 | + nameController = TextEditingController(); //客户姓名 | ||
| 46 | + customController = TextEditingController(); //客户要求 | ||
| 47 | + sexList = []; // 先生、女士、公司 | ||
| 48 | + tableListOrReserve = []; | ||
| 49 | + } | ||
| 50 | + | ||
| 51 | + //构造函数,初始化 | ||
| 52 | + NotebookDetailChangeModelOnly(this.detailEntity) { | ||
| 53 | + // clearData(); | ||
| 54 | + print(detailEntity); | ||
| 55 | + if (detailEntity.phone != '0') { | ||
| 56 | + phoneController.text = detailEntity.phone; | ||
| 57 | + } | ||
| 58 | + if (detailEntity.rnameStr != '') { | ||
| 59 | + nameController.text = detailEntity.rname; | ||
| 60 | + } | ||
| 61 | + | ||
| 62 | + if (detailEntity.cusdem != '') { | ||
| 63 | + customController.text = detailEntity.cusdem; | ||
| 64 | + } | ||
| 65 | + | ||
| 66 | + _initSexList(); | ||
| 67 | + } | ||
| 68 | + | ||
| 69 | + // /// 初始化 早市、午市、晚市 | ||
| 70 | + // _initSunDateList(morning, noon, night) { | ||
| 71 | + // String ddateSolt = detailEntity.ddate_solt; | ||
| 72 | + // if (morning != '') { | ||
| 73 | + // sunDateList.add({ | ||
| 74 | + // 'dateText': '早市', | ||
| 75 | + // 'dayText': '', | ||
| 76 | + // 'ddateSolt': 1, | ||
| 77 | + // 'key': 'morning', | ||
| 78 | + // 'isSelect': ddateSolt == '1' ? true : false | ||
| 79 | + // }); | ||
| 80 | + // } | ||
| 81 | + // if (noon != '') { | ||
| 82 | + // sunDateList.add({ | ||
| 83 | + // 'dateText': '午市', | ||
| 84 | + // 'dayText': '', | ||
| 85 | + // 'ddateSolt': 2, | ||
| 86 | + // 'key': 'noon', | ||
| 87 | + // 'isSelect': ddateSolt == '2' ? true : false | ||
| 88 | + // }); | ||
| 89 | + // } | ||
| 90 | + // if (night != '') { | ||
| 91 | + // sunDateList.add({ | ||
| 92 | + // 'dateText': '晚市', | ||
| 93 | + // 'dayText': '', | ||
| 94 | + // 'ddateSolt': 3, | ||
| 95 | + // 'key': 'night', | ||
| 96 | + // 'isSelect': ddateSolt == '3' ? true : false | ||
| 97 | + // }); | ||
| 98 | + // } | ||
| 99 | + // // initHourAndMinuteSelect(); | ||
| 100 | + // notifyListeners(); | ||
| 101 | + // } | ||
| 102 | + | ||
| 103 | + ///称谓 | ||
| 104 | + _initSexList() { | ||
| 105 | + String sexStr = detailEntity.sex; | ||
| 106 | + sexList = [ | ||
| 107 | + { | ||
| 108 | + 'title': '先生', | ||
| 109 | + 'select': sexStr == '1' ? true : false, | ||
| 110 | + 'code': '1', | ||
| 111 | + 'hasLeftBorder': true | ||
| 112 | + }, | ||
| 113 | + { | ||
| 114 | + 'title': '女士', | ||
| 115 | + 'select': sexStr == '2' ? true : false, | ||
| 116 | + 'code': '2', | ||
| 117 | + 'hasLeftBorder': false | ||
| 118 | + }, | ||
| 119 | + { | ||
| 120 | + 'title': '公司', | ||
| 121 | + 'select': sexStr == '3' ? true : false, | ||
| 122 | + 'code': '3', | ||
| 123 | + 'hasLeftBorder': false | ||
| 124 | + } | ||
| 125 | + ]; | ||
| 126 | + } | ||
| 127 | + | ||
| 128 | + List<t.Table> getSpTableList() { | ||
| 129 | + List<t.Table> tables = []; | ||
| 130 | + String tableList = App.sp.getString('table_list'); | ||
| 131 | + if (tableList != null) { | ||
| 132 | + List list = json.decode(tableList); | ||
| 133 | + if (list.length > 0) { | ||
| 134 | + list.forEach((element) { | ||
| 135 | + tables.addAll(TableOuter.fromJson2(element).list); | ||
| 136 | + }); | ||
| 137 | + } | ||
| 138 | + } | ||
| 139 | + return tables; | ||
| 140 | + } | ||
| 141 | + | ||
| 142 | + /// 根据时间和分钟组装 格式:11:00 | ||
| 143 | + _dealTime(int begin, int mm) { | ||
| 144 | + String sb = ''; | ||
| 145 | + if (begin < 10) { | ||
| 146 | + sb = '0$begin'; | ||
| 147 | + } else { | ||
| 148 | + sb = '$begin'; | ||
| 149 | + } | ||
| 150 | + sb = '$sb:'; | ||
| 151 | + if (mm < 10) { | ||
| 152 | + sb = '${sb}0${mm}'; | ||
| 153 | + } else { | ||
| 154 | + sb = '${sb}${mm}'; | ||
| 155 | + } | ||
| 156 | + return sb; | ||
| 157 | + } | ||
| 158 | + | ||
| 159 | + ///获取某个商家下所有服务员信息 **** 取得某个商家的早市、午市、晚市营业时间 | ||
| 160 | + Future<SunSellerInfoModel> getManagersInfo(BuildContext context) async { | ||
| 161 | + UserModel userModel = Provider.of<UserModel>(context, listen: false); | ||
| 162 | + Map<String, String> params = { | ||
| 163 | + "seller_id": userModel.user.sellerid, | ||
| 164 | + "seller_openid": userModel.user.openid | ||
| 165 | + }; | ||
| 166 | + BaseResp<Map<String, dynamic>> baseResp = await DioUtil() | ||
| 167 | + .request<Map<String, dynamic>>(context, Method.post, HttpUrl.sellerinfo, | ||
| 168 | + data: params) | ||
| 169 | + .catchError((error) { | ||
| 170 | + print(error.toString()); | ||
| 171 | + }); | ||
| 172 | + SunSellerInfoModel itemModel; | ||
| 173 | + if (baseResp == null) return itemModel; | ||
| 174 | + if (baseResp.code == Constant.status_success) { | ||
| 175 | + if (int.parse(baseResp.status) != Constant.status_success) { | ||
| 176 | + Utils.showToast(baseResp.msg ?? ""); | ||
| 177 | + return itemModel; | ||
| 178 | + } | ||
| 179 | + if (baseResp.responseData['data'] != null) { | ||
| 180 | + itemModel = SellerInfoModel.fromJson(baseResp.responseData).data; | ||
| 181 | + } else { | ||
| 182 | + Utils.showToast(baseResp.msg ?? ""); | ||
| 183 | + } | ||
| 184 | + return itemModel; | ||
| 185 | + } | ||
| 186 | + } | ||
| 187 | + | ||
| 188 | + // Future<bool> getTableItExistOrder( | ||
| 189 | + // BuildContext context, String rdate, String tableids, String ddateSolt,String rid,List oldTableList, | ||
| 190 | + // {showLoading = false, bool selfDismiss = false}) async { | ||
| 191 | + // Map<String, String> params = { | ||
| 192 | + // 'sid': Provider.of<UserModel>(context, listen: false).user.sellerid, | ||
| 193 | + // 'tableid': tableids, | ||
| 194 | + // 'rdate': rdate, | ||
| 195 | + // 'ddate_solt': ddateSolt, | ||
| 196 | + // 'rid':rid | ||
| 197 | + // }; | ||
| 198 | + // BaseResp<dynamic> baseResp = await DioUtil() | ||
| 199 | + // .request<dynamic>(context, Method.get, HttpUrl.get_table_it_exist_order, | ||
| 200 | + // data: params, showLoading: showLoading, selfDismiss: selfDismiss) | ||
| 201 | + // .catchError((error) { | ||
| 202 | + // print(error.toString()); | ||
| 203 | + // if (error is MyError) {} | ||
| 204 | + | ||
| 205 | + // return true; | ||
| 206 | + // }); | ||
| 207 | + // if (baseResp == null) return false; | ||
| 208 | + // if (baseResp.code == Constant.status_success) { | ||
| 209 | + // List<IsExistOrderSunModel> data = | ||
| 210 | + // IsExistOrderModel.fromJson(baseResp.responseData).data; | ||
| 211 | + // if (data.length > 0) { | ||
| 212 | + // String msg = ''; | ||
| 213 | + // String msgDel = ''; | ||
| 214 | + | ||
| 215 | + // data.forEach((element) { | ||
| 216 | + // //提示并且把桌子从选中的桌子助农筛选出去 | ||
| 217 | + // selectTablesOrReserve | ||
| 218 | + // .removeWhere((element1) => element1.id == element.id); | ||
| 219 | + // if (element.isOccupy == '1') { | ||
| 220 | + // //被占用了 | ||
| 221 | + // msg += '${element.name},'; | ||
| 222 | + // } else if (element.isOccupy == '0') { | ||
| 223 | + // //被删除了 | ||
| 224 | + // msgDel += '${element.name},'; | ||
| 225 | + // } | ||
| 226 | + // }); | ||
| 227 | + | ||
| 228 | + // if (msg.endsWith(',')) { | ||
| 229 | + // msg = msg.substring(0, msg.length - 1); | ||
| 230 | + // } | ||
| 231 | + // if (msgDel.endsWith(',')) { | ||
| 232 | + // msgDel = msgDel.substring(0, msgDel.length - 1); | ||
| 233 | + // } | ||
| 234 | + | ||
| 235 | + // if (msg != '' && msgDel == '') { | ||
| 236 | + // Utils.showToast('${msg}已被占用啦'); | ||
| 237 | + // } else if (msg == '' && msgDel != '') { | ||
| 238 | + // Utils.showToast('${msgDel}已被删除啦'); | ||
| 239 | + // } else if (msg != '' && msgDel != '') { | ||
| 240 | + // Utils.showToast('${msg}已被占用啦\n' + '${msgDel}已被删除啦'); | ||
| 241 | + // } | ||
| 242 | + // notifyListeners(); | ||
| 243 | + // return false; | ||
| 244 | + // } else { | ||
| 245 | + // return true; | ||
| 246 | + // } | ||
| 247 | + // } else { | ||
| 248 | + // Utils.showToast(baseResp.msg ?? ""); | ||
| 249 | + // } | ||
| 250 | + // return true; | ||
| 251 | + // } | ||
| 252 | + | ||
| 253 | + ///根据商家ID 获取桌位信息列表: 1:散座 2:包间 默认:获取所有数据 | ||
| 254 | + Future<List<TableListReserve>> getNewTableList(BuildContext context, | ||
| 255 | + String ddate, String ddate_solt, String pnum, List oldTableList) async { | ||
| 256 | + DateTime createTime = DateTime.fromMillisecondsSinceEpoch(int.parse(ddate)); | ||
| 257 | + String rdate = DateUtil.formatDate(createTime, format: "yyyyMMdd"); | ||
| 258 | + UserModel userModel = Provider.of<UserModel>(context, listen: false); | ||
| 259 | + Map<String, String> params = { | ||
| 260 | + "sid": userModel.user.sellerid, | ||
| 261 | + "rdate": rdate, | ||
| 262 | + 'ddate_solt': ddate_solt, | ||
| 263 | + }; | ||
| 264 | + if (pnum != null && pnum != '') { | ||
| 265 | + params['pnum'] = pnum; | ||
| 266 | + } | ||
| 267 | + if (detailEntity.id.isNotEmpty && detailEntity.id != "-1") { | ||
| 268 | + params['rid'] = detailEntity.id; | ||
| 269 | + } | ||
| 270 | + BaseResp<dynamic> baseResp = await DioUtil() | ||
| 271 | + .request<dynamic>(context, Method.post, HttpUrl.get_table_list, | ||
| 272 | + data: params) | ||
| 273 | + .catchError((error) { | ||
| 274 | + print(error.toString()); | ||
| 275 | + }); | ||
| 276 | + List<TableListSunModel> itemModelList; | ||
| 277 | + if (baseResp == null) return tableListOrReserve; | ||
| 278 | + if (baseResp.code == Constant.status_success) { | ||
| 279 | + if (int.parse(baseResp.status) != Constant.status_success) { | ||
| 280 | + Utils.showToast(baseResp.msg ?? ""); | ||
| 281 | + return tableListOrReserve; | ||
| 282 | + } | ||
| 283 | + if (baseResp.responseData['data'] != null) { | ||
| 284 | + itemModelList = TableListModel.fromJson(baseResp.responseData).data; | ||
| 285 | + } else { | ||
| 286 | + Utils.showToast(baseResp.msg ?? ""); | ||
| 287 | + } | ||
| 288 | + | ||
| 289 | + tableListOrReserve = []; | ||
| 290 | + | ||
| 291 | + for (int i = 0; i < itemModelList.length; i++) { | ||
| 292 | + if (itemModelList[i].name == "推荐") { | ||
| 293 | + recommendList = itemModelList[i].list; | ||
| 294 | + itemModelList.removeAt(i); | ||
| 295 | + } | ||
| 296 | + } | ||
| 297 | + | ||
| 298 | + List<String> tableIds = []; //所有桌位的id | ||
| 299 | + List<String> tableIdsOld = []; //带过来所有桌位的id | ||
| 300 | + | ||
| 301 | + List<t.Table> tableS = getSpTableList(); //缓存的所有桌子 | ||
| 302 | + for (t.Table elementT in tableS) { | ||
| 303 | + tableIds.add(elementT.id); | ||
| 304 | + } | ||
| 305 | + for (var table in oldTableList) { | ||
| 306 | + tableIdsOld.add(table.id); | ||
| 307 | + } | ||
| 308 | + for (TableListSunModel item in itemModelList) { | ||
| 309 | + if (item.name == "推荐") { | ||
| 310 | + itemModelList.remove(item); | ||
| 311 | + } | ||
| 312 | + | ||
| 313 | + for (var item in item.list) { | ||
| 314 | + for (var table in oldTableList) { | ||
| 315 | + if (item.id == table.id) { | ||
| 316 | + item.selected = true; | ||
| 317 | + | ||
| 318 | + if (!tableListOrReserve.contains(item)) { | ||
| 319 | + tableListOrReserve | ||
| 320 | + .add(TableListReserve.fromJson(item.toJson())); | ||
| 321 | + } | ||
| 322 | + } | ||
| 323 | + } | ||
| 324 | + } | ||
| 325 | + } | ||
| 326 | + | ||
| 327 | + List<String> combinedList = []; | ||
| 328 | + for (var old in tableIdsOld) { | ||
| 329 | + if (!tableIds.contains(old)) { | ||
| 330 | + //删除了 | ||
| 331 | + combinedList.add(old); | ||
| 332 | + } | ||
| 333 | + } | ||
| 334 | + | ||
| 335 | +// tables | ||
| 336 | + | ||
| 337 | + // List usedTableList = []; //被占用的包间 | ||
| 338 | + // for (var itemOld in oldTableList) { | ||
| 339 | + // if (tableList.length == 0) { | ||
| 340 | + // usedTableList = oldTableList; | ||
| 341 | + // } else { | ||
| 342 | + // for (var item in tableList) { | ||
| 343 | + // if (item.id != itemOld.id) { | ||
| 344 | + // usedTableList.add(item); | ||
| 345 | + // } | ||
| 346 | + // } | ||
| 347 | + // } | ||
| 348 | + // } | ||
| 349 | + List idold = []; | ||
| 350 | + for (var itemOld in oldTableList) { | ||
| 351 | + idold.add(itemOld.id); | ||
| 352 | + } | ||
| 353 | + List idnew = []; | ||
| 354 | + for (var item in tableListOrReserve) { | ||
| 355 | + idnew.add(item.id); | ||
| 356 | + } | ||
| 357 | + for (var item in idnew) { | ||
| 358 | + idold.remove(item); | ||
| 359 | + } | ||
| 360 | + print(idold); //被占用的桌子的id | ||
| 361 | + | ||
| 362 | + if (idold.length > 0) { | ||
| 363 | + print(combinedList); | ||
| 364 | + List delTablesid = []; //删除 | ||
| 365 | + List useTablesid = []; //占用 | ||
| 366 | + if (combinedList.length > 0) { | ||
| 367 | + //存在删除的桌位 | ||
| 368 | + for (String ids in idold) { | ||
| 369 | + if (combinedList.contains(ids)) { | ||
| 370 | + delTablesid.add(ids); | ||
| 371 | + } else { | ||
| 372 | + useTablesid.add(ids); | ||
| 373 | + } | ||
| 374 | + } | ||
| 375 | + } else { | ||
| 376 | + useTablesid.addAll(idold); //占用 | ||
| 377 | + } | ||
| 378 | + String msg = ''; | ||
| 379 | + String msgDel = ''; | ||
| 380 | + for (var item in oldTableList) { | ||
| 381 | + if (useTablesid.contains(item.id)) { | ||
| 382 | + msg += '${item.name},'; | ||
| 383 | + } | ||
| 384 | + if (delTablesid.contains(item.id)) { | ||
| 385 | + msgDel += '${item.name},'; | ||
| 386 | + } | ||
| 387 | + } | ||
| 388 | + if (msg.endsWith(',')) { | ||
| 389 | + msg = msg.substring(0, msg.length - 1); | ||
| 390 | + } | ||
| 391 | + if (msgDel.endsWith(',')) { | ||
| 392 | + msgDel = msgDel.substring(0, msgDel.length - 1); | ||
| 393 | + } | ||
| 394 | + | ||
| 395 | + if (msg != '' && msgDel == '') { | ||
| 396 | + Utils.showToast('${msg}已被占用啦'); | ||
| 397 | + } else if (msg == '' && msgDel != '') { | ||
| 398 | + Utils.showToast('${msgDel}已被删除啦'); | ||
| 399 | + } else if (msg != '' && msgDel != '') { | ||
| 400 | + Utils.showToast('${msg}已被占用啦\n' + '${msgDel}已被删除啦'); | ||
| 401 | + } | ||
| 402 | + } | ||
| 403 | + | ||
| 404 | + // if (usedTableList.length > 0) { | ||
| 405 | + // print(usedTableList); | ||
| 406 | + // String msg = ''; | ||
| 407 | + // for (var item in usedTableList) { | ||
| 408 | + // msg += '${item.name},'; | ||
| 409 | + // } | ||
| 410 | + // if (msg.endsWith(',')) { | ||
| 411 | + // msg = msg.substring(0, msg.length - 1); | ||
| 412 | + // } | ||
| 413 | + // Utils.showToast('${msg}已被占用啦'); | ||
| 414 | + // } | ||
| 415 | + | ||
| 416 | + // if(usedTableList.length > 0){ | ||
| 417 | + // for (TableList item in usedTableList) { | ||
| 418 | + // item | ||
| 419 | + // } | ||
| 420 | + // } | ||
| 421 | + | ||
| 422 | + // if (tableList.length == 0) { | ||
| 423 | + // // Utils.showToast('包间已经被预订'); | ||
| 424 | + // isRecommend = true; | ||
| 425 | + // } else { | ||
| 426 | + // isRecommend = false; | ||
| 427 | + // } | ||
| 428 | + print(tableListOrReserve); | ||
| 429 | + notifyListeners(); | ||
| 430 | + return tableListOrReserve; | ||
| 431 | + } | ||
| 432 | + } | ||
| 433 | + | ||
| 434 | + ///录入更改内部预订 | ||
| 435 | + Future<SunReserveInfoModel> setReserveInfoOnly( | ||
| 436 | + BuildContext context, | ||
| 437 | + String nameStr, | ||
| 438 | + String uid, | ||
| 439 | + int currTimeIndex, | ||
| 440 | + DateTime dateTime, | ||
| 441 | + String morning, | ||
| 442 | + String noon, | ||
| 443 | + String night) async { | ||
| 444 | + UserModel userModel = Provider.of<UserModel>(context, listen: false); | ||
| 445 | + if (phoneController.text.trim().length > 0) { | ||
| 446 | + //判断是否可以输入自己的手机号 | ||
| 447 | + CustomerProvider customerProvider = | ||
| 448 | + Provider.of<CustomerProvider>(context, listen: false); | ||
| 449 | + await customerProvider.getSellerGuest(context); | ||
| 450 | + if (customerProvider.isselfphone) { | ||
| 451 | + //录入客户电话时不能用自己手机号(管店) | ||
| 452 | + | ||
| 453 | + if (userModel.user.userphone == phoneController.text.trim() || | ||
| 454 | + userModel.user.userphoneMyPage == phoneController.text.trim()) { | ||
| 455 | + Utils.showToast('录入客户电话时不能用自己手机号!'); | ||
| 456 | + return null; | ||
| 457 | + } | ||
| 458 | + } | ||
| 459 | + } | ||
| 460 | + | ||
| 461 | + String ddateHm = detailEntity.ddateHm; //订座详情页面的到店时间 | ||
| 462 | + String ddateSolt = detailEntity.ddate_solt; //订座详情页面的餐段(1,2,3 早餐、午餐、晚餐) | ||
| 463 | + String tempTime = ddateHm; //默认上个页面到店时间半小时值 | ||
| 464 | + if (ddateSolt != currTimeIndex.toString()) { | ||
| 465 | + if (currTimeIndex == 1) { | ||
| 466 | + tempTime = '08:00'; | ||
| 467 | + if (userModel.user.morning != '' && userModel.user.morning != null) { | ||
| 468 | + List tempDate = userModel.user.morning.split("-"); | ||
| 469 | + tempTime = tempDate[0]; | ||
| 470 | + } | ||
| 471 | + } else if (currTimeIndex == 2) { | ||
| 472 | + tempTime = '12:00'; | ||
| 473 | + if (userModel.user.noon != '' && userModel.user.noon != null) { | ||
| 474 | + List tempDate = userModel.user.noon.split("-"); | ||
| 475 | + tempTime = tempDate[0]; | ||
| 476 | + } | ||
| 477 | + } else if (currTimeIndex == 3) { | ||
| 478 | + tempTime = '18:00'; | ||
| 479 | + if (userModel.user.night != '' && userModel.user.night != null) { | ||
| 480 | + List tempDate = userModel.user.night.split("-"); | ||
| 481 | + tempTime = tempDate[0]; | ||
| 482 | + } | ||
| 483 | + } | ||
| 484 | + } | ||
| 485 | + | ||
| 486 | + String ymd = DateUtil.formatDate(dateTime, format: DateFormats.y_mo_d); | ||
| 487 | + String timeStr = ymd + ' ' + tempTime + ':00'; | ||
| 488 | + | ||
| 489 | + LogUtil.v(timeStr); | ||
| 490 | + | ||
| 491 | + int ddate = DateUtil.getDateMsByTimeStr(timeStr); | ||
| 492 | + | ||
| 493 | + String tableSelectInfo = ''; | ||
| 494 | + for (TableListReserve item in tableListOrReserve) { | ||
| 495 | + // if (item.selected) { | ||
| 496 | + tableSelectInfo += ',${item.id}'; | ||
| 497 | + // } | ||
| 498 | + } | ||
| 499 | + print(tableSelectInfo); | ||
| 500 | + if (tableSelectInfo.startsWith(',')) { | ||
| 501 | + tableSelectInfo = tableSelectInfo.substring(1); | ||
| 502 | + } | ||
| 503 | + print(tableSelectInfo); | ||
| 504 | + | ||
| 505 | + String rdate = ''; | ||
| 506 | + | ||
| 507 | + String timeStrStart; | ||
| 508 | + String timeStrEnd; | ||
| 509 | + | ||
| 510 | + if (currTimeIndex == 1) { | ||
| 511 | + //早市 | ||
| 512 | + List timem = morning.split('-'); | ||
| 513 | + timeStrStart = ymd + ' ' + timem[0] + ':00'; | ||
| 514 | + timeStrEnd = ymd + ' ' + timem[1] + ':00'; | ||
| 515 | + } else if (currTimeIndex == 2) { | ||
| 516 | + //午市 | ||
| 517 | + List timem = noon.split('-'); | ||
| 518 | + timeStrStart = ymd + ' ' + timem[0] + ':00'; | ||
| 519 | + timeStrEnd = ymd + ' ' + timem[1] + ':00'; | ||
| 520 | + } else if (currTimeIndex == 3) { | ||
| 521 | + //晚市 | ||
| 522 | + List timem = night.split('-'); | ||
| 523 | + timeStrStart = ymd + ' ' + timem[0] + ':00'; | ||
| 524 | + timeStrEnd = ymd + ' ' + timem[1] + ':00'; | ||
| 525 | + } | ||
| 526 | + | ||
| 527 | + int startM = DateUtil.getDateMsByTimeStr(timeStrStart); | ||
| 528 | + int endM = DateUtil.getDateMsByTimeStr(timeStrEnd); | ||
| 529 | + String start = '${startM}'.substring(0, 10); | ||
| 530 | + String end = '${endM}'.substring(0, 10); | ||
| 531 | + rdate = start + '-' + end; | ||
| 532 | + Map<String, String> params = { | ||
| 533 | + "sid": userModel.user.sellerid, //商家ID | ||
| 534 | + "tid": tableSelectInfo, //桌子ID: 格式 2,3,4 | ||
| 535 | + 'note_name': userModel.user.account, | ||
| 536 | + 'type': "0", //内部预订 | ||
| 537 | + "rdate": rdate, //预定用餐时间范围:时间戳 开始时间戳(time)-结束时间戳(time) | ||
| 538 | + // 'is_set_ddate': "1", | ||
| 539 | + "ddate": '${ddate}'.substring(0, 10), //到店时间 | ||
| 540 | + "channel": '5', | ||
| 541 | + "uid": uid | ||
| 542 | + }; | ||
| 543 | + if (detailEntity.id.isNotEmpty && detailEntity.id != "-1") { | ||
| 544 | + params['rid'] = detailEntity.id; | ||
| 545 | + } | ||
| 546 | + if (nameStr.trim().length > 0) { | ||
| 547 | + String sex = '1'; | ||
| 548 | + for (var item in sexList) { | ||
| 549 | + if (item['select']) { | ||
| 550 | + sex = item['code']; | ||
| 551 | + } | ||
| 552 | + } | ||
| 553 | + | ||
| 554 | + params['rname'] = nameStr; //预订人姓名 | ||
| 555 | + params['sex'] = sex; //预订人性别:1:男 2:女 | ||
| 556 | + } | ||
| 557 | + if (phoneController.text.trim().length > 0) { | ||
| 558 | + params['phone'] = phoneController.text.replaceAll(' ', ''); //预订人电话 | ||
| 559 | + | ||
| 560 | + } | ||
| 561 | + // if (customController.text.trim().length > 0) { | ||
| 562 | + // params['cusdem'] = customController.text; //预订人需求:25汉字 | ||
| 563 | + | ||
| 564 | + // } | ||
| 565 | + params['cusdem'] = customController.text; //预订人需求:25汉字 | ||
| 566 | + print(params); | ||
| 567 | + BaseResp<Map<String, dynamic>> baseResp = await DioUtil() | ||
| 568 | + .request<Map<String, dynamic>>( | ||
| 569 | + context, Method.post, HttpUrl.set_reserve_info, | ||
| 570 | + data: params) | ||
| 571 | + .catchError((error) { | ||
| 572 | + print(error.toString()); | ||
| 573 | + }); | ||
| 574 | + SunReserveInfoModel itemModel = SunReserveInfoModel(null, null, null); | ||
| 575 | + if (baseResp == null) return itemModel; | ||
| 576 | + if (baseResp.code == Constant.status_success) { | ||
| 577 | + if (int.parse(baseResp.status) != Constant.status_success) { | ||
| 578 | + Utils.showToast(baseResp.msg ?? ""); | ||
| 579 | + return itemModel; | ||
| 580 | + } | ||
| 581 | + if (baseResp.responseData['data'] != null && | ||
| 582 | + baseResp.responseData['data']['row'] != null) { | ||
| 583 | + itemModel = ReserveInfoModel.fromJson(baseResp.responseData).data; | ||
| 584 | + } else { | ||
| 585 | + Utils.showToast(baseResp.msg ?? detailEntity.id == "-1" | ||
| 586 | + ? "录入预订订单失败,请重试!" | ||
| 587 | + : "变更预订订单失败,请重试!"); | ||
| 588 | + } | ||
| 589 | + return itemModel; | ||
| 590 | + } | ||
| 591 | + } | ||
| 592 | + | ||
| 593 | + //更改在线预订 | ||
| 594 | + Future<SunReserveInfoModel> updateOnlineReserveInfoOnly( | ||
| 595 | + BuildContext context, | ||
| 596 | + String nameStr, | ||
| 597 | + String uid, | ||
| 598 | + int currTimeIndex, | ||
| 599 | + DateTime dateTime, | ||
| 600 | + String morning, | ||
| 601 | + String noon, | ||
| 602 | + String night) async { | ||
| 603 | + UserModel userModel = Provider.of<UserModel>(context, listen: false); | ||
| 604 | + if (phoneController.text.trim().length > 0) { | ||
| 605 | + //判断是否可以输入自己的手机号 | ||
| 606 | + CustomerProvider customerProvider = | ||
| 607 | + Provider.of<CustomerProvider>(context, listen: false); | ||
| 608 | + await customerProvider.getSellerGuest(context); | ||
| 609 | + if (customerProvider.isselfphone) { | ||
| 610 | + //录入客户电话时不能用自己手机号(管店) | ||
| 611 | + | ||
| 612 | + if (userModel.user.userphone == phoneController.text.trim() || | ||
| 613 | + userModel.user.userphoneMyPage == phoneController.text.trim()) { | ||
| 614 | + Utils.showToast('录入客户电话时不能用自己手机号!'); | ||
| 615 | + return null; | ||
| 616 | + } | ||
| 617 | + } | ||
| 618 | + } | ||
| 619 | + | ||
| 620 | + String ddateHm = detailEntity.ddateHm; //订座详情页面的到店时间 | ||
| 621 | + String ddateSolt = detailEntity.ddate_solt; //订座详情页面的餐段(1,2,3 早餐、午餐、晚餐) | ||
| 622 | + String tempTime = ddateHm; //默认上个页面到店时间半小时值 | ||
| 623 | + | ||
| 624 | + if (ddateSolt != currTimeIndex.toString() || tempTime == '') { | ||
| 625 | + if (currTimeIndex == 1) { | ||
| 626 | + tempTime = '08:00'; | ||
| 627 | + ddateSolt = '1'; | ||
| 628 | + if (userModel.user.morning != '' && userModel.user.morning != null) { | ||
| 629 | + List tempDate = userModel.user.morning.split("-"); | ||
| 630 | + tempTime = tempDate[0]; | ||
| 631 | + } | ||
| 632 | + } else if (currTimeIndex == 2) { | ||
| 633 | + tempTime = '12:00'; | ||
| 634 | + ddateSolt = '2'; | ||
| 635 | + if (userModel.user.noon != '' && userModel.user.noon != null) { | ||
| 636 | + List tempDate = userModel.user.noon.split("-"); | ||
| 637 | + tempTime = tempDate[0]; | ||
| 638 | + } | ||
| 639 | + } else if (currTimeIndex == 3) { | ||
| 640 | + tempTime = '18:00'; | ||
| 641 | + ddateSolt = '3'; | ||
| 642 | + if (userModel.user.night != '' && userModel.user.night != null) { | ||
| 643 | + List tempDate = userModel.user.night.split("-"); | ||
| 644 | + tempTime = tempDate[0]; | ||
| 645 | + } | ||
| 646 | + } | ||
| 647 | + } | ||
| 648 | + | ||
| 649 | + String ymd = DateUtil.formatDate(dateTime, format: DateFormats.y_mo_d); | ||
| 650 | + String timeStr = ymd + ' ' + tempTime + ':00'; | ||
| 651 | + // int start = DateUtil.getDateMsByTimeStr(timeStr); | ||
| 652 | + | ||
| 653 | + LogUtil.v(timeStr); | ||
| 654 | + // String tempDdate = ymyStr + ' ' + ddateStr + ':00'; | ||
| 655 | + int ddate = DateUtil.getDateMsByTimeStr(timeStr); | ||
| 656 | + | ||
| 657 | + String tableSelectInfo = ''; | ||
| 658 | + for (TableListReserve item in tableListOrReserve) { | ||
| 659 | + // if (item.selected) { | ||
| 660 | + tableSelectInfo += ',${item.id}'; | ||
| 661 | + // } | ||
| 662 | + } | ||
| 663 | + print(tableSelectInfo); | ||
| 664 | + if (tableSelectInfo.startsWith(',')) { | ||
| 665 | + tableSelectInfo = tableSelectInfo.substring(1); | ||
| 666 | + } | ||
| 667 | + print(tableSelectInfo); | ||
| 668 | + String rdate = ''; | ||
| 669 | + | ||
| 670 | + String timeStrStart; | ||
| 671 | + String timeStrEnd; | ||
| 672 | + | ||
| 673 | + if (currTimeIndex == 1) { | ||
| 674 | + //早市 | ||
| 675 | + List timem = morning.split('-'); | ||
| 676 | + timeStrStart = ymd + ' ' + timem[0] + ':00'; | ||
| 677 | + timeStrEnd = ymd + ' ' + timem[1] + ':00'; | ||
| 678 | + } else if (currTimeIndex == 2) { | ||
| 679 | + //午市 | ||
| 680 | + List timem = noon.split('-'); | ||
| 681 | + timeStrStart = ymd + ' ' + timem[0] + ':00'; | ||
| 682 | + timeStrEnd = ymd + ' ' + timem[1] + ':00'; | ||
| 683 | + } else if (currTimeIndex == 3) { | ||
| 684 | + //晚市 | ||
| 685 | + List timem = night.split('-'); | ||
| 686 | + timeStrStart = ymd + ' ' + timem[0] + ':00'; | ||
| 687 | + timeStrEnd = ymd + ' ' + timem[1] + ':00'; | ||
| 688 | + } | ||
| 689 | + | ||
| 690 | + int startM = DateUtil.getDateMsByTimeStr(timeStrStart); | ||
| 691 | + int endM = DateUtil.getDateMsByTimeStr(timeStrEnd); | ||
| 692 | + String start = '${startM}'.substring(0, 10); | ||
| 693 | + String end = '${endM}'.substring(0, 10); | ||
| 694 | + rdate = start + '-' + end; | ||
| 695 | + | ||
| 696 | + Map<String, String> params = { | ||
| 697 | + "sid": userModel.user.sellerid, //商家ID | ||
| 698 | + "tid": tableSelectInfo, //桌子ID: 格式 2,3,4 | ||
| 699 | + | ||
| 700 | + "type": "0", | ||
| 701 | + "rdate": rdate, //预定用餐时间范围:时间戳 开始时间戳(time)-结束时间戳(time) | ||
| 702 | + "ddate": '${ddate}'.substring(0, 10), //到店时间 | ||
| 703 | + "ddate_solt": ddateSolt, | ||
| 704 | + 'note_name': userModel.user.account | ||
| 705 | + }; | ||
| 706 | + | ||
| 707 | + if (detailEntity.id.isNotEmpty && detailEntity.id != "-1") { | ||
| 708 | + params['rid'] = detailEntity.id; | ||
| 709 | + } | ||
| 710 | + if (nameStr.trim().length > 0) { | ||
| 711 | + String sex = '1'; | ||
| 712 | + for (var item in sexList) { | ||
| 713 | + if (item['select']) { | ||
| 714 | + sex = item['code']; | ||
| 715 | + } | ||
| 716 | + } | ||
| 717 | + | ||
| 718 | + params['rname'] = nameStr; //预订人姓名 | ||
| 719 | + params['sex'] = sex; //预订人性别:1:男 2:女 | ||
| 720 | + } | ||
| 721 | + if (phoneController.text.trim().length > 0) { | ||
| 722 | + params['phone'] = phoneController.text.replaceAll(' ', ''); //预订人电话 | ||
| 723 | + | ||
| 724 | + } | ||
| 725 | + // if (customController.text.trim().length > 0) { | ||
| 726 | + | ||
| 727 | + params['cusdem'] = customController.text; //预订人需求:25汉字 | ||
| 728 | + | ||
| 729 | + // } | ||
| 730 | + print(params); | ||
| 731 | + BaseResp<Map<String, dynamic>> baseResp = await DioUtil() | ||
| 732 | + .request<Map<String, dynamic>>( | ||
| 733 | + context, Method.post, HttpUrl.set_customer_info, | ||
| 734 | + data: params) | ||
| 735 | + .catchError((error) { | ||
| 736 | + print(error.toString()); | ||
| 737 | + }); | ||
| 738 | + SunReserveInfoModel itemModel; | ||
| 739 | + if (baseResp == null) return itemModel; | ||
| 740 | + if (baseResp.code == Constant.status_success) { | ||
| 741 | + if (int.parse(baseResp.status) != Constant.status_success) { | ||
| 742 | + Utils.showToast(baseResp.msg ?? ""); | ||
| 743 | + return itemModel; | ||
| 744 | + } | ||
| 745 | + if (baseResp.responseData['data'] != null && | ||
| 746 | + baseResp.responseData['data']['row'] != null) { | ||
| 747 | + itemModel = ReserveInfoModel.fromJson(baseResp.responseData).data; | ||
| 748 | + } else { | ||
| 749 | + Utils.showToast(baseResp.msg ?? "变更预订订单失败,请重试!"); | ||
| 750 | + } | ||
| 751 | + return itemModel; | ||
| 752 | + } | ||
| 753 | + } | ||
| 754 | + | ||
| 755 | + //获取历史录入 | ||
| 756 | + getUserHistorys(BuildContext context, Map<String, String> params) async { | ||
| 757 | + BaseResp<List> baseResp = await DioUtil() | ||
| 758 | + .request<List>(context, Method.post, HttpUrl.get_reserve_user, | ||
| 759 | + data: params, showLoading: false) | ||
| 760 | + .catchError((error) { | ||
| 761 | + print(error.toString()); | ||
| 762 | + }); | ||
| 763 | + if (baseResp != null && baseResp.code == Constant.status_success) { | ||
| 764 | + userHistorys = baseResp.data.map<UserHistoryEntity>((value) { | ||
| 765 | + return UserHistoryEntity.fromJson(value); | ||
| 766 | + }).toList(); | ||
| 767 | + notifyListeners(); | ||
| 768 | + } | ||
| 769 | + } | ||
| 770 | +} |
| 1 | -// import 'dart:convert'; | ||
| 2 | - | ||
| 3 | -// import 'package:common_utils/common_utils.dart'; | ||
| 4 | -// import 'package:flutter/material.dart'; | ||
| 5 | -// import 'package:one_key/app.dart'; | ||
| 6 | -// import 'package:one_key/constant/constant.dart'; | ||
| 7 | -// import 'package:one_key/models/notebook_detail.dart'; | ||
| 8 | -// import 'package:one_key/models/reserve_info_model.dart'; | ||
| 9 | -// import 'package:one_key/models/seller_info.dart'; | ||
| 10 | -// import 'package:one_key/models/table_list.dart'; | ||
| 11 | -// import 'package:one_key/models/user_history_entity.dart'; | ||
| 12 | -// import 'package:one_key/net/base_resp.dart'; | ||
| 13 | -// import 'package:one_key/net/dio_util.dart'; | ||
| 14 | -// import 'package:one_key/net/http_url.dart'; | ||
| 15 | -// import 'package:one_key/provider/customer_provider.dart'; | ||
| 16 | -// import 'package:one_key/provider/notebook_detail_model.dart'; | ||
| 17 | -// import 'package:one_key/provider/user_model.dart'; | ||
| 18 | -// import 'package:one_key/utils/utils.dart'; | ||
| 19 | -// import 'package:provider/provider.dart'; | ||
| 20 | -// import 'package:one_key/models/table.dart' as t; | ||
| 21 | - | ||
| 22 | -// import '../models/tableOuter.dart'; | ||
| 23 | -// import '../models/table_or_reserve_model.dart'; | ||
| 24 | - | ||
| 25 | -// class NotebookDetailChangeModel with ChangeNotifier { | ||
| 26 | -// List dateList = []; //日期选择 月-日 某天 | ||
| 27 | -// List sunDateList = []; // 早市、午市、晚市 | ||
| 28 | -// List personNumList = []; // 人数 | ||
| 29 | -// TextEditingController numController = TextEditingController(); //人数 | ||
| 30 | -// TextEditingController phoneController = TextEditingController(); //电话 | ||
| 31 | -// TextEditingController nameController = TextEditingController(); //客户姓名 | ||
| 32 | -// TextEditingController customController = TextEditingController(); //客户要求 | ||
| 33 | -// List sexList = []; // 先生、女士、公司 | ||
| 34 | -// Map dailyMap = {}; // 早市对应半点钟,午市对应半点钟、晚市对应半点钟 | ||
| 35 | -// List<String> mornings = []; //早市时间段 | ||
| 36 | -// List<String> noons = []; //午市时间段 | ||
| 37 | -// List<String> nights = []; //晚市时间段 | ||
| 38 | -// String ddateStr = ''; //16:30 | ||
| 39 | -// NotebookDetail detailEntity; | ||
| 40 | -// List<TableList> tableList = []; | ||
| 41 | -// List<TableListReserve> tableListOrReserve = []; | ||
| 42 | -// String isSetDate = '0'; | ||
| 43 | -// List<TableList> recommendList = []; //推荐列表 | ||
| 44 | -// // bool isRecommend = false; //是否展示推荐 | ||
| 45 | -// List oldTableList = []; | ||
| 46 | - | ||
| 47 | -// List<UserHistoryEntity> userHistorys = []; //历史录入 | ||
| 48 | - | ||
| 49 | -// DateTime dateTimeSelect; | ||
| 50 | -// DateTime dateTime = DateTime.now(); | ||
| 51 | - | ||
| 52 | -// String dateText = ""; //当前显示日期时间 | ||
| 53 | - | ||
| 54 | -// int currTimeIndex = 1; | ||
| 55 | -// String morning; //早市时间段 | ||
| 56 | -// String noon; //午市时间段 | ||
| 57 | -// String night; //晚市时间段 | ||
| 58 | - | ||
| 59 | -// clearData() { | ||
| 60 | -// dateList = []; //日期选择 月-日 某天 | ||
| 61 | -// sunDateList = []; // 早市、午市、晚市 | ||
| 62 | -// personNumList = []; // 人数 | ||
| 63 | -// numController = TextEditingController(); //人数 | ||
| 64 | -// phoneController = TextEditingController(); //电话 | ||
| 65 | -// nameController = TextEditingController(); //客户姓名 | ||
| 66 | -// customController = TextEditingController(); //客户要求 | ||
| 67 | -// sexList = []; // 先生、女士、公司 | ||
| 68 | -// dailyMap = {}; // 早市对应半点钟,午市对应半点钟、晚市对应半点钟 | ||
| 69 | -// ddateStr = ''; //16:30 | ||
| 70 | -// tableList = []; | ||
| 71 | -// tableListOrReserve = []; | ||
| 72 | -// isSetDate = '0'; | ||
| 73 | -// } | ||
| 74 | - | ||
| 75 | -// //构造函数,初始化 | ||
| 76 | -// NotebookDetailChangeModel(this.detailEntity) { | ||
| 77 | -// // clearData(); | ||
| 78 | -// print(detailEntity); | ||
| 79 | -// if (detailEntity.phone != '0') { | ||
| 80 | -// phoneController.text = detailEntity.phone; | ||
| 81 | -// } | ||
| 82 | -// if (detailEntity.rnameStr != '') { | ||
| 83 | -// nameController.text = detailEntity.rname; | ||
| 84 | -// } | ||
| 85 | - | ||
| 86 | -// if (detailEntity.cusdem != '') { | ||
| 87 | -// customController.text = detailEntity.cusdem; | ||
| 88 | -// } | ||
| 89 | - | ||
| 90 | -// _initDateList(); | ||
| 91 | - | ||
| 92 | -// _initSexList(); | ||
| 93 | -// } | ||
| 94 | - | ||
| 95 | -// ///初始化 日期选择 月-日 某天 | ||
| 96 | -// _initDateList() { | ||
| 97 | -// String createtime = detailEntity.ddate.toString() + '000'; | ||
| 98 | -// dateTime = DateTime.fromMillisecondsSinceEpoch(int.parse(createtime)); | ||
| 99 | -// ddateStr = DateUtil.formatDate(dateTime, format: DateFormats.h_m); | ||
| 100 | -// dateText = _returnDate(dateTime); | ||
| 101 | -// String dateTimeSelect = DateUtil.formatDateMs( | ||
| 102 | -// dateTime.millisecondsSinceEpoch, | ||
| 103 | -// format: 'yyyy-MM-dd'); | ||
| 104 | -// } | ||
| 105 | - | ||
| 106 | -// //生成日期文本 | ||
| 107 | -// createDateText(BuildContext context, DateTime day) { | ||
| 108 | -// if (Utils.isOneDay(day, dateTime)) return; //日期没变 | ||
| 109 | -// dateTimeSelect = day; | ||
| 110 | -// dateText = _returnDate(day); | ||
| 111 | -// dateTime = day; | ||
| 112 | -// // getReserveList(context, needLoading: false); | ||
| 113 | -// } | ||
| 114 | - | ||
| 115 | -// _returnDate(DateTime day) { | ||
| 116 | -// // String time = Utils.lunarCalendarHolidays(day); | ||
| 117 | -// String date = _returnDayDateWeek(day); | ||
| 118 | -// // date += ' ${time}'; | ||
| 119 | -// return date; | ||
| 120 | -// } | ||
| 121 | - | ||
| 122 | -// String _returnDayDateWeek(DateTime day) { | ||
| 123 | -// String date = ''; | ||
| 124 | -// DateTime dateNow = DateTime.now(); | ||
| 125 | -// String ymd = "${day.year}-" + | ||
| 126 | -// Utils.addZeroNumber(day.month) + | ||
| 127 | -// "-" + | ||
| 128 | -// Utils.addZeroNumber(day.day); | ||
| 129 | - | ||
| 130 | -// if (Utils.isOneDay(day, dateNow)) { | ||
| 131 | -// date += "今天 "; | ||
| 132 | -// } else if (Utils.isOneDay(day, dateNow.add(Duration(days: 1)))) { | ||
| 133 | -// date += "明天 "; | ||
| 134 | -// } else if (Utils.isOneDay(day, dateNow.add(Duration(days: 2)))) { | ||
| 135 | -// date += "后天 "; | ||
| 136 | -// } | ||
| 137 | -// date += ymd; | ||
| 138 | -// date += " 星期${Utils.formatWeekDayNum(day.weekday)}"; | ||
| 139 | -// return date; | ||
| 140 | -// } | ||
| 141 | - | ||
| 142 | -// /// 初始化 早市、午市、晚市 | ||
| 143 | -// _initSunDateList(morning, noon, night) { | ||
| 144 | -// String ddateSolt = detailEntity.ddate_solt; | ||
| 145 | -// if (morning != '') { | ||
| 146 | -// sunDateList.add({ | ||
| 147 | -// 'dateText': '早市', | ||
| 148 | -// 'dayText': '', | ||
| 149 | -// 'ddateSolt': 1, | ||
| 150 | -// 'key': 'morning', | ||
| 151 | -// 'isSelect': ddateSolt == '1' ? true : false | ||
| 152 | -// }); | ||
| 153 | -// } | ||
| 154 | -// if (noon != '') { | ||
| 155 | -// sunDateList.add({ | ||
| 156 | -// 'dateText': '午市', | ||
| 157 | -// 'dayText': '', | ||
| 158 | -// 'ddateSolt': 2, | ||
| 159 | -// 'key': 'noon', | ||
| 160 | -// 'isSelect': ddateSolt == '2' ? true : false | ||
| 161 | -// }); | ||
| 162 | -// } | ||
| 163 | -// if (night != '') { | ||
| 164 | -// sunDateList.add({ | ||
| 165 | -// 'dateText': '晚市', | ||
| 166 | -// 'dayText': '', | ||
| 167 | -// 'ddateSolt': 3, | ||
| 168 | -// 'key': 'night', | ||
| 169 | -// 'isSelect': ddateSolt == '3' ? true : false | ||
| 170 | -// }); | ||
| 171 | -// } | ||
| 172 | -// initHourAndMinuteSelect(); | ||
| 173 | -// notifyListeners(); | ||
| 174 | -// } | ||
| 175 | - | ||
| 176 | -// ///称谓 | ||
| 177 | -// _initSexList() { | ||
| 178 | -// String sexStr = detailEntity.sex; | ||
| 179 | -// sexList = [ | ||
| 180 | -// { | ||
| 181 | -// 'title': '先生', | ||
| 182 | -// 'select': sexStr == '1' ? true : false, | ||
| 183 | -// 'code': '1', | ||
| 184 | -// 'hasLeftBorder': true | ||
| 185 | -// }, | ||
| 186 | -// { | ||
| 187 | -// 'title': '女士', | ||
| 188 | -// 'select': sexStr == '2' ? true : false, | ||
| 189 | -// 'code': '2', | ||
| 190 | -// 'hasLeftBorder': false | ||
| 191 | -// }, | ||
| 192 | -// { | ||
| 193 | -// 'title': '公司', | ||
| 194 | -// 'select': sexStr == '3' ? true : false, | ||
| 195 | -// 'code': '3', | ||
| 196 | -// 'hasLeftBorder': false | ||
| 197 | -// } | ||
| 198 | -// ]; | ||
| 199 | -// } | ||
| 200 | - | ||
| 201 | -// /// 早市、午市、晚市对应的半个小时间隔时间段 | ||
| 202 | -// initDateHourMinuteList(BuildContext context) async { | ||
| 203 | -// UserModel userModel = Provider.of<UserModel>(context, listen: false); | ||
| 204 | -// morning = | ||
| 205 | -// userModel.user.morning.isEmpty ? "00:00-00:00" : userModel.user.morning; | ||
| 206 | -// noon = userModel.user.noon.isEmpty ? "00:00-00:00" : userModel.user.noon; | ||
| 207 | -// night = userModel.user.night.isEmpty ? "00:00-00:00" : userModel.user.night; | ||
| 208 | -// userModel.user.morning == '' | ||
| 209 | -// ? dailyMap.putIfAbsent('morning', () => '') | ||
| 210 | -// : dailyMap.putIfAbsent('morning', | ||
| 211 | -// () => _getHourAndMinute(context, userModel.user.morning, 1)); | ||
| 212 | -// userModel.user.noon == '' | ||
| 213 | -// ? dailyMap.putIfAbsent('noon', () => '') | ||
| 214 | -// : dailyMap.putIfAbsent( | ||
| 215 | -// 'noon', () => _getHourAndMinute(context, userModel.user.noon, 2)); | ||
| 216 | -// userModel.user.night == '' | ||
| 217 | -// ? dailyMap.putIfAbsent('night', () => '') | ||
| 218 | -// : dailyMap.putIfAbsent( | ||
| 219 | -// 'night', () => _getHourAndMinute(context, userModel.user.night, 3)); | ||
| 220 | -// // _initSunDateList( | ||
| 221 | -// // userModel.user.morning, userModel.user.noon, userModel.user.night); | ||
| 222 | -// } | ||
| 223 | - | ||
| 224 | -// //根据获取时间 11:00-12:30 获取30分钟间隔组装的数组 | ||
| 225 | -// _getHourAndMinute(BuildContext context, String hourAndMinuteStr, int mnd) { | ||
| 226 | -// List tempDate = hourAndMinuteStr.split("-"); | ||
| 227 | -// String beginDate = tempDate[0]; | ||
| 228 | -// String endDate = tempDate[1]; | ||
| 229 | -// List tempHour = beginDate.split(':'); | ||
| 230 | -// String isSetDate = detailEntity.is_set_ddate; | ||
| 231 | -// String ddateSolt = detailEntity.ddate_solt; | ||
| 232 | -// /*获取开始小时*/ | ||
| 233 | -// int beginHour = int.parse(tempHour[0]); | ||
| 234 | -// /*获取开始分钟*/ | ||
| 235 | -// int beginMinute = int.parse(tempHour[1]); | ||
| 236 | -// if (beginMinute == 15) { | ||
| 237 | -// beginMinute = 30; | ||
| 238 | -// } else if (beginMinute == 45) { | ||
| 239 | -// beginHour++; | ||
| 240 | -// beginMinute = 0; | ||
| 241 | -// } | ||
| 242 | -// List endTemp = endDate.split(':'); | ||
| 243 | -// /*获取结束小时*/ | ||
| 244 | -// int endHour = int.parse(endTemp[0]); | ||
| 245 | -// /*获取结束分钟*/ | ||
| 246 | -// int endMinute = int.parse(endTemp[1]); | ||
| 247 | -// if (endMinute == 15) { | ||
| 248 | -// endDate = '${endTemp[0]}:00'; | ||
| 249 | -// } else if (endMinute == 45) { | ||
| 250 | -// endDate = '${endTemp[0]}:30'; | ||
| 251 | -// } | ||
| 252 | -// List res = []; | ||
| 253 | -// bool tempLimit = true; | ||
| 254 | -// while (tempLimit) { | ||
| 255 | -// String temp = _dealTime(beginHour, beginMinute); | ||
| 256 | -// if (mnd == 1) { | ||
| 257 | -// //早市 | ||
| 258 | -// mornings.add(temp); | ||
| 259 | -// } else if (mnd == 2) { | ||
| 260 | -// //午市 | ||
| 261 | -// noons.add(temp); | ||
| 262 | -// } else if (mnd == 3) { | ||
| 263 | -// //晚市 | ||
| 264 | -// nights.add(temp); | ||
| 265 | -// } | ||
| 266 | -// bool tempSelect = false; | ||
| 267 | -// if (int.parse(isSetDate) == 1) //设置预订时间 | ||
| 268 | -// { | ||
| 269 | -// if (temp == ddateStr) { | ||
| 270 | -// tempSelect = true; | ||
| 271 | -// } | ||
| 272 | -// } else { | ||
| 273 | -// UserModel userModel = Provider.of<UserModel>(context, listen: false); | ||
| 274 | -// String beginDate = ''; | ||
| 275 | -// if (mnd == 1) { | ||
| 276 | -// beginDate = '08:00'; | ||
| 277 | -// if (userModel.user.morning != '' && userModel.user.morning != null) { | ||
| 278 | -// List tempDate = userModel.user.morning.split("-"); | ||
| 279 | -// beginDate = tempDate[0]; | ||
| 280 | -// } | ||
| 281 | -// } else if (mnd == 2) { | ||
| 282 | -// beginDate = '12:00'; | ||
| 283 | -// if (userModel.user.noon != '' && userModel.user.noon != null) { | ||
| 284 | -// List tempDate = userModel.user.noon.split("-"); | ||
| 285 | -// beginDate = tempDate[0]; | ||
| 286 | -// } | ||
| 287 | -// } else if (mnd == 3) { | ||
| 288 | -// beginDate = '18:00'; | ||
| 289 | -// if (userModel.user.night != '' && userModel.user.night != null) { | ||
| 290 | -// List tempDate = userModel.user.night.split("-"); | ||
| 291 | -// beginDate = tempDate[0]; | ||
| 292 | -// } | ||
| 293 | -// } | ||
| 294 | -// if (temp == beginDate) { | ||
| 295 | -// tempSelect = true; | ||
| 296 | -// } | ||
| 297 | -// // if (mnd == 1) { | ||
| 298 | -// // if (temp == '08:00') { | ||
| 299 | -// // tempSelect = true; | ||
| 300 | -// // } | ||
| 301 | -// // } else if (mnd == 2) { | ||
| 302 | -// // if (temp == '12:00') { | ||
| 303 | -// // tempSelect = true; | ||
| 304 | -// // } | ||
| 305 | -// // } else if (mnd == 3) { | ||
| 306 | -// // if (temp == '18:00') { | ||
| 307 | -// // tempSelect = true; | ||
| 308 | -// // } | ||
| 309 | -// // } | ||
| 310 | -// } | ||
| 311 | -// Map tempMap = {'title': temp, 'select': tempSelect}; | ||
| 312 | -// res.add(tempMap); | ||
| 313 | -// if (temp == endDate) { | ||
| 314 | -// tempLimit = false; | ||
| 315 | -// break; | ||
| 316 | -// } | ||
| 317 | -// if (beginMinute == 30) { | ||
| 318 | -// beginHour++; | ||
| 319 | -// if (beginHour >= 24) { | ||
| 320 | -// beginHour = 0; | ||
| 321 | -// } | ||
| 322 | -// } | ||
| 323 | -// beginMinute = (beginMinute + 30) % 60; | ||
| 324 | -// } | ||
| 325 | -// return res; | ||
| 326 | -// } | ||
| 327 | - | ||
| 328 | -// //初始化早市午市晚市选中时间 | ||
| 329 | -// initHourAndMinuteSelect() { | ||
| 330 | -// int timeMillsNow = DateTime.now().millisecondsSinceEpoch; | ||
| 331 | -// //当前选中 年-月-日 | ||
| 332 | -// String ymyStr = ""; | ||
| 333 | -// //今天 明天 其他天 | ||
| 334 | -// for (var item in dateList) { | ||
| 335 | -// if (item['select'] == true) { | ||
| 336 | -// ymyStr = item['title']; | ||
| 337 | -// } | ||
| 338 | -// } | ||
| 339 | -// String timeStr = ymyStr + ' 00:00:00'; | ||
| 340 | -// LogUtil.v(timeStr); | ||
| 341 | -// DateTime dateTime = DateUtil.getDateTime(timeStr); //当前年月日 | ||
| 342 | -// for (var sunDate in sunDateList) { | ||
| 343 | -// if (sunDate['isSelect'] == false) continue; | ||
| 344 | -// switch (sunDate['key']) { | ||
| 345 | -// case "morning": //选中早市 | ||
| 346 | -// bool select = false; | ||
| 347 | -// for (var temp in dailyMap['morning']) { | ||
| 348 | -// //早市选中距离当前时间最近 | ||
| 349 | -// temp['select'] = false; | ||
| 350 | -// if (select) continue; //只选中第一个 | ||
| 351 | -// if (timeMillsNow <= | ||
| 352 | -// DateUtil.getDateMsByTimeStr(DateUtil.formatDate(dateTime) | ||
| 353 | -// .replaceRange(11, 19, "${temp['title']}:00"))) { | ||
| 354 | -// temp['select'] = true; | ||
| 355 | -// select = true; | ||
| 356 | -// } | ||
| 357 | -// } | ||
| 358 | -// break; | ||
| 359 | -// case "noon": //选中午市 | ||
| 360 | -// bool select = false; | ||
| 361 | -// for (var temp in dailyMap['noon']) { | ||
| 362 | -// //午市选中12:00 | ||
| 363 | -// temp['select'] = false; | ||
| 364 | -// if (select) continue; | ||
| 365 | -// if (noons.contains("12:00") && | ||
| 366 | -// timeMillsNow <= | ||
| 367 | -// DateUtil.getDateMsByTimeStr(DateUtil.formatDate(dateTime) | ||
| 368 | -// .replaceRange(11, 19, "12:00:00"))) { | ||
| 369 | -// if (temp['title'] == "12:00") { | ||
| 370 | -// temp['select'] = true; | ||
| 371 | -// select = true; | ||
| 372 | -// } | ||
| 373 | -// } else { | ||
| 374 | -// if (timeMillsNow <= | ||
| 375 | -// DateUtil.getDateMsByTimeStr(DateUtil.formatDate(dateTime) | ||
| 376 | -// .replaceRange(11, 19, "${temp['title']}:00"))) { | ||
| 377 | -// temp['select'] = true; | ||
| 378 | -// select = true; | ||
| 379 | -// } | ||
| 380 | -// } | ||
| 381 | -// } | ||
| 382 | -// break; | ||
| 383 | -// case "night": //选中晚市 | ||
| 384 | -// bool select = false; | ||
| 385 | -// for (var temp in dailyMap['night']) { | ||
| 386 | -// //晚市选中18:30 | ||
| 387 | -// temp['select'] = false; | ||
| 388 | -// if (select) continue; | ||
| 389 | -// if (nights.contains("18:00") && | ||
| 390 | -// timeMillsNow <= | ||
| 391 | -// DateUtil.getDateMsByTimeStr(DateUtil.formatDate(dateTime) | ||
| 392 | -// .replaceRange(11, 19, "18:00:00"))) { | ||
| 393 | -// if (temp['title'] == "18:00") { | ||
| 394 | -// temp['select'] = true; | ||
| 395 | -// select = true; | ||
| 396 | -// } | ||
| 397 | -// } else { | ||
| 398 | -// if (timeMillsNow <= | ||
| 399 | -// DateUtil.getDateMsByTimeStr(DateUtil.formatDate(dateTime) | ||
| 400 | -// .replaceRange(11, 19, "${temp['title']}:00"))) { | ||
| 401 | -// temp['select'] = true; | ||
| 402 | -// select = true; | ||
| 403 | -// } | ||
| 404 | -// } | ||
| 405 | -// } | ||
| 406 | -// break; | ||
| 407 | -// } | ||
| 408 | -// } | ||
| 409 | -// LogUtil.v(dailyMap); | ||
| 410 | -// } | ||
| 411 | - | ||
| 412 | -// List<t.Table> getSpTableList() { | ||
| 413 | -// List<t.Table> tables = []; | ||
| 414 | -// String tableList = App.sp.getString('table_list'); | ||
| 415 | -// if (tableList != null) { | ||
| 416 | -// List list = json.decode(tableList); | ||
| 417 | -// if (list.length > 0) { | ||
| 418 | -// list.forEach((element) { | ||
| 419 | -// tables.addAll(TableOuter.fromJson2(element).list); | ||
| 420 | -// }); | ||
| 421 | -// } | ||
| 422 | -// } | ||
| 423 | -// return tables; | ||
| 424 | -// } | ||
| 425 | - | ||
| 426 | -// /// 根据时间和分钟组装 格式:11:00 | ||
| 427 | -// _dealTime(int begin, int mm) { | ||
| 428 | -// String sb = ''; | ||
| 429 | -// if (begin < 10) { | ||
| 430 | -// sb = '0$begin'; | ||
| 431 | -// } else { | ||
| 432 | -// sb = '$begin'; | ||
| 433 | -// } | ||
| 434 | -// sb = '$sb:'; | ||
| 435 | -// if (mm < 10) { | ||
| 436 | -// sb = '${sb}0${mm}'; | ||
| 437 | -// } else { | ||
| 438 | -// sb = '${sb}${mm}'; | ||
| 439 | -// } | ||
| 440 | -// return sb; | ||
| 441 | -// } | ||
| 442 | - | ||
| 443 | -// ///获取某个商家下所有服务员信息 **** 取得某个商家的早市、午市、晚市营业时间 | ||
| 444 | -// Future<SunSellerInfoModel> getManagersInfo(BuildContext context) async { | ||
| 445 | -// UserModel userModel = Provider.of<UserModel>(context, listen: false); | ||
| 446 | -// Map<String, String> params = { | ||
| 447 | -// "seller_id": userModel.user.sellerid, | ||
| 448 | -// "seller_openid": userModel.user.openid | ||
| 449 | -// }; | ||
| 450 | -// BaseResp<Map<String, dynamic>> baseResp = await DioUtil() | ||
| 451 | -// .request<Map<String, dynamic>>(context, Method.post, HttpUrl.sellerinfo, | ||
| 452 | -// data: params) | ||
| 453 | -// .catchError((error) { | ||
| 454 | -// print(error.toString()); | ||
| 455 | -// }); | ||
| 456 | -// SunSellerInfoModel itemModel; | ||
| 457 | -// if (baseResp == null) return itemModel; | ||
| 458 | -// if (baseResp.code == Constant.status_success) { | ||
| 459 | -// if (int.parse(baseResp.status) != Constant.status_success) { | ||
| 460 | -// Utils.showToast(baseResp.msg ?? ""); | ||
| 461 | -// return itemModel; | ||
| 462 | -// } | ||
| 463 | -// if (baseResp.responseData['data'] != null) { | ||
| 464 | -// itemModel = SellerInfoModel.fromJson(baseResp.responseData).data; | ||
| 465 | -// } else { | ||
| 466 | -// Utils.showToast(baseResp.msg ?? ""); | ||
| 467 | -// } | ||
| 468 | -// return itemModel; | ||
| 469 | -// } | ||
| 470 | -// } | ||
| 471 | - | ||
| 472 | -// ///根据商家ID 获取桌位信息列表: 1:散座 2:包间 默认:获取所有数据 | ||
| 473 | -// Future<List<TableList>> getNewTableList(BuildContext context, String ddate, | ||
| 474 | -// String ddate_solt, String pnum, List oldTableList) async { | ||
| 475 | -// DateTime createTime = DateTime.fromMillisecondsSinceEpoch(int.parse(ddate)); | ||
| 476 | -// String rdate = DateUtil.formatDate(createTime, format: "yyyyMMdd"); | ||
| 477 | -// UserModel userModel = Provider.of<UserModel>(context, listen: false); | ||
| 478 | -// Map<String, String> params = { | ||
| 479 | -// "sid": userModel.user.sellerid, | ||
| 480 | -// "rdate": rdate, | ||
| 481 | -// 'ddate_solt': ddate_solt, | ||
| 482 | -// }; | ||
| 483 | -// if (pnum != null && pnum != '') { | ||
| 484 | -// params['pnum'] = pnum; | ||
| 485 | -// } | ||
| 486 | -// if (detailEntity.id.isNotEmpty && detailEntity.id != "-1") { | ||
| 487 | -// params['rid'] = detailEntity.id; | ||
| 488 | -// } | ||
| 489 | -// BaseResp<dynamic> baseResp = await DioUtil() | ||
| 490 | -// .request<dynamic>(context, Method.post, HttpUrl.get_table_list, | ||
| 491 | -// data: params) | ||
| 492 | -// .catchError((error) { | ||
| 493 | -// print(error.toString()); | ||
| 494 | -// }); | ||
| 495 | -// List<TableListSunModel> itemModelList; | ||
| 496 | -// if (baseResp == null) return tableList; | ||
| 497 | -// if (baseResp.code == Constant.status_success) { | ||
| 498 | -// if (int.parse(baseResp.status) != Constant.status_success) { | ||
| 499 | -// Utils.showToast(baseResp.msg ?? ""); | ||
| 500 | -// return tableList; | ||
| 501 | -// } | ||
| 502 | -// if (baseResp.responseData['data'] != null) { | ||
| 503 | -// itemModelList = TableListModel.fromJson(baseResp.responseData).data; | ||
| 504 | -// } else { | ||
| 505 | -// Utils.showToast(baseResp.msg ?? ""); | ||
| 506 | -// } | ||
| 507 | -// tableList = []; | ||
| 508 | -// tableListOrReserve = []; | ||
| 509 | - | ||
| 510 | -// for (int i = 0; i < itemModelList.length; i++) { | ||
| 511 | -// if (itemModelList[i].name == "推荐") { | ||
| 512 | -// recommendList = itemModelList[i].list; | ||
| 513 | -// itemModelList.removeAt(i); | ||
| 514 | -// } | ||
| 515 | -// } | ||
| 516 | - | ||
| 517 | -// List<String> tableIds = []; //所有桌位的id | ||
| 518 | -// List<String> tableIdsOld = []; //带过来所有桌位的id | ||
| 519 | - | ||
| 520 | -// List<t.Table> tableS = getSpTableList(); //缓存的所有桌子 | ||
| 521 | -// for (t.Table elementT in tableS) { | ||
| 522 | -// tableIds.add(elementT.id); | ||
| 523 | -// } | ||
| 524 | -// for (var table in oldTableList) { | ||
| 525 | -// tableIdsOld.add(table.id); | ||
| 526 | -// } | ||
| 527 | -// for (TableListSunModel item in itemModelList) { | ||
| 528 | -// if (item.name == "推荐") { | ||
| 529 | -// itemModelList.remove(item); | ||
| 530 | -// } | ||
| 531 | - | ||
| 532 | -// for (var item in item.list) { | ||
| 533 | -// for (var table in oldTableList) { | ||
| 534 | -// if (item.id == table.id) { | ||
| 535 | -// item.selected = true; | ||
| 536 | -// if (!tableList.contains(item)) { | ||
| 537 | -// tableList.add(item); | ||
| 538 | -// } | ||
| 539 | -// if (!tableListOrReserve.contains(item)) { | ||
| 540 | -// tableListOrReserve | ||
| 541 | -// .add(TableListReserve.fromJson(item.toJson())); | ||
| 542 | -// } | ||
| 543 | -// } | ||
| 544 | -// } | ||
| 545 | -// } | ||
| 546 | -// } | ||
| 547 | - | ||
| 548 | -// List<String> combinedList = []; | ||
| 549 | -// for (var old in tableIdsOld) { | ||
| 550 | -// if (!tableIds.contains(old)) { | ||
| 551 | -// //删除了 | ||
| 552 | -// combinedList.add(old); | ||
| 553 | -// } | ||
| 554 | -// } | ||
| 555 | - | ||
| 556 | -// // tables | ||
| 557 | - | ||
| 558 | -// // List usedTableList = []; //被占用的包间 | ||
| 559 | -// // for (var itemOld in oldTableList) { | ||
| 560 | -// // if (tableList.length == 0) { | ||
| 561 | -// // usedTableList = oldTableList; | ||
| 562 | -// // } else { | ||
| 563 | -// // for (var item in tableList) { | ||
| 564 | -// // if (item.id != itemOld.id) { | ||
| 565 | -// // usedTableList.add(item); | ||
| 566 | -// // } | ||
| 567 | -// // } | ||
| 568 | -// // } | ||
| 569 | -// // } | ||
| 570 | -// List idold = []; | ||
| 571 | -// for (var itemOld in oldTableList) { | ||
| 572 | -// idold.add(itemOld.id); | ||
| 573 | -// } | ||
| 574 | -// List idnew = []; | ||
| 575 | -// for (var item in tableList) { | ||
| 576 | -// idnew.add(item.id); | ||
| 577 | -// } | ||
| 578 | -// for (var item in idnew) { | ||
| 579 | -// idold.remove(item); | ||
| 580 | -// } | ||
| 581 | -// print(idold); //被占用的桌子的id | ||
| 582 | - | ||
| 583 | -// if (idold.length > 0) { | ||
| 584 | -// print(combinedList); | ||
| 585 | -// List delTablesid = []; //删除 | ||
| 586 | -// List useTablesid = []; //占用 | ||
| 587 | -// if (combinedList.length > 0) { | ||
| 588 | -// //存在删除的桌位 | ||
| 589 | -// for (String ids in idold) { | ||
| 590 | -// if (combinedList.contains(ids)) { | ||
| 591 | -// delTablesid.add(ids); | ||
| 592 | -// } else { | ||
| 593 | -// useTablesid.add(ids); | ||
| 594 | -// } | ||
| 595 | -// } | ||
| 596 | -// } else { | ||
| 597 | -// useTablesid.addAll(idold); //占用 | ||
| 598 | -// } | ||
| 599 | -// String msg = ''; | ||
| 600 | -// String msgDel = ''; | ||
| 601 | -// for (var item in oldTableList) { | ||
| 602 | -// if (useTablesid.contains(item.id)) { | ||
| 603 | -// msg += '${item.name},'; | ||
| 604 | -// } | ||
| 605 | -// if (delTablesid.contains(item.id)) { | ||
| 606 | -// msgDel += '${item.name},'; | ||
| 607 | -// } | ||
| 608 | -// } | ||
| 609 | -// if (msg.endsWith(',')) { | ||
| 610 | -// msg = msg.substring(0, msg.length - 1); | ||
| 611 | -// } | ||
| 612 | -// if (msgDel.endsWith(',')) { | ||
| 613 | -// msgDel = msgDel.substring(0, msgDel.length - 1); | ||
| 614 | -// } | ||
| 615 | - | ||
| 616 | -// if (msg != '' && msgDel == '') { | ||
| 617 | -// Utils.showToast('${msg}已被占用啦'); | ||
| 618 | -// } else if (msg == '' && msgDel != '') { | ||
| 619 | -// Utils.showToast('${msgDel}已被删除啦'); | ||
| 620 | -// } else if (msg != '' && msgDel != '') { | ||
| 621 | -// Utils.showToast('${msg}已被占用啦\n' + '${msgDel}已被删除啦'); | ||
| 622 | -// } | ||
| 623 | -// } | ||
| 624 | - | ||
| 625 | -// // if (usedTableList.length > 0) { | ||
| 626 | -// // print(usedTableList); | ||
| 627 | -// // String msg = ''; | ||
| 628 | -// // for (var item in usedTableList) { | ||
| 629 | -// // msg += '${item.name},'; | ||
| 630 | -// // } | ||
| 631 | -// // if (msg.endsWith(',')) { | ||
| 632 | -// // msg = msg.substring(0, msg.length - 1); | ||
| 633 | -// // } | ||
| 634 | -// // Utils.showToast('${msg}已被占用啦'); | ||
| 635 | -// // } | ||
| 636 | - | ||
| 637 | -// // if(usedTableList.length > 0){ | ||
| 638 | -// // for (TableList item in usedTableList) { | ||
| 639 | -// // item | ||
| 640 | -// // } | ||
| 641 | -// // } | ||
| 642 | - | ||
| 643 | -// // if (tableList.length == 0) { | ||
| 644 | -// // // Utils.showToast('包间已经被预订'); | ||
| 645 | -// // isRecommend = true; | ||
| 646 | -// // } else { | ||
| 647 | -// // isRecommend = false; | ||
| 648 | -// // } | ||
| 649 | -// print(tableList); | ||
| 650 | -// notifyListeners(); | ||
| 651 | -// return tableList; | ||
| 652 | -// } | ||
| 653 | -// } | ||
| 654 | - | ||
| 655 | -// ///录入更改内部预订 | ||
| 656 | -// Future<SunReserveInfoModel> setReserveInfoOnly( | ||
| 657 | -// BuildContext context, String nameStr, String uid) async { | ||
| 658 | -// UserModel userModel = Provider.of<UserModel>(context, listen: false); | ||
| 659 | -// if (phoneController.text.trim().length > 0) { | ||
| 660 | -// //判断是否可以输入自己的手机号 | ||
| 661 | -// CustomerProvider customerProvider = | ||
| 662 | -// Provider.of<CustomerProvider>(context, listen: false); | ||
| 663 | -// await customerProvider.getSellerGuest(context); | ||
| 664 | -// if (customerProvider.isselfphone) { | ||
| 665 | -// //录入客户电话时不能用自己手机号(管店) | ||
| 666 | - | ||
| 667 | -// if (userModel.user.userphone == phoneController.text.trim() || | ||
| 668 | -// userModel.user.userphoneMyPage == phoneController.text.trim()) { | ||
| 669 | -// Utils.showToast('录入客户电话时不能用自己手机号!'); | ||
| 670 | -// return null; | ||
| 671 | -// } | ||
| 672 | -// } | ||
| 673 | -// } | ||
| 674 | - | ||
| 675 | -// // String tempTime; | ||
| 676 | -// // if (currTimeIndex == 1) { | ||
| 677 | -// // tempTime = '08:00'; | ||
| 678 | -// // } else if (currTimeIndex == 2) { | ||
| 679 | -// // tempTime = '12:00'; | ||
| 680 | -// // } else if (currTimeIndex == 3) { | ||
| 681 | -// // tempTime = '18:00'; | ||
| 682 | -// // } | ||
| 683 | -// // String ymd = DateUtil.formatDate(dateTime, format: DateFormats.y_mo_d); | ||
| 684 | -// // String timeStr = ymd + ' ' + tempTime + ':00'; | ||
| 685 | -// // int start = DateUtil.getDateMsByTimeStr(timeStr); | ||
| 686 | -// // int start = DateUtil.getDateMsByTimeStr(timeStr); | ||
| 687 | - | ||
| 688 | -// // LogUtil.v(timeStr); | ||
| 689 | -// // String tempDdate = ymyStr + ' ' + ddateStr + ':00'; | ||
| 690 | - | ||
| 691 | -// String ddateHm = detailEntity.ddateHm; //订座详情页面的到店时间 | ||
| 692 | -// String ddateSolt = detailEntity.ddate_solt; //订座详情页面的餐段(1,2,3 早餐、午餐、晚餐) | ||
| 693 | -// String tempTime = ddateHm; //默认上个页面到店时间半小时值 | ||
| 694 | -// if (ddateSolt != currTimeIndex.toString()) { | ||
| 695 | -// //餐段发生改变,则重新默认到店时间半小时值 | ||
| 696 | -// // if (currTimeIndex == 1) { | ||
| 697 | -// // tempTime = '08:00'; | ||
| 698 | -// // } else if (currTimeIndex == 2) { | ||
| 699 | -// // tempTime = '12:00'; | ||
| 700 | -// // } else if (currTimeIndex == 3) { | ||
| 701 | -// // tempTime = '18:00'; | ||
| 702 | -// // } | ||
| 703 | - | ||
| 704 | -// if (currTimeIndex == 1) { | ||
| 705 | -// tempTime = '08:00'; | ||
| 706 | -// if (userModel.user.morning != '' && userModel.user.morning != null) { | ||
| 707 | -// List tempDate = userModel.user.morning.split("-"); | ||
| 708 | -// tempTime = tempDate[0]; | ||
| 709 | -// } | ||
| 710 | -// } else if (currTimeIndex == 2) { | ||
| 711 | -// tempTime = '12:00'; | ||
| 712 | -// if (userModel.user.noon != '' && userModel.user.noon != null) { | ||
| 713 | -// List tempDate = userModel.user.noon.split("-"); | ||
| 714 | -// tempTime = tempDate[0]; | ||
| 715 | -// } | ||
| 716 | -// } else if (currTimeIndex == 3) { | ||
| 717 | -// tempTime = '18:00'; | ||
| 718 | -// if (userModel.user.night != '' && userModel.user.night != null) { | ||
| 719 | -// List tempDate = userModel.user.night.split("-"); | ||
| 720 | -// tempTime = tempDate[0]; | ||
| 721 | -// } | ||
| 722 | -// } | ||
| 723 | -// } | ||
| 724 | - | ||
| 725 | -// String ymd = DateUtil.formatDate(dateTime, format: DateFormats.y_mo_d); | ||
| 726 | -// String timeStr = ymd + ' ' + tempTime + ':00'; | ||
| 727 | -// // int start = DateUtil.getDateMsByTimeStr(timeStr); | ||
| 728 | - | ||
| 729 | -// LogUtil.v(timeStr); | ||
| 730 | -// // String tempDdate = ymyStr + ' ' + ddateStr + ':00'; | ||
| 731 | -// int ddate = DateUtil.getDateMsByTimeStr(timeStr); | ||
| 732 | - | ||
| 733 | -// String tableSelectInfo = ''; | ||
| 734 | -// for (TableListReserve item in tableListOrReserve) { | ||
| 735 | -// // if (item.selected) { | ||
| 736 | -// tableSelectInfo += ',${item.id}'; | ||
| 737 | -// // } | ||
| 738 | -// } | ||
| 739 | -// print(tableSelectInfo); | ||
| 740 | -// if (tableSelectInfo.startsWith(',')) { | ||
| 741 | -// tableSelectInfo = tableSelectInfo.substring(1); | ||
| 742 | -// } | ||
| 743 | -// print(tableSelectInfo); | ||
| 744 | - | ||
| 745 | -// String rdate = ''; | ||
| 746 | - | ||
| 747 | -// String timeStrStart; | ||
| 748 | -// String timeStrEnd; | ||
| 749 | - | ||
| 750 | -// if (currTimeIndex == 1) { | ||
| 751 | -// //早市 | ||
| 752 | -// List timem = morning.split('-'); | ||
| 753 | -// timeStrStart = ymd + ' ' + timem[0] + ':00'; | ||
| 754 | -// timeStrEnd = ymd + ' ' + timem[1] + ':00'; | ||
| 755 | -// } else if (currTimeIndex == 2) { | ||
| 756 | -// //午市 | ||
| 757 | -// List timem = noon.split('-'); | ||
| 758 | -// timeStrStart = ymd + ' ' + timem[0] + ':00'; | ||
| 759 | -// timeStrEnd = ymd + ' ' + timem[1] + ':00'; | ||
| 760 | -// } else if (currTimeIndex == 3) { | ||
| 761 | -// //晚市 | ||
| 762 | -// List timem = night.split('-'); | ||
| 763 | -// timeStrStart = ymd + ' ' + timem[0] + ':00'; | ||
| 764 | -// timeStrEnd = ymd + ' ' + timem[1] + ':00'; | ||
| 765 | -// } | ||
| 766 | - | ||
| 767 | -// int startM = DateUtil.getDateMsByTimeStr(timeStrStart); | ||
| 768 | -// int endM = DateUtil.getDateMsByTimeStr(timeStrEnd); | ||
| 769 | -// String start = '${startM}'.substring(0, 10); | ||
| 770 | -// String end = '${endM}'.substring(0, 10); | ||
| 771 | -// rdate = start + '-' + end; | ||
| 772 | -// Map<String, String> params = { | ||
| 773 | -// "sid": userModel.user.sellerid, //商家ID | ||
| 774 | -// "tid": tableSelectInfo, //桌子ID: 格式 2,3,4 | ||
| 775 | -// 'note_name': userModel.user.account, | ||
| 776 | -// 'type': "0", //内部预订 | ||
| 777 | -// "rdate": rdate, //预定用餐时间范围:时间戳 开始时间戳(time)-结束时间戳(time) | ||
| 778 | -// // 'is_set_ddate': "1", | ||
| 779 | -// "ddate": '${ddate}'.substring(0, 10), //到店时间 | ||
| 780 | -// "channel": '5', | ||
| 781 | -// "uid": uid | ||
| 782 | -// }; | ||
| 783 | -// if (detailEntity.id.isNotEmpty && detailEntity.id != "-1") { | ||
| 784 | -// params['rid'] = detailEntity.id; | ||
| 785 | -// } | ||
| 786 | -// if (nameStr.trim().length > 0) { | ||
| 787 | -// String sex = '1'; | ||
| 788 | -// for (var item in sexList) { | ||
| 789 | -// if (item['select']) { | ||
| 790 | -// sex = item['code']; | ||
| 791 | -// } | ||
| 792 | -// } | ||
| 793 | - | ||
| 794 | -// params['rname'] = nameStr; //预订人姓名 | ||
| 795 | -// params['sex'] = sex; //预订人性别:1:男 2:女 | ||
| 796 | -// } | ||
| 797 | -// if (phoneController.text.trim().length > 0) { | ||
| 798 | -// params['phone'] = phoneController.text.replaceAll(' ', ''); //预订人电话 | ||
| 799 | - | ||
| 800 | -// } | ||
| 801 | -// // if (customController.text.trim().length > 0) { | ||
| 802 | -// // params['cusdem'] = customController.text; //预订人需求:25汉字 | ||
| 803 | - | ||
| 804 | -// // } | ||
| 805 | -// params['cusdem'] = customController.text; //预订人需求:25汉字 | ||
| 806 | -// print(params); | ||
| 807 | -// BaseResp<Map<String, dynamic>> baseResp = await DioUtil() | ||
| 808 | -// .request<Map<String, dynamic>>( | ||
| 809 | -// context, Method.post, HttpUrl.set_reserve_info, | ||
| 810 | -// data: params) | ||
| 811 | -// .catchError((error) { | ||
| 812 | -// print(error.toString()); | ||
| 813 | -// }); | ||
| 814 | -// SunReserveInfoModel itemModel = SunReserveInfoModel(null, null, null); | ||
| 815 | -// if (baseResp == null) return itemModel; | ||
| 816 | -// if (baseResp.code == Constant.status_success) { | ||
| 817 | -// if (int.parse(baseResp.status) != Constant.status_success) { | ||
| 818 | -// Utils.showToast(baseResp.msg ?? ""); | ||
| 819 | -// return itemModel; | ||
| 820 | -// } | ||
| 821 | -// if (baseResp.responseData['data'] != null && | ||
| 822 | -// baseResp.responseData['data']['row'] != null) { | ||
| 823 | -// itemModel = ReserveInfoModel.fromJson(baseResp.responseData).data; | ||
| 824 | -// } else { | ||
| 825 | -// Utils.showToast(baseResp.msg ?? detailEntity.id == "-1" | ||
| 826 | -// ? "录入预订订单失败,请重试!" | ||
| 827 | -// : "变更预订订单失败,请重试!"); | ||
| 828 | -// } | ||
| 829 | -// return itemModel; | ||
| 830 | -// } | ||
| 831 | -// } | ||
| 832 | - | ||
| 833 | -// ///录入更改内部预订 | ||
| 834 | -// Future<SunReserveInfoModel> setReserveInfo( | ||
| 835 | -// BuildContext context, String nameStr, String uid) async { | ||
| 836 | -// UserModel userModel = Provider.of<UserModel>(context, listen: false); | ||
| 837 | -// if (phoneController.text.trim().length > 0) { | ||
| 838 | -// //判断是否可以输入自己的手机号 | ||
| 839 | -// CustomerProvider customerProvider = | ||
| 840 | -// Provider.of<CustomerProvider>(context, listen: false); | ||
| 841 | -// await customerProvider.getSellerGuest(context); | ||
| 842 | -// if (customerProvider.isselfphone) { | ||
| 843 | -// //录入客户电话时不能用自己手机号(管店) | ||
| 844 | - | ||
| 845 | -// if (userModel.user.userphone == phoneController.text.trim() || | ||
| 846 | -// userModel.user.userphoneMyPage == phoneController.text.trim()) { | ||
| 847 | -// Utils.showToast('录入客户电话时不能用自己手机号!'); | ||
| 848 | -// return null; | ||
| 849 | -// } | ||
| 850 | -// } | ||
| 851 | -// } | ||
| 852 | - | ||
| 853 | -// // String tempTime; | ||
| 854 | -// // if (currTimeIndex == 1) { | ||
| 855 | -// // tempTime = '08:00'; | ||
| 856 | -// // } else if (currTimeIndex == 2) { | ||
| 857 | -// // tempTime = '12:00'; | ||
| 858 | -// // } else if (currTimeIndex == 3) { | ||
| 859 | -// // tempTime = '18:00'; | ||
| 860 | -// // } | ||
| 861 | -// // String ymd = DateUtil.formatDate(dateTime, format: DateFormats.y_mo_d); | ||
| 862 | -// // String timeStr = ymd + ' ' + tempTime + ':00'; | ||
| 863 | -// // int start = DateUtil.getDateMsByTimeStr(timeStr); | ||
| 864 | -// // int start = DateUtil.getDateMsByTimeStr(timeStr); | ||
| 865 | - | ||
| 866 | -// // LogUtil.v(timeStr); | ||
| 867 | -// // String tempDdate = ymyStr + ' ' + ddateStr + ':00'; | ||
| 868 | - | ||
| 869 | -// String ddateHm = detailEntity.ddateHm; //订座详情页面的到店时间 | ||
| 870 | -// String ddateSolt = detailEntity.ddate_solt; //订座详情页面的餐段(1,2,3 早餐、午餐、晚餐) | ||
| 871 | -// String tempTime = ddateHm; //默认上个页面到店时间半小时值 | ||
| 872 | -// if (ddateSolt != currTimeIndex.toString()) { | ||
| 873 | -// //餐段发生改变,则重新默认到店时间半小时值 | ||
| 874 | -// // if (currTimeIndex == 1) { | ||
| 875 | -// // tempTime = '08:00'; | ||
| 876 | -// // } else if (currTimeIndex == 2) { | ||
| 877 | -// // tempTime = '12:00'; | ||
| 878 | -// // } else if (currTimeIndex == 3) { | ||
| 879 | -// // tempTime = '18:00'; | ||
| 880 | -// // } | ||
| 881 | - | ||
| 882 | -// if (currTimeIndex == 1) { | ||
| 883 | -// tempTime = '08:00'; | ||
| 884 | -// if (userModel.user.morning != '' && userModel.user.morning != null) { | ||
| 885 | -// List tempDate = userModel.user.morning.split("-"); | ||
| 886 | -// tempTime = tempDate[0]; | ||
| 887 | -// } | ||
| 888 | -// } else if (currTimeIndex == 2) { | ||
| 889 | -// tempTime = '12:00'; | ||
| 890 | -// if (userModel.user.noon != '' && userModel.user.noon != null) { | ||
| 891 | -// List tempDate = userModel.user.noon.split("-"); | ||
| 892 | -// tempTime = tempDate[0]; | ||
| 893 | -// } | ||
| 894 | -// } else if (currTimeIndex == 3) { | ||
| 895 | -// tempTime = '18:00'; | ||
| 896 | -// if (userModel.user.night != '' && userModel.user.night != null) { | ||
| 897 | -// List tempDate = userModel.user.night.split("-"); | ||
| 898 | -// tempTime = tempDate[0]; | ||
| 899 | -// } | ||
| 900 | -// } | ||
| 901 | -// } | ||
| 902 | - | ||
| 903 | -// String ymd = DateUtil.formatDate(dateTime, format: DateFormats.y_mo_d); | ||
| 904 | -// String timeStr = ymd + ' ' + tempTime + ':00'; | ||
| 905 | -// // int start = DateUtil.getDateMsByTimeStr(timeStr); | ||
| 906 | - | ||
| 907 | -// LogUtil.v(timeStr); | ||
| 908 | -// // String tempDdate = ymyStr + ' ' + ddateStr + ':00'; | ||
| 909 | -// int ddate = DateUtil.getDateMsByTimeStr(timeStr); | ||
| 910 | - | ||
| 911 | -// String tableSelectInfo = ''; | ||
| 912 | -// for (TableList item in tableList) { | ||
| 913 | -// // if (item.selected) { | ||
| 914 | -// tableSelectInfo += ',${item.id}'; | ||
| 915 | -// // } | ||
| 916 | -// } | ||
| 917 | -// print(tableSelectInfo); | ||
| 918 | -// if (tableSelectInfo.startsWith(',')) { | ||
| 919 | -// tableSelectInfo = tableSelectInfo.substring(1); | ||
| 920 | -// } | ||
| 921 | -// print(tableSelectInfo); | ||
| 922 | -// String rdate = ''; | ||
| 923 | - | ||
| 924 | -// String keys = ''; | ||
| 925 | - | ||
| 926 | -// if (currTimeIndex == 1) { | ||
| 927 | -// //早市 | ||
| 928 | -// keys = 'morning'; | ||
| 929 | -// } else if (currTimeIndex == 2) { | ||
| 930 | -// //午市 | ||
| 931 | -// keys = 'noon'; | ||
| 932 | -// } else if (currTimeIndex == 3) { | ||
| 933 | -// //晚市 | ||
| 934 | -// keys = 'night'; | ||
| 935 | -// } | ||
| 936 | -// if (keys != '') { | ||
| 937 | -// List temp = dailyMap[keys]; | ||
| 938 | -// String timeStrStart = ymd + ' ' + temp.first['title'] + ':00'; | ||
| 939 | -// String timeStrEnd = ymd + ' ' + temp.last['title'] + ':00'; | ||
| 940 | -// int startM = DateUtil.getDateMsByTimeStr(timeStrStart); | ||
| 941 | -// int endM = DateUtil.getDateMsByTimeStr(timeStrEnd); | ||
| 942 | -// String start = '${startM}'.substring(0, 10); | ||
| 943 | -// String end = '${endM}'.substring(0, 10); | ||
| 944 | -// rdate = start + '-' + end; | ||
| 945 | -// } | ||
| 946 | -// Map<String, String> params = { | ||
| 947 | -// "sid": userModel.user.sellerid, //商家ID | ||
| 948 | -// "tid": tableSelectInfo, //桌子ID: 格式 2,3,4 | ||
| 949 | -// 'note_name': userModel.user.account, | ||
| 950 | -// 'type': "0", //内部预订 | ||
| 951 | -// "rdate": rdate, //预定用餐时间范围:时间戳 开始时间戳(time)-结束时间戳(time) | ||
| 952 | -// // 'is_set_ddate': "1", | ||
| 953 | -// "ddate": '${ddate}'.substring(0, 10), //到店时间 | ||
| 954 | -// "channel": '5', | ||
| 955 | -// "uid": uid | ||
| 956 | -// }; | ||
| 957 | -// if (detailEntity.id.isNotEmpty && detailEntity.id != "-1") { | ||
| 958 | -// params['rid'] = detailEntity.id; | ||
| 959 | -// } | ||
| 960 | -// if (nameStr.trim().length > 0) { | ||
| 961 | -// String sex = '1'; | ||
| 962 | -// for (var item in sexList) { | ||
| 963 | -// if (item['select']) { | ||
| 964 | -// sex = item['code']; | ||
| 965 | -// } | ||
| 966 | -// } | ||
| 967 | - | ||
| 968 | -// params['rname'] = nameStr; //预订人姓名 | ||
| 969 | -// params['sex'] = sex; //预订人性别:1:男 2:女 | ||
| 970 | -// } | ||
| 971 | -// if (phoneController.text.trim().length > 0) { | ||
| 972 | -// params['phone'] = phoneController.text.replaceAll(' ', ''); //预订人电话 | ||
| 973 | - | ||
| 974 | -// } | ||
| 975 | -// // if (customController.text.trim().length > 0) { | ||
| 976 | -// // params['cusdem'] = customController.text; //预订人需求:25汉字 | ||
| 977 | - | ||
| 978 | -// // } | ||
| 979 | -// params['cusdem'] = customController.text; //预订人需求:25汉字 | ||
| 980 | -// print(params); | ||
| 981 | -// BaseResp<Map<String, dynamic>> baseResp = await DioUtil() | ||
| 982 | -// .request<Map<String, dynamic>>( | ||
| 983 | -// context, Method.post, HttpUrl.set_reserve_info, | ||
| 984 | -// data: params) | ||
| 985 | -// .catchError((error) { | ||
| 986 | -// print(error.toString()); | ||
| 987 | -// }); | ||
| 988 | -// SunReserveInfoModel itemModel = SunReserveInfoModel(null, null, null); | ||
| 989 | -// if (baseResp == null) return itemModel; | ||
| 990 | -// if (baseResp.code == Constant.status_success) { | ||
| 991 | -// if (int.parse(baseResp.status) != Constant.status_success) { | ||
| 992 | -// Utils.showToast(baseResp.msg ?? ""); | ||
| 993 | -// return itemModel; | ||
| 994 | -// } | ||
| 995 | -// if (baseResp.responseData['data'] != null && | ||
| 996 | -// baseResp.responseData['data']['row'] != null) { | ||
| 997 | -// itemModel = ReserveInfoModel.fromJson(baseResp.responseData).data; | ||
| 998 | -// } else { | ||
| 999 | -// Utils.showToast(baseResp.msg ?? detailEntity.id == "-1" | ||
| 1000 | -// ? "录入预订订单失败,请重试!" | ||
| 1001 | -// : "变更预订订单失败,请重试!"); | ||
| 1002 | -// } | ||
| 1003 | -// return itemModel; | ||
| 1004 | -// } | ||
| 1005 | -// } | ||
| 1006 | - | ||
| 1007 | -// //更改在线预订 | ||
| 1008 | -// Future<SunReserveInfoModel> updateOnlineReserveInfoOnly( | ||
| 1009 | -// BuildContext context, String nameStr, String uid) async { | ||
| 1010 | -// UserModel userModel = Provider.of<UserModel>(context, listen: false); | ||
| 1011 | -// if (phoneController.text.trim().length > 0) { | ||
| 1012 | -// //判断是否可以输入自己的手机号 | ||
| 1013 | -// CustomerProvider customerProvider = | ||
| 1014 | -// Provider.of<CustomerProvider>(context, listen: false); | ||
| 1015 | -// await customerProvider.getSellerGuest(context); | ||
| 1016 | -// if (customerProvider.isselfphone) { | ||
| 1017 | -// //录入客户电话时不能用自己手机号(管店) | ||
| 1018 | - | ||
| 1019 | -// if (userModel.user.userphone == phoneController.text.trim() || | ||
| 1020 | -// userModel.user.userphoneMyPage == phoneController.text.trim()) { | ||
| 1021 | -// Utils.showToast('录入客户电话时不能用自己手机号!'); | ||
| 1022 | -// return null; | ||
| 1023 | -// } | ||
| 1024 | -// } | ||
| 1025 | -// } | ||
| 1026 | -// // String pnum = ''; | ||
| 1027 | -// // for (var item in personNumList) { | ||
| 1028 | -// // if (item['isSelect']) { | ||
| 1029 | -// // pnum = item['dateText']; | ||
| 1030 | -// // } | ||
| 1031 | -// // } | ||
| 1032 | - | ||
| 1033 | -// // String sex = '1'; | ||
| 1034 | -// // for (var item in sexList) { | ||
| 1035 | -// // if (item['select']) { | ||
| 1036 | -// // sex = item['code']; | ||
| 1037 | -// // } | ||
| 1038 | -// // } | ||
| 1039 | -// // //当前选中 年-月-日string | ||
| 1040 | -// // String ymyStr = ""; | ||
| 1041 | -// // //今天 明天 其他天 | ||
| 1042 | -// // for (var item in dateList) { | ||
| 1043 | -// // if (item['select'] == true) { | ||
| 1044 | -// // ymyStr = item['title']; | ||
| 1045 | -// // } | ||
| 1046 | -// // } | ||
| 1047 | -// // String timeStr = ymyStr + ' ' + ddateStr + ':00'; | ||
| 1048 | -// // // int start = DateUtil.getDateMsByTimeStr(timeStr); | ||
| 1049 | - | ||
| 1050 | -// // // String tempDdate = ymyStr + ' ' + ddateStr + ':00'; | ||
| 1051 | -// // int ddate = DateUtil.getDateMsByTimeStr(timeStr); | ||
| 1052 | -// // String tableSelectInfo = ''; | ||
| 1053 | -// // for (TableList item in tableList) { | ||
| 1054 | -// // // if (item.selected) { | ||
| 1055 | -// // tableSelectInfo += ',${item.id}'; | ||
| 1056 | -// // // } | ||
| 1057 | -// // } | ||
| 1058 | -// // print(tableSelectInfo); | ||
| 1059 | -// // if (tableSelectInfo.startsWith(',')) { | ||
| 1060 | -// // tableSelectInfo = tableSelectInfo.substring(1); | ||
| 1061 | -// // } | ||
| 1062 | -// // print(tableSelectInfo); | ||
| 1063 | -// // String rdate = ''; | ||
| 1064 | -// // String ddateSolt = ''; | ||
| 1065 | -// // print(sunDateList); | ||
| 1066 | -// // for (var item in sunDateList) { | ||
| 1067 | -// // if (item['isSelect'] == true) { | ||
| 1068 | -// // String keys = ''; | ||
| 1069 | -// // ddateSolt = '${item['ddateSolt']}'; | ||
| 1070 | -// // if (item['ddateSolt'] == 1) { | ||
| 1071 | -// // //早市 | ||
| 1072 | -// // keys = 'morning'; | ||
| 1073 | -// // } else if (item['ddateSolt'] == 2) { | ||
| 1074 | -// // //午市 | ||
| 1075 | -// // keys = 'noon'; | ||
| 1076 | -// // } else if (item['ddateSolt'] == 3) { | ||
| 1077 | -// // //晚市 | ||
| 1078 | -// // keys = 'night'; | ||
| 1079 | -// // } | ||
| 1080 | -// // if (keys != '') { | ||
| 1081 | -// // List temp = dailyMap[keys]; | ||
| 1082 | -// // String timeStrStart = ymyStr + ' ' + temp.first['title'] + ':00'; | ||
| 1083 | -// // String timeStrEnd = ymyStr + ' ' + temp.last['title'] + ':00'; | ||
| 1084 | -// // int startM = DateUtil.getDateMsByTimeStr(timeStrStart); | ||
| 1085 | -// // int endM = DateUtil.getDateMsByTimeStr(timeStrEnd); | ||
| 1086 | -// // String start = '${startM}'.substring(0, 10); | ||
| 1087 | -// // String end = '${endM}'.substring(0, 10); | ||
| 1088 | -// // rdate = start + '-' + end; | ||
| 1089 | -// // } | ||
| 1090 | -// // } | ||
| 1091 | -// // } | ||
| 1092 | -// // Map<String, String> params = { | ||
| 1093 | -// //1 "rid": detailEntity.id, | ||
| 1094 | -// // 'is_set_ddate': isSetDate, | ||
| 1095 | -// //1 "sid": userModel.user.sellerid, //商家ID | ||
| 1096 | -// //1 "tid": tableSelectInfo, //桌子ID: 格式 2,3,4 | ||
| 1097 | -// //1 "rname": nameController.text, //预订人姓名 | ||
| 1098 | -// //1 "sex": sex, //预订人姓名:1:男 2:女 | ||
| 1099 | -// //1 "phone": phoneController.text, //预订人电话 | ||
| 1100 | -// // "cusdem": customController.text, //预订人需求:25汉字 | ||
| 1101 | -// //1 "type": "0", | ||
| 1102 | -// //1 "rdate": rdate, //预定用餐时间范围:时间戳 开始时间戳(time)-结束时间戳(time) | ||
| 1103 | -// //1 "ddate": '${ddate}'.substring(0, 10), //到店时间 | ||
| 1104 | -// // "ddate_solt": ddateSolt | ||
| 1105 | -// // }; | ||
| 1106 | -// // if (pnum != '' && pnum != null) { | ||
| 1107 | -// // params['pnum'] = pnum; | ||
| 1108 | -// // } | ||
| 1109 | -// // print(params); | ||
| 1110 | -// String ddateHm = detailEntity.ddateHm; //订座详情页面的到店时间 | ||
| 1111 | -// String ddateSolt = detailEntity.ddate_solt; //订座详情页面的餐段(1,2,3 早餐、午餐、晚餐) | ||
| 1112 | -// String tempTime = ddateHm; //默认上个页面到店时间半小时值 | ||
| 1113 | - | ||
| 1114 | -// if (ddateSolt != currTimeIndex.toString() || tempTime == '') { | ||
| 1115 | -// //餐段发生改变,则重新默认到店时间半小时值 | ||
| 1116 | -// // if (currTimeIndex == 1) { | ||
| 1117 | -// // tempTime = '08:00'; | ||
| 1118 | -// // ddateSolt = '1'; | ||
| 1119 | -// // } else if (currTimeIndex == 2) { | ||
| 1120 | -// // tempTime = '12:00'; | ||
| 1121 | -// // ddateSolt = '2'; | ||
| 1122 | -// // } else if (currTimeIndex == 3) { | ||
| 1123 | -// // tempTime = '18:00'; | ||
| 1124 | -// // ddateSolt = '3'; | ||
| 1125 | -// // } | ||
| 1126 | -// if (currTimeIndex == 1) { | ||
| 1127 | -// tempTime = '08:00'; | ||
| 1128 | -// ddateSolt = '1'; | ||
| 1129 | -// if (userModel.user.morning != '' && userModel.user.morning != null) { | ||
| 1130 | -// List tempDate = userModel.user.morning.split("-"); | ||
| 1131 | -// tempTime = tempDate[0]; | ||
| 1132 | -// } | ||
| 1133 | -// } else if (currTimeIndex == 2) { | ||
| 1134 | -// tempTime = '12:00'; | ||
| 1135 | -// ddateSolt = '2'; | ||
| 1136 | -// if (userModel.user.noon != '' && userModel.user.noon != null) { | ||
| 1137 | -// List tempDate = userModel.user.noon.split("-"); | ||
| 1138 | -// tempTime = tempDate[0]; | ||
| 1139 | -// } | ||
| 1140 | -// } else if (currTimeIndex == 3) { | ||
| 1141 | -// tempTime = '18:00'; | ||
| 1142 | -// ddateSolt = '3'; | ||
| 1143 | -// if (userModel.user.night != '' && userModel.user.night != null) { | ||
| 1144 | -// List tempDate = userModel.user.night.split("-"); | ||
| 1145 | -// tempTime = tempDate[0]; | ||
| 1146 | -// } | ||
| 1147 | -// } | ||
| 1148 | -// } | ||
| 1149 | - | ||
| 1150 | -// String ymd = DateUtil.formatDate(dateTime, format: DateFormats.y_mo_d); | ||
| 1151 | -// String timeStr = ymd + ' ' + tempTime + ':00'; | ||
| 1152 | -// // int start = DateUtil.getDateMsByTimeStr(timeStr); | ||
| 1153 | - | ||
| 1154 | -// LogUtil.v(timeStr); | ||
| 1155 | -// // String tempDdate = ymyStr + ' ' + ddateStr + ':00'; | ||
| 1156 | -// int ddate = DateUtil.getDateMsByTimeStr(timeStr); | ||
| 1157 | - | ||
| 1158 | -// String tableSelectInfo = ''; | ||
| 1159 | -// for (TableListReserve item in tableListOrReserve) { | ||
| 1160 | -// // if (item.selected) { | ||
| 1161 | -// tableSelectInfo += ',${item.id}'; | ||
| 1162 | -// // } | ||
| 1163 | -// } | ||
| 1164 | -// print(tableSelectInfo); | ||
| 1165 | -// if (tableSelectInfo.startsWith(',')) { | ||
| 1166 | -// tableSelectInfo = tableSelectInfo.substring(1); | ||
| 1167 | -// } | ||
| 1168 | -// print(tableSelectInfo); | ||
| 1169 | -// String rdate = ''; | ||
| 1170 | - | ||
| 1171 | -// String timeStrStart; | ||
| 1172 | -// String timeStrEnd; | ||
| 1173 | - | ||
| 1174 | -// if (currTimeIndex == 1) { | ||
| 1175 | -// //早市 | ||
| 1176 | -// List timem = morning.split('-'); | ||
| 1177 | -// timeStrStart = ymd + ' ' + timem[0] + ':00'; | ||
| 1178 | -// timeStrEnd = ymd + ' ' + timem[1] + ':00'; | ||
| 1179 | -// } else if (currTimeIndex == 2) { | ||
| 1180 | -// //午市 | ||
| 1181 | -// List timem = noon.split('-'); | ||
| 1182 | -// timeStrStart = ymd + ' ' + timem[0] + ':00'; | ||
| 1183 | -// timeStrEnd = ymd + ' ' + timem[1] + ':00'; | ||
| 1184 | -// } else if (currTimeIndex == 3) { | ||
| 1185 | -// //晚市 | ||
| 1186 | -// List timem = night.split('-'); | ||
| 1187 | -// timeStrStart = ymd + ' ' + timem[0] + ':00'; | ||
| 1188 | -// timeStrEnd = ymd + ' ' + timem[1] + ':00'; | ||
| 1189 | -// } | ||
| 1190 | - | ||
| 1191 | -// int startM = DateUtil.getDateMsByTimeStr(timeStrStart); | ||
| 1192 | -// int endM = DateUtil.getDateMsByTimeStr(timeStrEnd); | ||
| 1193 | -// String start = '${startM}'.substring(0, 10); | ||
| 1194 | -// String end = '${endM}'.substring(0, 10); | ||
| 1195 | -// rdate = start + '-' + end; | ||
| 1196 | -// // Map<String, String> params = { | ||
| 1197 | -// // "sid": userModel.user.sellerid, //商家ID | ||
| 1198 | -// // "tid": tableSelectInfo, //桌子ID: 格式 2,3,4 | ||
| 1199 | -// // 'note_name': userModel.user.account, | ||
| 1200 | -// // 'type': "0", //内部预订 | ||
| 1201 | -// // "rdate": rdate, //预定用餐时间范围:时间戳 开始时间戳(time)-结束时间戳(time) | ||
| 1202 | -// // // 'is_set_ddate': "1", | ||
| 1203 | -// // "ddate": '${ddate}'.substring(0, 10), //到店时间 | ||
| 1204 | -// // "channel": '5', | ||
| 1205 | -// // // "uid": userModel.user.openid | ||
| 1206 | -// // }; | ||
| 1207 | -// Map<String, String> params = { | ||
| 1208 | -// // 'is_set_ddate': isSetDate, | ||
| 1209 | -// "sid": userModel.user.sellerid, //商家ID | ||
| 1210 | -// "tid": tableSelectInfo, //桌子ID: 格式 2,3,4 | ||
| 1211 | - | ||
| 1212 | -// "type": "0", | ||
| 1213 | -// "rdate": rdate, //预定用餐时间范围:时间戳 开始时间戳(time)-结束时间戳(time) | ||
| 1214 | -// "ddate": '${ddate}'.substring(0, 10), //到店时间 | ||
| 1215 | -// "ddate_solt": ddateSolt, | ||
| 1216 | -// 'note_name': userModel.user.account | ||
| 1217 | -// }; | ||
| 1218 | - | ||
| 1219 | -// if (detailEntity.id.isNotEmpty && detailEntity.id != "-1") { | ||
| 1220 | -// params['rid'] = detailEntity.id; | ||
| 1221 | -// } | ||
| 1222 | -// if (nameStr.trim().length > 0) { | ||
| 1223 | -// String sex = '1'; | ||
| 1224 | -// for (var item in sexList) { | ||
| 1225 | -// if (item['select']) { | ||
| 1226 | -// sex = item['code']; | ||
| 1227 | -// } | ||
| 1228 | -// } | ||
| 1229 | - | ||
| 1230 | -// params['rname'] = nameStr; //预订人姓名 | ||
| 1231 | -// params['sex'] = sex; //预订人性别:1:男 2:女 | ||
| 1232 | -// } | ||
| 1233 | -// if (phoneController.text.trim().length > 0) { | ||
| 1234 | -// params['phone'] = phoneController.text.replaceAll(' ', ''); //预订人电话 | ||
| 1235 | - | ||
| 1236 | -// } | ||
| 1237 | -// // if (customController.text.trim().length > 0) { | ||
| 1238 | - | ||
| 1239 | -// params['cusdem'] = customController.text; //预订人需求:25汉字 | ||
| 1240 | - | ||
| 1241 | -// // } | ||
| 1242 | -// print(params); | ||
| 1243 | -// BaseResp<Map<String, dynamic>> baseResp = await DioUtil() | ||
| 1244 | -// .request<Map<String, dynamic>>( | ||
| 1245 | -// context, Method.post, HttpUrl.set_customer_info, | ||
| 1246 | -// data: params) | ||
| 1247 | -// .catchError((error) { | ||
| 1248 | -// print(error.toString()); | ||
| 1249 | -// }); | ||
| 1250 | -// SunReserveInfoModel itemModel; | ||
| 1251 | -// if (baseResp == null) return itemModel; | ||
| 1252 | -// if (baseResp.code == Constant.status_success) { | ||
| 1253 | -// if (int.parse(baseResp.status) != Constant.status_success) { | ||
| 1254 | -// Utils.showToast(baseResp.msg ?? ""); | ||
| 1255 | -// return itemModel; | ||
| 1256 | -// } | ||
| 1257 | -// if (baseResp.responseData['data'] != null && | ||
| 1258 | -// baseResp.responseData['data']['row'] != null) { | ||
| 1259 | -// itemModel = ReserveInfoModel.fromJson(baseResp.responseData).data; | ||
| 1260 | -// } else { | ||
| 1261 | -// Utils.showToast(baseResp.msg ?? "变更预订订单失败,请重试!"); | ||
| 1262 | -// } | ||
| 1263 | -// return itemModel; | ||
| 1264 | -// } | ||
| 1265 | -// } | ||
| 1266 | - | ||
| 1267 | -// //更改在线预订 | ||
| 1268 | -// Future<SunReserveInfoModel> updateOnlineReserveInfo( | ||
| 1269 | -// BuildContext context, String nameStr, String uid) async { | ||
| 1270 | -// UserModel userModel = Provider.of<UserModel>(context, listen: false); | ||
| 1271 | -// if (phoneController.text.trim().length > 0) { | ||
| 1272 | -// //判断是否可以输入自己的手机号 | ||
| 1273 | -// CustomerProvider customerProvider = | ||
| 1274 | -// Provider.of<CustomerProvider>(context, listen: false); | ||
| 1275 | -// await customerProvider.getSellerGuest(context); | ||
| 1276 | -// if (customerProvider.isselfphone) { | ||
| 1277 | -// //录入客户电话时不能用自己手机号(管店) | ||
| 1278 | - | ||
| 1279 | -// if (userModel.user.userphone == phoneController.text.trim() || | ||
| 1280 | -// userModel.user.userphoneMyPage == phoneController.text.trim()) { | ||
| 1281 | -// Utils.showToast('录入客户电话时不能用自己手机号!'); | ||
| 1282 | -// return null; | ||
| 1283 | -// } | ||
| 1284 | -// } | ||
| 1285 | -// } | ||
| 1286 | -// // String pnum = ''; | ||
| 1287 | -// // for (var item in personNumList) { | ||
| 1288 | -// // if (item['isSelect']) { | ||
| 1289 | -// // pnum = item['dateText']; | ||
| 1290 | -// // } | ||
| 1291 | -// // } | ||
| 1292 | - | ||
| 1293 | -// // String sex = '1'; | ||
| 1294 | -// // for (var item in sexList) { | ||
| 1295 | -// // if (item['select']) { | ||
| 1296 | -// // sex = item['code']; | ||
| 1297 | -// // } | ||
| 1298 | -// // } | ||
| 1299 | -// // //当前选中 年-月-日string | ||
| 1300 | -// // String ymyStr = ""; | ||
| 1301 | -// // //今天 明天 其他天 | ||
| 1302 | -// // for (var item in dateList) { | ||
| 1303 | -// // if (item['select'] == true) { | ||
| 1304 | -// // ymyStr = item['title']; | ||
| 1305 | -// // } | ||
| 1306 | -// // } | ||
| 1307 | -// // String timeStr = ymyStr + ' ' + ddateStr + ':00'; | ||
| 1308 | -// // // int start = DateUtil.getDateMsByTimeStr(timeStr); | ||
| 1309 | - | ||
| 1310 | -// // // String tempDdate = ymyStr + ' ' + ddateStr + ':00'; | ||
| 1311 | -// // int ddate = DateUtil.getDateMsByTimeStr(timeStr); | ||
| 1312 | -// // String tableSelectInfo = ''; | ||
| 1313 | -// // for (TableList item in tableList) { | ||
| 1314 | -// // // if (item.selected) { | ||
| 1315 | -// // tableSelectInfo += ',${item.id}'; | ||
| 1316 | -// // // } | ||
| 1317 | -// // } | ||
| 1318 | -// // print(tableSelectInfo); | ||
| 1319 | -// // if (tableSelectInfo.startsWith(',')) { | ||
| 1320 | -// // tableSelectInfo = tableSelectInfo.substring(1); | ||
| 1321 | -// // } | ||
| 1322 | -// // print(tableSelectInfo); | ||
| 1323 | -// // String rdate = ''; | ||
| 1324 | -// // String ddateSolt = ''; | ||
| 1325 | -// // print(sunDateList); | ||
| 1326 | -// // for (var item in sunDateList) { | ||
| 1327 | -// // if (item['isSelect'] == true) { | ||
| 1328 | -// // String keys = ''; | ||
| 1329 | -// // ddateSolt = '${item['ddateSolt']}'; | ||
| 1330 | -// // if (item['ddateSolt'] == 1) { | ||
| 1331 | -// // //早市 | ||
| 1332 | -// // keys = 'morning'; | ||
| 1333 | -// // } else if (item['ddateSolt'] == 2) { | ||
| 1334 | -// // //午市 | ||
| 1335 | -// // keys = 'noon'; | ||
| 1336 | -// // } else if (item['ddateSolt'] == 3) { | ||
| 1337 | -// // //晚市 | ||
| 1338 | -// // keys = 'night'; | ||
| 1339 | -// // } | ||
| 1340 | -// // if (keys != '') { | ||
| 1341 | -// // List temp = dailyMap[keys]; | ||
| 1342 | -// // String timeStrStart = ymyStr + ' ' + temp.first['title'] + ':00'; | ||
| 1343 | -// // String timeStrEnd = ymyStr + ' ' + temp.last['title'] + ':00'; | ||
| 1344 | -// // int startM = DateUtil.getDateMsByTimeStr(timeStrStart); | ||
| 1345 | -// // int endM = DateUtil.getDateMsByTimeStr(timeStrEnd); | ||
| 1346 | -// // String start = '${startM}'.substring(0, 10); | ||
| 1347 | -// // String end = '${endM}'.substring(0, 10); | ||
| 1348 | -// // rdate = start + '-' + end; | ||
| 1349 | -// // } | ||
| 1350 | -// // } | ||
| 1351 | -// // } | ||
| 1352 | -// // Map<String, String> params = { | ||
| 1353 | -// //1 "rid": detailEntity.id, | ||
| 1354 | -// // 'is_set_ddate': isSetDate, | ||
| 1355 | -// //1 "sid": userModel.user.sellerid, //商家ID | ||
| 1356 | -// //1 "tid": tableSelectInfo, //桌子ID: 格式 2,3,4 | ||
| 1357 | -// //1 "rname": nameController.text, //预订人姓名 | ||
| 1358 | -// //1 "sex": sex, //预订人姓名:1:男 2:女 | ||
| 1359 | -// //1 "phone": phoneController.text, //预订人电话 | ||
| 1360 | -// // "cusdem": customController.text, //预订人需求:25汉字 | ||
| 1361 | -// //1 "type": "0", | ||
| 1362 | -// //1 "rdate": rdate, //预定用餐时间范围:时间戳 开始时间戳(time)-结束时间戳(time) | ||
| 1363 | -// //1 "ddate": '${ddate}'.substring(0, 10), //到店时间 | ||
| 1364 | -// // "ddate_solt": ddateSolt | ||
| 1365 | -// // }; | ||
| 1366 | -// // if (pnum != '' && pnum != null) { | ||
| 1367 | -// // params['pnum'] = pnum; | ||
| 1368 | -// // } | ||
| 1369 | -// // print(params); | ||
| 1370 | -// String ddateHm = detailEntity.ddateHm; //订座详情页面的到店时间 | ||
| 1371 | -// String ddateSolt = detailEntity.ddate_solt; //订座详情页面的餐段(1,2,3 早餐、午餐、晚餐) | ||
| 1372 | -// String tempTime = ddateHm; //默认上个页面到店时间半小时值 | ||
| 1373 | - | ||
| 1374 | -// if (ddateSolt != currTimeIndex.toString() || tempTime == '') { | ||
| 1375 | -// //餐段发生改变,则重新默认到店时间半小时值 | ||
| 1376 | -// // if (currTimeIndex == 1) { | ||
| 1377 | -// // tempTime = '08:00'; | ||
| 1378 | -// // ddateSolt = '1'; | ||
| 1379 | -// // } else if (currTimeIndex == 2) { | ||
| 1380 | -// // tempTime = '12:00'; | ||
| 1381 | -// // ddateSolt = '2'; | ||
| 1382 | -// // } else if (currTimeIndex == 3) { | ||
| 1383 | -// // tempTime = '18:00'; | ||
| 1384 | -// // ddateSolt = '3'; | ||
| 1385 | -// // } | ||
| 1386 | -// if (currTimeIndex == 1) { | ||
| 1387 | -// tempTime = '08:00'; | ||
| 1388 | -// ddateSolt = '1'; | ||
| 1389 | -// if (userModel.user.morning != '' && userModel.user.morning != null) { | ||
| 1390 | -// List tempDate = userModel.user.morning.split("-"); | ||
| 1391 | -// tempTime = tempDate[0]; | ||
| 1392 | -// } | ||
| 1393 | -// } else if (currTimeIndex == 2) { | ||
| 1394 | -// tempTime = '12:00'; | ||
| 1395 | -// ddateSolt = '2'; | ||
| 1396 | -// if (userModel.user.noon != '' && userModel.user.noon != null) { | ||
| 1397 | -// List tempDate = userModel.user.noon.split("-"); | ||
| 1398 | -// tempTime = tempDate[0]; | ||
| 1399 | -// } | ||
| 1400 | -// } else if (currTimeIndex == 3) { | ||
| 1401 | -// tempTime = '18:00'; | ||
| 1402 | -// ddateSolt = '3'; | ||
| 1403 | -// if (userModel.user.night != '' && userModel.user.night != null) { | ||
| 1404 | -// List tempDate = userModel.user.night.split("-"); | ||
| 1405 | -// tempTime = tempDate[0]; | ||
| 1406 | -// } | ||
| 1407 | -// } | ||
| 1408 | -// } | ||
| 1409 | - | ||
| 1410 | -// String ymd = DateUtil.formatDate(dateTime, format: DateFormats.y_mo_d); | ||
| 1411 | -// String timeStr = ymd + ' ' + tempTime + ':00'; | ||
| 1412 | -// // int start = DateUtil.getDateMsByTimeStr(timeStr); | ||
| 1413 | - | ||
| 1414 | -// LogUtil.v(timeStr); | ||
| 1415 | -// // String tempDdate = ymyStr + ' ' + ddateStr + ':00'; | ||
| 1416 | -// int ddate = DateUtil.getDateMsByTimeStr(timeStr); | ||
| 1417 | - | ||
| 1418 | -// String tableSelectInfo = ''; | ||
| 1419 | -// for (TableList item in tableList) { | ||
| 1420 | -// // if (item.selected) { | ||
| 1421 | -// tableSelectInfo += ',${item.id}'; | ||
| 1422 | -// // } | ||
| 1423 | -// } | ||
| 1424 | -// print(tableSelectInfo); | ||
| 1425 | -// if (tableSelectInfo.startsWith(',')) { | ||
| 1426 | -// tableSelectInfo = tableSelectInfo.substring(1); | ||
| 1427 | -// } | ||
| 1428 | -// print(tableSelectInfo); | ||
| 1429 | -// String rdate = ''; | ||
| 1430 | - | ||
| 1431 | -// String keys = ''; | ||
| 1432 | - | ||
| 1433 | -// if (currTimeIndex == 1) { | ||
| 1434 | -// //早市 | ||
| 1435 | -// keys = 'morning'; | ||
| 1436 | -// } else if (currTimeIndex == 2) { | ||
| 1437 | -// //午市 | ||
| 1438 | -// keys = 'noon'; | ||
| 1439 | -// } else if (currTimeIndex == 3) { | ||
| 1440 | -// //晚市 | ||
| 1441 | -// keys = 'night'; | ||
| 1442 | -// } | ||
| 1443 | -// if (keys != '') { | ||
| 1444 | -// List temp = dailyMap[keys]; | ||
| 1445 | -// String timeStrStart = ymd + ' ' + temp.first['title'] + ':00'; | ||
| 1446 | -// String timeStrEnd = ymd + ' ' + temp.last['title'] + ':00'; | ||
| 1447 | -// int startM = DateUtil.getDateMsByTimeStr(timeStrStart); | ||
| 1448 | -// int endM = DateUtil.getDateMsByTimeStr(timeStrEnd); | ||
| 1449 | -// String start = '${startM}'.substring(0, 10); | ||
| 1450 | -// String end = '${endM}'.substring(0, 10); | ||
| 1451 | -// rdate = start + '-' + end; | ||
| 1452 | -// } | ||
| 1453 | -// // Map<String, String> params = { | ||
| 1454 | -// // "sid": userModel.user.sellerid, //商家ID | ||
| 1455 | -// // "tid": tableSelectInfo, //桌子ID: 格式 2,3,4 | ||
| 1456 | -// // 'note_name': userModel.user.account, | ||
| 1457 | -// // 'type': "0", //内部预订 | ||
| 1458 | -// // "rdate": rdate, //预定用餐时间范围:时间戳 开始时间戳(time)-结束时间戳(time) | ||
| 1459 | -// // // 'is_set_ddate': "1", | ||
| 1460 | -// // "ddate": '${ddate}'.substring(0, 10), //到店时间 | ||
| 1461 | -// // "channel": '5', | ||
| 1462 | -// // // "uid": userModel.user.openid | ||
| 1463 | -// // }; | ||
| 1464 | -// Map<String, String> params = { | ||
| 1465 | -// // 'is_set_ddate': isSetDate, | ||
| 1466 | -// "sid": userModel.user.sellerid, //商家ID | ||
| 1467 | -// "tid": tableSelectInfo, //桌子ID: 格式 2,3,4 | ||
| 1468 | - | ||
| 1469 | -// "type": "0", | ||
| 1470 | -// "rdate": rdate, //预定用餐时间范围:时间戳 开始时间戳(time)-结束时间戳(time) | ||
| 1471 | -// "ddate": '${ddate}'.substring(0, 10), //到店时间 | ||
| 1472 | -// "ddate_solt": ddateSolt, | ||
| 1473 | -// 'note_name': userModel.user.account | ||
| 1474 | -// }; | ||
| 1475 | - | ||
| 1476 | -// if (detailEntity.id.isNotEmpty && detailEntity.id != "-1") { | ||
| 1477 | -// params['rid'] = detailEntity.id; | ||
| 1478 | -// } | ||
| 1479 | -// if (nameStr.trim().length > 0) { | ||
| 1480 | -// String sex = '1'; | ||
| 1481 | -// for (var item in sexList) { | ||
| 1482 | -// if (item['select']) { | ||
| 1483 | -// sex = item['code']; | ||
| 1484 | -// } | ||
| 1485 | -// } | ||
| 1486 | - | ||
| 1487 | -// params['rname'] = nameStr; //预订人姓名 | ||
| 1488 | -// params['sex'] = sex; //预订人性别:1:男 2:女 | ||
| 1489 | -// } | ||
| 1490 | -// if (phoneController.text.trim().length > 0) { | ||
| 1491 | -// params['phone'] = phoneController.text.replaceAll(' ', ''); //预订人电话 | ||
| 1492 | - | ||
| 1493 | -// } | ||
| 1494 | -// // if (customController.text.trim().length > 0) { | ||
| 1495 | - | ||
| 1496 | -// params['cusdem'] = customController.text; //预订人需求:25汉字 | ||
| 1497 | - | ||
| 1498 | -// // } | ||
| 1499 | -// print(params); | ||
| 1500 | -// BaseResp<Map<String, dynamic>> baseResp = await DioUtil() | ||
| 1501 | -// .request<Map<String, dynamic>>( | ||
| 1502 | -// context, Method.post, HttpUrl.set_customer_info, | ||
| 1503 | -// data: params) | ||
| 1504 | -// .catchError((error) { | ||
| 1505 | -// print(error.toString()); | ||
| 1506 | -// }); | ||
| 1507 | -// SunReserveInfoModel itemModel; | ||
| 1508 | -// if (baseResp == null) return itemModel; | ||
| 1509 | -// if (baseResp.code == Constant.status_success) { | ||
| 1510 | -// if (int.parse(baseResp.status) != Constant.status_success) { | ||
| 1511 | -// Utils.showToast(baseResp.msg ?? ""); | ||
| 1512 | -// return itemModel; | ||
| 1513 | -// } | ||
| 1514 | -// if (baseResp.responseData['data'] != null && | ||
| 1515 | -// baseResp.responseData['data']['row'] != null) { | ||
| 1516 | -// itemModel = ReserveInfoModel.fromJson(baseResp.responseData).data; | ||
| 1517 | -// } else { | ||
| 1518 | -// Utils.showToast(baseResp.msg ?? "变更预订订单失败,请重试!"); | ||
| 1519 | -// } | ||
| 1520 | -// return itemModel; | ||
| 1521 | -// } | ||
| 1522 | -// } | ||
| 1523 | - | ||
| 1524 | -// //获取历史录入 | ||
| 1525 | -// getUserHistorys(BuildContext context, Map<String, String> params) async { | ||
| 1526 | -// BaseResp<List> baseResp = await DioUtil() | ||
| 1527 | -// .request<List>(context, Method.post, HttpUrl.get_reserve_user, | ||
| 1528 | -// data: params, showLoading: false) | ||
| 1529 | -// .catchError((error) { | ||
| 1530 | -// print(error.toString()); | ||
| 1531 | -// }); | ||
| 1532 | -// if (baseResp != null && baseResp.code == Constant.status_success) { | ||
| 1533 | -// userHistorys = baseResp.data.map<UserHistoryEntity>((value) { | ||
| 1534 | -// return UserHistoryEntity.fromJson(value); | ||
| 1535 | -// }).toList(); | ||
| 1536 | -// notifyListeners(); | ||
| 1537 | -// } | ||
| 1538 | -// } | ||
| 1539 | -// } |
| @@ -18,14 +18,14 @@ class RemarkManagerModel extends ChangeNotifier { | @@ -18,14 +18,14 @@ class RemarkManagerModel extends ChangeNotifier { | ||
| 18 | 18 | ||
| 19 | //获取备注 | 19 | //获取备注 |
| 20 | getRemarks(BuildContext context, Map<String, String> params, | 20 | getRemarks(BuildContext context, Map<String, String> params, |
| 21 | - {bool showPageLoading = false}) async { | 21 | + {bool showPageLoading = false,bool selfDismiss = false}) async { |
| 22 | if (showPageLoading) { | 22 | if (showPageLoading) { |
| 23 | pageState = PageState.Loading; | 23 | pageState = PageState.Loading; |
| 24 | notifyListeners(); | 24 | notifyListeners(); |
| 25 | } | 25 | } |
| 26 | BaseResp<List> baseResp = await DioUtil() | 26 | BaseResp<List> baseResp = await DioUtil() |
| 27 | .request<List>(context, Method.post, HttpUrl.get_custom_remark, | 27 | .request<List>(context, Method.post, HttpUrl.get_custom_remark, |
| 28 | - data: params, showLoading: showPageLoading ? false : true) | 28 | + data: params, showLoading: showPageLoading ? false : true,selfDismiss: selfDismiss) |
| 29 | .catchError((error) { | 29 | .catchError((error) { |
| 30 | print(error.toString()); | 30 | print(error.toString()); |
| 31 | if (error is MyError) { | 31 | if (error is MyError) { |
| @@ -185,11 +185,11 @@ class NavigatorUtil { | @@ -185,11 +185,11 @@ class NavigatorUtil { | ||
| 185 | String ridFeast}) { | 185 | String ridFeast}) { |
| 186 | if (object != null) { | 186 | if (object != null) { |
| 187 | return _navigateTo(context, | 187 | return _navigateTo(context, |
| 188 | - "${Routes.select_table_f}?rid=$rid&ridFeast=$ridFeast&tid=$tid&dateTime=$dateTime&fromPage=$fromPage&ddate_slot=$ddate_slot&canChoose=$canChoose&object=${FluroConvertUtils.object2string(object)}&hmS=$hmS&hmE=$hmE&source=$source"); | 188 | + "${Routes.select_table_f_or_reserve}?rid=$rid&ridFeast=$ridFeast&tid=$tid&dateTime=$dateTime&fromPage=$fromPage&ddate_slot=$ddate_slot&canChoose=$canChoose&object=${FluroConvertUtils.object2string(object)}&hmS=$hmS&hmE=$hmE&source=$source"); |
| 189 | } | 189 | } |
| 190 | // object = {'object': [], "tid": ''}; | 190 | // object = {'object': [], "tid": ''}; |
| 191 | return _navigateTo(context, | 191 | return _navigateTo(context, |
| 192 | - "${Routes.select_table_f}?rid=$rid&ridFeast=$ridFeast&tid=$tid&dateTime=$dateTime&fromPage=$fromPage&ddate_slot=$ddate_slot&canChoose=$canChoose&hmS=$hmS&hmE=$hmE&source=$source"); | 192 | + "${Routes.select_table_f_or_reserve}?rid=$rid&ridFeast=$ridFeast&tid=$tid&dateTime=$dateTime&fromPage=$fromPage&ddate_slot=$ddate_slot&canChoose=$canChoose&hmS=$hmS&hmE=$hmE&source=$source"); |
| 193 | } | 193 | } |
| 194 | /// 选择桌位——方硕新修改的选择桌位页面 | 194 | /// 选择桌位——方硕新修改的选择桌位页面 |
| 195 | static Future goSelectTableFPage( | 195 | static Future goSelectTableFPage( |
| @@ -272,6 +272,23 @@ class NavigatorUtil { | @@ -272,6 +272,23 @@ class NavigatorUtil { | ||
| 272 | "${Routes.change_detail_f}?detail=${FluroConvertUtils.object2string(detailEntity)}&rid=$rid&back=${back}", | 272 | "${Routes.change_detail_f}?detail=${FluroConvertUtils.object2string(detailEntity)}&rid=$rid&back=${back}", |
| 273 | replace: replace); | 273 | replace: replace); |
| 274 | } | 274 | } |
| 275 | + | ||
| 276 | + /// 变更预订——方硕新修改页面 | ||
| 277 | + static void goNoteBookChangeFPageOnly( | ||
| 278 | + BuildContext context, | ||
| 279 | + NotebookDetail detailEntity, | ||
| 280 | + String rid, { | ||
| 281 | + replace = false, | ||
| 282 | + bool back = false, | ||
| 283 | + }) { | ||
| 284 | + if (detailEntity.type == "0") { | ||
| 285 | + //内部预订 | ||
| 286 | + detailEntity.is_set_ddate = "1"; | ||
| 287 | + } | ||
| 288 | + _navigateTo(context, | ||
| 289 | + "${Routes.change_detail_f_only}?detail=${FluroConvertUtils.object2string(detailEntity)}&rid=$rid&back=${back}", | ||
| 290 | + replace: replace); | ||
| 291 | + } | ||
| 275 | 292 | ||
| 276 | /// 可订时段管理 | 293 | /// 可订时段管理 |
| 277 | static void goBookTimeSetPage(BuildContext context) { | 294 | static void goBookTimeSetPage(BuildContext context) { |
| @@ -169,12 +169,14 @@ import '../models/seller_template_color_list_model.dart'; | @@ -169,12 +169,14 @@ import '../models/seller_template_color_list_model.dart'; | ||
| 169 | import '../models/set_xuan_tai_model.dart'; | 169 | import '../models/set_xuan_tai_model.dart'; |
| 170 | import '../models/setmeal_by_id_model.dart'; | 170 | import '../models/setmeal_by_id_model.dart'; |
| 171 | import '../models/setmeal_model.dart'; | 171 | import '../models/setmeal_model.dart'; |
| 172 | +import '../models/table_or_reserve_model.dart'; | ||
| 172 | import '../models/wine_manage_model.dart'; | 173 | import '../models/wine_manage_model.dart'; |
| 173 | import '../pages/coupon/coupon_poster_page.dart'; | 174 | import '../pages/coupon/coupon_poster_page.dart'; |
| 174 | import '../pages/coupon/coupon_setting_page.dart'; | 175 | import '../pages/coupon/coupon_setting_page.dart'; |
| 175 | import '../pages/coupon/coupon_verification_detail_page.dart'; | 176 | import '../pages/coupon/coupon_verification_detail_page.dart'; |
| 176 | import '../pages/coupon/verification_coupon_page.dart'; | 177 | import '../pages/coupon/verification_coupon_page.dart'; |
| 177 | import '../pages/detail/book_deposit_page.dart'; | 178 | import '../pages/detail/book_deposit_page.dart'; |
| 179 | +import '../pages/detail/notebook_detail_change_page_f_only.dart'; | ||
| 178 | import '../pages/detail/select_tables_f_page_or_reserve.dart'; | 180 | import '../pages/detail/select_tables_f_page_or_reserve.dart'; |
| 179 | import '../pages/detail/verify_food_page.dart'; | 181 | import '../pages/detail/verify_food_page.dart'; |
| 180 | import '../pages/feast/feast_board.dart'; | 182 | import '../pages/feast/feast_board.dart'; |
| @@ -290,6 +292,7 @@ import '../provider/collect_store_provider.dart'; | @@ -290,6 +292,7 @@ import '../provider/collect_store_provider.dart'; | ||
| 290 | import '../provider/comment_manage_provider.dart'; | 292 | import '../provider/comment_manage_provider.dart'; |
| 291 | import '../provider/feast_model.dart'; | 293 | import '../provider/feast_model.dart'; |
| 292 | import '../provider/marketing_center_provider.dart'; | 294 | import '../provider/marketing_center_provider.dart'; |
| 295 | +import '../provider/notebook_detail_change_model_only.dart'; | ||
| 293 | import '../provider/plan_dish_provider.dart'; | 296 | import '../provider/plan_dish_provider.dart'; |
| 294 | import '../provider/store_wine_provider.dart'; | 297 | import '../provider/store_wine_provider.dart'; |
| 295 | 298 | ||
| @@ -537,46 +540,46 @@ var handleSelectTableFHandler = new Handler( | @@ -537,46 +540,46 @@ var handleSelectTableFHandler = new Handler( | ||
| 537 | 540 | ||
| 538 | 541 | ||
| 539 | // 跳转到选择桌位_方硕新修改的页面 | 542 | // 跳转到选择桌位_方硕新修改的页面 |
| 540 | -// var handleSelectTableFOrReserveHandler = new Handler( | ||
| 541 | -// handlerFunc: (BuildContext context, Map<String, List<Object>> params) { | ||
| 542 | -// String rid = params['rid'].first; | ||
| 543 | -// String tid = params['tid'].first; | ||
| 544 | -// DateTime dateTime = | ||
| 545 | -// DateTime.fromMillisecondsSinceEpoch(int.parse(params["dateTime"].first)); | ||
| 546 | -// String ddateSlot = params["ddate_slot"].first; | ||
| 547 | -// String source = params["source"].first; | ||
| 548 | - | ||
| 549 | -// String fromPage = params["fromPage"].first; | ||
| 550 | -// bool canChoose = params["canChoose"].first == "true" ? true : false; | ||
| 551 | -// String hmS = params["hmS"].first; | ||
| 552 | -// String hmE = params["hmE"].first; | ||
| 553 | -// List<TableList> res = []; | ||
| 554 | -// if (params.keys.contains('object')) { | ||
| 555 | -// Map object = FluroConvertUtils.string2map(params["object"].first); | ||
| 556 | -// List temp = object['object']; | ||
| 557 | - | ||
| 558 | -// for (var item in temp) { | ||
| 559 | -// res.add(TableList.fromJson(item)); | ||
| 560 | -// } | ||
| 561 | -// } | ||
| 562 | - | ||
| 563 | -// String ridFeast = params["ridFeast"].first; | ||
| 564 | - | ||
| 565 | -// // return SelectTablePage(rid, dateTime, ddate_slot,canChoose: canChoose); | ||
| 566 | -// return ChangeNotifierProvider<ChooseTableModel>( | ||
| 567 | -// create: (_) => ChooseTableModel(), | ||
| 568 | -// child: ChangeNotifierProvider<TableManagerModelOrReserve>( | ||
| 569 | -// create: (_) => TableManagerModelOrReserve(), | ||
| 570 | -// child: SelectTableFPageOrReserve(rid, dateTime, ddateSlot, | ||
| 571 | -// canChoose: canChoose, | ||
| 572 | -// tableList: res, | ||
| 573 | -// fromPage: fromPage, | ||
| 574 | -// tid: tid, | ||
| 575 | -// hmS: hmS, | ||
| 576 | -// hmE: hmE, | ||
| 577 | -// source: source, | ||
| 578 | -// ridFeast: ridFeast))); | ||
| 579 | -// }); | 543 | +var handleSelectTableFOrReserveHandler = new Handler( |
| 544 | + handlerFunc: (BuildContext context, Map<String, List<Object>> params) { | ||
| 545 | + String rid = params['rid'].first; | ||
| 546 | + String tid = params['tid'].first; | ||
| 547 | + DateTime dateTime = | ||
| 548 | + DateTime.fromMillisecondsSinceEpoch(int.parse(params["dateTime"].first)); | ||
| 549 | + String ddateSlot = params["ddate_slot"].first; | ||
| 550 | + String source = params["source"].first; | ||
| 551 | + | ||
| 552 | + String fromPage = params["fromPage"].first; | ||
| 553 | + bool canChoose = params["canChoose"].first == "true" ? true : false; | ||
| 554 | + String hmS = params["hmS"].first; | ||
| 555 | + String hmE = params["hmE"].first; | ||
| 556 | + List<TableListReserve> res = []; | ||
| 557 | + if (params.keys.contains('object')) { | ||
| 558 | + Map object = FluroConvertUtils.string2map(params["object"].first); | ||
| 559 | + List temp = object['object']; | ||
| 560 | + | ||
| 561 | + for (var item in temp) { | ||
| 562 | + res.add(TableListReserve.fromJson(item)); | ||
| 563 | + } | ||
| 564 | + } | ||
| 565 | + | ||
| 566 | + String ridFeast = params["ridFeast"].first; | ||
| 567 | + | ||
| 568 | + // return SelectTablePage(rid, dateTime, ddate_slot,canChoose: canChoose); | ||
| 569 | + return ChangeNotifierProvider<ChooseTableModel>( | ||
| 570 | + create: (_) => ChooseTableModel(), | ||
| 571 | + child: ChangeNotifierProvider<TableManagerModelOrReserve>( | ||
| 572 | + create: (_) => TableManagerModelOrReserve(), | ||
| 573 | + child: SelectTableFPageOrReserve(rid, dateTime, ddateSlot, | ||
| 574 | + canChoose: canChoose, | ||
| 575 | + tableList: res, | ||
| 576 | + fromPage: fromPage, | ||
| 577 | + tid: tid, | ||
| 578 | + hmS: hmS, | ||
| 579 | + hmE: hmE, | ||
| 580 | + source: source, | ||
| 581 | + ridFeast: ridFeast))); | ||
| 582 | +}); | ||
| 580 | 583 | ||
| 581 | // 跳转到照片管理的选择桌位_方硕新修改的页面 | 584 | // 跳转到照片管理的选择桌位_方硕新修改的页面 |
| 582 | var photoManagerPageHandle = new Handler( | 585 | var photoManagerPageHandle = new Handler( |
| @@ -728,6 +731,31 @@ var noteBookChangeFPageHandle = new Handler( | @@ -728,6 +731,31 @@ var noteBookChangeFPageHandle = new Handler( | ||
| 728 | ))))); | 731 | ))))); |
| 729 | }); | 732 | }); |
| 730 | 733 | ||
| 734 | + | ||
| 735 | +// 跳转到变更预订——方硕新修改页面 | ||
| 736 | +var noteBookChangeFPageOnlyHandle = new Handler( | ||
| 737 | + handlerFunc: (BuildContext context, Map<String, List<Object>> params) { | ||
| 738 | + // String rid=params['rid'].first; | ||
| 739 | + // NotebookDetail detailEntity = params["detailEntity"].first; | ||
| 740 | + NotebookDetail detailEntity = NotebookDetail.fromJson(json | ||
| 741 | + .decode(FluroConvertUtils.fluroCnParamsDecode(params["detail"].first))); | ||
| 742 | + String rid = params['rid'].first; | ||
| 743 | + bool back = FluroConvertUtils.string2bool(params["back"].first); | ||
| 744 | + return ChangeNotifierProvider<NotebookDetailChangeModelOnly>( | ||
| 745 | + create: (_) => NotebookDetailChangeModelOnly(detailEntity), | ||
| 746 | + child: ChangeNotifierProvider<RemarkManagerModel>( | ||
| 747 | + create: (_) => RemarkManagerModel(), | ||
| 748 | + child: ChangeNotifierProvider<CustomerProvider>( | ||
| 749 | + create: (_) => CustomerProvider(), | ||
| 750 | + child: ChangeNotifierProvider<MarketingCenterProvider>( | ||
| 751 | + create: (_) => MarketingCenterProvider(), | ||
| 752 | + child: NoteBookChangeFPageOnly( | ||
| 753 | + detailEntity: detailEntity, | ||
| 754 | + rid: rid, | ||
| 755 | + back: back, | ||
| 756 | + ))))); | ||
| 757 | +}); | ||
| 758 | + | ||
| 731 | // 跳转可订时段管理页面 | 759 | // 跳转可订时段管理页面 |
| 732 | var handleBookTimeSetHandler = new Handler( | 760 | var handleBookTimeSetHandler = new Handler( |
| 733 | handlerFunc: (BuildContext context, Map<String, List<Object>> params) { | 761 | handlerFunc: (BuildContext context, Map<String, List<Object>> params) { |
| @@ -18,6 +18,8 @@ class Routes { | @@ -18,6 +18,8 @@ class Routes { | ||
| 18 | 18 | ||
| 19 | static String select_table = "/select_table"; //选择桌位 | 19 | static String select_table = "/select_table"; //选择桌位 |
| 20 | static String select_table_f = "/select_table_f"; //选择桌位_方硕新修改的页面 | 20 | static String select_table_f = "/select_table_f"; //选择桌位_方硕新修改的页面 |
| 21 | + | ||
| 22 | + | ||
| 21 | static String invication = "/invication"; //邀请函 | 23 | static String invication = "/invication"; //邀请函 |
| 22 | 24 | ||
| 23 | static String invication_sim = "/invication_sim"; //邀请函 | 25 | static String invication_sim = "/invication_sim"; //邀请函 |
| @@ -84,6 +86,10 @@ class Routes { | @@ -84,6 +86,10 @@ class Routes { | ||
| 84 | static String personnel_password_edit_page = | 86 | static String personnel_password_edit_page = |
| 85 | "/personnel_password_edit_page"; //密码修改页 | 87 | "/personnel_password_edit_page"; //密码修改页 |
| 86 | static String change_detail_f = "/change_detail_f"; //变更预订_方硕新修改页面 | 88 | static String change_detail_f = "/change_detail_f"; //变更预订_方硕新修改页面 |
| 89 | + | ||
| 90 | + | ||
| 91 | + | ||
| 92 | + static String change_detail_f_only = "/change_detail_f_only"; //变更预订_方硕新修改页面 | ||
| 87 | static String photo_manager_page = "/photo_manager_page"; //照片管理 | 93 | static String photo_manager_page = "/photo_manager_page"; //照片管理 |
| 88 | static String edit_reserver_page = "/edit_reserver_page"; //填写预订联系人 | 94 | static String edit_reserver_page = "/edit_reserver_page"; //填写预订联系人 |
| 89 | static String store_customer_page = "/store_customer_page"; //全店客情 | 95 | static String store_customer_page = "/store_customer_page"; //全店客情 |
| @@ -393,7 +399,7 @@ class Routes { | @@ -393,7 +399,7 @@ class Routes { | ||
| 393 | router.define(reserve_detail_sim, handler: reserveDetailSimHandler); | 399 | router.define(reserve_detail_sim, handler: reserveDetailSimHandler); |
| 394 | router.define(select_table, handler: handleSelectTableHandler); | 400 | router.define(select_table, handler: handleSelectTableHandler); |
| 395 | router.define(select_table_f, handler: handleSelectTableFHandler); | 401 | router.define(select_table_f, handler: handleSelectTableFHandler); |
| 396 | -// router.define(select_table_f_or_reserve, handler: handleSelectTableFOrReserveHandler); | 402 | +router.define(select_table_f_or_reserve, handler: handleSelectTableFOrReserveHandler); |
| 397 | 403 | ||
| 398 | router.define(invication, handler: handleInvicationHandler); | 404 | router.define(invication, handler: handleInvicationHandler); |
| 399 | router.define(invication_sim, handler: handleInvicationSimHandler); | 405 | router.define(invication_sim, handler: handleInvicationSimHandler); |
| @@ -469,6 +475,8 @@ class Routes { | @@ -469,6 +475,8 @@ class Routes { | ||
| 469 | router.define(personnel_password_edit_page, | 475 | router.define(personnel_password_edit_page, |
| 470 | handler: personnelPasswordEditPageHandle); | 476 | handler: personnelPasswordEditPageHandle); |
| 471 | router.define(change_detail_f, handler: noteBookChangeFPageHandle); | 477 | router.define(change_detail_f, handler: noteBookChangeFPageHandle); |
| 478 | + router.define(change_detail_f_only, handler: noteBookChangeFPageOnlyHandle); | ||
| 479 | + | ||
| 472 | router.define(photo_manager_page, handler: photoManagerPageHandle); | 480 | router.define(photo_manager_page, handler: photoManagerPageHandle); |
| 473 | router.define(edit_reserver_page, handler: editReserverPageHandle); | 481 | router.define(edit_reserver_page, handler: editReserverPageHandle); |
| 474 | router.define(store_customer_page, handler: storeCustomerPageHandle); | 482 | router.define(store_customer_page, handler: storeCustomerPageHandle); |
-
Please register or login to post a comment