Showing
12 changed files
with
1845 additions
and
485 deletions
| @@ -548,7 +548,7 @@ | @@ -548,7 +548,7 @@ | ||
| 548 | CODE_SIGN_ENTITLEMENTS = Runner/RunnerProfile.entitlements; | 548 | CODE_SIGN_ENTITLEMENTS = Runner/RunnerProfile.entitlements; |
| 549 | CODE_SIGN_IDENTITY = "Apple Development"; | 549 | CODE_SIGN_IDENTITY = "Apple Development"; |
| 550 | CODE_SIGN_STYLE = Automatic; | 550 | CODE_SIGN_STYLE = Automatic; |
| 551 | - CURRENT_PROJECT_VERSION = 52691; | 551 | + CURRENT_PROJECT_VERSION = 52692; |
| 552 | DEVELOPMENT_TEAM = 8J59HM8B82; | 552 | DEVELOPMENT_TEAM = 8J59HM8B82; |
| 553 | ENABLE_BITCODE = NO; | 553 | ENABLE_BITCODE = NO; |
| 554 | FLUTTER_BUILD_MODE = release; | 554 | FLUTTER_BUILD_MODE = release; |
| @@ -696,7 +696,7 @@ | @@ -696,7 +696,7 @@ | ||
| 696 | CODE_SIGN_ENTITLEMENTS = "Runner/一键订Debug.entitlements"; | 696 | CODE_SIGN_ENTITLEMENTS = "Runner/一键订Debug.entitlements"; |
| 697 | CODE_SIGN_IDENTITY = "Apple Development"; | 697 | CODE_SIGN_IDENTITY = "Apple Development"; |
| 698 | CODE_SIGN_STYLE = Automatic; | 698 | CODE_SIGN_STYLE = Automatic; |
| 699 | - CURRENT_PROJECT_VERSION = 52691; | 699 | + CURRENT_PROJECT_VERSION = 52692; |
| 700 | DEVELOPMENT_TEAM = 8J59HM8B82; | 700 | DEVELOPMENT_TEAM = 8J59HM8B82; |
| 701 | ENABLE_BITCODE = NO; | 701 | ENABLE_BITCODE = NO; |
| 702 | FLUTTER_BUILD_MODE = release; | 702 | FLUTTER_BUILD_MODE = release; |
| @@ -732,7 +732,7 @@ | @@ -732,7 +732,7 @@ | ||
| 732 | CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; | 732 | CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; |
| 733 | CODE_SIGN_IDENTITY = "Apple Development"; | 733 | CODE_SIGN_IDENTITY = "Apple Development"; |
| 734 | CODE_SIGN_STYLE = Automatic; | 734 | CODE_SIGN_STYLE = Automatic; |
| 735 | - CURRENT_PROJECT_VERSION = 52691; | 735 | + CURRENT_PROJECT_VERSION = 52692; |
| 736 | DEVELOPMENT_TEAM = 8J59HM8B82; | 736 | DEVELOPMENT_TEAM = 8J59HM8B82; |
| 737 | ENABLE_BITCODE = NO; | 737 | ENABLE_BITCODE = NO; |
| 738 | FLUTTER_BUILD_MODE = release; | 738 | FLUTTER_BUILD_MODE = release; |
lib/models/table_or_reserve_model.dart
0 → 100644
| 1 | +class TableListReseveModel { | ||
| 2 | + int ret; | ||
| 3 | + List<TableListReseveSunModel> data; | ||
| 4 | + String msg; | ||
| 5 | + | ||
| 6 | + TableListReseveModel({this.ret, this.data, this.msg}); | ||
| 7 | + | ||
| 8 | + TableListReseveModel.fromJson(Map<String, dynamic> json) { | ||
| 9 | + ret = json['ret']; | ||
| 10 | + if (json['data'] != null) { | ||
| 11 | + data = <TableListReseveSunModel>[]; | ||
| 12 | + json['data'].forEach((v) { | ||
| 13 | + data.add(new TableListReseveSunModel.fromJson(v)); | ||
| 14 | + }); | ||
| 15 | + } | ||
| 16 | + msg = json['msg']; | ||
| 17 | + } | ||
| 18 | + | ||
| 19 | + Map<String, dynamic> toJson() { | ||
| 20 | + final Map<String, dynamic> data = new Map<String, dynamic>(); | ||
| 21 | + data['ret'] = this.ret; | ||
| 22 | + if (this.data != null) { | ||
| 23 | + data['data'] = this.data?.map((v) => v.toJson()).toList(); | ||
| 24 | + } | ||
| 25 | + data['msg'] = this.msg; | ||
| 26 | + return data; | ||
| 27 | + } | ||
| 28 | +} | ||
| 29 | + | ||
| 30 | +class TableListReseveSunModel { | ||
| 31 | + String id; | ||
| 32 | + String sellerid; | ||
| 33 | + String name; | ||
| 34 | + String orderO; | ||
| 35 | + String status; | ||
| 36 | + String cdate; | ||
| 37 | + List<TableListReserve> tableList; | ||
| 38 | + int count; | ||
| 39 | + bool select = false; | ||
| 40 | + | ||
| 41 | + TableListReseveSunModel( | ||
| 42 | + {this.id, | ||
| 43 | + this.sellerid, | ||
| 44 | + this.name, | ||
| 45 | + this.orderO, | ||
| 46 | + this.status, | ||
| 47 | + this.cdate, | ||
| 48 | + this.tableList, | ||
| 49 | + this.count, | ||
| 50 | + this.select}); | ||
| 51 | + | ||
| 52 | + TableListReseveSunModel.fromJson(Map<String, dynamic> json) { | ||
| 53 | + id = json['id']; | ||
| 54 | + sellerid = json['sellerid']; | ||
| 55 | + name = json['name']; | ||
| 56 | + orderO = json['order_o']; | ||
| 57 | + status = json['status']; | ||
| 58 | + cdate = json['cdate']; | ||
| 59 | + tableList = <TableListReserve>[]; | ||
| 60 | + if (json['tableList'] != null) { | ||
| 61 | + json['tableList'].forEach((v) { | ||
| 62 | + tableList?.add(new TableListReserve.fromJson(v)); | ||
| 63 | + }); | ||
| 64 | + } | ||
| 65 | + count = json['count']; | ||
| 66 | + } | ||
| 67 | + | ||
| 68 | + TableListReseveSunModel.fromJson2(Map<String, dynamic> json) { | ||
| 69 | + id = json['id']; | ||
| 70 | + sellerid = json['sellerid']; | ||
| 71 | + name = json['name']; | ||
| 72 | + orderO = json['order_o']; | ||
| 73 | + status = json['status']; | ||
| 74 | + cdate = json['cdate']; | ||
| 75 | + tableList = <TableListReserve>[]; | ||
| 76 | + if (json['tableList'] != null) { | ||
| 77 | + json['tableList'].forEach((v) { | ||
| 78 | + tableList?.add(new TableListReserve.fromJson2(v)); | ||
| 79 | + }); | ||
| 80 | + } | ||
| 81 | + count = json['count']; | ||
| 82 | + } | ||
| 83 | + | ||
| 84 | + Map<String, dynamic> toJson() { | ||
| 85 | + final Map<String, dynamic> data = new Map<String, dynamic>(); | ||
| 86 | + data['id'] = this.id; | ||
| 87 | + data['sellerid'] = this.sellerid; | ||
| 88 | + data['name'] = this.name; | ||
| 89 | + data['order_o'] = this.orderO; | ||
| 90 | + data['status'] = this.status; | ||
| 91 | + data['cdate'] = this.cdate; | ||
| 92 | + if (this.tableList != null) { | ||
| 93 | + data['tableList'] = this.tableList?.map((v) => v.toJson()).toList(); | ||
| 94 | + } | ||
| 95 | + data['count'] = this.count; | ||
| 96 | + | ||
| 97 | + return data; | ||
| 98 | + } | ||
| 99 | +} | ||
| 100 | + | ||
| 101 | +class TableListReserve { | ||
| 102 | + String id; | ||
| 103 | + String rid; | ||
| 104 | + String sellerid; | ||
| 105 | + String tid; | ||
| 106 | + String name; | ||
| 107 | + String tablePnum; | ||
| 108 | + String mostPnum; | ||
| 109 | + String orderO; | ||
| 110 | + String status; | ||
| 111 | + String tablestatus; | ||
| 112 | + String enable; | ||
| 113 | + String spell; | ||
| 114 | + String cdate; | ||
| 115 | + dynamic isLock; | ||
| 116 | + dynamic isMerge; | ||
| 117 | + dynamic tids; | ||
| 118 | + dynamic lockTname; | ||
| 119 | + dynamic lockTid; | ||
| 120 | + String isPhoto; | ||
| 121 | + List<BanquetListModel> banquetList; | ||
| 122 | + ReserveListModel reserveList; | ||
| 123 | + String reserveLock; | ||
| 124 | + bool selected = false; //是否选中 | ||
| 125 | + | ||
| 126 | + //获取桌位类型 | ||
| 127 | + String sign; | ||
| 128 | + String reserver; | ||
| 129 | + String pnum; | ||
| 130 | + String place_order_name; | ||
| 131 | + String label; | ||
| 132 | + String signStr; | ||
| 133 | + String notebookId; | ||
| 134 | + | ||
| 135 | + //获取桌位可坐人数 | ||
| 136 | + String get tableNum { | ||
| 137 | + if (tablePnum == null || tablePnum.isEmpty || tablePnum == "0") { | ||
| 138 | + return ""; | ||
| 139 | + } else if (mostPnum != null && | ||
| 140 | + mostPnum.isNotEmpty && | ||
| 141 | + mostPnum != "0" && | ||
| 142 | + mostPnum != "null") { | ||
| 143 | + if (tablePnum == mostPnum) { | ||
| 144 | + return "$tablePnum人"; | ||
| 145 | + } else { | ||
| 146 | + return "$tablePnum-$mostPnum人"; | ||
| 147 | + } | ||
| 148 | + } else { | ||
| 149 | + return "$tablePnum人"; | ||
| 150 | + } | ||
| 151 | + } | ||
| 152 | + | ||
| 153 | + //获取桌位类型 | ||
| 154 | + String get tidStr { | ||
| 155 | + switch (tid) { | ||
| 156 | + case "1": | ||
| 157 | + return "散座"; | ||
| 158 | + case "2": | ||
| 159 | + return "包间"; | ||
| 160 | + case "3": | ||
| 161 | + return "卡座"; | ||
| 162 | + } | ||
| 163 | + } | ||
| 164 | + | ||
| 165 | + TableListReserve( | ||
| 166 | + {this.id, | ||
| 167 | + this.rid, | ||
| 168 | + this.sellerid, | ||
| 169 | + this.tid, | ||
| 170 | + this.name, | ||
| 171 | + this.tablePnum, | ||
| 172 | + this.mostPnum, | ||
| 173 | + this.orderO, | ||
| 174 | + this.status, | ||
| 175 | + this.tablestatus, | ||
| 176 | + this.enable, | ||
| 177 | + this.spell, | ||
| 178 | + this.cdate, | ||
| 179 | + this.isLock, | ||
| 180 | + this.isMerge, | ||
| 181 | + this.tids, | ||
| 182 | + this.lockTname, | ||
| 183 | + this.lockTid, | ||
| 184 | + this.isPhoto, | ||
| 185 | + this.banquetList, | ||
| 186 | + this.reserveList, | ||
| 187 | + this.reserveLock}); | ||
| 188 | + TableListReserve.fromJson2(Map<String, dynamic> json) { | ||
| 189 | + id = json['id']; | ||
| 190 | + rid = json['rid']; | ||
| 191 | + sellerid = json['sellerid']; | ||
| 192 | + tid = json['tid']; | ||
| 193 | + name = json['name']; | ||
| 194 | + tablePnum = json['table_pnum']; | ||
| 195 | + mostPnum = json['most_pnum']; | ||
| 196 | + orderO = json['order_o']; | ||
| 197 | + status = json['status']; | ||
| 198 | + tablestatus = json['tablestatus']; | ||
| 199 | + enable = json['enable']; | ||
| 200 | + spell = json['spell']; | ||
| 201 | + cdate = json['cdate']; | ||
| 202 | + isLock = json['is_lock']; | ||
| 203 | + isMerge = json['is_merge']; | ||
| 204 | + tids = json['tids']; | ||
| 205 | + lockTname = json['lock_tname']; | ||
| 206 | + lockTid = json['lock_tid']; | ||
| 207 | + isPhoto = json['is_photo']; | ||
| 208 | + | ||
| 209 | + reserveLock = json['reserveLock'].toString(); | ||
| 210 | + banquetList = <BanquetListModel>[]; | ||
| 211 | + selected = false; | ||
| 212 | + // if (json['banquetList'] != null) { | ||
| 213 | + // json['banquetList'].forEach((v) { | ||
| 214 | + // banquetList.add(new BanquetListModel.fromJson(v)); | ||
| 215 | + // }); | ||
| 216 | + // } | ||
| 217 | + | ||
| 218 | + // if (json['reserveList'] != null) { | ||
| 219 | + // reserveList = ReserveListModel.fromJson(json['reserveList']); | ||
| 220 | + // } | ||
| 221 | + } | ||
| 222 | + | ||
| 223 | + TableListReserve.fromJson(Map<String, dynamic> json) { | ||
| 224 | + id = json['id']; | ||
| 225 | + rid = json['rid']; | ||
| 226 | + sellerid = json['sellerid']; | ||
| 227 | + tid = json['tid']; | ||
| 228 | + name = json['name']; | ||
| 229 | + tablePnum = json['table_pnum']; | ||
| 230 | + mostPnum = json['most_pnum']; | ||
| 231 | + orderO = json['order_o']; | ||
| 232 | + status = json['status']; | ||
| 233 | + tablestatus = json['tablestatus']; | ||
| 234 | + enable = json['enable']; | ||
| 235 | + spell = json['spell']; | ||
| 236 | + cdate = json['cdate']; | ||
| 237 | + isLock = json['is_lock']; | ||
| 238 | + isMerge = json['is_merge']; | ||
| 239 | + tids = json['tids']; | ||
| 240 | + lockTname = json['lock_tname']; | ||
| 241 | + lockTid = json['lock_tid']; | ||
| 242 | + isPhoto = json['is_photo']; | ||
| 243 | + | ||
| 244 | + reserveLock = json['reserveLock'].toString(); | ||
| 245 | + banquetList = <BanquetListModel>[]; | ||
| 246 | + selected = false; | ||
| 247 | + if (json['banquetList'] != null) { | ||
| 248 | + json['banquetList'].forEach((v) { | ||
| 249 | + banquetList.add(new BanquetListModel.fromJson(v)); | ||
| 250 | + }); | ||
| 251 | + } | ||
| 252 | + | ||
| 253 | + if (json['reserveList'] != null) { | ||
| 254 | + reserveList = ReserveListModel.fromJson(json['reserveList']); | ||
| 255 | + } | ||
| 256 | + } | ||
| 257 | + | ||
| 258 | + Map<String, dynamic> toJson() { | ||
| 259 | + final Map<String, dynamic> data = new Map<String, dynamic>(); | ||
| 260 | + data['id'] = this.id; | ||
| 261 | + data['rid'] = this.rid; | ||
| 262 | + data['sellerid'] = this.sellerid; | ||
| 263 | + data['tid'] = this.tid; | ||
| 264 | + data['name'] = this.name; | ||
| 265 | + data['table_pnum'] = this.tablePnum; | ||
| 266 | + data['most_pnum'] = this.mostPnum; | ||
| 267 | + data['order_o'] = this.orderO; | ||
| 268 | + data['status'] = this.status; | ||
| 269 | + data['tablestatus'] = this.tablestatus; | ||
| 270 | + data['enable'] = this.enable; | ||
| 271 | + data['spell'] = this.spell; | ||
| 272 | + data['cdate'] = this.cdate; | ||
| 273 | + data['is_lock'] = this.isLock; | ||
| 274 | + data['is_merge'] = this.isMerge; | ||
| 275 | + data['tids'] = this.tids; | ||
| 276 | + data['lock_tname'] = this.lockTname; | ||
| 277 | + data['lock_tid'] = this.lockTid; | ||
| 278 | + data['is_photo'] = this.isPhoto; | ||
| 279 | + data['reserveLock'] = this.reserveLock; | ||
| 280 | + if (this.banquetList != null) { | ||
| 281 | + data['banquetList'] = this.banquetList.map((v) => v.toJson()).toList(); | ||
| 282 | + } | ||
| 283 | + if (this.reserveList != null) { | ||
| 284 | + data['reserveList'] = this.reserveList.toJson(); | ||
| 285 | + } | ||
| 286 | + return data; | ||
| 287 | + } | ||
| 288 | +} | ||
| 289 | + | ||
| 290 | +class BanquetListModel { | ||
| 291 | + String rname; | ||
| 292 | + String sex; | ||
| 293 | + String ddate; | ||
| 294 | + String remark; | ||
| 295 | + dynamic staffNickName; | ||
| 296 | + dynamic staffAccount; | ||
| 297 | + String phone; | ||
| 298 | + String id; | ||
| 299 | + String rid; | ||
| 300 | + String className; | ||
| 301 | + String nickName; | ||
| 302 | + String account; | ||
| 303 | + String talbeStr; | ||
| 304 | + dynamic lost; | ||
| 305 | + | ||
| 306 | + BanquetListModel( | ||
| 307 | + {this.rname, | ||
| 308 | + this.sex, | ||
| 309 | + this.ddate, | ||
| 310 | + this.remark, | ||
| 311 | + this.staffNickName, | ||
| 312 | + this.staffAccount, | ||
| 313 | + this.phone, | ||
| 314 | + this.id, | ||
| 315 | + this.rid, | ||
| 316 | + this.className, | ||
| 317 | + this.nickName, | ||
| 318 | + this.account, | ||
| 319 | + this.talbeStr, | ||
| 320 | + this.lost}); | ||
| 321 | + | ||
| 322 | + BanquetListModel.fromJson(Map<String, dynamic> json) { | ||
| 323 | + rname = json['rname']; | ||
| 324 | + sex = json['sex']; | ||
| 325 | + ddate = json['ddate']; | ||
| 326 | + remark = json['remark']; | ||
| 327 | + staffNickName = json['staff_nick_name']; | ||
| 328 | + staffAccount = json['staff_account']; | ||
| 329 | + phone = json['phone']; | ||
| 330 | + id = json['id']; | ||
| 331 | + rid = json['rid']; | ||
| 332 | + className = json['class_name']; | ||
| 333 | + nickName = json['nick_name']; | ||
| 334 | + account = json['account']; | ||
| 335 | + talbeStr = json['talbeStr']; | ||
| 336 | + lost = json['lost']; | ||
| 337 | + } | ||
| 338 | + | ||
| 339 | + Map<String, dynamic> toJson() { | ||
| 340 | + final Map<String, dynamic> data = new Map<String, dynamic>(); | ||
| 341 | + data['rname'] = this.rname; | ||
| 342 | + data['sex'] = this.sex; | ||
| 343 | + data['ddate'] = this.ddate; | ||
| 344 | + data['remark'] = this.remark; | ||
| 345 | + data['staff_nick_name'] = this.staffNickName; | ||
| 346 | + data['staff_account'] = this.staffAccount; | ||
| 347 | + data['phone'] = this.phone; | ||
| 348 | + data['id'] = this.id; | ||
| 349 | + data['rid'] = this.rid; | ||
| 350 | + data['class_name'] = this.className; | ||
| 351 | + data['nick_name'] = this.nickName; | ||
| 352 | + data['account'] = this.account; | ||
| 353 | + data['talbeStr'] = this.talbeStr; | ||
| 354 | + data['lost'] = this.lost; | ||
| 355 | + return data; | ||
| 356 | + } | ||
| 357 | +} | ||
| 358 | + | ||
| 359 | +class ReserveListModel { | ||
| 360 | + String id; | ||
| 361 | + String sid; | ||
| 362 | + String uid; | ||
| 363 | + String tid; | ||
| 364 | + String tableinfo; | ||
| 365 | + String rname; | ||
| 366 | + String sex; | ||
| 367 | + String phone; | ||
| 368 | + dynamic cusdem; | ||
| 369 | + String rdate; | ||
| 370 | + String ddate; | ||
| 371 | + String isSetDdate; | ||
| 372 | + String ddateSolt; | ||
| 373 | + String status; | ||
| 374 | + String action; | ||
| 375 | + String type; | ||
| 376 | + dynamic actualPum; | ||
| 377 | + String placeOrderName; | ||
| 378 | + dynamic aname; | ||
| 379 | + String reserveCount; | ||
| 380 | + | ||
| 381 | + //预订总次数显示 | ||
| 382 | + String get reserveCountShow { | ||
| 383 | + if (reserveCount == '1' || phone == null || phone == '' | ||
| 384 | + // || | ||
| 385 | + // reserver == null || | ||
| 386 | + // reserver.isEmpty || | ||
| 387 | + // reserver == '' | ||
| 388 | + ) { | ||
| 389 | + // 预订次数== 1 或者 姓名或者客户电话号码为空的时候 ,显示首次预订 | ||
| 390 | + return "首次预订"; | ||
| 391 | + } else if (reserveCount != null && | ||
| 392 | + reserveCount != '0' && | ||
| 393 | + reserveCount != '') { | ||
| 394 | + return '${reserveCount}次预订'; | ||
| 395 | + } else { | ||
| 396 | + return ''; | ||
| 397 | + } | ||
| 398 | + } | ||
| 399 | + | ||
| 400 | + String get signStr { | ||
| 401 | + if (status != null && status.isNotEmpty) { | ||
| 402 | + switch (status) { | ||
| 403 | + case "1": //已预订 | ||
| 404 | + return "已预订"; | ||
| 405 | + case "5": //已安排包间 | ||
| 406 | + // itemRv.setBackgroundResource(R.drawable.table_white); | ||
| 407 | + // if(item.getOrder_status()==3){ | ||
| 408 | + // status.setBackgroundResource(R.drawable.table_bg_bottom_yellow); | ||
| 409 | + // status.setText("已买单"); | ||
| 410 | + // }else{ | ||
| 411 | + // status.setBackgroundResource(R.drawable.table_bg_bottom_red); | ||
| 412 | + // status.setText("已预订"); | ||
| 413 | + // } | ||
| 414 | + // status.setVisibility(View.VISIBLE); | ||
| 415 | + // pnum.setText(item.getNoteName()); | ||
| 416 | + return "已预订"; | ||
| 417 | + case "2": //用餐中 | ||
| 418 | + return "已预订"; | ||
| 419 | + case "10": //婚宴 | ||
| 420 | + return "已预订"; | ||
| 421 | + default: | ||
| 422 | + return ""; | ||
| 423 | + } | ||
| 424 | + } | ||
| 425 | + // if (enable == "0") return "已停用"; | ||
| 426 | + return ""; | ||
| 427 | + } | ||
| 428 | + | ||
| 429 | + ReserveListModel( | ||
| 430 | + {this.id, | ||
| 431 | + this.sid, | ||
| 432 | + this.uid, | ||
| 433 | + this.tid, | ||
| 434 | + this.tableinfo, | ||
| 435 | + this.rname, | ||
| 436 | + this.sex, | ||
| 437 | + this.phone, | ||
| 438 | + this.cusdem, | ||
| 439 | + this.rdate, | ||
| 440 | + this.ddate, | ||
| 441 | + this.isSetDdate, | ||
| 442 | + this.ddateSolt, | ||
| 443 | + this.status, | ||
| 444 | + this.action, | ||
| 445 | + this.type, | ||
| 446 | + this.actualPum, | ||
| 447 | + this.placeOrderName, | ||
| 448 | + this.aname, | ||
| 449 | + this.reserveCount}); | ||
| 450 | + | ||
| 451 | + ReserveListModel.fromJson(Map<String, dynamic> json) { | ||
| 452 | + id = json['id']; | ||
| 453 | + sid = json['sid']; | ||
| 454 | + uid = json['uid']; | ||
| 455 | + tid = json['tid']; | ||
| 456 | + tableinfo = json['tableinfo']; | ||
| 457 | + rname = json['rname']; | ||
| 458 | + sex = json['sex']; | ||
| 459 | + phone = json['phone']; | ||
| 460 | + cusdem = json['cusdem']; | ||
| 461 | + rdate = json['rdate']; | ||
| 462 | + ddate = json['ddate']; | ||
| 463 | + isSetDdate = json['is_set_ddate']; | ||
| 464 | + ddateSolt = json['ddate_solt']; | ||
| 465 | + status = json['status']; | ||
| 466 | + action = json['action']; | ||
| 467 | + type = json['type']; | ||
| 468 | + actualPum = json['actual_pum']; | ||
| 469 | + placeOrderName = json['place_order_name']; | ||
| 470 | + aname = json['aname']; | ||
| 471 | + reserveCount = json['reserveCount'].toString(); | ||
| 472 | + } | ||
| 473 | + | ||
| 474 | + Map<String, dynamic> toJson() { | ||
| 475 | + final Map<String, dynamic> data = new Map<String, dynamic>(); | ||
| 476 | + data['id'] = this.id; | ||
| 477 | + data['sid'] = this.sid; | ||
| 478 | + data['uid'] = this.uid; | ||
| 479 | + data['tid'] = this.tid; | ||
| 480 | + data['tableinfo'] = this.tableinfo; | ||
| 481 | + data['rname'] = this.rname; | ||
| 482 | + data['sex'] = this.sex; | ||
| 483 | + data['phone'] = this.phone; | ||
| 484 | + data['cusdem'] = this.cusdem; | ||
| 485 | + data['rdate'] = this.rdate; | ||
| 486 | + data['ddate'] = this.ddate; | ||
| 487 | + data['is_set_ddate'] = this.isSetDdate; | ||
| 488 | + data['ddate_solt'] = this.ddateSolt; | ||
| 489 | + data['status'] = this.status; | ||
| 490 | + data['action'] = this.action; | ||
| 491 | + data['type'] = this.type; | ||
| 492 | + data['actual_pum'] = this.actualPum; | ||
| 493 | + data['place_order_name'] = this.placeOrderName; | ||
| 494 | + data['aname'] = this.aname; | ||
| 495 | + data['reserveCount'] = this.reserveCount; | ||
| 496 | + return data; | ||
| 497 | + } | ||
| 498 | +} |
| @@ -528,26 +528,29 @@ class HttpUrl { | @@ -528,26 +528,29 @@ class HttpUrl { | ||
| 528 | "?service=App.Pay.AppPayJiSuVersion"; // App调起支付(购买版本) | 528 | "?service=App.Pay.AppPayJiSuVersion"; // App调起支付(购买版本) |
| 529 | static const String set_reserve_img_text = | 529 | static const String set_reserve_img_text = |
| 530 | "?service=App.Reserve.SetReserveImgText"; // 保存预订详情自定义图文 | 530 | "?service=App.Reserve.SetReserveImgText"; // 保存预订详情自定义图文 |
| 531 | -static const String get_reserve_img_text = | ||
| 532 | - "?service=App.Reserve.GetReserveImgText"; // 获取预订详情自定义图文 | ||
| 533 | - static const String set_seller_user_account_type = | ||
| 534 | - "?service=App.Seller.SetSellerUserAccountType"; // 设置账号服务类型 | 531 | + static const String get_reserve_img_text = |
| 532 | + "?service=App.Reserve.GetReserveImgText"; // 获取预订详情自定义图文 | ||
| 533 | + static const String set_seller_user_account_type = | ||
| 534 | + "?service=App.Seller.SetSellerUserAccountType"; // 设置账号服务类型 | ||
| 535 | 535 | ||
| 536 | - | ||
| 537 | - static const String get_seller_user_account_type = | ||
| 538 | - "?service=App.Seller.GetSellerUserAccountType"; // 获取账号服务类型 | ||
| 539 | - static const String set_serve_uid_by_rid = | ||
| 540 | - "?service=App.Reserve.SetServeUidByRid"; // 设置订单服务经理 | 536 | + static const String get_seller_user_account_type = |
| 537 | + "?service=App.Seller.GetSellerUserAccountType"; // 获取账号服务类型 | ||
| 538 | + static const String set_serve_uid_by_rid = | ||
| 539 | + "?service=App.Reserve.SetServeUidByRid"; // 设置订单服务经理 | ||
| 541 | 540 | ||
| 542 | - static const String get_colors_data = | ||
| 543 | - "?service=App.Seller.GetColorsData"; // 模版颜色可选数据 | 541 | + static const String get_colors_data = |
| 542 | + "?service=App.Seller.GetColorsData"; // 模版颜色可选数据 | ||
| 543 | + | ||
| 544 | + static const String get_my_page_count_data = | ||
| 545 | + "?service=App.Seller.GetMyPageCountData"; // 获取商家我的页面三个统计数据 | ||
| 546 | + | ||
| 547 | + static const String get_table_list_or_reserve = | ||
| 548 | + "?service=Android.Reserve.GetTableListOrReserve"; // 获取商家桌位列表及对应预订数据 | ||
| 549 | + | ||
| 550 | + static const String get_user_account_type_by_id = | ||
| 551 | + "?service=App.Seller.getUserAccountTypeById"; // 当前uid的类型,只订不服,只服不订 | ||
| 544 | 552 | ||
| 545 | - static const String get_my_page_count_data = | ||
| 546 | - "?service=App.Seller.GetMyPageCountData"; // 获取商家我的页面三个统计数据 | ||
| 547 | 553 | ||
| 548 | - | ||
| 549 | 554 | ||
| 550 | - | ||
| 551 | - | ||
| 552 | 555 | ||
| 553 | } | 556 | } |
| @@ -78,6 +78,11 @@ class _CompleteCreateStorePageState extends State<CompleteCreateStorePage> { | @@ -78,6 +78,11 @@ class _CompleteCreateStorePageState extends State<CompleteCreateStorePage> { | ||
| 78 | //退出清空桌位数据 | 78 | //退出清空桌位数据 |
| 79 | App.sp.remove('table_list'); | 79 | App.sp.remove('table_list'); |
| 80 | } | 80 | } |
| 81 | + if (App.sp.containsKey('table_list_or_reserve')) { | ||
| 82 | + //退出清空桌位数据 | ||
| 83 | + App.sp.remove('table_list_or_reserve'); | ||
| 84 | + } | ||
| 85 | + | ||
| 81 | if (App.sp.containsKey('specid')) { | 86 | if (App.sp.containsKey('specid')) { |
| 82 | //退出清空销售计价 | 87 | //退出清空销售计价 |
| 83 | App.sp.remove('specid'); | 88 | App.sp.remove('specid'); |
| @@ -91,14 +96,11 @@ class _CompleteCreateStorePageState extends State<CompleteCreateStorePage> { | @@ -91,14 +96,11 @@ class _CompleteCreateStorePageState extends State<CompleteCreateStorePage> { | ||
| 91 | //退出清空模块过期数据缓存 | 96 | //退出清空模块过期数据缓存 |
| 92 | App.sp.remove('sellerEdateModule'); | 97 | App.sp.remove('sellerEdateModule'); |
| 93 | } | 98 | } |
| 94 | - if (App.sp.containsKey('notebook_timer')) { | 99 | + if (App.sp.containsKey('notebook_timer')) { |
| 95 | //退出清空订单发短信2分钟限制数据缓存 | 100 | //退出清空订单发短信2分钟限制数据缓存 |
| 96 | App.sp.remove('notebook_timer'); | 101 | App.sp.remove('notebook_timer'); |
| 97 | } | 102 | } |
| 98 | 103 | ||
| 99 | - | ||
| 100 | - | ||
| 101 | - | ||
| 102 | // bus.emit('refresh_token'); | 104 | // bus.emit('refresh_token'); |
| 103 | Map<String, dynamic> userMap = { | 105 | Map<String, dynamic> userMap = { |
| 104 | "sellerimage": seller['seller_image'], | 106 | "sellerimage": seller['seller_image'], |
| @@ -147,6 +147,10 @@ class _IfNeedCreateStoreState extends State<IfNeedCreateStore> | @@ -147,6 +147,10 @@ class _IfNeedCreateStoreState extends State<IfNeedCreateStore> | ||
| 147 | //退出清空桌位数据 | 147 | //退出清空桌位数据 |
| 148 | App.sp.remove('table_list'); | 148 | App.sp.remove('table_list'); |
| 149 | } | 149 | } |
| 150 | + if (App.sp.containsKey('table_list_or_reserve')) { | ||
| 151 | + //退出清空桌位数据 | ||
| 152 | + App.sp.remove('table_list_or_reserve'); | ||
| 153 | + } | ||
| 150 | if (App.sp.containsKey('specid')) { | 154 | if (App.sp.containsKey('specid')) { |
| 151 | //退出清空销售计价 | 155 | //退出清空销售计价 |
| 152 | App.sp.remove('specid'); | 156 | App.sp.remove('specid'); |
| 1 | +import 'package:flutter/material.dart'; | ||
| 2 | +import 'package:flutter_screenutil/flutter_screenutil.dart'; | ||
| 3 | +import 'package:one_key/models/area.dart'; | ||
| 4 | +import 'package:one_key/res/colors.dart'; | ||
| 5 | +import 'package:one_key/widgets/h_empty_view.dart'; | ||
| 6 | + | ||
| 7 | +import '../../models/table_or_reserve_model.dart'; | ||
| 8 | + | ||
| 9 | +class AreaItemTableOrReserve extends StatefulWidget { | ||
| 10 | + final TableListReseveSunModel area; | ||
| 11 | + final ValueChanged selectCallback; | ||
| 12 | + final bool showBadge; | ||
| 13 | + | ||
| 14 | + AreaItemTableOrReserve(this.area, this.selectCallback, | ||
| 15 | + {this.showBadge = true}); | ||
| 16 | + | ||
| 17 | + @override | ||
| 18 | + State<StatefulWidget> createState() { | ||
| 19 | + // TODO: implement createState | ||
| 20 | + return new AreaItemTableOrReserveState(); | ||
| 21 | + } | ||
| 22 | +} | ||
| 23 | + | ||
| 24 | +class AreaItemTableOrReserveState extends State<AreaItemTableOrReserve> { | ||
| 25 | + @override | ||
| 26 | + Widget build(BuildContext context) { | ||
| 27 | + // TODO: implement build | ||
| 28 | + TableListReseveSunModel area = widget.area; | ||
| 29 | + bool isSelected = area.select; | ||
| 30 | + return GestureDetector( | ||
| 31 | + onTap: () { | ||
| 32 | + if (widget.selectCallback != null) { | ||
| 33 | + widget.selectCallback(widget.area); | ||
| 34 | + } | ||
| 35 | + }, | ||
| 36 | + child: | ||
| 37 | + // Stack( | ||
| 38 | + // overflow: Overflow.visible, | ||
| 39 | + // alignment: Alignment.topLeft, | ||
| 40 | + // children: <Widget>[ | ||
| 41 | + Container( | ||
| 42 | + // width: ScreenUtil().setWidth(104 * 2), | ||
| 43 | + // height: ScreenUtil().setWidth(10), | ||
| 44 | + margin: EdgeInsets.only( | ||
| 45 | + right: ScreenUtil().setWidth(15), | ||
| 46 | + top: ScreenUtil().setWidth(20), | ||
| 47 | + ), | ||
| 48 | + padding: EdgeInsets.symmetric( | ||
| 49 | + horizontal: ScreenUtil().setWidth(14), | ||
| 50 | + // vertical: ScreenUtil().setWidth(4) | ||
| 51 | + ), | ||
| 52 | + alignment: Alignment.center, | ||
| 53 | + decoration: BoxDecoration( | ||
| 54 | + borderRadius: BorderRadius.circular(ScreenUtil().setWidth(10)), | ||
| 55 | + color: isSelected | ||
| 56 | + ? MyColours.color_199095 | ||
| 57 | + : | ||
| 58 | + // widget.showBadge && area.count != -1 && area.count <= 0 | ||
| 59 | + // ? Color.fromRGBO(154, 154, 154, 1) | ||
| 60 | + // : | ||
| 61 | + MyColours.color_ffffff, | ||
| 62 | + border: Border.all( | ||
| 63 | + color: MyColours.color_E0E0E0, | ||
| 64 | + width: ScreenUtil().setWidth(2))), | ||
| 65 | + child: Text( | ||
| 66 | + area.name, | ||
| 67 | + overflow: TextOverflow.ellipsis, | ||
| 68 | + style: TextStyle( | ||
| 69 | + color: isSelected | ||
| 70 | + ? MyColours.color_ffffff | ||
| 71 | + : MyColours.color_333333, | ||
| 72 | + // color: isSelected || | ||
| 73 | + // (widget.showBadge && area.count != -1 && area.count <= 0) | ||
| 74 | + // ? MyColours.color_ffffff | ||
| 75 | + // : MyColours.color_333333, | ||
| 76 | + fontSize: ScreenUtil().setSp(24), | ||
| 77 | + decoration: TextDecoration.none, | ||
| 78 | + fontWeight: FontWeight.normal), | ||
| 79 | + ), | ||
| 80 | + ), | ||
| 81 | + // !widget.showBadge | ||
| 82 | + // ? SizedBox() | ||
| 83 | + // : area.count == -1 | ||
| 84 | + // ? Container() | ||
| 85 | + // : Positioned( | ||
| 86 | + // right: ScreenUtil().setWidth(12), | ||
| 87 | + // top: ScreenUtil().setWidth(6), | ||
| 88 | + // child: Container( | ||
| 89 | + // padding: EdgeInsets.symmetric( | ||
| 90 | + // vertical: ScreenUtil().setWidth(6), | ||
| 91 | + // horizontal: ScreenUtil().setWidth(4)), | ||
| 92 | + // // width: ScreenUtil().setWidth(78), | ||
| 93 | + // // height: ScreenUtil().setWidth(30), | ||
| 94 | + // alignment: Alignment.center, | ||
| 95 | + // decoration: BoxDecoration( | ||
| 96 | + // color: area.count <= 0 | ||
| 97 | + // ? MyColours.color_999999 | ||
| 98 | + // : MyColours.color_199095, | ||
| 99 | + // // borderRadius: BorderRadius.only( | ||
| 100 | + // // topLeft: Radius.circular(ScreenUtil().setWidth(10)), | ||
| 101 | + // // topRight: Radius.circular(ScreenUtil().setWidth(15)), | ||
| 102 | + // // bottomRight: | ||
| 103 | + // // Radius.circular(ScreenUtil().setWidth(15))) | ||
| 104 | + // ), | ||
| 105 | + // child: Text(area.count <= 0 ? "满座" : "${area.count}", | ||
| 106 | + // style: TextStyle( | ||
| 107 | + // color: MyColours.color_ffffff, | ||
| 108 | + // fontSize: ScreenUtil().setSp(26), | ||
| 109 | + // decoration: TextDecoration.none, | ||
| 110 | + // fontWeight: FontWeight.normal)), | ||
| 111 | + // ), | ||
| 112 | + // ), | ||
| 113 | + // ], | ||
| 114 | + // ) | ||
| 115 | + ); | ||
| 116 | + } | ||
| 117 | +} |
lib/pages/table/table_item_or_reserve.dart
0 → 100644
| 1 | +import 'package:flutter/material.dart'; | ||
| 2 | +import 'package:flutter_screenutil/flutter_screenutil.dart'; | ||
| 3 | +import 'package:one_key/models/notebook.dart'; | ||
| 4 | +import 'package:one_key/res/colors.dart'; | ||
| 5 | + | ||
| 6 | +import 'package:one_key/models/table.dart' as t; | ||
| 7 | +import 'package:one_key/utils/utils.dart'; | ||
| 8 | +import 'package:one_key/widgets/v_empty_view.dart'; | ||
| 9 | + | ||
| 10 | +import '../../models/table_or_reserve_model.dart'; | ||
| 11 | +import '../../utils/screen_util.dart'; | ||
| 12 | + | ||
| 13 | +class TableItemOrReserve extends StatefulWidget { | ||
| 14 | + final TableListReserve table; | ||
| 15 | + final bool canSelected; //是否能选中 | ||
| 16 | + final ValueChanged<TableListReserve> onSelected; | ||
| 17 | + | ||
| 18 | + final String rid; | ||
| 19 | + final Map<String, Notebook> tableMap; //记录已预订桌位对应的订单 | ||
| 20 | + | ||
| 21 | + final int height; //高度 | ||
| 22 | + final bool need; | ||
| 23 | + final List<TableListReserve> selectTables; | ||
| 24 | + | ||
| 25 | + TableItemOrReserve(this.table, | ||
| 26 | + {this.onSelected, | ||
| 27 | + this.canSelected = false, | ||
| 28 | + this.height = 185, | ||
| 29 | + this.rid, | ||
| 30 | + this.tableMap, | ||
| 31 | + this.need = true, | ||
| 32 | + this.selectTables}); | ||
| 33 | + | ||
| 34 | + @override | ||
| 35 | + State<StatefulWidget> createState() { | ||
| 36 | + // TODO: implement createState | ||
| 37 | + return new TableItemOrReserveState(); | ||
| 38 | + } | ||
| 39 | +} | ||
| 40 | + | ||
| 41 | +class TableItemOrReserveState extends State<TableItemOrReserve> { | ||
| 42 | + // 判断两数组是否有相同元素, true: 存在相同 false:没相同 | ||
| 43 | + haveSame(List arr, List otherArr) { | ||
| 44 | + if (arr == null || otherArr == null) { | ||
| 45 | + return false; | ||
| 46 | + } | ||
| 47 | + // 合并数组 | ||
| 48 | + | ||
| 49 | + arr.addAll(otherArr); | ||
| 50 | + | ||
| 51 | + // 合并数组并去重 | ||
| 52 | + Set setArr = new Set(); //用set进行去重 | ||
| 53 | + setArr.addAll(arr); //把数组塞进set里 | ||
| 54 | + List newList = setArr.toList(); | ||
| 55 | + | ||
| 56 | + return arr.length != newList.length; | ||
| 57 | + } | ||
| 58 | + | ||
| 59 | + String rnameStr(rname) { | ||
| 60 | + if (rname == null || rname == '' || rname == ' ') return ""; | ||
| 61 | + return rname; | ||
| 62 | + } | ||
| 63 | + | ||
| 64 | + String sexStr(String sex) { | ||
| 65 | + if (sex == null || sex == '' || sex == '0') return ""; | ||
| 66 | + switch (sex.toString()) { | ||
| 67 | + case "1": //先生 | ||
| 68 | + case "男": | ||
| 69 | + case "先生": | ||
| 70 | + return "先生"; | ||
| 71 | + case "2": //女士 | ||
| 72 | + case "女": | ||
| 73 | + case "女士": | ||
| 74 | + return "女士"; | ||
| 75 | + case "3": //公司 | ||
| 76 | + case "公司": | ||
| 77 | + return "公司"; | ||
| 78 | + } | ||
| 79 | + } | ||
| 80 | + | ||
| 81 | + @override | ||
| 82 | + Widget build(BuildContext context) { | ||
| 83 | + TableListReserve table = widget.table; | ||
| 84 | + | ||
| 85 | + if (table.reserveList != null) { | ||
| 86 | + table.signStr = table.reserveList.signStr; | ||
| 87 | + table.sign = table.reserveList.status; | ||
| 88 | + if (table.reserveList.rname != null && | ||
| 89 | + table.reserveList.rname != '' && | ||
| 90 | + table.reserveList.rname != ' ') { | ||
| 91 | + table.reserver = | ||
| 92 | + rnameStr(table.reserveList.rname) + sexStr(table.reserveList.sex); | ||
| 93 | + } | ||
| 94 | + | ||
| 95 | + table.pnum = table.reserveList.actualPum; | ||
| 96 | + table.place_order_name = table.reserveList.placeOrderName; | ||
| 97 | + table.label = table.reserveList.reserveCountShow; | ||
| 98 | + table.notebookId = table.reserveList.id; | ||
| 99 | + } else if (table.banquetList != null && table.banquetList.length > 0) { | ||
| 100 | + table.signStr = '已预订'; | ||
| 101 | + table.sign = '10'; | ||
| 102 | + if (table.banquetList[0].rname != null && | ||
| 103 | + table.banquetList[0].rname != '' && | ||
| 104 | + table.banquetList[0].rname != ' ') { | ||
| 105 | + table.reserver = rnameStr(table.banquetList[0].rname) + | ||
| 106 | + sexStr(table.banquetList[0].sex); | ||
| 107 | + } | ||
| 108 | + | ||
| 109 | + table.label = table.banquetList[0].className; | ||
| 110 | + table.notebookId = table.banquetList[0].rid; | ||
| 111 | + } | ||
| 112 | + | ||
| 113 | + // if (table.sign == '5' && widget.tableMap[table.id]?.orderInfo != null) { | ||
| 114 | + // if (widget.tableMap[table.id].orderInfo?.status == '3') { | ||
| 115 | + // table.signStr = '已买单'; | ||
| 116 | + // } | ||
| 117 | + // } | ||
| 118 | + | ||
| 119 | + bool isSelf = false; | ||
| 120 | + //当前桌子的预订id | ||
| 121 | + String idNow = ''; | ||
| 122 | + if (widget.tableMap.containsKey('${table.id}')) { | ||
| 123 | + //包含,证明该桌子已经被预订了 | ||
| 124 | + idNow = widget.tableMap['${table.id}'].id; | ||
| 125 | + if (idNow == widget.rid) { | ||
| 126 | + isSelf = true; | ||
| 127 | + } | ||
| 128 | + } | ||
| 129 | + List selectTids = []; //被选中的桌子ids | ||
| 130 | + if (widget.selectTables != null) { | ||
| 131 | + widget.selectTables.forEach((element) { | ||
| 132 | + selectTids.add(element.id); | ||
| 133 | + }); | ||
| 134 | + } | ||
| 135 | + | ||
| 136 | + // bool islock = (table.isLock == '1' && | ||
| 137 | + // widget.tableMap.containsKey(table.lockTid)) || | ||
| 138 | + // (table.isMerge == '1' && | ||
| 139 | + // haveSame(widget.tableMap.keys.toList(), table.tids.split(','))) || | ||
| 140 | + // (table.isLock == '1' && selectTids.contains(table.lockTid)) || | ||
| 141 | + // (table.isMerge == '1' && | ||
| 142 | + // haveSame( | ||
| 143 | + // selectTids, | ||
| 144 | + // table.tids.split( | ||
| 145 | + // ','))); //真正上锁*******被合并桌子上锁:合并的桌子被预订&&islock == '1' || 合并桌子上锁:被合并的桌子被预订&&ismerge == '1' | ||
| 146 | +bool islock = table.reserveLock == '1'; | ||
| 147 | + return GestureDetector( | ||
| 148 | + onTap: () { | ||
| 149 | + if (islock && table.signStr != '已预订') { | ||
| 150 | + return; | ||
| 151 | + } | ||
| 152 | + setState(() { | ||
| 153 | + table.selected = !(table.selected ?? false); | ||
| 154 | + }); | ||
| 155 | + | ||
| 156 | + widget.onSelected(table); | ||
| 157 | + }, | ||
| 158 | + child: islock && table.signStr != '已预订' | ||
| 159 | + ? Stack( | ||
| 160 | + children: [ | ||
| 161 | + Container( | ||
| 162 | + // width: ScreenUtil().setWidth(160), | ||
| 163 | + // height: ScreenUtil().setWidth(widget.height), | ||
| 164 | + // margin: EdgeInsets.all(ScreenUtil().setWidth(9)), | ||
| 165 | + decoration: BoxDecoration( | ||
| 166 | + color: MyColours.color_DBDBDB, | ||
| 167 | + border: Border.all( | ||
| 168 | + width: ScreenUtil().setWidth(2), | ||
| 169 | + color: MyColours.color_BFC4D4), | ||
| 170 | + borderRadius: BorderRadius.all( | ||
| 171 | + Radius.circular(ScreenUtil().setWidth(20)))), | ||
| 172 | + child: Column( | ||
| 173 | + crossAxisAlignment: CrossAxisAlignment.center, | ||
| 174 | + mainAxisAlignment: MainAxisAlignment.center, | ||
| 175 | + children: <Widget>[ | ||
| 176 | + widget.need && table.signStr == '已预订' && !isSelf | ||
| 177 | + ? SizedBox() | ||
| 178 | + : VEmptyView(10), | ||
| 179 | + Container( | ||
| 180 | + // color: Colors.red, | ||
| 181 | + alignment: Alignment.center, | ||
| 182 | + child: Text( | ||
| 183 | + table.name, | ||
| 184 | + maxLines: 1, | ||
| 185 | + style: TextStyle( | ||
| 186 | + color: MyColours.color_333333, | ||
| 187 | + fontSize: ScreenUtil().setSp(36), | ||
| 188 | + decoration: TextDecoration.none, | ||
| 189 | + fontWeight: FontWeight.bold), | ||
| 190 | + overflow: TextOverflow.ellipsis, | ||
| 191 | + )), | ||
| 192 | + VEmptyView(10), | ||
| 193 | + Image.asset( | ||
| 194 | + Utils.getImgPath('lock'), | ||
| 195 | + width: w(16), | ||
| 196 | + ) | ||
| 197 | + ], | ||
| 198 | + )), | ||
| 199 | + Positioned( | ||
| 200 | + left: 0, | ||
| 201 | + top: 0, | ||
| 202 | + child: table.tidStr == null | ||
| 203 | + ? Container() | ||
| 204 | + : Container( | ||
| 205 | + // width: ScreenUtil().setWidth(60), | ||
| 206 | + // height: ScreenUtil().setWidth(42), | ||
| 207 | + padding: EdgeInsets.all(ScreenUtil().setWidth(4)), | ||
| 208 | + alignment: Alignment.center, | ||
| 209 | + decoration: BoxDecoration( | ||
| 210 | + // color: widget.canSelected && table.selected | ||
| 211 | + // ? MyColours.color_199095 | ||
| 212 | + // : Color.fromRGBO(239, 239, 239, 1), | ||
| 213 | + borderRadius: BorderRadius.only( | ||
| 214 | + topLeft: Radius.circular(ScreenUtil().setWidth(20)), | ||
| 215 | + // topRight: | ||
| 216 | + // Radius.circular(ScreenUtil().setWidth(8)), | ||
| 217 | + // bottomRight: Radius.circular( | ||
| 218 | + // ScreenUtil().setWidth(8)) | ||
| 219 | + )), | ||
| 220 | + child: Text(table.tidStr, | ||
| 221 | + style: TextStyle( | ||
| 222 | + color: MyColours.color_999999, | ||
| 223 | + fontSize: ScreenUtil().setSp(20), | ||
| 224 | + decoration: TextDecoration.none, | ||
| 225 | + fontWeight: FontWeight.normal)), | ||
| 226 | + ), | ||
| 227 | + ), | ||
| 228 | + ], | ||
| 229 | + ) | ||
| 230 | + : Stack( | ||
| 231 | + children: <Widget>[ | ||
| 232 | + Container( | ||
| 233 | + // width: ScreenUtil().setWidth(160), | ||
| 234 | + // height: ScreenUtil().setWidth(widget.height), | ||
| 235 | + // margin: EdgeInsets.all(ScreenUtil().setWidth(9)), | ||
| 236 | + decoration: BoxDecoration( | ||
| 237 | + color: widget.need && table.signStr == '已预订' && !isSelf | ||
| 238 | + ? table.sign == '10' | ||
| 239 | + ? MyColours.color_FEF3E6 | ||
| 240 | + : MyColours.color_80438E93 | ||
| 241 | + : widget.canSelected && table.selected | ||
| 242 | + ? MyColours.color_199095 | ||
| 243 | + : MyColours.color_ffffff, | ||
| 244 | + border: Border.all( | ||
| 245 | + width: ScreenUtil().setWidth(2), | ||
| 246 | + color: MyColours.color_E0E0E0), | ||
| 247 | + borderRadius: BorderRadius.all( | ||
| 248 | + Radius.circular(ScreenUtil().setWidth(20)))), | ||
| 249 | + child: Stack( | ||
| 250 | + // alignment: Alignment.center, | ||
| 251 | + children: <Widget>[ | ||
| 252 | + Container( | ||
| 253 | + // alignment: Alignment.center, | ||
| 254 | + // color: Colors.blueAccent, | ||
| 255 | + // height: ScreenUtil().setWidth(widget.height), | ||
| 256 | + // padding: EdgeInsets.symmetric( | ||
| 257 | + // horizontal: ScreenUtil().setWidth(20)), | ||
| 258 | + // margin: EdgeInsets.only(left: ScreenUtil().setWidth(20)), | ||
| 259 | + child: Column( | ||
| 260 | + // mainAxisSize: MainAxisSize.min, | ||
| 261 | + crossAxisAlignment: CrossAxisAlignment.center, | ||
| 262 | + mainAxisAlignment: MainAxisAlignment.center, | ||
| 263 | + children: <Widget>[ | ||
| 264 | + widget.need && table.signStr == '已预订' && !isSelf | ||
| 265 | + ? SizedBox() | ||
| 266 | + : VEmptyView(10), | ||
| 267 | + Container( | ||
| 268 | + // color: Colors.red, | ||
| 269 | + alignment: Alignment.center, | ||
| 270 | + child: Text( | ||
| 271 | + table.name, | ||
| 272 | + maxLines: 1, | ||
| 273 | + style: TextStyle( | ||
| 274 | + color: (widget.need && | ||
| 275 | + table.signStr == '已预订' && | ||
| 276 | + !isSelf) | ||
| 277 | + ? MyColours.color_333333 | ||
| 278 | + : (widget.canSelected && | ||
| 279 | + table.selected) | ||
| 280 | + ? MyColours.color_ffffff | ||
| 281 | + : MyColours.color_333333, | ||
| 282 | + fontSize: ScreenUtil().setSp(34), | ||
| 283 | + decoration: TextDecoration.none, | ||
| 284 | + fontWeight: FontWeight.bold), | ||
| 285 | + overflow: TextOverflow.ellipsis, | ||
| 286 | + ) | ||
| 287 | + // Text( | ||
| 288 | + // table.name, | ||
| 289 | + // // textAlign: TextAlign.center, | ||
| 290 | + // maxLines: 2, | ||
| 291 | + // style: TextStyle( | ||
| 292 | + // color: table.table.signStr == '已停用' | ||
| 293 | + // ? MyColours.color_999999 | ||
| 294 | + // : MyColours.color_353535, | ||
| 295 | + // fontSize: ScreenUtil().setSp(28), | ||
| 296 | + // decoration: TextDecoration.none, | ||
| 297 | + // fontWeight: FontWeight.normal), | ||
| 298 | + // overflow: TextOverflow.ellipsis, | ||
| 299 | + // ), | ||
| 300 | + ), | ||
| 301 | + ((table.reserver != null && table.reserver != '') || | ||
| 302 | + (table.pnum != '' && | ||
| 303 | + table.pnum != null && | ||
| 304 | + table.pnum != '0')) | ||
| 305 | + ? VEmptyView(8) | ||
| 306 | + : SizedBox(), | ||
| 307 | + table.signStr == '已预订' && !isSelf | ||
| 308 | + ? SizedBox() | ||
| 309 | + : Text( | ||
| 310 | + table.tableNum, | ||
| 311 | + style: TextStyle( | ||
| 312 | + color: table.signStr == '已预订' && !isSelf | ||
| 313 | + ? MyColours.color_353535 | ||
| 314 | + : (widget.canSelected && | ||
| 315 | + table.selected) | ||
| 316 | + ? MyColours.color_ffffff | ||
| 317 | + : MyColours.color_353535, | ||
| 318 | + fontSize: ScreenUtil().setSp(22), | ||
| 319 | + decoration: TextDecoration.none, | ||
| 320 | + fontWeight: FontWeight.normal), | ||
| 321 | + overflow: TextOverflow.ellipsis, | ||
| 322 | + ), | ||
| 323 | + table.signStr == '已预订' && | ||
| 324 | + !isSelf && | ||
| 325 | + ((table.reserver != null && | ||
| 326 | + !table.reserver.isEmpty && | ||
| 327 | + table.reserver != '') || | ||
| 328 | + (table.pnum != '' && | ||
| 329 | + table.pnum != null && | ||
| 330 | + table.pnum != '0')) | ||
| 331 | + ? Text( | ||
| 332 | + (table.reserver == null || | ||
| 333 | + table.reserver.isEmpty || | ||
| 334 | + table.reserver == '') | ||
| 335 | + ? (table.pnum != '' && | ||
| 336 | + table.pnum != null && | ||
| 337 | + table.pnum != '0') | ||
| 338 | + ? '(${table.pnum}人)' | ||
| 339 | + : '' | ||
| 340 | + : '${table.reserver}' + | ||
| 341 | + (table.pnum != '' && | ||
| 342 | + table.pnum != null && | ||
| 343 | + table.pnum != '0' | ||
| 344 | + ? '(${table.pnum}人)' | ||
| 345 | + : ''), | ||
| 346 | + style: TextStyle( | ||
| 347 | + color: table.signStr == '已预订' && !isSelf | ||
| 348 | + ? MyColours.color_353535 | ||
| 349 | + : (widget.canSelected && | ||
| 350 | + table.selected) | ||
| 351 | + ? MyColours.color_ffffff | ||
| 352 | + : MyColours.color_353535, | ||
| 353 | + fontSize: ScreenUtil().setSp(22), | ||
| 354 | + decoration: TextDecoration.none, | ||
| 355 | + fontWeight: FontWeight.normal), | ||
| 356 | + overflow: TextOverflow.ellipsis, | ||
| 357 | + ) | ||
| 358 | + : SizedBox(), | ||
| 359 | + | ||
| 360 | + widget.need && | ||
| 361 | + table.signStr == '已预订' && | ||
| 362 | + !isSelf && | ||
| 363 | + table.place_order_name != null && | ||
| 364 | + table.place_order_name != '' | ||
| 365 | + ? Padding( | ||
| 366 | + padding: EdgeInsets.only( | ||
| 367 | + top: ScreenUtil().setWidth(6), | ||
| 368 | + bottom: ScreenUtil().setWidth(8), | ||
| 369 | + ), | ||
| 370 | + child: Text( | ||
| 371 | + table.place_order_name != null && | ||
| 372 | + table.place_order_name != '' | ||
| 373 | + ? '${table.place_order_name}订' | ||
| 374 | + : '', | ||
| 375 | + style: TextStyle( | ||
| 376 | + color: MyColours.color_353535, | ||
| 377 | + fontSize: ScreenUtil().setSp(22), | ||
| 378 | + decoration: TextDecoration.none, | ||
| 379 | + fontWeight: FontWeight.normal), | ||
| 380 | + overflow: TextOverflow.ellipsis, | ||
| 381 | + ), | ||
| 382 | + ) | ||
| 383 | + : SizedBox(), | ||
| 384 | + // VEmptyView(6), | ||
| 385 | + // Text( | ||
| 386 | + // table.lowStr, | ||
| 387 | + // style: TextStyle( | ||
| 388 | + // color: MyColours.color_777777, | ||
| 389 | + // fontSize: ScreenUtil().setSp(26), | ||
| 390 | + // decoration: TextDecoration.none, | ||
| 391 | + // fontWeight: FontWeight.normal), | ||
| 392 | + // overflow: TextOverflow.ellipsis, | ||
| 393 | + // ) | ||
| 394 | + table.signStr == '已预订' && !isSelf | ||
| 395 | + ? Container( | ||
| 396 | + // width: ScreenUtil().setWidth(160), | ||
| 397 | + height: ScreenUtil().setWidth(34), | ||
| 398 | + ) | ||
| 399 | + : SizedBox() | ||
| 400 | + ], | ||
| 401 | + ), | ||
| 402 | + ), | ||
| 403 | + | ||
| 404 | + table.signStr == '已预订' && !isSelf | ||
| 405 | + ? SizedBox() | ||
| 406 | + : Positioned( | ||
| 407 | + left: 0, | ||
| 408 | + top: 0, | ||
| 409 | + child: table.tidStr == null | ||
| 410 | + ? Container() | ||
| 411 | + : Container( | ||
| 412 | + // width: ScreenUtil().setWidth(60), | ||
| 413 | + // height: ScreenUtil().setWidth(42), | ||
| 414 | + padding: EdgeInsets.all( | ||
| 415 | + ScreenUtil().setWidth(4)), | ||
| 416 | + alignment: Alignment.center, | ||
| 417 | + decoration: BoxDecoration( | ||
| 418 | + color: widget.canSelected && | ||
| 419 | + table.selected | ||
| 420 | + ? MyColours.color_199095 | ||
| 421 | + : Color.fromRGBO( | ||
| 422 | + 239, 239, 239, 1), | ||
| 423 | + borderRadius: BorderRadius.only( | ||
| 424 | + topLeft: Radius.circular( | ||
| 425 | + ScreenUtil().setWidth(20)), | ||
| 426 | + // topRight: | ||
| 427 | + // Radius.circular(ScreenUtil().setWidth(8)), | ||
| 428 | + // bottomRight: Radius.circular( | ||
| 429 | + // ScreenUtil().setWidth(8)) | ||
| 430 | + )), | ||
| 431 | + child: Text(table.tidStr, | ||
| 432 | + style: TextStyle( | ||
| 433 | + color: widget.canSelected && | ||
| 434 | + table.selected | ||
| 435 | + ? MyColours.color_ffffff | ||
| 436 | + : MyColours.color_333333, | ||
| 437 | + fontSize: ScreenUtil().setSp(20), | ||
| 438 | + decoration: TextDecoration.none, | ||
| 439 | + fontWeight: FontWeight.normal)), | ||
| 440 | + ), | ||
| 441 | + ), | ||
| 442 | + // widget.need && table.signStr == '已预订' | ||
| 443 | + // ? Positioned( | ||
| 444 | + // bottom: 0, | ||
| 445 | + // left: 0, | ||
| 446 | + // right: 0, | ||
| 447 | + // child: table.signStr.isEmpty | ||
| 448 | + // ? Container() | ||
| 449 | + // : Container( | ||
| 450 | + // width: ScreenUtil().setWidth(160), | ||
| 451 | + // height: ScreenUtil().setWidth(40), | ||
| 452 | + // alignment: Alignment.center, | ||
| 453 | + // decoration: BoxDecoration( | ||
| 454 | + // color: table.signStr == '已停用' | ||
| 455 | + // ? MyColours.color_777777 | ||
| 456 | + // : table.signStr == '已买单' | ||
| 457 | + // ? MyColours.color_F59A23 | ||
| 458 | + // : MyColours.color_E95750, | ||
| 459 | + // borderRadius: BorderRadius.only( | ||
| 460 | + // bottomLeft: Radius.circular( | ||
| 461 | + // ScreenUtil().setWidth(8)), | ||
| 462 | + // bottomRight: Radius.circular( | ||
| 463 | + // ScreenUtil().setWidth(8)))), | ||
| 464 | + // child: Text( | ||
| 465 | + // table.signStr, | ||
| 466 | + // style: TextStyle( | ||
| 467 | + // color: MyColours.color_ffffff, | ||
| 468 | + // fontSize: ScreenUtil().setSp(24), | ||
| 469 | + // decoration: TextDecoration.none, | ||
| 470 | + // fontWeight: FontWeight.normal), | ||
| 471 | + // ), | ||
| 472 | + // ), | ||
| 473 | + // ) | ||
| 474 | + // : SizedBox(), | ||
| 475 | + ], | ||
| 476 | + ), | ||
| 477 | + ), | ||
| 478 | + // Positioned( | ||
| 479 | + // top: 3, | ||
| 480 | + // right: 5, | ||
| 481 | + // child: widget.canSelected && (table.selected ?? false) | ||
| 482 | + // ? Image.asset( | ||
| 483 | + // "assets/icon_selected.png", | ||
| 484 | + // width: ScreenUtil().setWidth(40), | ||
| 485 | + // height: ScreenUtil().setWidth(40), | ||
| 486 | + // ) | ||
| 487 | + // : Container()), | ||
| 488 | + widget.need && table.signStr == '已预订' && !isSelf | ||
| 489 | + ? SizedBox() | ||
| 490 | + : Positioned( | ||
| 491 | + left: ScreenUtil().setWidth(18), | ||
| 492 | + bottom: ScreenUtil().setWidth(12), | ||
| 493 | + child: table.isPhoto != 1 | ||
| 494 | + ? Image.asset( | ||
| 495 | + widget.canSelected && table.selected | ||
| 496 | + ? 'assets/f_camera_white.png' | ||
| 497 | + : "assets/f_camera.png", | ||
| 498 | + width: ScreenUtil().setWidth(22), | ||
| 499 | + height: ScreenUtil().setWidth(22), | ||
| 500 | + ) | ||
| 501 | + : Container()), | ||
| 502 | + Positioned( | ||
| 503 | + bottom: 0, | ||
| 504 | + right: 0, | ||
| 505 | + left: 0, | ||
| 506 | + child: table.signStr == '已预订' && !isSelf | ||
| 507 | + ? Container( | ||
| 508 | + // width: ScreenUtil().setWidth(160), | ||
| 509 | + height: ScreenUtil().setWidth(34), | ||
| 510 | + alignment: Alignment.center, | ||
| 511 | + padding: EdgeInsets.symmetric( | ||
| 512 | + horizontal: ScreenUtil().setWidth(10)), | ||
| 513 | + decoration: BoxDecoration( | ||
| 514 | + color: table.sign == '10' | ||
| 515 | + ? MyColours.color_F7C797 | ||
| 516 | + : MyColours.color_d9d9d9, | ||
| 517 | + borderRadius: BorderRadius.only( | ||
| 518 | + bottomLeft: Radius.circular( | ||
| 519 | + ScreenUtil().setWidth(20)), | ||
| 520 | + bottomRight: Radius.circular( | ||
| 521 | + ScreenUtil().setWidth(20)))), | ||
| 522 | + child: Text( | ||
| 523 | + table.label, | ||
| 524 | + textAlign: TextAlign.center, | ||
| 525 | + style: TextStyle( | ||
| 526 | + color: MyColours.color_28323B, | ||
| 527 | + fontSize: ScreenUtil().setSp(22), | ||
| 528 | + decoration: TextDecoration.none, | ||
| 529 | + fontWeight: FontWeight.normal), | ||
| 530 | + ), | ||
| 531 | + ) | ||
| 532 | + : SizedBox()) | ||
| 533 | + ], | ||
| 534 | + ), | ||
| 535 | + ); | ||
| 536 | + } | ||
| 537 | +} |
| @@ -20,6 +20,7 @@ import 'package:one_key/models/sms_info.dart'; | @@ -20,6 +20,7 @@ import 'package:one_key/models/sms_info.dart'; | ||
| 20 | import 'package:one_key/models/user_history_entity.dart'; | 20 | import 'package:one_key/models/user_history_entity.dart'; |
| 21 | 21 | ||
| 22 | import 'package:one_key/pages/table/area_item_table.dart'; | 22 | import 'package:one_key/pages/table/area_item_table.dart'; |
| 23 | +import 'package:one_key/pages/table/table_item_or_reserve.dart'; | ||
| 23 | import 'package:one_key/provider/base_info_provider.dart'; | 24 | import 'package:one_key/provider/base_info_provider.dart'; |
| 24 | import 'package:one_key/provider/coupon_provider.dart'; | 25 | import 'package:one_key/provider/coupon_provider.dart'; |
| 25 | import 'package:one_key/provider/my_model.dart'; | 26 | import 'package:one_key/provider/my_model.dart'; |
| @@ -55,6 +56,7 @@ import 'package:sendsms/sendsms.dart'; | @@ -55,6 +56,7 @@ import 'package:sendsms/sendsms.dart'; | ||
| 55 | import '../../app.dart'; | 56 | import '../../app.dart'; |
| 56 | import '../../models/get_seller_info_model.dart'; | 57 | import '../../models/get_seller_info_model.dart'; |
| 57 | import '../../models/remark.dart'; | 58 | import '../../models/remark.dart'; |
| 59 | +import '../../models/table_or_reserve_model.dart'; | ||
| 58 | import '../../models/user.dart'; | 60 | import '../../models/user.dart'; |
| 59 | import '../../provider/SmsModel.dart'; | 61 | import '../../provider/SmsModel.dart'; |
| 60 | import '../../provider/marketing_center_provider.dart'; | 62 | import '../../provider/marketing_center_provider.dart'; |
| @@ -69,6 +71,8 @@ import '../../widgets/special_text/my_extended_text_selection_controls.dart'; | @@ -69,6 +71,8 @@ import '../../widgets/special_text/my_extended_text_selection_controls.dart'; | ||
| 69 | import '../detail/notebook_detail_change_page_f.dart'; | 71 | import '../detail/notebook_detail_change_page_f.dart'; |
| 70 | import 'package:flutter_picker/flutter_picker.dart' as Picker; | 72 | import 'package:flutter_picker/flutter_picker.dart' as Picker; |
| 71 | 73 | ||
| 74 | +import 'area_item_table_or_reserve.dart'; | ||
| 75 | + | ||
| 72 | const scrollDuration = Duration(microseconds: 500); | 76 | const scrollDuration = Duration(microseconds: 500); |
| 73 | 77 | ||
| 74 | // typedef CustomCallBack = void Function(Object object); | 78 | // typedef CustomCallBack = void Function(Object object); |
| @@ -93,7 +97,7 @@ class TableManagerPageState extends State<TableManagerPage> { | @@ -93,7 +97,7 @@ class TableManagerPageState extends State<TableManagerPage> { | ||
| 93 | int _selectIndex = 0; | 97 | int _selectIndex = 0; |
| 94 | ScrollController _areaController = ScrollController(); | 98 | ScrollController _areaController = ScrollController(); |
| 95 | List<String> personNumList = []; | 99 | List<String> personNumList = []; |
| 96 | - bool isSelected = true; //全部按钮 | 100 | + // bool isSelected = true; //全部按钮 |
| 97 | String nameStr; | 101 | String nameStr; |
| 98 | FocusNode _nameNode = FocusNode(); | 102 | FocusNode _nameNode = FocusNode(); |
| 99 | FocusNode _phoneNode = FocusNode(); | 103 | FocusNode _phoneNode = FocusNode(); |
| @@ -157,22 +161,30 @@ class TableManagerPageState extends State<TableManagerPage> { | @@ -157,22 +161,30 @@ class TableManagerPageState extends State<TableManagerPage> { | ||
| 157 | // personNumList.add('30以上'); | 161 | // personNumList.add('30以上'); |
| 158 | 162 | ||
| 159 | WidgetsBinding.instance.addPostFrameCallback((_) { | 163 | WidgetsBinding.instance.addPostFrameCallback((_) { |
| 164 | + tableManagerModel.pageStateOrReserve = PageState.Loading; | ||
| 165 | + // tableManagerModel.initTimeTable(context); | ||
| 166 | + if (App.sp.containsKey('table_list')) { | ||
| 167 | +// //退出清空桌位数据 | ||
| 168 | + App.sp.remove('table_list'); | ||
| 169 | + } | ||
| 170 | + | ||
| 171 | + | ||
| 172 | + // getSpTableList(); | ||
| 160 | UserModel userModel = Provider.of<UserModel>(context, listen: false); | 173 | UserModel userModel = Provider.of<UserModel>(context, listen: false); |
| 161 | tableManagerModel.dateTime = DateTime.now(); | 174 | tableManagerModel.dateTime = DateTime.now(); |
| 162 | tableManagerModel.dateText = | 175 | tableManagerModel.dateText = |
| 163 | tableManagerModel.returnDate(tableManagerModel.dateTime); | 176 | tableManagerModel.returnDate(tableManagerModel.dateTime); |
| 164 | tableManagerModel.dateTimeSelect = tableManagerModel.dateTime; | 177 | tableManagerModel.dateTimeSelect = tableManagerModel.dateTime; |
| 165 | tableManagerModel.notifyListeners; | 178 | tableManagerModel.notifyListeners; |
| 166 | - _getAuthUserLists(); | 179 | + getUserAccountTypeById(showLoading: false); |
| 167 | // couponProvider.sendSMS = false; | 180 | // couponProvider.sendSMS = false; |
| 168 | - String tableSp = App.sp.getString('table_list'); | ||
| 169 | - if (tableSp != null) { | ||
| 170 | - //有缓存数据 | ||
| 171 | - tableManagerModel.showLoading = true; | ||
| 172 | - Loading.showLoading(context); | ||
| 173 | - } else { | ||
| 174 | - tableManagerModel.showLoading = false; | ||
| 175 | - } | 181 | + // String tableSp = App.sp.getString('table_list_or_reserve'); |
| 182 | + // if (tableSp != null) { | ||
| 183 | + // //有缓存数据 | ||
| 184 | + // // tableManagerModel.showLoading = true; | ||
| 185 | + // // Loading.showLoading(context); | ||
| 186 | + | ||
| 187 | + // } | ||
| 176 | 188 | ||
| 177 | _myExtendedMaterialTextSelectionControls = | 189 | _myExtendedMaterialTextSelectionControls = |
| 178 | MyTextSelectionControls(callback: (value) { | 190 | MyTextSelectionControls(callback: (value) { |
| @@ -184,15 +196,16 @@ class TableManagerPageState extends State<TableManagerPage> { | @@ -184,15 +196,16 @@ class TableManagerPageState extends State<TableManagerPage> { | ||
| 184 | }); | 196 | }); |
| 185 | _getSellerById(); | 197 | _getSellerById(); |
| 186 | 198 | ||
| 187 | - _couponNetworkData(selfDismiss: true); | 199 | + // _couponNetworkData(selfDismiss: true); |
| 188 | 200 | ||
| 189 | - getDzSellerConf(); | ||
| 190 | - _getRemark(); | 201 | + // getDzSellerConf(); |
| 202 | + // _getRemark(); | ||
| 191 | 203 | ||
| 192 | EventBus().on("refresh_tablemanager", (arg) { | 204 | EventBus().on("refresh_tablemanager", (arg) { |
| 193 | //订座-完成预订 刷新管理桌位 | 205 | //订座-完成预订 刷新管理桌位 |
| 194 | - tableManagerModel.getReserveList(context, | ||
| 195 | - needLoading: false, needKeep: true); | 206 | + tableManagerModel.getTableListOrReserve( |
| 207 | + context, | ||
| 208 | + ); | ||
| 196 | print(tableManagerModel); | 209 | print(tableManagerModel); |
| 197 | }); | 210 | }); |
| 198 | EventBus().on("refresh_tablePhoto", (arg) { | 211 | EventBus().on("refresh_tablePhoto", (arg) { |
| @@ -201,7 +214,7 @@ class TableManagerPageState extends State<TableManagerPage> { | @@ -201,7 +214,7 @@ class TableManagerPageState extends State<TableManagerPage> { | ||
| 201 | }); | 214 | }); |
| 202 | EventBus().on("refresh_table_m_coupon", (arg) { | 215 | EventBus().on("refresh_table_m_coupon", (arg) { |
| 203 | ///刷新优惠券 | 216 | ///刷新优惠券 |
| 204 | - _couponNetworkData(); | 217 | + // _couponNetworkData(); |
| 205 | }); | 218 | }); |
| 206 | if (widget.guest != null) { | 219 | if (widget.guest != null) { |
| 207 | for (var item in _baseIndoProvider.sexList) { | 220 | for (var item in _baseIndoProvider.sexList) { |
| @@ -220,6 +233,31 @@ class TableManagerPageState extends State<TableManagerPage> { | @@ -220,6 +233,31 @@ class TableManagerPageState extends State<TableManagerPage> { | ||
| 220 | }); | 233 | }); |
| 221 | } | 234 | } |
| 222 | 235 | ||
| 236 | + List<TableListReseveSunModel> getSpTableList() { | ||
| 237 | + String tableList = App.sp.getString('table_list_or_reserve'); | ||
| 238 | + if (tableList == null) { | ||
| 239 | + tableManagerModel.pageStateOrReserve = PageState.Loading; | ||
| 240 | + setState(() {}); | ||
| 241 | + return []; | ||
| 242 | + } | ||
| 243 | + | ||
| 244 | + List<TableListReseveSunModel> temp = []; | ||
| 245 | + List<TableListReseveSunModel> tempShow = []; | ||
| 246 | + List list = json.decode(tableList); | ||
| 247 | + if (list.length > 0) { | ||
| 248 | + list.forEach((element) { | ||
| 249 | + temp.add(TableListReseveSunModel.fromJson2(element)); | ||
| 250 | + print(temp); | ||
| 251 | + tempShow.add(TableListReseveSunModel.fromJson2(element)); | ||
| 252 | + }); | ||
| 253 | + } | ||
| 254 | + | ||
| 255 | + tableManagerModel.tablesOrReserveData = temp; | ||
| 256 | + tableManagerModel.tablesOrReserveDataShow = tempShow; | ||
| 257 | + tableManagerModel.pageStateOrReserve = PageState.Success; | ||
| 258 | + setState(() {}); | ||
| 259 | + } | ||
| 260 | + | ||
| 223 | @override | 261 | @override |
| 224 | void dispose() { | 262 | void dispose() { |
| 225 | // TODO: implement dispose | 263 | // TODO: implement dispose |
| @@ -234,7 +272,7 @@ class TableManagerPageState extends State<TableManagerPage> { | @@ -234,7 +272,7 @@ class TableManagerPageState extends State<TableManagerPage> { | ||
| 234 | StoreBaseIndoProvider storeBaseIndoProvider = | 272 | StoreBaseIndoProvider storeBaseIndoProvider = |
| 235 | Provider.of<StoreBaseIndoProvider>(context, listen: false); | 273 | Provider.of<StoreBaseIndoProvider>(context, listen: false); |
| 236 | GetSellerInfoSunModel sellerInfoSunModel = | 274 | GetSellerInfoSunModel sellerInfoSunModel = |
| 237 | - await storeBaseIndoProvider.getSellerById(context); | 275 | + await storeBaseIndoProvider.getSellerById(context, showLoading: false); |
| 238 | if (sellerInfoSunModel != null) { | 276 | if (sellerInfoSunModel != null) { |
| 239 | if (App.sp.containsKey('user')) { | 277 | if (App.sp.containsKey('user')) { |
| 240 | String s = App.sp.getString('user'); | 278 | String s = App.sp.getString('user'); |
| @@ -251,16 +289,16 @@ class TableManagerPageState extends State<TableManagerPage> { | @@ -251,16 +289,16 @@ class TableManagerPageState extends State<TableManagerPage> { | ||
| 251 | await UserModel().saveUserInfo(_user); | 289 | await UserModel().saveUserInfo(_user); |
| 252 | } | 290 | } |
| 253 | } | 291 | } |
| 254 | - tableManagerModel.initTime(context); | 292 | + tableManagerModel.initTimeTable(context); |
| 255 | } | 293 | } |
| 256 | 294 | ||
| 257 | - ///获取备注信息 | ||
| 258 | - _getRemark() async { | ||
| 259 | - Map<String, String> params = { | ||
| 260 | - "uid": Provider.of<UserModel>(context, listen: false).user.openid | ||
| 261 | - }; | ||
| 262 | - await remarkManagerModel.getRemarks(context, params); | ||
| 263 | - } | 295 | + // ///获取备注信息 |
| 296 | + // _getRemark() async { | ||
| 297 | + // Map<String, String> params = { | ||
| 298 | + // "uid": Provider.of<UserModel>(context, listen: false).user.openid | ||
| 299 | + // }; | ||
| 300 | + // await remarkManagerModel.getRemarks(context, params); | ||
| 301 | + // } | ||
| 264 | 302 | ||
| 265 | _saveUser(String rolename) async { | 303 | _saveUser(String rolename) async { |
| 266 | NavigatorUtil.goHomePage(context, initialIndex: 1); | 304 | NavigatorUtil.goHomePage(context, initialIndex: 1); |
| @@ -290,95 +328,26 @@ class TableManagerPageState extends State<TableManagerPage> { | @@ -290,95 +328,26 @@ class TableManagerPageState extends State<TableManagerPage> { | ||
| 290 | } | 328 | } |
| 291 | } | 329 | } |
| 292 | 330 | ||
| 293 | - //获取员工信息列表 | ||
| 294 | - _getAuthUserLists({bool showLoading = true}) async { | ||
| 295 | - Map<String, String> params = { | ||
| 296 | - "sellerid": Provider.of<UserModel>(context, listen: false).user.sellerid, | ||
| 297 | - }; | ||
| 298 | - | ||
| 299 | - await personnelProvider.getAuthUserLists(context, params, | 331 | + //获取登陆人类型 只订不服 |
| 332 | + getUserAccountTypeById({bool showLoading = false}) async { | ||
| 333 | + String accountType = await tableManagerModel.getUserAccountTypeById(context, | ||
| 300 | showLoading: showLoading); | 334 | showLoading: showLoading); |
| 301 | - if (personnelProvider.dataMap != null) { | ||
| 302 | - User user = Provider.of<UserModel>(context, listen: false).user; | ||
| 303 | - | ||
| 304 | - if (user.role_name == '管理员') { | ||
| 305 | - personnelProvider.dataMap.admin.listdata.forEach((element) { | ||
| 306 | - if (user.openid == element.id) { | ||
| 307 | - if (element.accountType == '3') { | ||
| 308 | - _saveUser('管理员'); | ||
| 309 | - } else { | ||
| 310 | - _saveUserAddition('管理员'); | ||
| 311 | - } | ||
| 312 | - } | ||
| 313 | - }); | ||
| 314 | - } else if (user.role_name == '店长') { | ||
| 315 | - personnelProvider.dataMap.shopowner.listdata.forEach((element) { | ||
| 316 | - if (user.openid == element.id) { | ||
| 317 | - if (element.accountType == '3') { | ||
| 318 | - _saveUser('店长'); | ||
| 319 | - } else { | ||
| 320 | - _saveUserAddition('店长'); | ||
| 321 | - } | ||
| 322 | - } | ||
| 323 | - }); | ||
| 324 | - } else if (user.role_name == '客户经理') { | ||
| 325 | - personnelProvider.dataMap.manager.listdata.forEach((element) { | ||
| 326 | - if (user.openid == element.id) { | ||
| 327 | - if (element.accountType == '3') { | ||
| 328 | - _saveUser('客户经理'); | ||
| 329 | - } else { | ||
| 330 | - _saveUserAddition('客户经理'); | ||
| 331 | - } | ||
| 332 | - } | ||
| 333 | - }); | ||
| 334 | - } else if (user.role_name == '收银员') { | ||
| 335 | - personnelProvider.dataMap.cashier.listdata.forEach((element) { | ||
| 336 | - if (user.openid == element.id) { | ||
| 337 | - if (element.accountType == '3') { | ||
| 338 | - _saveUser('收银员'); | ||
| 339 | - } else { | ||
| 340 | - _saveUserAddition('收银员'); | ||
| 341 | - } | ||
| 342 | - } | ||
| 343 | - }); | ||
| 344 | - } else if (user.role_name == '服务员') { | ||
| 345 | - personnelProvider.dataMap.waiter.listdata.forEach((element) { | ||
| 346 | - if (user.openid == element.id) { | ||
| 347 | - if (element.accountType == '3') { | ||
| 348 | - _saveUser('服务员'); | ||
| 349 | - } else { | ||
| 350 | - _saveUserAddition('服务员'); | ||
| 351 | - } | ||
| 352 | - } | ||
| 353 | - }); | ||
| 354 | - } else if (user.role_name == '前台') { | ||
| 355 | - personnelProvider.dataMap.reception.listdata.forEach((element) { | ||
| 356 | - if (user.openid == element.id) { | ||
| 357 | - if (element.accountType == '3') { | ||
| 358 | - _saveUser('前台'); | ||
| 359 | - } else { | ||
| 360 | - _saveUserAddition('前台'); | ||
| 361 | - } | ||
| 362 | - } | ||
| 363 | - }); | ||
| 364 | - } else if (user.role_name == '迎宾') { | ||
| 365 | - personnelProvider.dataMap.welcome.listdata.forEach((element) { | ||
| 366 | - if (user.openid == element.id) { | ||
| 367 | - if (element.accountType == '3') { | ||
| 368 | - _saveUser('迎宾'); | ||
| 369 | - } else { | ||
| 370 | - _saveUserAddition('迎宾'); | ||
| 371 | - } | ||
| 372 | - } | ||
| 373 | - }); | ||
| 374 | - } | 335 | + if (accountType == '3') { |
| 336 | + _saveUser(Provider.of<UserModel>(context, listen: false) | ||
| 337 | + .user | ||
| 338 | + .role_name_addition); | ||
| 339 | + } else { | ||
| 340 | + _saveUserAddition(Provider.of<UserModel>(context, listen: false) | ||
| 341 | + .user | ||
| 342 | + .role_name_addition); | ||
| 375 | } | 343 | } |
| 376 | } | 344 | } |
| 377 | 345 | ||
| 378 | getDzSellerConf() async { | 346 | getDzSellerConf() async { |
| 379 | MarketingCenterProvider marketingCenterProvider = | 347 | MarketingCenterProvider marketingCenterProvider = |
| 380 | Provider.of<MarketingCenterProvider>(context, listen: false); | 348 | Provider.of<MarketingCenterProvider>(context, listen: false); |
| 381 | - bool success = await marketingCenterProvider.getDzSellerConf(context); | 349 | + bool success = await marketingCenterProvider.getDzSellerConf(context, |
| 350 | + showLoading: false); | ||
| 382 | if (success && marketingCenterProvider.dzSellerConfModel != null) { | 351 | if (success && marketingCenterProvider.dzSellerConfModel != null) { |
| 383 | noticeSms = marketingCenterProvider.dzSellerConfModel.isNotice == '1' | 352 | noticeSms = marketingCenterProvider.dzSellerConfModel.isNotice == '1' |
| 384 | ? true | 353 | ? true |
| @@ -507,13 +476,10 @@ class TableManagerPageState extends State<TableManagerPage> { | @@ -507,13 +476,10 @@ class TableManagerPageState extends State<TableManagerPage> { | ||
| 507 | 476 | ||
| 508 | ///刷新图片显示 | 477 | ///刷新图片显示 |
| 509 | _refreshTablePhoto() async { | 478 | _refreshTablePhoto() async { |
| 510 | - List temp = | ||
| 511 | - await tableManagerModel.getTableList(context, needLoading: false); | ||
| 512 | - if (temp.length > 0) { | ||
| 513 | - tableManagerModel.getReserveList(context, | ||
| 514 | - needLoading: false, needKeep: true); | ||
| 515 | - tableManagerModel.notifyListeners(); | ||
| 516 | - } | 479 | + await tableManagerModel.getTableListOrReserve( |
| 480 | + context, | ||
| 481 | + ); | ||
| 482 | + tableManagerModel.notifyListeners(); | ||
| 517 | } | 483 | } |
| 518 | 484 | ||
| 519 | // Widget list(List data) => ScrollablePositionedList.builder( | 485 | // Widget list(List data) => ScrollablePositionedList.builder( |
| @@ -553,12 +519,7 @@ class TableManagerPageState extends State<TableManagerPage> { | @@ -553,12 +519,7 @@ class TableManagerPageState extends State<TableManagerPage> { | ||
| 553 | vertical: ScreenUtil().setWidth(20), | 519 | vertical: ScreenUtil().setWidth(20), |
| 554 | horizontal: ScreenUtil().setWidth(10)), | 520 | horizontal: ScreenUtil().setWidth(10)), |
| 555 | shrinkWrap: true, | 521 | shrinkWrap: true, |
| 556 | - itemCount: tableManagerModel.tableOuterList.length == 0 | ||
| 557 | - ? 0 | ||
| 558 | - : tableManagerModel.currentArea == '全部' | ||
| 559 | - ? tableManagerModel.tablesShow.length | ||
| 560 | - : tableManagerModel | ||
| 561 | - .areaTableMapShow[tableManagerModel.currentArea].length, | 522 | + itemCount: tableManagerModel.tablesOrReserveDataShow[i].tableList.length, |
| 562 | gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( | 523 | gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( |
| 563 | crossAxisCount: 4, | 524 | crossAxisCount: 4, |
| 564 | childAspectRatio: 1, | 525 | childAspectRatio: 1, |
| @@ -567,104 +528,23 @@ class TableManagerPageState extends State<TableManagerPage> { | @@ -567,104 +528,23 @@ class TableManagerPageState extends State<TableManagerPage> { | ||
| 567 | ), | 528 | ), |
| 568 | 529 | ||
| 569 | itemBuilder: (BuildContext context, int index) { | 530 | itemBuilder: (BuildContext context, int index) { |
| 570 | - List<t.Table> data = tableManagerModel.tableOuterList.length == 0 | ||
| 571 | - ? [] | ||
| 572 | - : tableManagerModel.currentArea == '全部' | ||
| 573 | - ? tableManagerModel.tablesShow | ||
| 574 | - : tableManagerModel | ||
| 575 | - .areaTableMapShow[tableManagerModel.areas[i].name]; | ||
| 576 | - // if (index == data.length || data.length == 0) { | ||
| 577 | - // return InkWell( | ||
| 578 | - // onTap: () async { | ||
| 579 | - // List<String> areas = []; | ||
| 580 | - // for (int i = 0; i < tableManagerModel.areas.length; i++) { | ||
| 581 | - // areas.add(tableManagerModel.areas[i].name); | ||
| 582 | - // } | ||
| 583 | - | ||
| 584 | - // //添加桌位弹框 | ||
| 585 | - // await DialogUtil.openCreateTableDialog( | ||
| 586 | - // context, areas, i, personNumList, | ||
| 587 | - // onTap: (Map<String, String> value) async { | ||
| 588 | - // print(value); | ||
| 589 | - // // 'areaname': | ||
| 590 | - // // areas[currentAreaIndex], | ||
| 591 | - // // 'name': controller.text, | ||
| 592 | - // // 'pnumMin': pnumMin, | ||
| 593 | - // // 'pnumMax': pnumMax | ||
| 594 | - // //添加桌位 接口参数带整合??? | ||
| 595 | - // // 以下是旧的不去,明天添加桌位接口 | ||
| 596 | - // String rid; | ||
| 597 | - // for (Area item in tableManagerModel.areas) { | ||
| 598 | - // if (item.name == value['areaname']) { | ||
| 599 | - // rid = item.rid; | ||
| 600 | - // } | ||
| 601 | - // } | ||
| 602 | - // Map<String, String> params = { | ||
| 603 | - // 'rid': rid, | ||
| 604 | - // 'name': value['name'], | ||
| 605 | - // }; | ||
| 606 | - // if (value['pnumMin'] != '') { | ||
| 607 | - // params['pnum'] = value['pnumMin']; | ||
| 608 | - // } | ||
| 609 | - // if (value['pnumMax'] != '') { | ||
| 610 | - // params['most_pnum'] = value['pnumMax']; | ||
| 611 | - // } | ||
| 612 | - // bool success = | ||
| 613 | - // await tableManagerModel.addTable(context, params); | ||
| 614 | - // print(success); | ||
| 615 | - // if (success) { | ||
| 616 | - // Utils.showToast('添加成功!'); | ||
| 617 | - // // TableOuter tableOuter = TableOuter(); | ||
| 618 | - // // tableOuter.name = value; | ||
| 619 | - // // tableOuter.list = []; | ||
| 620 | - // // tableManagerModel.tableOuterList.add(tableOuter); | ||
| 621 | - // // tableManagerModel.initData(); | ||
| 622 | - // // Timer( | ||
| 623 | - // // Duration(milliseconds: 500), | ||
| 624 | - // // () => _areaController.jumpTo( | ||
| 625 | - // // _areaController.position.maxScrollExtent)); | ||
| 626 | - | ||
| 627 | - // // await tableManagerModel | ||
| 628 | - // // .getTableList(context); | ||
| 629 | - // // await tableManagerModel | ||
| 630 | - // // .initData(); | ||
| 631 | - // await tableManagerModel.refreshTable(context); | ||
| 632 | - // } | ||
| 633 | - // }); | ||
| 634 | - // }, | ||
| 635 | - // child: Container( | ||
| 636 | - // child: DottedBorder( | ||
| 637 | - // dashPattern: [5, 5, 5, 5], | ||
| 638 | - // borderType: BorderType.RRect, | ||
| 639 | - // radius: Radius.circular(ScreenUtil().setWidth(20)), | ||
| 640 | - // // padding: EdgeInsets.all(ScreenUtil().setWidth(70)), | ||
| 641 | - // color: MyColours.color_E0E0E0, | ||
| 642 | - // strokeWidth: ScreenUtil().setWidth(2), | ||
| 643 | - // child: ClipRRect( | ||
| 644 | - // borderRadius: BorderRadius.all( | ||
| 645 | - // Radius.circular(ScreenUtil().setWidth(20))), | ||
| 646 | - // child: Container( | ||
| 647 | - // height: ScreenUtil().screenWidth - | ||
| 648 | - // ScreenUtil().setWidth(12 * 3 - 10 * 2), | ||
| 649 | - // width: ScreenUtil().screenWidth - | ||
| 650 | - // ScreenUtil().setWidth(12 * 3 - 10 * 2), | ||
| 651 | - // child: Column( | ||
| 652 | - // mainAxisAlignment: MainAxisAlignment.center, | ||
| 653 | - // children: [ | ||
| 654 | - // Image.asset(Utils.getImgPath('add_store'), | ||
| 655 | - // width: ScreenUtil().setWidth(32)), | ||
| 656 | - // ], | ||
| 657 | - // ), | ||
| 658 | - // ), | ||
| 659 | - // ), | ||
| 660 | - // ))); | ||
| 661 | - // } else { | ||
| 662 | - return Selector<TableManagerModel, t.Table>( | 531 | + // List<t.Table> data = tableManagerModel.tableOuterList.length == 0 |
| 532 | + // ? [] | ||
| 533 | + // : tableManagerModel.currentArea == '全部' | ||
| 534 | + // ? tableManagerModel.tablesShow | ||
| 535 | + // : tableManagerModel.areaTableMapShow[ | ||
| 536 | + // tableManagerModel.tablesOrReserveDataShow[i].name]; | ||
| 537 | + | ||
| 538 | + TableListReserve data = | ||
| 539 | + tableManagerModel.tablesOrReserveDataShow[i].tableList[index]; | ||
| 540 | + | ||
| 541 | + return Selector<TableManagerModel, TableListReserve>( | ||
| 663 | shouldRebuild: (pre, next) => true, | 542 | shouldRebuild: (pre, next) => true, |
| 664 | - selector: (context, model) => data[index], | 543 | + selector: (context, model) => data, |
| 665 | builder: (context, table, _) { | 544 | builder: (context, table, _) { |
| 666 | - return FTableItem(table, | ||
| 667 | - canSelected: true, selectTables: tableManagerModel.selectTables, | 545 | + return TableItemOrReserve(table, |
| 546 | + canSelected: true, | ||
| 547 | + selectTables: tableManagerModel.selectTablesOrReserve, | ||
| 668 | onSelected: (table) { | 548 | onSelected: (table) { |
| 669 | if (table.signStr == '已预订') { | 549 | if (table.signStr == '已预订') { |
| 670 | if (table.sign == '10') { | 550 | if (table.sign == '10') { |
| @@ -674,19 +554,17 @@ class TableManagerPageState extends State<TableManagerPage> { | @@ -674,19 +554,17 @@ class TableManagerPageState extends State<TableManagerPage> { | ||
| 674 | } else { | 554 | } else { |
| 675 | //进入订座详情页面 | 555 | //进入订座详情页面 |
| 676 | NavigatorUtil.goNotebookDetailPage( | 556 | NavigatorUtil.goNotebookDetailPage( |
| 677 | - context, | ||
| 678 | - tableManagerModel.tableMap[table.id].id, | ||
| 679 | - tableManagerModel.tableMap[table.id].uid); | 557 | + context, table.notebookId, data.reserveList.uid); |
| 680 | } | 558 | } |
| 681 | } else { | 559 | } else { |
| 682 | setState(() { | 560 | setState(() { |
| 683 | - if ((table as t.Table).selected) { | ||
| 684 | - tableManagerModel.selectTables.add(table); | 561 | + if ((table as TableListReserve).selected) { |
| 562 | + tableManagerModel.selectTablesOrReserve.add(table); | ||
| 685 | } else { | 563 | } else { |
| 686 | - tableManagerModel.selectTables | 564 | + tableManagerModel.selectTablesOrReserve |
| 687 | .removeWhere((t) => t.id == table.id); | 565 | .removeWhere((t) => t.id == table.id); |
| 688 | } | 566 | } |
| 689 | - if (tableManagerModel.selectTables.length == 0) { | 567 | + if (tableManagerModel.selectTablesOrReserve.length == 0) { |
| 690 | // wechatNotification = true; | 568 | // wechatNotification = true; |
| 691 | _clearData(); | 569 | _clearData(); |
| 692 | } | 570 | } |
| @@ -728,7 +606,7 @@ class TableManagerPageState extends State<TableManagerPage> { | @@ -728,7 +606,7 @@ class TableManagerPageState extends State<TableManagerPage> { | ||
| 728 | // ((int.parse((table as t.Table).enable) + 1) % 2) | 606 | // ((int.parse((table as t.Table).enable) + 1) % 2) |
| 729 | // .toString(); | 607 | // .toString(); |
| 730 | // if ((table as t.Table).enable == "1") { | 608 | // if ((table as t.Table).enable == "1") { |
| 731 | - // for (Area area in tableManagerModel.areas) { | 609 | + // for (Area area in tableManagerModel.tablesOrReserveDataShow) { |
| 732 | // if (area.name == | 610 | // if (area.name == |
| 733 | // tableManagerModel.currentArea) { | 611 | // tableManagerModel.currentArea) { |
| 734 | // if (table.sign != '5' && table.sign != '1') { | 612 | // if (table.sign != '5' && table.sign != '1') { |
| @@ -739,7 +617,7 @@ class TableManagerPageState extends State<TableManagerPage> { | @@ -739,7 +617,7 @@ class TableManagerPageState extends State<TableManagerPage> { | ||
| 739 | // } | 617 | // } |
| 740 | // } | 618 | // } |
| 741 | // } else { | 619 | // } else { |
| 742 | - // for (Area area in tableManagerModel.areas) { | 620 | + // for (Area area in tableManagerModel.tablesOrReserveDataShow) { |
| 743 | // if (area.name == | 621 | // if (area.name == |
| 744 | // tableManagerModel.currentArea) { | 622 | // tableManagerModel.currentArea) { |
| 745 | // if (table.sign != '5' && table.sign != '1') { | 623 | // if (table.sign != '5' && table.sign != '1') { |
| @@ -762,10 +640,7 @@ class TableManagerPageState extends State<TableManagerPage> { | @@ -762,10 +640,7 @@ class TableManagerPageState extends State<TableManagerPage> { | ||
| 762 | // } | 640 | // } |
| 763 | // } | 641 | // } |
| 764 | // }); | 642 | // }); |
| 765 | - }, | ||
| 766 | - fromPage: 'table_manage', | ||
| 767 | - tableMap: tableManagerModel.tableMap, | ||
| 768 | - rid: ""); | 643 | + }, tableMap: tableManagerModel.tableMap, rid: ""); |
| 769 | }, | 644 | }, |
| 770 | ); | 645 | ); |
| 771 | // } | 646 | // } |
| @@ -2167,7 +2042,7 @@ class TableManagerPageState extends State<TableManagerPage> { | @@ -2167,7 +2042,7 @@ class TableManagerPageState extends State<TableManagerPage> { | ||
| 2167 | _onlyReserve() async { | 2042 | _onlyReserve() async { |
| 2168 | bool isShow = true; //是否需要弹窗 “预订失败!” | 2043 | bool isShow = true; //是否需要弹窗 “预订失败!” |
| 2169 | SunReserveInfoModel _model = | 2044 | SunReserveInfoModel _model = |
| 2170 | - await tableManagerModel.setReserveInfo(context, (v) { | 2045 | + await tableManagerModel.setReserveInfoOrReseve(context, (v) { |
| 2171 | if (v) { | 2046 | if (v) { |
| 2172 | isShow = true; | 2047 | isShow = true; |
| 2173 | } else { | 2048 | } else { |
| @@ -2367,11 +2242,12 @@ class TableManagerPageState extends State<TableManagerPage> { | @@ -2367,11 +2242,12 @@ class TableManagerPageState extends State<TableManagerPage> { | ||
| 2367 | height: ScreenUtil().setWidth(60), | 2242 | height: ScreenUtil().setWidth(60), |
| 2368 | child: ListView.builder( | 2243 | child: ListView.builder( |
| 2369 | padding: EdgeInsets.only(left: ScreenUtil().setWidth(48)), | 2244 | padding: EdgeInsets.only(left: ScreenUtil().setWidth(48)), |
| 2370 | - itemCount: tableManagerModel.selectTables.length, | 2245 | + itemCount: tableManagerModel.selectTablesOrReserve.length, |
| 2371 | shrinkWrap: true, | 2246 | shrinkWrap: true, |
| 2372 | scrollDirection: Axis.horizontal, | 2247 | scrollDirection: Axis.horizontal, |
| 2373 | itemBuilder: (BuildContext contxt, int index) { | 2248 | itemBuilder: (BuildContext contxt, int index) { |
| 2374 | - t.Table table = tableManagerModel.selectTables[index]; | 2249 | + TableListReserve table = |
| 2250 | + tableManagerModel.selectTablesOrReserve[index]; | ||
| 2375 | return Container( | 2251 | return Container( |
| 2376 | margin: | 2252 | margin: |
| 2377 | EdgeInsets.only(right: ScreenUtil().setWidth(20)), | 2253 | EdgeInsets.only(right: ScreenUtil().setWidth(20)), |
| @@ -2399,9 +2275,10 @@ class TableManagerPageState extends State<TableManagerPage> { | @@ -2399,9 +2275,10 @@ class TableManagerPageState extends State<TableManagerPage> { | ||
| 2399 | InkWell( | 2275 | InkWell( |
| 2400 | onTap: () { | 2276 | onTap: () { |
| 2401 | //删除已经选择的桌位 | 2277 | //删除已经选择的桌位 |
| 2402 | - tableManagerModel.selectTables | 2278 | + tableManagerModel.selectTablesOrReserve |
| 2403 | .removeWhere((t) => t.id == table.id); | 2279 | .removeWhere((t) => t.id == table.id); |
| 2404 | - if (tableManagerModel.selectTables.length == | 2280 | + if (tableManagerModel |
| 2281 | + .selectTablesOrReserve.length == | ||
| 2405 | 0) { | 2282 | 0) { |
| 2406 | // wechatNotification = true; | 2283 | // wechatNotification = true; |
| 2407 | _clearData(); | 2284 | _clearData(); |
| @@ -2522,7 +2399,7 @@ class TableManagerPageState extends State<TableManagerPage> { | @@ -2522,7 +2399,7 @@ class TableManagerPageState extends State<TableManagerPage> { | ||
| 2522 | _wechatReserve(bool isWechat) async { | 2399 | _wechatReserve(bool isWechat) async { |
| 2523 | bool isShow = true; //是否需要弹窗 “预订失败!” | 2400 | bool isShow = true; //是否需要弹窗 “预订失败!” |
| 2524 | SunReserveInfoModel _model = | 2401 | SunReserveInfoModel _model = |
| 2525 | - await tableManagerModel.setReserveInfo(context, (v) { | 2402 | + await tableManagerModel.setReserveInfoOrReseve(context, (v) { |
| 2526 | if (v) { | 2403 | if (v) { |
| 2527 | isShow = true; | 2404 | isShow = true; |
| 2528 | } else { | 2405 | } else { |
| @@ -2613,7 +2490,7 @@ class TableManagerPageState extends State<TableManagerPage> { | @@ -2613,7 +2490,7 @@ class TableManagerPageState extends State<TableManagerPage> { | ||
| 2613 | ddateIndex = null; | 2490 | ddateIndex = null; |
| 2614 | youhui = '选择优惠'; | 2491 | youhui = '选择优惠'; |
| 2615 | couponSelectIndex = 0; | 2492 | couponSelectIndex = 0; |
| 2616 | - tableManagerModel.selectTables = []; | 2493 | + tableManagerModel.selectTablesOrReserve = []; |
| 2617 | wechatNotification = true; | 2494 | wechatNotification = true; |
| 2618 | showPhoneHistory = false; //显示客户历史记录 | 2495 | showPhoneHistory = false; //显示客户历史记录 |
| 2619 | _baseIndoProvider.userHistorys.clear(); | 2496 | _baseIndoProvider.userHistorys.clear(); |
| @@ -2630,18 +2507,30 @@ class TableManagerPageState extends State<TableManagerPage> { | @@ -2630,18 +2507,30 @@ class TableManagerPageState extends State<TableManagerPage> { | ||
| 2630 | if (showErro != '短信余额不足,请充值短信条数') { | 2507 | if (showErro != '短信余额不足,请充值短信条数') { |
| 2631 | showErro = ''; | 2508 | showErro = ''; |
| 2632 | } | 2509 | } |
| 2633 | - for (t.Table item in tableManagerModel.tablesShow) { | ||
| 2634 | - item.selected = false; | ||
| 2635 | - } | ||
| 2636 | - tableManagerModel.areaTableMapShow.forEach((key, value) { | ||
| 2637 | - value.forEach((element) { | 2510 | + tableManagerModel.tablesOrReserveData.forEach((element) { |
| 2511 | + element.tableList.forEach((element) { | ||
| 2638 | element.selected = false; | 2512 | element.selected = false; |
| 2639 | }); | 2513 | }); |
| 2640 | }); | 2514 | }); |
| 2515 | + tableManagerModel.tablesOrReserveDataShow.forEach((element) { | ||
| 2516 | + element.tableList.forEach((element) { | ||
| 2517 | + element.selected = false; | ||
| 2518 | + }); | ||
| 2519 | + }); | ||
| 2520 | + // for (t.Table item in tableManagerModel.tablesShow) { | ||
| 2521 | + // item.selected = false; | ||
| 2522 | + // } | ||
| 2523 | + // tableManagerModel.areaTableMapShow.forEach((key, value) { | ||
| 2524 | + // value.forEach((element) { | ||
| 2525 | + // element.selected = false; | ||
| 2526 | + // }); | ||
| 2527 | + // }); | ||
| 2641 | 2528 | ||
| 2642 | tableManagerModel.notifyListeners(); | 2529 | tableManagerModel.notifyListeners(); |
| 2643 | } | 2530 | } |
| 2644 | 2531 | ||
| 2532 | + /** | ||
| 2533 | + | ||
| 2645 | ///选中的桌子widget | 2534 | ///选中的桌子widget |
| 2646 | Widget _selectTableWidgetSms() { | 2535 | Widget _selectTableWidgetSms() { |
| 2647 | return InkWell( | 2536 | return InkWell( |
| @@ -2749,11 +2638,11 @@ class TableManagerPageState extends State<TableManagerPage> { | @@ -2749,11 +2638,11 @@ class TableManagerPageState extends State<TableManagerPage> { | ||
| 2749 | child: ListView.builder( | 2638 | child: ListView.builder( |
| 2750 | padding: | 2639 | padding: |
| 2751 | EdgeInsets.only(left: ScreenUtil().setWidth(48)), | 2640 | EdgeInsets.only(left: ScreenUtil().setWidth(48)), |
| 2752 | - itemCount: tableManagerModel.selectTables.length, | 2641 | + itemCount: tableManagerModel.selectTablesOrReserve.length, |
| 2753 | shrinkWrap: true, | 2642 | shrinkWrap: true, |
| 2754 | scrollDirection: Axis.horizontal, | 2643 | scrollDirection: Axis.horizontal, |
| 2755 | itemBuilder: (BuildContext contxt, int index) { | 2644 | itemBuilder: (BuildContext contxt, int index) { |
| 2756 | - t.Table table = tableManagerModel.selectTables[index]; | 2645 | + TableListReserve table = tableManagerModel.selectTablesOrReserve[index]; |
| 2757 | return Container( | 2646 | return Container( |
| 2758 | margin: EdgeInsets.only( | 2647 | margin: EdgeInsets.only( |
| 2759 | right: ScreenUtil().setWidth(20)), | 2648 | right: ScreenUtil().setWidth(20)), |
| @@ -2781,10 +2670,10 @@ class TableManagerPageState extends State<TableManagerPage> { | @@ -2781,10 +2670,10 @@ class TableManagerPageState extends State<TableManagerPage> { | ||
| 2781 | InkWell( | 2670 | InkWell( |
| 2782 | onTap: () { | 2671 | onTap: () { |
| 2783 | //删除已经选择的桌位 | 2672 | //删除已经选择的桌位 |
| 2784 | - tableManagerModel.selectTables | 2673 | + tableManagerModel.selectTablesOrReserve |
| 2785 | .removeWhere((t) => t.id == table.id); | 2674 | .removeWhere((t) => t.id == table.id); |
| 2786 | if (tableManagerModel | 2675 | if (tableManagerModel |
| 2787 | - .selectTables.length == | 2676 | + .selectTablesOrReserve.length == |
| 2788 | 0) { | 2677 | 0) { |
| 2789 | // wechatNotification = true; | 2678 | // wechatNotification = true; |
| 2790 | _clearData(); | 2679 | _clearData(); |
| @@ -3216,6 +3105,8 @@ class TableManagerPageState extends State<TableManagerPage> { | @@ -3216,6 +3105,8 @@ class TableManagerPageState extends State<TableManagerPage> { | ||
| 3216 | ))); | 3105 | ))); |
| 3217 | } | 3106 | } |
| 3218 | 3107 | ||
| 3108 | + */ | ||
| 3109 | + | ||
| 3219 | _smsReserve() async { | 3110 | _smsReserve() async { |
| 3220 | if (!noticeSms) { | 3111 | if (!noticeSms) { |
| 3221 | if (myModel.smsInfo == '0') { | 3112 | if (myModel.smsInfo == '0') { |
| @@ -3310,19 +3201,19 @@ class TableManagerPageState extends State<TableManagerPage> { | @@ -3310,19 +3201,19 @@ class TableManagerPageState extends State<TableManagerPage> { | ||
| 3310 | cusdem = customController.text; | 3201 | cusdem = customController.text; |
| 3311 | } | 3202 | } |
| 3312 | bool isShow = true; //是否需要弹窗 “预订失败!” | 3203 | bool isShow = true; //是否需要弹窗 “预订失败!” |
| 3313 | - SunReserveInfoModel _model = await tableManagerModel.setReserveInfo(context, | ||
| 3314 | - (v) { | 3204 | + SunReserveInfoModel _model = await tableManagerModel |
| 3205 | + .setReserveInfoOrReseve(context, (v) { | ||
| 3315 | if (v) { | 3206 | if (v) { |
| 3316 | isShow = true; | 3207 | isShow = true; |
| 3317 | } else { | 3208 | } else { |
| 3318 | isShow = false; | 3209 | isShow = false; |
| 3319 | } | 3210 | } |
| 3320 | }, | 3211 | }, |
| 3321 | - needKeep: true, | ||
| 3322 | - pnum: pnum, | ||
| 3323 | - cusdem: cusdem, | ||
| 3324 | - tempTime: ddateHm == '选填' ? null : ddateHm, | ||
| 3325 | - guest: guest); | 3212 | + needKeep: true, |
| 3213 | + pnum: pnum, | ||
| 3214 | + cusdem: cusdem, | ||
| 3215 | + tempTime: ddateHm == '选填' ? null : ddateHm, | ||
| 3216 | + guest: guest); | ||
| 3326 | if (_model != null && | 3217 | if (_model != null && |
| 3327 | ObjectUtil.isNotEmpty(_model.row) && | 3218 | ObjectUtil.isNotEmpty(_model.row) && |
| 3328 | ObjectUtil.isNotEmpty(_model.row.id)) { | 3219 | ObjectUtil.isNotEmpty(_model.row.id)) { |
| @@ -3483,8 +3374,8 @@ class TableManagerPageState extends State<TableManagerPage> { | @@ -3483,8 +3374,8 @@ class TableManagerPageState extends State<TableManagerPage> { | ||
| 3483 | //构建常用备注 | 3374 | //构建常用备注 |
| 3484 | List<Widget> _buildAlwayItems() { | 3375 | List<Widget> _buildAlwayItems() { |
| 3485 | List<Widget> tables = []; | 3376 | List<Widget> tables = []; |
| 3486 | - if (tableManagerModel.selectTables.length < 6) { | ||
| 3487 | - for (t.Table table in tableManagerModel.selectTables) { | 3377 | + if (tableManagerModel.selectTablesOrReserve.length < 6) { |
| 3378 | + for (TableListReserve table in tableManagerModel.selectTablesOrReserve) { | ||
| 3488 | tables.add(Container( | 3379 | tables.add(Container( |
| 3489 | padding: EdgeInsets.symmetric( | 3380 | padding: EdgeInsets.symmetric( |
| 3490 | horizontal: ScreenUtil().setWidth(10), | 3381 | horizontal: ScreenUtil().setWidth(10), |
| @@ -3536,7 +3427,7 @@ class TableManagerPageState extends State<TableManagerPage> { | @@ -3536,7 +3427,7 @@ class TableManagerPageState extends State<TableManagerPage> { | ||
| 3536 | borderRadius: | 3427 | borderRadius: |
| 3537 | BorderRadius.circular(ScreenUtil().setWidth(10))), | 3428 | BorderRadius.circular(ScreenUtil().setWidth(10))), |
| 3538 | child: Text( | 3429 | child: Text( |
| 3539 | - '等${tableManagerModel.selectTables.length}个桌位', | 3430 | + '等${tableManagerModel.selectTablesOrReserve.length}个桌位', |
| 3540 | style: TextStyle( | 3431 | style: TextStyle( |
| 3541 | fontSize: ScreenUtil().setSp(26), | 3432 | fontSize: ScreenUtil().setSp(26), |
| 3542 | color: MyColours.color_199095, | 3433 | color: MyColours.color_199095, |
| @@ -3553,7 +3444,7 @@ class TableManagerPageState extends State<TableManagerPage> { | @@ -3553,7 +3444,7 @@ class TableManagerPageState extends State<TableManagerPage> { | ||
| 3553 | borderRadius: | 3444 | borderRadius: |
| 3554 | BorderRadius.circular(ScreenUtil().setWidth(10))), | 3445 | BorderRadius.circular(ScreenUtil().setWidth(10))), |
| 3555 | child: Text( | 3446 | child: Text( |
| 3556 | - tableManagerModel.selectTables[i].name, | 3447 | + tableManagerModel.selectTablesOrReserve[i].name, |
| 3557 | style: TextStyle( | 3448 | style: TextStyle( |
| 3558 | fontSize: ScreenUtil().setSp(36), | 3449 | fontSize: ScreenUtil().setSp(36), |
| 3559 | color: MyColours.color_ffffff, | 3450 | color: MyColours.color_ffffff, |
| @@ -3574,10 +3465,7 @@ class TableManagerPageState extends State<TableManagerPage> { | @@ -3574,10 +3465,7 @@ class TableManagerPageState extends State<TableManagerPage> { | ||
| 3574 | tableManagerModel.returnDayDateStr(tableManagerModel.dateTimeSelect); | 3465 | tableManagerModel.returnDayDateStr(tableManagerModel.dateTimeSelect); |
| 3575 | tableManagerModel.selectWeekAndLunarCalendar = tableManagerModel | 3466 | tableManagerModel.selectWeekAndLunarCalendar = tableManagerModel |
| 3576 | .returnWeekAndLunarCalendar(tableManagerModel.dateTimeSelect, context); | 3467 | .returnWeekAndLunarCalendar(tableManagerModel.dateTimeSelect, context); |
| 3577 | - bool success = await tableManagerModel.getReserveList(context, | ||
| 3578 | - needLoading: false, | ||
| 3579 | - showMsg: true, | ||
| 3580 | - showloading: true, | 3468 | + bool success = await tableManagerModel.getTableListOrReserve(context, |
| 3581 | selfDismiss: true); | 3469 | selfDismiss: true); |
| 3582 | 3470 | ||
| 3583 | Loading.hideLoading(context); | 3471 | Loading.hideLoading(context); |
| @@ -3636,10 +3524,7 @@ class TableManagerPageState extends State<TableManagerPage> { | @@ -3636,10 +3524,7 @@ class TableManagerPageState extends State<TableManagerPage> { | ||
| 3636 | if (day != null) { | 3524 | if (day != null) { |
| 3637 | tableManagerModel.createDateText1(context, day); | 3525 | tableManagerModel.createDateText1(context, day); |
| 3638 | bool success = await tableManagerModel | 3526 | bool success = await tableManagerModel |
| 3639 | - .getReserveList(context, | ||
| 3640 | - needLoading: false, | ||
| 3641 | - showMsg: true, | ||
| 3642 | - showloading: true, | 3527 | + .getTableListOrReserve(context, |
| 3643 | selfDismiss: true); | 3528 | selfDismiss: true); |
| 3644 | 3529 | ||
| 3645 | Loading.hideLoading(context); | 3530 | Loading.hideLoading(context); |
| @@ -3806,16 +3691,12 @@ class TableManagerPageState extends State<TableManagerPage> { | @@ -3806,16 +3691,12 @@ class TableManagerPageState extends State<TableManagerPage> { | ||
| 3806 | ), | 3691 | ), |
| 3807 | VEmptyView(10), | 3692 | VEmptyView(10), |
| 3808 | 3693 | ||
| 3809 | - model.pageState != PageState.Success | 3694 | + model.pageStateOrReserve != PageState.Success |
| 3810 | ? Expanded( | 3695 | ? Expanded( |
| 3811 | child: ExceptionPage( | 3696 | child: ExceptionPage( |
| 3812 | - pageState: model.pageState, | 3697 | + pageState: model.pageStateOrReserve, |
| 3813 | callback: () { | 3698 | callback: () { |
| 3814 | - if (tableManagerModel.tableOuterList.isEmpty) { | ||
| 3815 | - tableManagerModel.getTableList(context); | ||
| 3816 | - } else { | ||
| 3817 | - tableManagerModel.getReserveList(context); | ||
| 3818 | - } | 3699 | + tableManagerModel.getTableListOrReserve(context); |
| 3819 | }, | 3700 | }, |
| 3820 | emptyMsg: "暂时没有桌位哦", | 3701 | emptyMsg: "暂时没有桌位哦", |
| 3821 | emptyImg: "empty_search", | 3702 | emptyImg: "empty_search", |
| @@ -3835,167 +3716,38 @@ class TableManagerPageState extends State<TableManagerPage> { | @@ -3835,167 +3716,38 @@ class TableManagerPageState extends State<TableManagerPage> { | ||
| 3835 | HEmptyView(20), | 3716 | HEmptyView(20), |
| 3836 | Expanded( | 3717 | Expanded( |
| 3837 | child: ListView.builder( | 3718 | child: ListView.builder( |
| 3838 | - itemCount: tableManagerModel.areas.length == | ||
| 3839 | - 0 | ||
| 3840 | - ? 0 | ||
| 3841 | - : tableManagerModel.areas.length + 1, | 3719 | + itemCount: tableManagerModel |
| 3720 | + .tablesOrReserveDataShow.length, | ||
| 3842 | shrinkWrap: true, | 3721 | shrinkWrap: true, |
| 3843 | scrollDirection: Axis.horizontal, | 3722 | scrollDirection: Axis.horizontal, |
| 3844 | itemBuilder: | 3723 | itemBuilder: |
| 3845 | (BuildContext contxt, int index) { | 3724 | (BuildContext contxt, int index) { |
| 3846 | - // if (index == | ||
| 3847 | - // tableManagerModel.areas.length + | ||
| 3848 | - // 1 || | ||
| 3849 | - // tableManagerModel.areas.length == 0) { | ||
| 3850 | - // return InkWell( | ||
| 3851 | - // onTap: () async { | ||
| 3852 | - // //添加区域弹框 | ||
| 3853 | - // await DialogUtil | ||
| 3854 | - // .openCreateAreaDialog(context, | ||
| 3855 | - // onTap: (value) async { | ||
| 3856 | - // print(value); | ||
| 3857 | - // //添加区域 | ||
| 3858 | - // bool success = | ||
| 3859 | - // await tableManagerModel | ||
| 3860 | - // .addTableAreas( | ||
| 3861 | - // context, value); | ||
| 3862 | - // print(success); | ||
| 3863 | - // if (success) { | ||
| 3864 | - // Utils.showToast('添加成功!'); | ||
| 3865 | - // tableManagerModel.currentArea = | ||
| 3866 | - // value; | ||
| 3867 | - | ||
| 3868 | - // await tableManagerModel | ||
| 3869 | - // .refreshTable(context); | ||
| 3870 | - // // await tableManagerModel | ||
| 3871 | - // // .getTableList(context, | ||
| 3872 | - // // needLoading: false); | ||
| 3873 | - // // tableManagerModel.initData(); | ||
| 3874 | - | ||
| 3875 | - // // setState(() { | ||
| 3876 | - // // updateMenu(); | ||
| 3877 | - // // }); | ||
| 3878 | - // // _scrollToIndex(widget | ||
| 3879 | - // // .tableManagerModel | ||
| 3880 | - // // .areas | ||
| 3881 | - // // .length); | ||
| 3882 | - | ||
| 3883 | - // } | ||
| 3884 | - // }); | ||
| 3885 | - // }, | ||
| 3886 | - // child: Column( | ||
| 3887 | - // children: [ | ||
| 3888 | - // VEmptyView(20), | ||
| 3889 | - // DottedBorder( | ||
| 3890 | - // dashPattern: [5, 5, 5, 5], | ||
| 3891 | - // borderType: BorderType.RRect, | ||
| 3892 | - // // radius: Radius.circular( | ||
| 3893 | - // // ScreenUtil().setWidth(10)), | ||
| 3894 | - // // padding: EdgeInsets.all(ScreenUtil().setWidth(70)), | ||
| 3895 | - // color: MyColours.color_199095, | ||
| 3896 | - // strokeWidth: | ||
| 3897 | - // ScreenUtil().setWidth(2), | ||
| 3898 | - // child: ClipRRect( | ||
| 3899 | - // borderRadius: BorderRadius | ||
| 3900 | - // .all(Radius.circular( | ||
| 3901 | - // ScreenUtil() | ||
| 3902 | - // .setWidth(10))), | ||
| 3903 | - // child: Container( | ||
| 3904 | - // height: ScreenUtil() | ||
| 3905 | - // .setWidth(25 * 2), | ||
| 3906 | - // width: ScreenUtil() | ||
| 3907 | - // .setWidth(70 * 2), | ||
| 3908 | - // child: Column( | ||
| 3909 | - // mainAxisAlignment: | ||
| 3910 | - // MainAxisAlignment | ||
| 3911 | - // .center, | ||
| 3912 | - // children: [ | ||
| 3913 | - // Image.asset( | ||
| 3914 | - // Utils.getImgPath( | ||
| 3915 | - // 'add_area'), | ||
| 3916 | - // width: ScreenUtil() | ||
| 3917 | - // .setWidth(24)), | ||
| 3918 | - // ], | ||
| 3919 | - // ), | ||
| 3920 | - // ), | ||
| 3921 | - // ), | ||
| 3922 | - // ) | ||
| 3923 | - // ], | ||
| 3924 | - // ), | ||
| 3925 | - // ); | ||
| 3926 | - // } else { | ||
| 3927 | - if (index == 0) { | ||
| 3928 | - return InkWell( | ||
| 3929 | - onTap: () { | ||
| 3930 | - setState(() { | ||
| 3931 | - isSelected = true; | ||
| 3932 | - tableManagerModel.currentArea = | ||
| 3933 | - '全部'; | ||
| 3934 | - // tableManagerModel.tablesShow = | ||
| 3935 | - // tableManagerModel | ||
| 3936 | - // .tabl; | ||
| 3937 | - }); | ||
| 3938 | - }, | ||
| 3939 | - child: Container( | ||
| 3940 | - // width: ScreenUtil().setWidth(104 * 2), | ||
| 3941 | - height: ScreenUtil().setWidth(80), | ||
| 3942 | - margin: EdgeInsets.only( | ||
| 3943 | - right: ScreenUtil().setWidth(15), | ||
| 3944 | - top: ScreenUtil().setWidth(20), | ||
| 3945 | - ), | ||
| 3946 | - padding: EdgeInsets.symmetric( | ||
| 3947 | - horizontal: | ||
| 3948 | - ScreenUtil().setWidth(14), | ||
| 3949 | - vertical: | ||
| 3950 | - ScreenUtil().setWidth(10)), | ||
| 3951 | - alignment: Alignment.center, | ||
| 3952 | - decoration: BoxDecoration( | ||
| 3953 | - // borderRadius: BorderRadius.circular(ScreenUtil().setWidth(10)), | ||
| 3954 | - color: isSelected | ||
| 3955 | - ? MyColours.color_199095 | ||
| 3956 | - : MyColours.color_ffffff, | ||
| 3957 | - border: Border.all( | ||
| 3958 | - color: | ||
| 3959 | - MyColours.color_E0E0E0, | ||
| 3960 | - width: ScreenUtil() | ||
| 3961 | - .setWidth(2))), | ||
| 3962 | - child: Text( | ||
| 3963 | - '全部', | ||
| 3964 | - overflow: TextOverflow.ellipsis, | ||
| 3965 | - style: TextStyle( | ||
| 3966 | - color: isSelected | ||
| 3967 | - ? MyColours.color_ffffff | ||
| 3968 | - : MyColours.color_333333, | ||
| 3969 | - fontSize: | ||
| 3970 | - ScreenUtil().setSp(24), | ||
| 3971 | - decoration: | ||
| 3972 | - TextDecoration.none, | ||
| 3973 | - fontWeight: | ||
| 3974 | - FontWeight.normal), | ||
| 3975 | - ), | ||
| 3976 | - ), | ||
| 3977 | - ); | ||
| 3978 | - } else { | ||
| 3979 | - return AreaItemTable( | ||
| 3980 | - model.areas[index - 1], | ||
| 3981 | - tableManagerModel.currentArea, | ||
| 3982 | - (area) { | ||
| 3983 | - setState(() { | ||
| 3984 | - isSelected = false; | ||
| 3985 | - tableManagerModel.selectNumber = | ||
| 3986 | - index - 1; | ||
| 3987 | - tableManagerModel.currentArea = | ||
| 3988 | - tableManagerModel | ||
| 3989 | - .areas[index - 1].name; | ||
| 3990 | - // tableManagerModel.currentTables = | ||
| 3991 | - // tableManagerModel | ||
| 3992 | - // .areaTableMapShow[ | ||
| 3993 | - // tableManagerModel | ||
| 3994 | - // .currentArea]; | ||
| 3995 | - // _anmationMenu(); | ||
| 3996 | - }); | 3725 | + return AreaItemTableOrReserve( |
| 3726 | + tableManagerModel | ||
| 3727 | + .tablesOrReserveDataShow[index], | ||
| 3728 | + (area) { | ||
| 3729 | + tableManagerModel | ||
| 3730 | + .tablesOrReserveDataShow | ||
| 3731 | + .forEach((element) { | ||
| 3732 | + element.select = false; | ||
| 3997 | }); | 3733 | }); |
| 3998 | - } | 3734 | + setState(() { |
| 3735 | + // isSelected = false; | ||
| 3736 | + area.select = true; | ||
| 3737 | + tableManagerModel.selectNumber = | ||
| 3738 | + index; | ||
| 3739 | + // tableManagerModel.currentArea = | ||
| 3740 | + // tableManagerModel | ||
| 3741 | + // .areas[index - 1].name; | ||
| 3742 | + // tableManagerModel.currentTables = | ||
| 3743 | + // tableManagerModel | ||
| 3744 | + // .areaTableMapShow[ | ||
| 3745 | + // tableManagerModel | ||
| 3746 | + // .currentArea]; | ||
| 3747 | + // _anmationMenu(); | ||
| 3748 | + }); | ||
| 3749 | + }); | ||
| 3750 | + | ||
| 3999 | // } | 3751 | // } |
| 4000 | }, | 3752 | }, |
| 4001 | )), | 3753 | )), |
| @@ -4003,18 +3755,42 @@ class TableManagerPageState extends State<TableManagerPage> { | @@ -4003,18 +3755,42 @@ class TableManagerPageState extends State<TableManagerPage> { | ||
| 4003 | onTap: () { | 3755 | onTap: () { |
| 4004 | setState(() { | 3756 | setState(() { |
| 4005 | model.swichState = !model.swichState; | 3757 | model.swichState = !model.swichState; |
| 4006 | - if (model.swichState) { | ||
| 4007 | - model.areaTableMapShow = | ||
| 4008 | - tableManagerModel | ||
| 4009 | - .areaTableMapCanNote; | ||
| 4010 | - model.tablesShow = | ||
| 4011 | - tableManagerModel.tablesCanNote; | ||
| 4012 | - } else { | ||
| 4013 | - model.areaTableMapShow = | ||
| 4014 | - model.areaTableMap; | ||
| 4015 | - model.tablesShow = model.tablesAll; | ||
| 4016 | - } | ||
| 4017 | }); | 3758 | }); |
| 3759 | + if (model.swichState) { | ||
| 3760 | + //把没有预订和宴会的桌子筛选出来显示 | ||
| 3761 | + | ||
| 3762 | + model.tablesOrReserveData | ||
| 3763 | + .forEach((element) { | ||
| 3764 | + if (element.tableList != null && | ||
| 3765 | + element.tableList.length > 0) { | ||
| 3766 | + List<TableListReserve> tableList = | ||
| 3767 | + []; | ||
| 3768 | + element.tableList | ||
| 3769 | + .forEach((element1) { | ||
| 3770 | + if (element1.reserveList == | ||
| 3771 | + null && | ||
| 3772 | + element1.banquetList == | ||
| 3773 | + null) { | ||
| 3774 | + //空桌子 | ||
| 3775 | + tableList.add(element1); | ||
| 3776 | + } | ||
| 3777 | + }); | ||
| 3778 | + | ||
| 3779 | + model | ||
| 3780 | + .tablesOrReserveDataShow[model | ||
| 3781 | + .tablesOrReserveDataShow | ||
| 3782 | + .indexWhere((elementShow) => | ||
| 3783 | + elementShow.id == | ||
| 3784 | + element.id)] | ||
| 3785 | + .tableList = tableList; | ||
| 3786 | + } | ||
| 3787 | + }); | ||
| 3788 | + } else { | ||
| 3789 | + model.tablesOrReserveDataShow = | ||
| 3790 | + model.tablesOrReserveData.toList(); | ||
| 3791 | + } | ||
| 3792 | + | ||
| 3793 | + setState(() {}); | ||
| 4018 | }, | 3794 | }, |
| 4019 | child: Container( | 3795 | child: Container( |
| 4020 | margin: EdgeInsets.only( | 3796 | margin: EdgeInsets.only( |
| @@ -4069,7 +3845,7 @@ class TableManagerPageState extends State<TableManagerPage> { | @@ -4069,7 +3845,7 @@ class TableManagerPageState extends State<TableManagerPage> { | ||
| 4069 | ], | 3845 | ], |
| 4070 | ), | 3846 | ), |
| 4071 | ), | 3847 | ), |
| 4072 | - if (tableManagerModel.currentArea != null) | 3848 | + if (tableManagerModel.selectNumber != null) |
| 4073 | Expanded( | 3849 | Expanded( |
| 4074 | // flex: 2, | 3850 | // flex: 2, |
| 4075 | child: Container( | 3851 | child: Container( |
| @@ -4079,20 +3855,22 @@ class TableManagerPageState extends State<TableManagerPage> { | @@ -4079,20 +3855,22 @@ class TableManagerPageState extends State<TableManagerPage> { | ||
| 4079 | color: Color.fromRGBO(249, 249, 249, 1), | 3855 | color: Color.fromRGBO(249, 249, 249, 1), |
| 4080 | child: item( | 3856 | child: item( |
| 4081 | tableManagerModel.selectNumber))), | 3857 | tableManagerModel.selectNumber))), |
| 4082 | - tableManagerModel.selectTables.length > 0 | ||
| 4083 | - ? wechatNotification | ||
| 4084 | - ? _selectTableWidgetWechat() | ||
| 4085 | - : Expanded( | ||
| 4086 | - flex: 5, child: _selectTableWidgetSms()) | 3858 | + tableManagerModel.selectTablesOrReserve.length > 0 |
| 3859 | + ? | ||
| 3860 | + // wechatNotification | ||
| 3861 | + // ? | ||
| 3862 | + _selectTableWidgetWechat() | ||
| 3863 | + // : Expanded( | ||
| 3864 | + // flex: 5, child: _selectTableWidgetSms()) | ||
| 4087 | : SizedBox() | 3865 | : SizedBox() |
| 4088 | ])) | 3866 | ])) |
| 4089 | // return CCMenuPage.builder( | 3867 | // return CCMenuPage.builder( |
| 4090 | // tableManagerModel: tableManagerModel, | 3868 | // tableManagerModel: tableManagerModel, |
| 4091 | - // itemCount: tableManagerModel.areas.length, | 3869 | + // itemCount: tableManagerModel.tablesOrReserveDataShow.length, |
| 4092 | // onTap: (index) async {}, | 3870 | // onTap: (index) async {}, |
| 4093 | // tabBuilder: (BuildContext context, int index) { | 3871 | // tabBuilder: (BuildContext context, int index) { |
| 4094 | - // if (index == tableManagerModel.areas.length || | ||
| 4095 | - // tableManagerModel.areas.length == 0) { | 3872 | + // if (index == tableManagerModel.tablesOrReserveDataShow.length || |
| 3873 | + // tableManagerModel.tablesOrReserveDataShow.length == 0) { | ||
| 4096 | // return Column( | 3874 | // return Column( |
| 4097 | // children: [ | 3875 | // children: [ |
| 4098 | // VEmptyView(20), | 3876 | // VEmptyView(20), |
| @@ -399,7 +399,7 @@ class FeastModel extends ChangeNotifier { | @@ -399,7 +399,7 @@ class FeastModel extends ChangeNotifier { | ||
| 399 | data: params, showLoading: isShowLoading) | 399 | data: params, showLoading: isShowLoading) |
| 400 | .catchError((error) { | 400 | .catchError((error) { |
| 401 | print(error.toString()); | 401 | print(error.toString()); |
| 402 | - if (error is MyError) {} | 402 | + if (error is MyError) |
| 403 | return false; | 403 | return false; |
| 404 | }); | 404 | }); |
| 405 | if (baseResp.code == Constant.status_success) { | 405 | if (baseResp.code == Constant.status_success) { |
| @@ -30,14 +30,14 @@ class StoreBaseIndoProvider with ChangeNotifier { | @@ -30,14 +30,14 @@ class StoreBaseIndoProvider with ChangeNotifier { | ||
| 30 | String _dataKey = "data"; | 30 | String _dataKey = "data"; |
| 31 | 31 | ||
| 32 | ///根据商家ID获取商家信息 | 32 | ///根据商家ID获取商家信息 |
| 33 | - Future<GetSellerInfoSunModel> getSellerById(BuildContext context) async { | 33 | + Future<GetSellerInfoSunModel> getSellerById(BuildContext context,{bool showLoading = true}) async { |
| 34 | Map<String, String> params = { | 34 | Map<String, String> params = { |
| 35 | "sellerid": Provider.of<UserModel>(context, listen: false).user.sellerid, | 35 | "sellerid": Provider.of<UserModel>(context, listen: false).user.sellerid, |
| 36 | }; | 36 | }; |
| 37 | BaseResp<Map<String, dynamic>> baseResp = await DioUtil() | 37 | BaseResp<Map<String, dynamic>> baseResp = await DioUtil() |
| 38 | .request<Map<String, dynamic>>( | 38 | .request<Map<String, dynamic>>( |
| 39 | context, Method.post, HttpUrl.get_seller_info, | 39 | context, Method.post, HttpUrl.get_seller_info, |
| 40 | - data: params) | 40 | + data: params,showLoading:showLoading ) |
| 41 | .catchError((error) { | 41 | .catchError((error) { |
| 42 | print(error.toString()); | 42 | print(error.toString()); |
| 43 | }); | 43 | }); |
| @@ -27,6 +27,7 @@ import 'package:one_key/utils/utils.dart'; | @@ -27,6 +27,7 @@ import 'package:one_key/utils/utils.dart'; | ||
| 27 | import 'package:provider/provider.dart'; | 27 | import 'package:provider/provider.dart'; |
| 28 | 28 | ||
| 29 | import '../models/get_board_model.dart'; | 29 | import '../models/get_board_model.dart'; |
| 30 | +import '../models/table_or_reserve_model.dart'; | ||
| 30 | import '../models/user.dart'; | 31 | import '../models/user.dart'; |
| 31 | import '../widgets/loading.dart'; | 32 | import '../widgets/loading.dart'; |
| 32 | import 'notebook_model.dart'; | 33 | import 'notebook_model.dart'; |
| @@ -70,24 +71,138 @@ class TableManagerModel with ChangeNotifier { | @@ -70,24 +71,138 @@ class TableManagerModel with ChangeNotifier { | ||
| 70 | String doltStr = ''; | 71 | String doltStr = ''; |
| 71 | DateTime dateTimeSelect; | 72 | DateTime dateTimeSelect; |
| 72 | int selectNumber; | 73 | int selectNumber; |
| 74 | + | ||
| 73 | List dailyList = []; // 早市对应半点钟,午市对应半点钟、晚市对应半点钟 | 75 | List dailyList = []; // 早市对应半点钟,午市对应半点钟、晚市对应半点钟 |
| 74 | List<FeastBoardModel> banquetByDateData = []; //宴会看板数据/宴会预订的数据 | 76 | List<FeastBoardModel> banquetByDateData = []; //宴会看板数据/宴会预订的数据 |
| 75 | List<Notebook> noteBooks; | 77 | List<Notebook> noteBooks; |
| 76 | PageState pageState; | 78 | PageState pageState; |
| 79 | + | ||
| 80 | + PageState pageStateOrReserve; | ||
| 77 | bool showLoading = false; | 81 | bool showLoading = false; |
| 82 | + List<TableListReseveSunModel> tablesOrReserveData = []; //桌位页面数据接口重组 | ||
| 83 | + | ||
| 84 | + List<TableListReseveSunModel> tablesOrReserveDataShow = []; //桌位页面数据接口重组 | ||
| 85 | + | ||
| 86 | + List<TableListReserve> selectTablesOrReserve = []; //选择的桌位 | ||
| 78 | 87 | ||
| 79 | TableManagerModel() { | 88 | TableManagerModel() { |
| 80 | print('fdsfs'); | 89 | print('fdsfs'); |
| 81 | - String tableSp = App.sp.getString('table_list'); | 90 | + String tableSp = App.sp.getString('table_list_or_reserve'); |
| 82 | 91 | ||
| 83 | if (tableSp == null) { | 92 | if (tableSp == null) { |
| 84 | - pageState = PageState.Loading; | 93 | + pageStateOrReserve = PageState.Loading; |
| 85 | } else { | 94 | } else { |
| 86 | - tableOuterList = getSpTableList(); | ||
| 87 | - tablesAll = getSpTableAll(); | ||
| 88 | - pageState = PageState.Success; | ||
| 89 | - initData(needKeep: false); | 95 | + getSpTableListOr(); |
| 96 | + | ||
| 97 | + // initData(needKeep: false); | ||
| 98 | + } | ||
| 99 | + } | ||
| 100 | + | ||
| 101 | + List<TableListReseveSunModel> getSpTableListOr() { | ||
| 102 | + String tableList = App.sp.getString('table_list_or_reserve'); | ||
| 103 | + if (tableList == null) { | ||
| 104 | + return []; | ||
| 105 | + } | ||
| 106 | + | ||
| 107 | + List<TableListReseveSunModel> temp = []; | ||
| 108 | + List<TableListReseveSunModel> tempShow = []; | ||
| 109 | + List list = json.decode(tableList); | ||
| 110 | + if (list.length > 0) { | ||
| 111 | + list.forEach((element) { | ||
| 112 | + temp.add(TableListReseveSunModel.fromJson2(element)); | ||
| 113 | + print(temp); | ||
| 114 | + tempShow.add(TableListReseveSunModel.fromJson2(element)); | ||
| 115 | + }); | ||
| 116 | + } | ||
| 117 | + selectNumber = 0; | ||
| 118 | + tablesOrReserveData = temp; | ||
| 119 | + tablesOrReserveDataShow = tempShow; | ||
| 120 | + pageStateOrReserve = PageState.Success; | ||
| 121 | + } | ||
| 122 | + | ||
| 123 | + Future<String> getUserAccountTypeById(BuildContext context, | ||
| 124 | + {showLoading = false, bool selfDismiss = false}) async { | ||
| 125 | + Map<String, String> params = { | ||
| 126 | + 'uid': Provider.of<UserModel>(context, listen: false).user.openid, | ||
| 127 | + }; | ||
| 128 | + BaseResp<dynamic> baseResp = await DioUtil() | ||
| 129 | + .request<dynamic>( | ||
| 130 | + context, Method.get, HttpUrl.get_user_account_type_by_id, | ||
| 131 | + data: params, showLoading: showLoading, selfDismiss: selfDismiss) | ||
| 132 | + .catchError((error) { | ||
| 133 | + print(error.toString()); | ||
| 134 | + if (error is MyError) {} | ||
| 135 | + }); | ||
| 136 | + String accountType = '1'; | ||
| 137 | + if (baseResp == null) return accountType; | ||
| 138 | + if (baseResp.code == Constant.status_success) { | ||
| 139 | + if (baseResp.data is Map) { | ||
| 140 | + accountType = baseResp.data['account_type'] ?? '1'; | ||
| 141 | + } | ||
| 142 | + } else { | ||
| 143 | + Utils.showToast(baseResp.msg ?? ""); | ||
| 90 | } | 144 | } |
| 145 | + return accountType; | ||
| 146 | + } | ||
| 147 | + | ||
| 148 | + // 获取商家桌位列表及对应预订数据 | ||
| 149 | + | ||
| 150 | + Future<bool> getTableListOrReserve(BuildContext context, | ||
| 151 | + {showLoading = false, bool selfDismiss = false}) async { | ||
| 152 | + Map<String, String> params = { | ||
| 153 | + 'sid': Provider.of<UserModel>(context, listen: false).user.sellerid, | ||
| 154 | + 'x': '1', | ||
| 155 | + 'y': '200', | ||
| 156 | + "rdate": _getRdate(), | ||
| 157 | + "ddate_solt": currTimeIndex.toString(), | ||
| 158 | + "keywords": "", | ||
| 159 | + "sort": "1" | ||
| 160 | + }; | ||
| 161 | + BaseResp<dynamic> baseResp = await DioUtil() | ||
| 162 | + .request<dynamic>( | ||
| 163 | + context, Method.get, HttpUrl.get_table_list_or_reserve, | ||
| 164 | + data: params, showLoading: showLoading, selfDismiss: selfDismiss) | ||
| 165 | + .catchError((error) { | ||
| 166 | + print(error.toString()); | ||
| 167 | + if (error is MyError) {} | ||
| 168 | + pageStateOrReserve = PageState.ConnectivityError; | ||
| 169 | + notifyListeners(); | ||
| 170 | + }); | ||
| 171 | + if (baseResp == null) return false; | ||
| 172 | + if (baseResp.code == Constant.status_success) { | ||
| 173 | + tablesOrReserveData = | ||
| 174 | + TableListReseveModel.fromJson(baseResp.responseData).data; | ||
| 175 | + tablesOrReserveDataShow = | ||
| 176 | + TableListReseveModel.fromJson(baseResp.responseData).data; | ||
| 177 | + if (tablesOrReserveData.length == 0) { | ||
| 178 | + pageStateOrReserve = PageState.Empty; | ||
| 179 | + } else { | ||
| 180 | + List<TableListReserve> tableListOrReserveDataAll = []; //桌位页面数据接口重组 --全部 | ||
| 181 | + | ||
| 182 | + tablesOrReserveData.forEach((element) { | ||
| 183 | + tableListOrReserveDataAll.addAll(element.tableList); | ||
| 184 | + }); | ||
| 185 | + | ||
| 186 | + TableListReseveSunModel data0 = TableListReseveSunModel(); | ||
| 187 | + | ||
| 188 | + data0.name = '全部'; | ||
| 189 | + data0.select = true; | ||
| 190 | + data0.tableList = tableListOrReserveDataAll; | ||
| 191 | + tablesOrReserveData.insert(0, data0); | ||
| 192 | + | ||
| 193 | + tablesOrReserveDataShow.insert(0, data0); | ||
| 194 | + selectNumber = 0; | ||
| 195 | + | ||
| 196 | + App.sp.setString( | ||
| 197 | + 'table_list_or_reserve', json.encode(tablesOrReserveDataShow)); | ||
| 198 | + | ||
| 199 | + pageStateOrReserve = PageState.Success; | ||
| 200 | + } | ||
| 201 | + } else { | ||
| 202 | + pageStateOrReserve = PageState.ConnectivityError; | ||
| 203 | + Utils.showToast(baseResp.msg ?? ""); | ||
| 204 | + } | ||
| 205 | + notifyListeners(); | ||
| 91 | } | 206 | } |
| 92 | 207 | ||
| 93 | List<TableOuter> getSpTableList() { | 208 | List<TableOuter> getSpTableList() { |
| @@ -168,6 +283,122 @@ class TableManagerModel with ChangeNotifier { | @@ -168,6 +283,122 @@ class TableManagerModel with ChangeNotifier { | ||
| 168 | } | 283 | } |
| 169 | 284 | ||
| 170 | //初始化时间 | 285 | //初始化时间 |
| 286 | + initTimeTable(BuildContext context) async { | ||
| 287 | + UserModel userModel = Provider.of<UserModel>(context, listen: false); | ||
| 288 | + dateTime = DateTime.now(); | ||
| 289 | + dateText = returnDate(dateTime); | ||
| 290 | + dateTimeSelect = dateTime; | ||
| 291 | + // morning = '07:00-10:00'; | ||
| 292 | + // noon = '11:00-14:30'; | ||
| 293 | + // night = '16:00-21:00'; | ||
| 294 | + morning = | ||
| 295 | + userModel.user.morning.isEmpty ? "00:00-00:00" : userModel.user.morning; | ||
| 296 | + noon = userModel.user.noon.isEmpty ? "00:00-00:00" : userModel.user.noon; | ||
| 297 | + night = userModel.user.night.isEmpty ? "00:00-00:00" : userModel.user.night; | ||
| 298 | + userModel.user.morning.isEmpty | ||
| 299 | + ? dailyMap.putIfAbsent("morning", () => "") | ||
| 300 | + : dailyMap.putIfAbsent("morning", () => _getHourAndMinute(morning, 1)); | ||
| 301 | + userModel.user.noon.isEmpty | ||
| 302 | + ? dailyMap.putIfAbsent("noon", () => "") | ||
| 303 | + : dailyMap.putIfAbsent("noon", () => _getHourAndMinute(noon, 2)); | ||
| 304 | + userModel.user.night.isEmpty | ||
| 305 | + ? dailyMap.putIfAbsent("night", () => "") | ||
| 306 | + : dailyMap.putIfAbsent("night", () => _getHourAndMinute(night, 3)); | ||
| 307 | + if (dateTime.isBefore(DateTime.parse(dateTime.year.toString() + | ||
| 308 | + "-" + | ||
| 309 | + Utils.addZeroNumber(dateTime.month) + | ||
| 310 | + "-" + | ||
| 311 | + Utils.addZeroNumber(dateTime.day) + | ||
| 312 | + " " + | ||
| 313 | + morning.split("-")[1] + | ||
| 314 | + ":00"))) { | ||
| 315 | + //未过早市 | ||
| 316 | + currTimeIndex = 1; | ||
| 317 | + } else if (dateTime.isAfter(DateTime.parse(dateTime.year.toString() + | ||
| 318 | + "-" + | ||
| 319 | + Utils.addZeroNumber(dateTime.month) + | ||
| 320 | + "-" + | ||
| 321 | + Utils.addZeroNumber(dateTime.day) + | ||
| 322 | + " " + | ||
| 323 | + morning.split("-")[1] + | ||
| 324 | + ":00")) && | ||
| 325 | + dateTime.isBefore(DateTime.parse(dateTime.year.toString() + | ||
| 326 | + "-" + | ||
| 327 | + Utils.addZeroNumber(dateTime.month) + | ||
| 328 | + "-" + | ||
| 329 | + Utils.addZeroNumber(dateTime.day) + | ||
| 330 | + " " + | ||
| 331 | + noon.split("-")[1] + | ||
| 332 | + ":00"))) { | ||
| 333 | + //过了早市,未过午市 | ||
| 334 | + currTimeIndex = 2; | ||
| 335 | + } else if (dateTime.isAfter(DateTime.parse(dateTime.year.toString() + | ||
| 336 | + "-" + | ||
| 337 | + Utils.addZeroNumber(dateTime.month) + | ||
| 338 | + "-" + | ||
| 339 | + Utils.addZeroNumber(dateTime.day) + | ||
| 340 | + " " + | ||
| 341 | + noon.split("-")[1] + | ||
| 342 | + ":00")) && | ||
| 343 | + dateTime.isBefore(DateTime.parse(dateTime.year.toString() + | ||
| 344 | + "-" + | ||
| 345 | + Utils.addZeroNumber(dateTime.month) + | ||
| 346 | + "-" + | ||
| 347 | + Utils.addZeroNumber(dateTime.day) + | ||
| 348 | + " " + | ||
| 349 | + night.split("-")[1] + | ||
| 350 | + ":00"))) { | ||
| 351 | + //过了午市,未过晚市 | ||
| 352 | + currTimeIndex = 3; | ||
| 353 | + } else { | ||
| 354 | + //过了晚市 | ||
| 355 | + currTimeIndex = 3; | ||
| 356 | + } | ||
| 357 | + | ||
| 358 | + selectDateStr = returnDayDateStr(dateTime); | ||
| 359 | + selectWeekAndLunarCalendar = returnWeekAndLunarCalendar(dateTime, context); | ||
| 360 | + | ||
| 361 | + getTableListOrReserve(context); | ||
| 362 | + userModel.user.morning.isEmpty | ||
| 363 | + ? dailyMap.putIfAbsent("morning", () => "") | ||
| 364 | + : dailyMap.putIfAbsent("morning", () => _getHourAndMinute(morning, 1)); | ||
| 365 | + userModel.user.noon.isEmpty | ||
| 366 | + ? dailyMap.putIfAbsent("noon", () => "") | ||
| 367 | + : dailyMap.putIfAbsent("noon", () => _getHourAndMinute(noon, 2)); | ||
| 368 | + userModel.user.night.isEmpty | ||
| 369 | + ? dailyMap.putIfAbsent("night", () => "") | ||
| 370 | + : dailyMap.putIfAbsent("night", () => _getHourAndMinute(night, 3)); | ||
| 371 | + | ||
| 372 | + // List temp = []; | ||
| 373 | + // String tableSp = App.sp.getString('table_list'); | ||
| 374 | + // if (tableSp == null) { | ||
| 375 | + // temp = await getTableList(context); | ||
| 376 | + // } else { | ||
| 377 | + // // List list = json.decode(tableSp); | ||
| 378 | + // // list.forEach((element) { | ||
| 379 | + // // temp.add(TableOuter.fromJson2(element)); | ||
| 380 | + // // }); | ||
| 381 | + // temp = getSpTableList(); | ||
| 382 | + // } | ||
| 383 | + | ||
| 384 | + // if (temp.length > 0) { | ||
| 385 | + // await getReserveList(context, selfDismiss: true); | ||
| 386 | + // // await getReserveList(context, | ||
| 387 | + // // needLoading: false, | ||
| 388 | + // // showMsg: true, | ||
| 389 | + // // showloading: true, | ||
| 390 | + // // selfDismiss: true); | ||
| 391 | + // if (showLoading) { | ||
| 392 | + // Loading.hideLoading(context); | ||
| 393 | + // } | ||
| 394 | + // } else { | ||
| 395 | + // // pageState = PageState.Empty; | ||
| 396 | + // pageState = PageState.Success; | ||
| 397 | + // notifyListeners(); | ||
| 398 | + // } | ||
| 399 | + } | ||
| 400 | + | ||
| 401 | + //初始化时间 | ||
| 171 | initTime(BuildContext context) async { | 402 | initTime(BuildContext context) async { |
| 172 | UserModel userModel = Provider.of<UserModel>(context, listen: false); | 403 | UserModel userModel = Provider.of<UserModel>(context, listen: false); |
| 173 | dateTime = DateTime.now(); | 404 | dateTime = DateTime.now(); |
| @@ -416,6 +647,187 @@ class TableManagerModel with ChangeNotifier { | @@ -416,6 +647,187 @@ class TableManagerModel with ChangeNotifier { | ||
| 416 | } | 647 | } |
| 417 | 648 | ||
| 418 | ///录入更改内部预订 | 649 | ///录入更改内部预订 |
| 650 | + Future<SunReserveInfoModel> setReserveInfoOrReseve( | ||
| 651 | + BuildContext context, CustomCallBack callback, | ||
| 652 | + {needKeep = false, | ||
| 653 | + Guest guest, | ||
| 654 | + String pnum, | ||
| 655 | + String tempTime, | ||
| 656 | + String cusdem, | ||
| 657 | + String reserveType = '普通用餐'}) async { | ||
| 658 | + if (selectTablesOrReserve.length == 0) { | ||
| 659 | + Utils.showToast('请选择桌位'); | ||
| 660 | + return null; | ||
| 661 | + } | ||
| 662 | + if (guest != null && guest.phone != null) { | ||
| 663 | + //判断是否可以输入自己的手机号 | ||
| 664 | + CustomerProvider customerProvider = | ||
| 665 | + Provider.of<CustomerProvider>(context, listen: false); | ||
| 666 | + await customerProvider.getSellerGuest(context); | ||
| 667 | + if (customerProvider.isselfphone) { | ||
| 668 | + //录入客户电话时不能用自己手机号(管店) | ||
| 669 | + | ||
| 670 | + User user = Provider.of<UserModel>(context, listen: false).user; | ||
| 671 | + if (user.userphone == guest.phone || | ||
| 672 | + user.userphoneMyPage == guest.phone) { | ||
| 673 | + Utils.showToast('录入客户电话时不能用自己手机号!'); | ||
| 674 | + callback(false); | ||
| 675 | + return null; | ||
| 676 | + } | ||
| 677 | + } | ||
| 678 | + } | ||
| 679 | + | ||
| 680 | + bool sucess = await getReserveList(context, | ||
| 681 | + showMsg: true, | ||
| 682 | + needLoading: false, | ||
| 683 | + needKeep: true, | ||
| 684 | + showloading: true, | ||
| 685 | + needOrReseve: true); | ||
| 686 | + if (sucess) { | ||
| 687 | + callback(true); | ||
| 688 | + } else { | ||
| 689 | + //提示过了,不需要提示 | ||
| 690 | + callback(false); | ||
| 691 | + } | ||
| 692 | + | ||
| 693 | + if (sucess) { | ||
| 694 | + UserModel userModel = Provider.of<UserModel>(context, listen: false); | ||
| 695 | + // | ||
| 696 | + if (tempTime == null) { | ||
| 697 | + // if (currTimeIndex == 1) { | ||
| 698 | + // tempTime = '08:00'; | ||
| 699 | + // } else if (currTimeIndex == 2) { | ||
| 700 | + // tempTime = '12:00'; | ||
| 701 | + // } else if (currTimeIndex == 3) { | ||
| 702 | + // tempTime = '18:00'; | ||
| 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 | + String tableSelectInfo = ''; | ||
| 733 | + for (TableListReserve item in selectTablesOrReserve) { | ||
| 734 | + // if (item.selected) { | ||
| 735 | + tableSelectInfo += ',${item.id}'; | ||
| 736 | + // } | ||
| 737 | + } | ||
| 738 | + print(tableSelectInfo); | ||
| 739 | + if (tableSelectInfo.startsWith(',')) { | ||
| 740 | + tableSelectInfo = tableSelectInfo.substring(1); | ||
| 741 | + } | ||
| 742 | + print(tableSelectInfo); | ||
| 743 | + String rdate = ''; | ||
| 744 | + | ||
| 745 | + String keys = ''; | ||
| 746 | + | ||
| 747 | + if (currTimeIndex == 1) { | ||
| 748 | + //早市 | ||
| 749 | + keys = 'morning'; | ||
| 750 | + } else if (currTimeIndex == 2) { | ||
| 751 | + //午市 | ||
| 752 | + keys = 'noon'; | ||
| 753 | + } else if (currTimeIndex == 3) { | ||
| 754 | + //晚市 | ||
| 755 | + keys = 'night'; | ||
| 756 | + } | ||
| 757 | + | ||
| 758 | + if (keys != '') { | ||
| 759 | + List temp = dailyMap[keys]; | ||
| 760 | + String timeStrStart = ymd + ' ' + temp.first + ':00'; | ||
| 761 | + String timeStrEnd = ymd + ' ' + temp.last + ':00'; | ||
| 762 | + int startM = DateUtil.getDateMsByTimeStr(timeStrStart); | ||
| 763 | + int endM = DateUtil.getDateMsByTimeStr(timeStrEnd); | ||
| 764 | + String start = '${startM}'.substring(0, 10); | ||
| 765 | + String end = '${endM}'.substring(0, 10); | ||
| 766 | + rdate = start + '-' + end; | ||
| 767 | + } | ||
| 768 | + | ||
| 769 | + Map<String, String> params = { | ||
| 770 | + "sid": userModel.user.sellerid, //商家ID | ||
| 771 | + "tid": tableSelectInfo, //桌子ID: 格式 2,3,4 | ||
| 772 | + 'note_name': userModel.user.account, | ||
| 773 | + 'type': "0", //内部预订 | ||
| 774 | + "rdate": rdate, //预定用餐时间范围:时间戳 开始时间戳(time)-结束时间戳(time) | ||
| 775 | + "ddate": '${ddate}'.substring(0, 10), //到店时间 | ||
| 776 | + // 'is_set_ddate': '1', | ||
| 777 | + "channel": '5', | ||
| 778 | + "uid": userModel.user.openid, | ||
| 779 | + // 'sex': '', | ||
| 780 | + // 'phone': '', | ||
| 781 | + // "cusdem": '' | ||
| 782 | + }; | ||
| 783 | + if (pnum != null && pnum != '') { | ||
| 784 | + params["actual_pum"] = pnum; //预定用餐人数 | ||
| 785 | + // params["pnum"] = pnum; //预定用餐人数 | ||
| 786 | + } | ||
| 787 | + if (cusdem != null) { | ||
| 788 | + params['cusdem'] = cusdem; | ||
| 789 | + } | ||
| 790 | + if (guest != null) { | ||
| 791 | + if (guest.rnameStr != '') { | ||
| 792 | + params['rname'] = guest.rnameStr; | ||
| 793 | + } | ||
| 794 | + if (guest.sex != '0' && guest.sex != null) { | ||
| 795 | + params['sex'] = guest.sex; | ||
| 796 | + } | ||
| 797 | + if (guest.phone != null) { | ||
| 798 | + params['phone'] = guest.phone; | ||
| 799 | + } | ||
| 800 | + } | ||
| 801 | + | ||
| 802 | + params['reserve_type'] = reserveType; | ||
| 803 | + | ||
| 804 | + print(params); | ||
| 805 | + BaseResp<Map<String, dynamic>> baseResp = await DioUtil() | ||
| 806 | + .request<Map<String, dynamic>>( | ||
| 807 | + context, Method.get, HttpUrl.set_reserve_info, | ||
| 808 | + data: params) | ||
| 809 | + .catchError((error) { | ||
| 810 | + print(error.toString()); | ||
| 811 | + }); | ||
| 812 | + SunReserveInfoModel itemModel; | ||
| 813 | + if (baseResp == null) return itemModel; | ||
| 814 | + if (baseResp.code == Constant.status_success) { | ||
| 815 | + if (int.parse(baseResp.status) != Constant.status_success) { | ||
| 816 | + Utils.showToast(baseResp.msg ?? ""); | ||
| 817 | + return itemModel; | ||
| 818 | + } | ||
| 819 | + if (baseResp.responseData['data'] != null && | ||
| 820 | + baseResp.responseData['data']['row'] != null) { | ||
| 821 | + itemModel = ReserveInfoModel.fromJson(baseResp.responseData).data; | ||
| 822 | + } else { | ||
| 823 | + Utils.showToast("录入预订订单失败,请重试!"); | ||
| 824 | + } | ||
| 825 | + return itemModel; | ||
| 826 | + } | ||
| 827 | + } | ||
| 828 | + } | ||
| 829 | + | ||
| 830 | + ///录入更改内部预订 | ||
| 419 | Future<SunReserveInfoModel> setReserveInfo( | 831 | Future<SunReserveInfoModel> setReserveInfo( |
| 420 | BuildContext context, CustomCallBack callback, | 832 | BuildContext context, CustomCallBack callback, |
| 421 | {needKeep = false, | 833 | {needKeep = false, |
| @@ -810,7 +1222,8 @@ class TableManagerModel with ChangeNotifier { | @@ -810,7 +1222,8 @@ class TableManagerModel with ChangeNotifier { | ||
| 810 | 1222 | ||
| 811 | //获取已预订列表 | 1223 | //获取已预订列表 |
| 812 | getReserveList(BuildContext context, | 1224 | getReserveList(BuildContext context, |
| 813 | - {bool needLoading = true, | 1225 | + {bool needOrReseve = false, |
| 1226 | + bool needLoading = true, | ||
| 814 | bool needKeep = false, | 1227 | bool needKeep = false, |
| 815 | bool showMsg = false, | 1228 | bool showMsg = false, |
| 816 | bool showloading = false, | 1229 | bool showloading = false, |
| @@ -986,14 +1399,14 @@ class TableManagerModel with ChangeNotifier { | @@ -986,14 +1399,14 @@ class TableManagerModel with ChangeNotifier { | ||
| 986 | selectTables = tempSelectTables; | 1399 | selectTables = tempSelectTables; |
| 987 | Utils.showToast('${msg}已被预订,请选择其他桌位!'); | 1400 | Utils.showToast('${msg}已被预订,请选择其他桌位!'); |
| 988 | print(tableMap); | 1401 | print(tableMap); |
| 989 | - initData(needKeep: needKeep); | 1402 | + initData(needKeep: needKeep, needOrReseve: needOrReseve); |
| 990 | 1403 | ||
| 991 | // notifyListeners(); | 1404 | // notifyListeners(); |
| 992 | return false; | 1405 | return false; |
| 993 | } | 1406 | } |
| 994 | 1407 | ||
| 995 | print(tableMap); | 1408 | print(tableMap); |
| 996 | - initData(needKeep: needKeep); | 1409 | + initData(needKeep: needKeep, needOrReseve: needOrReseve); |
| 997 | 1410 | ||
| 998 | return true; | 1411 | return true; |
| 999 | } | 1412 | } |
| @@ -1100,7 +1513,7 @@ class TableManagerModel with ChangeNotifier { | @@ -1100,7 +1513,7 @@ class TableManagerModel with ChangeNotifier { | ||
| 1100 | } | 1513 | } |
| 1101 | 1514 | ||
| 1102 | //初始桌位数据 | 1515 | //初始桌位数据 |
| 1103 | - initData({bool needKeep = false}) { | 1516 | + initData({bool needKeep = false, bool needOrReseve = false}) { |
| 1104 | areas.clear(); | 1517 | areas.clear(); |
| 1105 | areaTableMap.clear(); | 1518 | areaTableMap.clear(); |
| 1106 | List<t.Table> tempTableAll = []; | 1519 | List<t.Table> tempTableAll = []; |
| @@ -1195,13 +1608,17 @@ class TableManagerModel with ChangeNotifier { | @@ -1195,13 +1608,17 @@ class TableManagerModel with ChangeNotifier { | ||
| 1195 | if (currentArea != null && currentArea != '') { | 1608 | if (currentArea != null && currentArea != '') { |
| 1196 | // tablesShow = areaTableMapShow[currentArea]; | 1609 | // tablesShow = areaTableMapShow[currentArea]; |
| 1197 | List keys = areaTableMapShow.keys.toList(); | 1610 | List keys = areaTableMapShow.keys.toList(); |
| 1198 | - selectNumber = keys.indexOf(currentArea); | 1611 | + if (!needOrReseve) { |
| 1612 | + selectNumber = keys.indexOf(currentArea); | ||
| 1613 | + } | ||
| 1199 | } | 1614 | } |
| 1200 | } | 1615 | } |
| 1201 | } else { | 1616 | } else { |
| 1202 | if (currentArea != null && currentArea != '') { | 1617 | if (currentArea != null && currentArea != '') { |
| 1203 | tablesShow = areaTableMapShow[currentArea]; | 1618 | tablesShow = areaTableMapShow[currentArea]; |
| 1204 | - selectNumber = areaTableMapShow.length; | 1619 | + if (!needOrReseve) { |
| 1620 | + selectNumber = areaTableMapShow.length; | ||
| 1621 | + } | ||
| 1205 | } | 1622 | } |
| 1206 | // pageState = PageState.Empty; | 1623 | // pageState = PageState.Empty; |
| 1207 | pageState = PageState.Success; | 1624 | pageState = PageState.Success; |
| @@ -386,6 +386,10 @@ class UserModel with ChangeNotifier { | @@ -386,6 +386,10 @@ class UserModel with ChangeNotifier { | ||
| 386 | //退出清空桌位数据 | 386 | //退出清空桌位数据 |
| 387 | App.sp.remove('table_list'); | 387 | App.sp.remove('table_list'); |
| 388 | } | 388 | } |
| 389 | + if (App.sp.containsKey('table_list_or_reserve')) { | ||
| 390 | + //退出清空桌位数据 | ||
| 391 | + App.sp.remove('table_list_or_reserve'); | ||
| 392 | + } | ||
| 389 | if (App.sp.containsKey('specid')) { | 393 | if (App.sp.containsKey('specid')) { |
| 390 | //退出清空销售计价 | 394 | //退出清空销售计价 |
| 391 | App.sp.remove('specid'); | 395 | App.sp.remove('specid'); |
-
Please register or login to post a comment