navigator_util.dart
20.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
import 'package:fluro/fluro.dart';
import 'package:flutter/material.dart';
import 'package:one_key/models/cookbook_model.dart';
import 'package:one_key/models/coupon_model.dart';
import 'package:one_key/models/integral_model.dart';
import 'package:one_key/models/notebook.dart';
import 'package:one_key/models/notebook_detail.dart';
import 'package:one_key/models/personnel_manage_model.dart';
import 'package:one_key/models/sms_info.dart';
import 'package:one_key/models/statics_model.dart';
import 'package:one_key/models/table_list.dart';
import 'package:one_key/models/user_history_entity.dart';
import 'package:one_key/res/colors.dart';
import 'package:one_key/route/routes.dart';
import 'package:one_key/utils/fluro_convert_utils.dart';
import 'package:one_key/utils/utils.dart';
import 'package:sqflite/sqlite_api.dart';
import '../app.dart';
class NavigatorUtil {
static Future _navigateTo(BuildContext context, String path,
{bool replace = false,
bool clearStack = false,
TransitionType transitionType = TransitionType.material,
Duration transitionDuration = const Duration(milliseconds: 250),
RouteTransitionsBuilder transitionBuilder}) {
Utils.changeStatusColor(color: MyColours.color_ffffff);
return App.router.navigateTo(context, path,
replace: replace,
clearStack: clearStack,
transitionDuration: transitionDuration,
transitionBuilder: transitionBuilder,
transition: transitionType);
}
/// 登录页
static void goLoginPage(BuildContext context) {
_navigateTo(context, Routes.login, clearStack: true);
}
/// 首页
static void goHomePage(BuildContext context, {int initialIndex = 1}) {
_navigateTo(context, "${Routes.home}?initialIndex=$initialIndex",
clearStack: true);
}
/// 订单详情
static void goNotebookDetailPage(BuildContext context, String rid, String uid,
{String mid = "", bool fromNotify = false, replace = false}) {
_navigateTo(context,
"${Routes.reserve_detail}?rid=$rid&mid=$mid&uid=$uid&fromNotify=$fromNotify",
replace: replace);
}
/// 处理在线预订
static Future goHandleOnlinePage(BuildContext context, String rid, String mid,
{fromNotify = false, replace = false}) {
return _navigateTo(context,
"${Routes.handle_online_page}?rid=$rid&mid=$mid&fromNotify=$fromNotify",
replace: replace);
}
/// 选择桌位
static Future goSelectTablePage(
BuildContext context, String rid, int dateTime, String ddate_slot,
{bool canChoose = false,
Map object,
String fromPage = 'change',
String tid = ''}) {
if (object != null) {
return _navigateTo(context,
"${Routes.select_table}?rid=$rid&tid=$tid&dateTime=$dateTime&fromPage=$fromPage&ddate_slot=$ddate_slot&canChoose=$canChoose&object=${FluroConvertUtils.object2string(object)}");
}
// object = {'object': [], "tid": ''};
return _navigateTo(context,
"${Routes.select_table}?rid=$rid&tid=$tid&dateTime=$dateTime&fromPage=$fromPage&ddate_slot=$ddate_slot&canChoose=$canChoose");
}
/// 选择桌位-照片管理
static Future goPhotoManagerSelectTablePage(
BuildContext context, String rid, int dateTime, String ddate_slot,
{bool canChoose = false,
Map object,
String fromPage = 'change',
String tid = ''}) {
if (object != null) {
return _navigateTo(context,
"${Routes.photo_manager_page}?rid=$rid&tid=$tid&dateTime=$dateTime&fromPage=$fromPage&ddate_slot=$ddate_slot&canChoose=$canChoose&object=${FluroConvertUtils.object2string(object)}");
}
// object = {'object': [], "tid": ''};
return _navigateTo(context,
"${Routes.photo_manager_page}?rid=$rid&tid=$tid&dateTime=$dateTime&fromPage=$fromPage&ddate_slot=$ddate_slot&canChoose=$canChoose");
}
/// 选择桌位——方硕新修改的选择桌位页面
static Future goSelectTableFPage(
BuildContext context, String rid, int dateTime, String ddate_slot,
{bool canChoose = false,
Map object,
String fromPage = 'change',
String tid = ''}) {
if (object != null) {
return _navigateTo(context,
"${Routes.select_table_f}?rid=$rid&tid=$tid&dateTime=$dateTime&fromPage=$fromPage&ddate_slot=$ddate_slot&canChoose=$canChoose&object=${FluroConvertUtils.object2string(object)}");
}
// object = {'object': [], "tid": ''};
return _navigateTo(context,
"${Routes.select_table_f}?rid=$rid&tid=$tid&dateTime=$dateTime&fromPage=$fromPage&ddate_slot=$ddate_slot&canChoose=$canChoose");
}
/// 邀请函
static void goInvicationPage(
BuildContext context,
String rid,
String tableInfo,
String ddate,
String ddateStr,
String phone,
String ddate_solt,
String name,
String sex,
{bool replace = false,
String tid}) {
_navigateTo(context,
"${Routes.invication}?rid=$rid&tid=$tid&tableInfo=${FluroConvertUtils.fluroCnParamsEncode(tableInfo)}&ddate=$ddate&ddateStr=${FluroConvertUtils.fluroCnParamsEncode(ddateStr)}&phone=$phone&ddate_solt=$ddate_solt&name=${Uri.encodeComponent(name)}&sex=$sex",
replace: replace);
}
/// 发短信
static void goSmsPage(BuildContext context, String rid) {
_navigateTo(context, "${Routes.sms}?rid=$rid");
}
/// 浏览器
static void goWebviewPage(BuildContext context) {
_navigateTo(context, "${Routes.webview}");
}
///协议
static Future<dynamic> goWebPage(
BuildContext context, String title, String url,
{bool need = false}) {
return _navigateTo(
context,
"${Routes.web_page}?title=${Uri.encodeComponent(title)}&url=$url&need=${need}",
);
}
// /// 变更预订
// static void goNoteBookChangePage(
// BuildContext context, NotebookDetail detailEntity, String rid,
// {replace = false}) {
// if (detailEntity.type == "0") {
// //内部预订
// detailEntity.is_set_ddate = "1";
// }
// _navigateTo(context,
// "${Routes.change_detail}?detail=${FluroConvertUtils.object2string(detailEntity)}&rid=$rid",
// replace: replace);
// }
/// 变更预订——方硕新修改页面
static void goNoteBookChangeFPage(
BuildContext context, NotebookDetail detailEntity, String rid,
{replace = false}) {
if (detailEntity.type == "0") {
//内部预订
detailEntity.is_set_ddate = "1";
}
_navigateTo(context,
"${Routes.change_detail_f}?detail=${FluroConvertUtils.object2string(detailEntity)}&rid=$rid",
replace: replace);
}
/// 可订时段管理
static void goBookTimeSetPage(BuildContext context) {
_navigateTo(context, "${Routes.book_time_set}");
}
/// 可订时段管理
static void goReceiveOrdersTimeSetPage(BuildContext context) {
_navigateTo(context, "${Routes.receive_orders_time_set}");
}
/// 常用备注管理
static void goRemarkManagerPage(BuildContext context) {
_navigateTo(context, "${Routes.remark_manager}");
}
/// 已选菜品
static void goHasOrderFoodPage(BuildContext context,
{String rid, fromNotify = false, replace = false}) {
_navigateTo(
context, "${Routes.has_order_food}?rid=${rid}&fromNotify=${fromNotify}",
replace: replace);
}
/// 提前买单编辑页面
static Future goOnlineCheckEditPage(BuildContext context,
{String rid, String mid, fromNotify = false, replace = false}) {
return _navigateTo(context,
"${Routes.online_check_edit}?fromNotify=${fromNotify}&rid=${rid}&mid=$mid",
replace: replace);
}
/// 提前买单查看页面
static void goOnlineCheckDetailPage(BuildContext context,
{String rid, fromNotify = false, replace = false}) {
_navigateTo(context,
"${Routes.online_check_detail}?fromNotify=${fromNotify}&rid=${rid}",
replace: replace);
}
/// 发票详情
static void goInvoiceDetailPage(BuildContext context,
{String rid, fromNotify = false, replace = false}) {
_navigateTo(
context, "${Routes.invoice_detail}?fromNotify=${fromNotify}&rid=${rid}",
replace: replace);
}
/// 优惠券列表
static void goCouponPage(BuildContext context,
{replace = false, needRefrsh = false}) {
_navigateTo(context, "${Routes.coupon}?needRefrsh=${needRefrsh}",
replace: replace);
}
/// 优惠券历史列表
static void goCouponHistoryPage(BuildContext context, {replace = false}) {
_navigateTo(context, "${Routes.coupon_history}", replace: replace);
}
/// 创建优惠券
static Future<dynamic> goCouponEditPage(BuildContext context,
{replace = false}) {
return _navigateTo(context, "${Routes.coupon_edit}", replace: replace);
}
/// 选择优惠券
static Future<dynamic> goCouponSelectPage(BuildContext context,
{String from, bool hasModify, replace = false}) {
return _navigateTo(
context, "${Routes.coupon_select}?from=${from}&hasModify=${hasModify}",
replace: replace);
}
/// 优惠券详情页
static Future<dynamic> goCouponDetailPage(
BuildContext context, CouponSunModel couponSunModel,
{replace = false}) {
return _navigateTo(context,
"${Routes.coupon_detail}?couponSunModel=${FluroConvertUtils.object2string(couponSunModel)}",
replace: replace);
}
/// 个人资料页面
static Future<dynamic> goBaseInfoPage(BuildContext context,
{replace = false}) {
return _navigateTo(context, "${Routes.base_info}", replace: replace);
}
/// 绑定手机号吗页面
static Future<dynamic> goBindingPhonePage(BuildContext context,
{replace = false, bool wechat = true}) {
return _navigateTo(context, "${Routes.binding_phone}?wechat=${wechat}",
replace: replace);
}
/// 是否新建店铺页面
static Future<dynamic> goIfNeedCreateStorePage(BuildContext context,
{replace = false, bool noStore}) {
return _navigateTo(
context, "${Routes.if_need_create_store}?noStore=${noStore}",
replace: replace);
}
/// 新建店铺页面
static Future<dynamic> goCreateStorePage(BuildContext context,
{replace = false}) {
return _navigateTo(context, "${Routes.create_store}", replace: replace);
}
/// 播放视频页
static Future<dynamic> goPlayVideoPage(BuildContext context,
{replace = false, String urlStr}) {
return _navigateTo(context,
"${Routes.play_video}?urlStr=${FluroConvertUtils.fluroCnParamsEncode(urlStr)}",
replace: replace,
transitionType: TransitionType.materialFullScreenDialog);
}
/// 地图选择页
static Future<dynamic> goMapChoicePointPage(BuildContext context,
{replace = false, String urlStr}) {
return _navigateTo(context, "${Routes.map_choice_point}", replace: replace);
}
/// 店铺名称
static Future<dynamic> goEnterStoreNamePage(BuildContext context,
{replace = false}) {
return _navigateTo(context, "${Routes.enter_store_name}", replace: replace);
}
/// 店铺地址
static Future<dynamic> goEnterStoreAddressPage(BuildContext context,
{replace = false}) {
return _navigateTo(context, "${Routes.enter_store_address}",
replace: replace);
}
/// 店铺担任角色
static Future<dynamic> goEnterStorePositionPage(BuildContext context,
{replace = false}) {
return _navigateTo(context, "${Routes.enter_store_position}",
replace: replace);
}
/// 店铺营业时间
static Future<dynamic> goEnterStoreTimePage(BuildContext context,
{replace = false}) {
return _navigateTo(context, "${Routes.enter_store_time}", replace: replace);
}
/// 店铺接单电话
static Future<dynamic> goEnterStorePhonePage(BuildContext context,
{replace = false}) {
return _navigateTo(context, "${Routes.enter_store_phone}",
replace: replace);
}
/// 店铺门头照片
static Future<dynamic> goEnterStoreFrontPhotoPage(BuildContext context,
{replace = false}) {
return _navigateTo(context, "${Routes.enter_store_front_photo}",
replace: replace);
}
/// 店铺环境
static Future<dynamic> goEnterStoreEnvironmentPage(BuildContext context,
{replace = false}) {
return _navigateTo(context, "${Routes.enter_store_environment}",
replace: replace);
}
/// 新建店铺完成页面
static Future<dynamic> goCompleteStorePage(BuildContext context,
{replace = false}) {
return _navigateTo(context, "${Routes.complete_create_store}",
replace: replace);
}
/// 我的积分页面
static Future<dynamic> goMyIntegralPage(BuildContext context,
{replace = false, IntegralSunModel sunModel}) {
return _navigateTo(context,
"${Routes.my_integral_page}?sunModel=${FluroConvertUtils.object2string(sunModel)}",
replace: replace);
}
/// 我的联系人页面
static Future<dynamic> goMyContantPage(BuildContext context,
{replace = false, IntegralSunModel sunModel}) {
return _navigateTo(context, "${Routes.my_contant_page}", replace: replace);
}
/// 桌位照片管理
static Future<dynamic> goTablePhotoManagerPage(BuildContext context,
{replace = false, String tid, String tname}) {
return _navigateTo(context,
"${Routes.table_photo_manager}?tid=${tid}&tname=${Uri.encodeComponent(tname)}",
replace: replace);
}
/// 统计
static Future<dynamic> goStatisticsPage(BuildContext context,
{replace = false}) {
return _navigateTo(context, "${Routes.statistics_page}", replace: replace);
}
/// 统计发短信
static Future<dynamic> goStatisticsSmsPage(BuildContext context,
{replace = false, Map<String, List> selectData}) {
return _navigateTo(context,
"${Routes.statistics_sms_page}?selectData=${FluroConvertUtils.object2string(selectData)}",
replace: replace);
}
/// 包间类型置满
static Future<dynamic> goStoreTypeFillManagePage(BuildContext context,
{replace = false}) {
return _navigateTo(context, "${Routes.store_type_fill_manage_page}",
replace: replace);
}
/// 短信余额显示
static Future<dynamic> goSmsManagePage(BuildContext context,
{replace = false, SmsInfoData smsInfoData}) {
return _navigateTo(context,
"${Routes.sms_manager_page}?smsInfoData=${FluroConvertUtils.object2string(smsInfoData)}",
replace: replace);
}
/// 短信充值
static Future<dynamic> goSmsRechargePage(BuildContext context,
{replace = false, SmsInfoData smsInfoData}) {
return _navigateTo(context,
"${Routes.sms_recharge_page}?smsInfoData=${FluroConvertUtils.object2string(smsInfoData)}",
replace: replace);
}
/// 店铺信息
static Future<dynamic> goStoreBaseInfoPage(BuildContext context,
{replace = false, SmsInfoData smsInfoData}) {
return _navigateTo(context, "${Routes.store_base_info_page}",
replace: replace);
}
/// 包间类型管理
static Future<dynamic> goRoomTypeManagePage(BuildContext context,
{replace = false, SmsInfoData smsInfoData}) {
return _navigateTo(context, "${Routes.room_type_manage_page}",
replace: replace);
}
/// 包间类型创建
static Future<dynamic> goRoomTypeCreatePage(BuildContext context,
{replace = false,
SmsInfoData smsInfoData,
bool isNew = true,
String tableClassId}) {
return _navigateTo(context,
"${Routes.room_type_create_page}?isnew=${isNew}&tableClassId=${tableClassId}",
replace: replace);
}
///包间管理中 ------ 选择桌位
static Future goRoomTypeSelectTablePage(
BuildContext context, String rid, int dateTime, String ddate_slot,
{bool canChoose = false,
String object,
String fromPage = 'change',
String tid = ''}) {
if (object != null) {
return _navigateTo(context,
"${Routes.room_type_select_table_page}?rid=$rid&tid=$tid&dateTime=$dateTime&fromPage=$fromPage&ddate_slot=$ddate_slot&canChoose=$canChoose&object=${object}");
}
// object = {'object': [], "tid": ''};
return _navigateTo(context,
"${Routes.room_type_select_table_page}?rid=$rid&tid=$tid&dateTime=$dateTime&fromPage=$fromPage&ddate_slot=$ddate_slot&canChoose=$canChoose");
}
/// 菜单管理
static Future<dynamic> goMenuManagePage(BuildContext context,
{replace = false}) {
return _navigateTo(context, "${Routes.menu_manage_page}", replace: replace);
}
/// 菜单分类管理
static Future<dynamic> goMenuCategoryPage(BuildContext context,
{replace = false}) {
return _navigateTo(context, "${Routes.menu_category_page}",
replace: replace);
}
/// 添加菜品页面
static Future<dynamic> goMenuAddDishesPage(BuildContext context,
{replace = false, bool isNew = true, String idstr}) {
return _navigateTo(
context, "${Routes.menu_add_dishes_page}?isNew=$isNew&idstr=${idstr}",
replace: replace);
}
/// 员工管理页面
static Future<dynamic> goPersonnelManagePage(BuildContext context,
{replace = false, bool isNew = true, String idstr}) {
return _navigateTo(context, "${Routes.personnel_manage_page}",
replace: replace);
}
/// 员工管理页面
static Future<dynamic> goPersonnelDetailPage(BuildContext context,
{replace = false, PersonnelManageSunModel model, String position}) {
return _navigateTo(context,
"${Routes.personnel_detail_page}?model=${FluroConvertUtils.object2string(model)}&position=${Uri.encodeComponent(position)}",
replace: replace);
}
/// 密码展示页
static Future<dynamic> goPersonnelPasswordPage(BuildContext context,
{replace = false, String idstr, String account}) {
return _navigateTo(context,
"${Routes.personnel_password_page}?account=$account&idstr=${idstr}",
replace: replace);
}
/// 密码修改页
static Future<dynamic> goPersonnelPasswordEditPage(
BuildContext context, {
replace = false,
String idstr,
}) {
return _navigateTo(
context, "${Routes.personnel_password_edit_page}?idstr=${idstr}",
replace: replace);
}
/// 填写预订联系人页面
static Future<dynamic> goEditReserverPage(
BuildContext context, String rid, String name, String sex,
{replace = false, bool needBtn = false}) {
return _navigateTo(context,
"${Routes.edit_reserver_page}?rid=${rid}&needBtn=$needBtn&name=${Uri.encodeComponent(name)}&sex=$sex",
replace: replace);
}
/// 全店客情页面
static Future<dynamic> goStoreCustomerPage(BuildContext context,
{replace = false, bool needBtn = false}) {
return _navigateTo(context, "${Routes.store_customer_page}",
replace: replace);
}
/// 我的客情页面
static Future<dynamic> goMyCustomerPage(BuildContext context,
{replace = false, bool needBtn = false}) {
return _navigateTo(context, "${Routes.my_customer_page}", replace: replace);
}
/// 客情列表
static Future<dynamic> goCustomerListPage(BuildContext context,
{replace = false, bool needBtn = false}) {
return _navigateTo(context, "${Routes.customer_list_page}",
replace: replace);
}
/// 客情设置
static Future<dynamic> goCustomerSetPage(BuildContext context,
{replace = false}) {
return _navigateTo(context, "${Routes.customer_set_page}",
replace: replace);
}
/// 全店营销记录
static Future<dynamic> goMarketingRecordsPage(BuildContext context,
{replace = false}) {
return _navigateTo(context, "${Routes.marketing_records_page}",
replace: replace);
}
/// 全店营销记录详情
static Future<dynamic> goMarketingRecordsDetailPage(BuildContext context,
{replace = false}) {
return _navigateTo(context, "${Routes.marketing_records_detail_page}",
replace: replace);
}
/// 创建营销
static Future<dynamic> goMakeMarkingPage(BuildContext context,
{replace = false}) {
return _navigateTo(context, "${Routes.make_marketing_page}",
replace: replace);
}
/// 客户详情
static Future<dynamic> goCustomerDetailPage(
BuildContext context,
UserHistoryEntity userHistoryEntity, {
replace = false,
}) {
return _navigateTo(context,
"${Routes.customer_detail_page}?userHistoryEntity=${FluroConvertUtils.object2string(userHistoryEntity)}",
replace: replace);
}
///编辑客户详情
static Future<dynamic> goCustomerDetailEditPage(
BuildContext context, {
replace = false,
}) {
return _navigateTo(context, "${Routes.customer_edit_detail_page}",
replace: replace);
}
///纪念日
static Future<dynamic> goFestivalEditPage(
BuildContext context, {
replace = false,
}) {
return _navigateTo(context, "${Routes.festival_edit_page}",
replace: replace);
}
///客户订单
static Future<dynamic> goCustomerOrderPage(
BuildContext context, {
replace = false,
}) {
return _navigateTo(context, "${Routes.customer_order_page}",
replace: replace);
}
}