Commit cc1b4797ce403eb198f4fea1b694756b52f1685f

Authored by “gaiyaguang”
2 parents ff9b53f2 0df94843

推送iOS原生回传参数给flutter

@@ -13,12 +13,12 @@ if (flutterRoot == null) { @@ -13,12 +13,12 @@ if (flutterRoot == null) {
13 13
14 def flutterVersionCode = localProperties.getProperty('flutter.versionCode') 14 def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
15 if (flutterVersionCode == null) { 15 if (flutterVersionCode == null) {
16 - flutterVersionCode = '112' 16 + flutterVersionCode = '121'
17 } 17 }
18 18
19 def flutterVersionName = localProperties.getProperty('flutter.versionName') 19 def flutterVersionName = localProperties.getProperty('flutter.versionName')
20 if (flutterVersionName == null) { 20 if (flutterVersionName == null) {
21 - flutterVersionName = '1.1.2' 21 + flutterVersionName = '1.2.1'
22 } 22 }
23 23
24 apply plugin: 'com.android.application' 24 apply plugin: 'com.android.application'
@@ -31,12 +31,23 @@ @@ -31,12 +31,23 @@
31 <meta-data 31 <meta-data
32 android:name="io.flutter.embedding.android.SplashScreenDrawable" 32 android:name="io.flutter.embedding.android.SplashScreenDrawable"
33 android:resource="@drawable/launch_background" /> 33 android:resource="@drawable/launch_background" />
  34 +
34 <intent-filter> 35 <intent-filter>
35 <action android:name="android.intent.action.MAIN"/> 36 <action android:name="android.intent.action.MAIN"/>
36 <category android:name="android.intent.category.LAUNCHER"/> 37 <category android:name="android.intent.category.LAUNCHER"/>
37 <action android:name="android.intent.action.VIEW"/> 38 <action android:name="android.intent.action.VIEW"/>
38 <category android:name="android.intent.category.DEFAULT"/> 39 <category android:name="android.intent.category.DEFAULT"/>
39 </intent-filter> 40 </intent-filter>
  41 +
  42 + <!-- 通知栏跳转intent -->
  43 + <intent-filter>
  44 + <action android:name="android.intent.action.VIEW"/>
  45 + <category android:name="android.intent.category.DEFAULT"/>
  46 + <data
  47 + android:scheme="xgscheme"
  48 + android:host="com.naji.book"
  49 + android:path="/book_detail" />
  50 + </intent-filter>
40 </activity> 51 </activity>
41 52
42 <!-- Don't delete the meta-data below. 53 <!-- Don't delete the meta-data below.
@@ -4,10 +4,54 @@ import androidx.annotation.NonNull; @@ -4,10 +4,54 @@ import androidx.annotation.NonNull;
4 import io.flutter.embedding.android.FlutterActivity 4 import io.flutter.embedding.android.FlutterActivity
5 import io.flutter.embedding.engine.FlutterEngine 5 import io.flutter.embedding.engine.FlutterEngine
6 import io.flutter.plugins.GeneratedPluginRegistrant 6 import io.flutter.plugins.GeneratedPluginRegistrant
  7 +import android.os.Bundle
  8 +import android.util.Log
  9 +import io.flutter.plugin.common.MethodChannel
  10 +import io.flutter.plugin.common.MethodCall
7 11
8 class MainActivity: FlutterActivity() { 12 class MainActivity: FlutterActivity() {
9 13
  14 + private var TAG = "| com.naji.book |"
  15 +
  16 + // 通道名称
  17 + private var CHANNEL = "com.naji/book"
  18 +
  19 + // native端的Intent数据
  20 + private var intentMap = mutableMapOf<String, String>()
  21 +
10 override fun configureFlutterEngine(@NonNull flutterEngine: FlutterEngine) { 22 override fun configureFlutterEngine(@NonNull flutterEngine: FlutterEngine) {
11 GeneratedPluginRegistrant.registerWith(flutterEngine); 23 GeneratedPluginRegistrant.registerWith(flutterEngine);
12 } 24 }
  25 +
  26 + override fun onCreate(savedInstanceState: Bundle?) {
  27 + super.onCreate(savedInstanceState)
  28 + // flutter版本更新后使用 getFlutterEngine().getDartExecutor().getBinaryMessenger()代替 getFlutterView()
  29 + val channel = MethodChannel(getFlutterEngine()?.getDartExecutor()?.getBinaryMessenger(), CHANNEL)
  30 +
  31 + // 这里要获取启动时的intent
  32 + val uri = intent.data
  33 + val paramsMap = mutableMapOf<String, String>()
  34 + if (uri != null) {
  35 + val set = uri.queryParameterNames
  36 + for (name in set) {
  37 + val value = uri.getQueryParameter(name)
  38 + paramsMap[name.toString()] = value.toString()
  39 + }
  40 + }
  41 +
  42 + intentMap = paramsMap
  43 +
  44 + channel.setMethodCallHandler { call, result ->
  45 + Log.i(TAG,intentMap.toString());
  46 + when (call.method) {
  47 + "getIntent" -> get_intent(call, result)
  48 + }
  49 + }
  50 + }
  51 +
  52 + // 获取intent
  53 + private fun get_intent(call: MethodCall, result: MethodChannel.Result) {
  54 + Log.i(TAG, "调用${call.method}方法")
  55 + result.success(intentMap)
  56 + }
13 } 57 }
@@ -7,7 +7,22 @@ import Flutter @@ -7,7 +7,22 @@ import Flutter
7 _ application: UIApplication, 7 _ application: UIApplication,
8 didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? 8 didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
9 ) -> Bool { 9 ) -> Bool {
  10 + let controller = self.window.rootViewController as! FlutterViewController
  11 + let channel = FlutterMethodChannel.init(name: "com.naji/book", binaryMessenger: controller as! FlutterBinaryMessenger)
  12 + channel.setMethodCallHandler { (call, result) in
  13 + if call.method == "getIntent" {
  14 + // let para = call.arguments
  15 + // print(para!)
  16 + let userInfo = launchOptions?[UIApplication.LaunchOptionsKey.remoteNotification];
  17 +
  18 + result(userInfo);
  19 + }else{
  20 + result(FlutterMethodNotImplemented)
  21 + }
  22 + }
10 GeneratedPluginRegistrant.register(with: self) 23 GeneratedPluginRegistrant.register(with: self)
  24 +// NSDictionary * userInfo = [launchOptions objectForKey:UIApplicationLaunchOptionsRemoteNotificationKey];//获取
  25 +
11 return super.application(application, didFinishLaunchingWithOptions: launchOptions) 26 return super.application(application, didFinishLaunchingWithOptions: launchOptions)
12 } 27 }
13 } 28 }
@@ -6,8 +6,10 @@ import 'package:flutter_easyrefresh/ball_pulse_footer.dart'; @@ -6,8 +6,10 @@ import 'package:flutter_easyrefresh/ball_pulse_footer.dart';
6 import 'package:flutter_easyrefresh/easy_refresh.dart'; 6 import 'package:flutter_easyrefresh/easy_refresh.dart';
7 import 'package:flutter_easyrefresh/material_header.dart'; 7 import 'package:flutter_easyrefresh/material_header.dart';
8 import 'package:fluwx/fluwx.dart'; 8 import 'package:fluwx/fluwx.dart';
  9 +import 'package:one_key/pages/detail/handle_online_page.dart';
9 import 'package:one_key/provider/message_dialog_model.dart'; 10 import 'package:one_key/provider/message_dialog_model.dart';
10 import 'package:intl/date_symbol_data_local.dart'; 11 import 'package:intl/date_symbol_data_local.dart';
  12 +import 'package:one_key/provider/tools.dart';
11 import 'package:one_key/utils/utils.dart'; 13 import 'package:one_key/utils/utils.dart';
12 import 'package:provider/provider.dart'; 14 import 'package:provider/provider.dart';
13 import 'package:tpns_flutter_plugin/tpns_flutter_plugin.dart'; 15 import 'package:tpns_flutter_plugin/tpns_flutter_plugin.dart';
@@ -29,7 +31,7 @@ Future<void> main() async { @@ -29,7 +31,7 @@ Future<void> main() async {
29 Routes.configureRoutes(router); 31 Routes.configureRoutes(router);
30 App.router = router; 32 App.router = router;
31 App.setupLocator(); 33 App.setupLocator();
32 - LogUtil.init(isDebug: false, tag: 'ONE_KEY'); 34 + LogUtil.init(isDebug: true, tag: 'ONE_KEY');
33 Provider.debugCheckInvalidValueType = null; 35 Provider.debugCheckInvalidValueType = null;
34 await initializeDateFormatting(); 36 await initializeDateFormatting();
35 SystemChrome.setPreferredOrientations( 37 SystemChrome.setPreferredOrientations(
@@ -61,6 +63,7 @@ class MyApp extends StatefulWidget { @@ -61,6 +63,7 @@ class MyApp extends StatefulWidget {
61 } 63 }
62 64
63 class MyAppState extends State<MyApp> { 65 class MyAppState extends State<MyApp> {
  66 +
64 @override 67 @override
65 void initState() { 68 void initState() {
66 // TODO: implement initState 69 // TODO: implement initState
@@ -22,9 +22,11 @@ import 'package:provider/provider.dart'; @@ -22,9 +22,11 @@ import 'package:provider/provider.dart';
22 import 'package:one_key/utils/event_bus.dart'; 22 import 'package:one_key/utils/event_bus.dart';
23 23
24 class HandleOnlinePage extends StatefulWidget { 24 class HandleOnlinePage extends StatefulWidget {
  25 +
25 final String rid; 26 final String rid;
26 final String mid; 27 final String mid;
27 - HandleOnlinePage(this.rid, this.mid); 28 + final bool fromNotify;
  29 + HandleOnlinePage(this.rid, this.mid, {this.fromNotify=false});
28 30
29 @override 31 @override
30 State<StatefulWidget> createState() { 32 State<StatefulWidget> createState() {
@@ -59,7 +61,7 @@ class HandleOnlinePageState extends State<HandleOnlinePage> { @@ -59,7 +61,7 @@ class HandleOnlinePageState extends State<HandleOnlinePage> {
59 if (detailEntity.status != "0") { 61 if (detailEntity.status != "0") {
60 //已处理 62 //已处理
61 Future.delayed(Duration(milliseconds: 200), () { 63 Future.delayed(Duration(milliseconds: 200), () {
62 - NavigatorUtil.goNotebookDetailPage(context, detailEntity.id, 64 + NavigatorUtil.goNotebookDetailPage(context, detailEntity.id,fromNotify: widget.fromNotify,
63 replace: true); 65 replace: true);
64 }); 66 });
65 setMessageStatus(); 67 setMessageStatus();
@@ -163,233 +165,234 @@ class HandleOnlinePageState extends State<HandleOnlinePage> { @@ -163,233 +165,234 @@ class HandleOnlinePageState extends State<HandleOnlinePage> {
163 Widget build(BuildContext context) { 165 Widget build(BuildContext context) {
164 // TODO: implement build 166 // TODO: implement build
165 return SafeArea( 167 return SafeArea(
166 - child: detailEntity == null  
167 - ? Container(  
168 - width: double.infinity,  
169 - height: double.infinity,  
170 - color: MyColours.color_ffffff,  
171 - )  
172 - : Column(  
173 - children: <Widget>[  
174 - MyAppBar(  
175 - "在线预订详情",  
176 - showBack: true,  
177 - ),  
178 - Expanded(  
179 - child: DefaultTextStyle(  
180 - style: TextStyle(decoration: TextDecoration.none),  
181 - child: Container(  
182 - color: MyColours.color_ffffff,  
183 - child: Column(  
184 - children: <Widget>[  
185 - Expanded(  
186 - child: SingleChildScrollView(  
187 - child: Container(  
188 - color: MyColours.color_ffffff,  
189 - padding: EdgeInsets.symmetric(  
190 - horizontal: ScreenUtil().setWidth(43)),  
191 - child: Column( 168 + child: WillPopScope(
  169 + child: detailEntity == null
  170 + ? Container(
  171 + width: double.infinity,
  172 + height: double.infinity,
  173 + color: MyColours.color_ffffff,
  174 + )
  175 + : Column(
  176 + children: <Widget>[
  177 + MyAppBar(
  178 + "在线预订详情",
  179 + showBack: true,
  180 + ),
  181 + Expanded(
  182 + child: DefaultTextStyle(
  183 + style: TextStyle(decoration: TextDecoration.none),
  184 + child: Container(
  185 + color: MyColours.color_ffffff,
  186 + child: Column(
  187 + children: <Widget>[
  188 + Expanded(
  189 + child: SingleChildScrollView(
  190 + child: Container(
  191 + color: MyColours.color_ffffff,
  192 + padding: EdgeInsets.symmetric(
  193 + horizontal: ScreenUtil().setWidth(43)),
  194 + child: Column(
  195 + children: <Widget>[
  196 + RowMultiText(
  197 + "用餐时段", detailEntity.ddateMd),
  198 + Stack(
  199 + alignment: Alignment.center,
192 children: <Widget>[ 200 children: <Widget>[
193 - RowMultiText(  
194 - "用餐时段", detailEntity.ddateMd),  
195 - Stack(  
196 - alignment: Alignment.center, 201 + Column(
197 children: <Widget>[ 202 children: <Widget>[
198 - Column(  
199 - children: <Widget>[  
200 - RowMultiText("用餐时间",  
201 - detailEntity.ddateHm),  
202 - Offstage(  
203 - offstage:  
204 - detailEntity.type == "0"  
205 - ? false  
206 - : true,  
207 - child: RowMultiText("用餐人数",  
208 - detailEntity.pnum),  
209 - )  
210 - ],  
211 - ),  
212 - Image.asset(  
213 - detailEntity.statuImgAssets,  
214 - width: ScreenUtil().setWidth(100),  
215 - height: ScreenUtil().setWidth(30),  
216 - )  
217 - ],  
218 - ),  
219 - RowMultiText(  
220 - "包间需求",  
221 - (detailEntity.demands.length  
222 - .toString() +  
223 - "个") ??  
224 - ""),  
225 - Align(  
226 - alignment: Alignment.centerRight,  
227 - child: Offstage( 203 + RowMultiText("用餐时间",
  204 + detailEntity.ddateHm),
  205 + Offstage(
228 offstage: 206 offstage:
229 - detailEntity.demands.length >  
230 - 0 207 + detailEntity.type == "0"
231 ? false 208 ? false
232 : true, 209 : true,
233 - child: Container(  
234 - height:  
235 - ScreenUtil().setHeight(210),  
236 - child: ListView.builder(  
237 - itemBuilder:  
238 - (BuildContext contxt,  
239 - int index) {  
240 - return NeedItem(detailEntity  
241 - .demands[index]);  
242 - },  
243 - itemCount: detailEntity  
244 - .demands.length,  
245 - shrinkWrap: true,  
246 - scrollDirection:  
247 - Axis.horizontal,  
248 - ),  
249 - ),  
250 - )),  
251 - RowMultiText(  
252 - "客户姓名", detailEntity.rnameStr),  
253 - RowMultiText(  
254 - "客户电话", detailEntity.phone),  
255 - RowMultiText(  
256 - "备注信息", detailEntity.cusdem ?? ""),  
257 - MyDivider(double.infinity,  
258 - ScreenUtil().setHeight(1)),  
259 - Container(  
260 - color: MyColours.color_ffffff,  
261 - width: double.infinity,  
262 - height: ScreenUtil().setHeight(80),  
263 - alignment: Alignment.center,  
264 - child: Stack(  
265 - alignment: Alignment.center,  
266 - children: <Widget>[  
267 - Positioned(  
268 - left: 0,  
269 - child: Text(  
270 - "客户经理",  
271 - style: TextStyle(  
272 - color: MyColours  
273 - .color_828282,  
274 - fontSize: ScreenUtil()  
275 - .setSp(30)),  
276 - ),  
277 - ),  
278 - Positioned(  
279 - right: 0,  
280 - child: GestureDetector(  
281 - onTap: () async {  
282 - List<String> list = [];  
283 - for (Manager manager  
284 - in managers) {  
285 - list.add(  
286 - manager.roleUserName);  
287 - }  
288 - DialogUtil  
289 - .showSelectCusmanDialog(  
290 - context, list,(value){  
291 - if(value!=null){  
292 - setState(() {  
293 - cusmanText = managers[  
294 - value.first]  
295 - .userName;  
296 - });  
297 - _setCurrManager();  
298 - }  
299 - })  
300 - .then((value) {  
301 -  
302 - });  
303 - },  
304 - child: Text(  
305 - cusmanText,  
306 - style: TextStyle(  
307 - color: MyColours  
308 - .color_353535,  
309 - fontSize: ScreenUtil()  
310 - .setSp(30),  
311 - decoration: TextDecoration  
312 - .underline,  
313 - ),  
314 - ),  
315 - ),  
316 - )  
317 - ],  
318 - ), 210 + child: RowMultiText("用餐人数",
  211 + detailEntity.pnum),
  212 + )
  213 + ],
319 ), 214 ),
  215 + Image.asset(
  216 + detailEntity.statuImgAssets,
  217 + width: ScreenUtil().setWidth(100),
  218 + height: ScreenUtil().setWidth(30),
  219 + )
320 ], 220 ],
321 - )),  
322 - ),  
323 - ),  
324 - Container(  
325 - margin: EdgeInsets.only(  
326 - top: ScreenUtil().setHeight(30),  
327 - bottom: ScreenUtil().setHeight(30)),  
328 - child: Column(  
329 - children: <Widget>[  
330 - CommonButton(  
331 - content: "安排包间",  
332 - width: 669,  
333 - height: 76,  
334 - fontSize: 34,  
335 - onPress: () async {  
336 - Map map = await NavigatorUtil  
337 - .goSelectTablePage(  
338 - context,  
339 - widget.rid,  
340 - int.parse(detailEntity.ddate) *  
341 - 1000,  
342 - detailEntity.ddate_solt);  
343 - if (map['tid'] != null) {  
344 - setReserveStatus("5", tid: map['tid']);  
345 - }  
346 - },  
347 - ),  
348 - VEmptyView(20),  
349 - Container(  
350 - width: ScreenUtil().setWidth(669),  
351 - height: ScreenUtil().setHeight(76),  
352 - decoration: BoxDecoration(  
353 - border: Border.all(  
354 - color: MyColours.color_199095),  
355 - borderRadius: BorderRadius.circular(  
356 - ScreenUtil().setWidth(5)),  
357 ), 221 ),
358 - child: Row(  
359 - crossAxisAlignment:  
360 - CrossAxisAlignment.center,  
361 - children: <Widget>[  
362 - Expanded( 222 + RowMultiText(
  223 + "包间需求",
  224 + (detailEntity.demands.length
  225 + .toString() +
  226 + "个") ??
  227 + ""),
  228 + Align(
  229 + alignment: Alignment.centerRight,
  230 + child: Offstage(
  231 + offstage:
  232 + detailEntity.demands.length >
  233 + 0
  234 + ? false
  235 + : true,
  236 + child: Container(
  237 + height:
  238 + ScreenUtil().setHeight(210),
  239 + child: ListView.builder(
  240 + itemBuilder:
  241 + (BuildContext contxt,
  242 + int index) {
  243 + return NeedItem(detailEntity
  244 + .demands[index]);
  245 + },
  246 + itemCount: detailEntity
  247 + .demands.length,
  248 + shrinkWrap: true,
  249 + scrollDirection:
  250 + Axis.horizontal,
  251 + ),
  252 + ),
  253 + )),
  254 + RowMultiText(
  255 + "客户姓名", detailEntity.rnameStr),
  256 + RowMultiText(
  257 + "客户电话", detailEntity.phone),
  258 + RowMultiText(
  259 + "备注信息", detailEntity.cusdem ?? ""),
  260 + MyDivider(double.infinity,
  261 + ScreenUtil().setHeight(1)),
  262 + Container(
  263 + color: MyColours.color_ffffff,
  264 + width: double.infinity,
  265 + height: ScreenUtil().setHeight(80),
  266 + alignment: Alignment.center,
  267 + child: Stack(
  268 + alignment: Alignment.center,
  269 + children: <Widget>[
  270 + Positioned(
  271 + left: 0,
  272 + child: Text(
  273 + "客户经理",
  274 + style: TextStyle(
  275 + color: MyColours
  276 + .color_828282,
  277 + fontSize: ScreenUtil()
  278 + .setSp(30)),
  279 + ),
  280 + ),
  281 + Positioned(
  282 + right: 0,
363 child: GestureDetector( 283 child: GestureDetector(
  284 + onTap: () async {
  285 + List<String> list = [];
  286 + for (Manager manager
  287 + in managers) {
  288 + list.add(
  289 + manager.roleUserName);
  290 + }
  291 + DialogUtil
  292 + .showSelectCusmanDialog(
  293 + context, list,(value){
  294 + if(value!=null){
  295 + setState(() {
  296 + cusmanText = managers[
  297 + value.first]
  298 + .userName;
  299 + });
  300 + _setCurrManager();
  301 + }
  302 + })
  303 + .then((value) {
  304 +
  305 + });
  306 + },
  307 + child: Text(
  308 + cusmanText,
  309 + style: TextStyle(
  310 + color: MyColours
  311 + .color_353535,
  312 + fontSize: ScreenUtil()
  313 + .setSp(30),
  314 + decoration: TextDecoration
  315 + .underline,
  316 + ),
  317 + ),
  318 + ),
  319 + )
  320 + ],
  321 + ),
  322 + ),
  323 + ],
  324 + )),
  325 + ),
  326 + ),
  327 + Container(
  328 + margin: EdgeInsets.only(
  329 + top: ScreenUtil().setHeight(30),
  330 + bottom: ScreenUtil().setHeight(30)),
  331 + child: Column(
  332 + children: <Widget>[
  333 + CommonButton(
  334 + content: "安排包间",
  335 + width: 669,
  336 + height: 76,
  337 + fontSize: 34,
  338 + onPress: () async {
  339 + Map map = await NavigatorUtil
  340 + .goSelectTablePage(
  341 + context,
  342 + widget.rid,
  343 + int.parse(detailEntity.ddate) *
  344 + 1000,
  345 + detailEntity.ddate_solt);
  346 + if (map['tid'] != null) {
  347 + setReserveStatus("5", tid: map['tid']);
  348 + }
  349 + },
  350 + ),
  351 + VEmptyView(20),
  352 + Container(
  353 + width: ScreenUtil().setWidth(669),
  354 + height: ScreenUtil().setHeight(76),
  355 + decoration: BoxDecoration(
  356 + border: Border.all(
  357 + color: MyColours.color_199095),
  358 + borderRadius: BorderRadius.circular(
  359 + ScreenUtil().setWidth(5)),
  360 + ),
  361 + child: Row(
  362 + crossAxisAlignment:
  363 + CrossAxisAlignment.center,
  364 + children: <Widget>[
  365 + Expanded(
  366 + child: GestureDetector(
364 child: Center( 367 child: Center(
365 child: Text( 368 child: Text(
366 "拒绝订单", 369 "拒绝订单",
367 style: TextStyle( 370 style: TextStyle(
368 color: 371 color:
369 - MyColours.color_199095, 372 + MyColours.color_199095,
370 fontSize: 373 fontSize:
371 - ScreenUtil().setSp(34)), 374 + ScreenUtil().setSp(34)),
372 ), 375 ),
373 ), 376 ),
374 onTap: () { 377 onTap: () {
375 _showRefuseDialog(); 378 _showRefuseDialog();
376 }, 379 },
377 )), 380 )),
378 - MyDivider(  
379 - ScreenUtil().setWidth(2),  
380 - ScreenUtil().setHeight(52),  
381 - color: MyColours.color_199095,  
382 - ),  
383 - Expanded(  
384 - child: GestureDetector( 381 + MyDivider(
  382 + ScreenUtil().setWidth(2),
  383 + ScreenUtil().setHeight(52),
  384 + color: MyColours.color_199095,
  385 + ),
  386 + Expanded(
  387 + child: GestureDetector(
385 child: Center( 388 child: Center(
386 child: Text( 389 child: Text(
387 "联系顾客", 390 "联系顾客",
388 style: TextStyle( 391 style: TextStyle(
389 color: 392 color:
390 - MyColours.color_199095, 393 + MyColours.color_199095,
391 fontSize: 394 fontSize:
392 - ScreenUtil().setSp(34)), 395 + ScreenUtil().setSp(34)),
393 ), 396 ),
394 ), 397 ),
395 onTap: () { 398 onTap: () {
@@ -403,17 +406,26 @@ class HandleOnlinePageState extends State<HandleOnlinePage> { @@ -403,17 +406,26 @@ class HandleOnlinePageState extends State<HandleOnlinePage> {
403 } 406 }
404 }, 407 },
405 )), 408 )),
406 - ],  
407 - ),  
408 - )  
409 - ],  
410 - ),  
411 - )  
412 - ],  
413 - ))),  
414 - )  
415 - ],  
416 - ), 409 + ],
  410 + ),
  411 + )
  412 + ],
  413 + ),
  414 + )
  415 + ],
  416 + ))),
  417 + )
  418 + ],
  419 + ),
  420 + onWillPop: ()async{
  421 + if(widget.fromNotify){
  422 + NavigatorUtil.goHomePage(context,initialIndex: 0);
  423 + return true;
  424 + }
  425 + Navigator.of(context).pop();
  426 + return true;
  427 + },
  428 + )
417 ); 429 );
418 } 430 }
419 } 431 }
@@ -29,8 +29,9 @@ import 'package:provider/provider.dart'; @@ -29,8 +29,9 @@ import 'package:provider/provider.dart';
29 29
30 class NotebookDetailPage extends StatefulWidget { 30 class NotebookDetailPage extends StatefulWidget {
31 final String rid; 31 final String rid;
  32 + final bool fromNotify;
32 33
33 - NotebookDetailPage(this.rid); 34 + NotebookDetailPage(this.rid, {this.fromNotify=false});
34 35
35 @override 36 @override
36 State<StatefulWidget> createState() { 37 State<StatefulWidget> createState() {
@@ -142,7 +143,7 @@ class NotebookDetailPageState extends State<NotebookDetailPage> { @@ -142,7 +143,7 @@ class NotebookDetailPageState extends State<NotebookDetailPage> {
142 "cause": json.encode(causeMap) 143 "cause": json.encode(causeMap)
143 }; 144 };
144 bool success = 145 bool success =
145 - await detailModel.setReserveStatus(context, params, ifPush: false); 146 + await detailModel.setReserveStatus(context, params, ifPush: false);
146 if (success) { 147 if (success) {
147 _getReserveDetail(); 148 _getReserveDetail();
148 } 149 }
@@ -169,7 +170,7 @@ class NotebookDetailPageState extends State<NotebookDetailPage> { @@ -169,7 +170,7 @@ class NotebookDetailPageState extends State<NotebookDetailPage> {
169 context: context, 170 context: context,
170 barrierDismissible: false, 171 barrierDismissible: false,
171 barrierLabel: 172 barrierLabel:
172 - MaterialLocalizations.of(context).modalBarrierDismissLabel, 173 + MaterialLocalizations.of(context).modalBarrierDismissLabel,
173 transitionDuration: const Duration(milliseconds: 150), 174 transitionDuration: const Duration(milliseconds: 150),
174 pageBuilder: (BuildContext context, Animation animation, 175 pageBuilder: (BuildContext context, Animation animation,
175 Animation secondaryAnimation) { 176 Animation secondaryAnimation) {
@@ -196,7 +197,7 @@ class NotebookDetailPageState extends State<NotebookDetailPage> { @@ -196,7 +197,7 @@ class NotebookDetailPageState extends State<NotebookDetailPage> {
196 decoration: BoxDecoration( 197 decoration: BoxDecoration(
197 color: Colors.white, 198 color: Colors.white,
198 borderRadius: 199 borderRadius:
199 - BorderRadius.circular(ScreenUtil().setWidth(10)), 200 + BorderRadius.circular(ScreenUtil().setWidth(10)),
200 ), 201 ),
201 child: Column( 202 child: Column(
202 mainAxisSize: MainAxisSize.min, 203 mainAxisSize: MainAxisSize.min,
@@ -276,7 +277,7 @@ class NotebookDetailPageState extends State<NotebookDetailPage> { @@ -276,7 +277,7 @@ class NotebookDetailPageState extends State<NotebookDetailPage> {
276 Text(value['title'], 277 Text(value['title'],
277 style: TextStyle( 278 style: TextStyle(
278 fontSize: 279 fontSize:
279 - ScreenUtil().setSp(32), 280 + ScreenUtil().setSp(32),
280 fontWeight: FontWeight.normal, 281 fontWeight: FontWeight.normal,
281 decoration: TextDecoration.none, 282 decoration: TextDecoration.none,
282 color: MyColours.color_333333)) 283 color: MyColours.color_333333))
@@ -284,42 +285,42 @@ class NotebookDetailPageState extends State<NotebookDetailPage> { @@ -284,42 +285,42 @@ class NotebookDetailPageState extends State<NotebookDetailPage> {
284 ), 285 ),
285 value['title'] == '其他原因' && isShowTF 286 value['title'] == '其他原因' && isShowTF
286 ? Material( 287 ? Material(
287 - child: Container(  
288 - color: Colors.white,  
289 - padding: EdgeInsets.only(  
290 - left:  
291 - ScreenUtil().setWidth(76)),  
292 - child: TextField(  
293 - maxLines: 1,  
294 - controller: _cancelController,  
295 - focusNode: _cancelNode,  
296 - textAlignVertical:  
297 - TextAlignVertical.bottom,  
298 - decoration: InputDecoration(  
299 - hintText: "请填写原因",  
300 - hintStyle: TextStyle(  
301 - color: MyColours.color_999999,  
302 - fontSize:  
303 - ScreenUtil().setSp(30),  
304 - ),  
305 - enabledBorder:  
306 - UnderlineInputBorder(  
307 - borderSide: BorderSide(  
308 - color: MyColours  
309 - .color_d8d8d8),  
310 - ),  
311 - // border: InputBorder.none, 288 + child: Container(
  289 + color: Colors.white,
  290 + padding: EdgeInsets.only(
  291 + left:
  292 + ScreenUtil().setWidth(76)),
  293 + child: TextField(
  294 + maxLines: 1,
  295 + controller: _cancelController,
  296 + focusNode: _cancelNode,
  297 + textAlignVertical:
  298 + TextAlignVertical.bottom,
  299 + decoration: InputDecoration(
  300 + hintText: "请填写原因",
  301 + hintStyle: TextStyle(
  302 + color: MyColours.color_999999,
  303 + fontSize:
  304 + ScreenUtil().setSp(30),
312 ), 305 ),
313 - onChanged: (_) {  
314 - setState(() {});  
315 - },  
316 - onEditingComplete: () {  
317 - print('fff');  
318 - _cancelNode.unfocus();  
319 - },  
320 - // keyboardType: TextInputType.number, 306 + enabledBorder:
  307 + UnderlineInputBorder(
  308 + borderSide: BorderSide(
  309 + color: MyColours
  310 + .color_d8d8d8),
  311 + ),
  312 + // border: InputBorder.none,
321 ), 313 ),
322 - )) 314 + onChanged: (_) {
  315 + setState(() {});
  316 + },
  317 + onEditingComplete: () {
  318 + print('fff');
  319 + _cancelNode.unfocus();
  320 + },
  321 + // keyboardType: TextInputType.number,
  322 + ),
  323 + ))
323 : Container(), 324 : Container(),
324 VEmptyView(40) 325 VEmptyView(40)
325 ]), 326 ]),
@@ -353,7 +354,7 @@ class NotebookDetailPageState extends State<NotebookDetailPage> { @@ -353,7 +354,7 @@ class NotebookDetailPageState extends State<NotebookDetailPage> {
353 Navigator.of(context).pop(); 354 Navigator.of(context).pop();
354 Loading.showLoading(context); 355 Loading.showLoading(context);
355 setReserveStatus('4', desc: desc); 356 setReserveStatus('4', desc: desc);
356 - bus.emit("refresh_book_list"); 357 + bus.emit("refresh_book_list");
357 }, 358 },
358 text: '确认', 359 text: '确认',
359 height: ScreenUtil().setWidth(80), 360 height: ScreenUtil().setWidth(80),
@@ -375,296 +376,297 @@ class NotebookDetailPageState extends State<NotebookDetailPage> { @@ -375,296 +376,297 @@ class NotebookDetailPageState extends State<NotebookDetailPage> {
375 if (MediaQuery.of(context).viewInsets.bottom == 0) { 376 if (MediaQuery.of(context).viewInsets.bottom == 0) {
376 _cancelNode.unfocus(); 377 _cancelNode.unfocus();
377 } 378 }
378 - return detailEntity == null  
379 - ? Container(  
380 - width: double.infinity,  
381 - height: double.infinity,  
382 - color: MyColours.color_ffffff,  
383 - )  
384 - : Container(  
385 - color: MyColours.color_ffffff,  
386 - child: Column(  
387 - children: <Widget>[  
388 - SizedBox(height: ScreenUtil.statusBarHeight),  
389 - MyAppBar(  
390 - "订座详情",  
391 - showBack: true,  
392 - ),  
393 - Expanded(  
394 - child: DefaultTextStyle(  
395 - style: TextStyle(decoration: TextDecoration.none), 379 + return WillPopScope(
  380 + child: detailEntity == null
  381 + ? Container(
  382 + width: double.infinity,
  383 + height: double.infinity,
  384 + color: MyColours.color_ffffff,
  385 + )
  386 + : Container(
  387 + color: MyColours.color_ffffff,
  388 + child: Column(
  389 + children: <Widget>[
  390 + SizedBox(height: ScreenUtil.statusBarHeight),
  391 + MyAppBar(
  392 + "订座详情",
  393 + showBack: true,
  394 + ),
  395 + Expanded(
  396 + child: DefaultTextStyle(
  397 + style: TextStyle(decoration: TextDecoration.none),
  398 + child: Container(
  399 + color: MyColours.color_ffffff,
  400 + child: SingleChildScrollView(
396 child: Container( 401 child: Container(
397 - color: MyColours.color_ffffff,  
398 - child: SingleChildScrollView(  
399 - child: Container(  
400 - color: MyColours.color_ffffff,  
401 - padding: EdgeInsets.symmetric(  
402 - horizontal: ScreenUtil().setWidth(43)),  
403 - child: Column( 402 + color: MyColours.color_ffffff,
  403 + padding: EdgeInsets.symmetric(
  404 + horizontal: ScreenUtil().setWidth(43)),
  405 + child: Column(
  406 + children: <Widget>[
  407 + RowMultiText("用餐时段", detailEntity.ddateMd),
  408 + Stack(
  409 + alignment: Alignment.center,
404 children: <Widget>[ 410 children: <Widget>[
405 - RowMultiText("用餐时段", detailEntity.ddateMd),  
406 - Stack(  
407 - alignment: Alignment.center, 411 + Column(
408 children: <Widget>[ 412 children: <Widget>[
409 - Column(  
410 - children: <Widget>[  
411 - RowMultiText(  
412 - "用餐时间", detailEntity.ddateHm),  
413 - Offstage(  
414 - offstage: detailEntity.type == "0"  
415 - ? false  
416 - : true,  
417 - child: RowMultiText(  
418 - "用餐人数", detailEntity.pnum),  
419 - )  
420 - ],  
421 - ),  
422 - Image.asset(  
423 - detailEntity.statuImgAssets,  
424 - width: ScreenUtil().setWidth(100),  
425 - height: ScreenUtil().setWidth(30), 413 + RowMultiText(
  414 + "用餐时间", detailEntity.ddateHm),
  415 + Offstage(
  416 + offstage: detailEntity.type == "0"
  417 + ? false
  418 + : true,
  419 + child: RowMultiText(
  420 + "用餐人数", detailEntity.pnum),
426 ) 421 )
427 ], 422 ],
428 ), 423 ),
429 - Offstage(  
430 - offstage: detailEntity.demands.length <= 0  
431 - ? true  
432 - : false,  
433 - child: Column(  
434 - children: <Widget>[  
435 - RowMultiText(  
436 - "包间需求",  
437 - (detailEntity.demands.length  
438 - .toString() +  
439 - "个") ??  
440 - ""),  
441 - Align(  
442 - alignment: Alignment.centerRight,  
443 - child: Offstage(  
444 - offstage:  
445 - detailEntity.demands.length >  
446 - 0  
447 - ? false  
448 - : true,  
449 - child: Container(  
450 - height:  
451 - ScreenUtil().setHeight(210),  
452 - child: ListView.builder(  
453 - itemBuilder:  
454 - (BuildContext contxt,  
455 - int index) {  
456 - return NeedItem(detailEntity  
457 - .demands[index]);  
458 - },  
459 - itemCount: detailEntity  
460 - .demands.length,  
461 - shrinkWrap: true,  
462 - scrollDirection:  
463 - Axis.horizontal,  
464 - ),  
465 - ),  
466 - ))  
467 - ],  
468 - ),  
469 - ),  
470 - RowMultiText(  
471 - "预订桌位",  
472 - (detailEntity.tables.length.toString() +  
473 - "个")),  
474 - Align(  
475 - alignment: Alignment.centerRight,  
476 - child: Offstage(  
477 - offstage: detailEntity.tables.length > 0  
478 - ? false  
479 - : true,  
480 - child: Container(  
481 - height: ScreenUtil().setHeight(210),  
482 - child: ListView.builder(  
483 - itemBuilder: (BuildContext contxt,  
484 - int index) {  
485 - return TableItem(  
486 - detailEntity.tables[index]);  
487 - },  
488 - itemCount:  
489 - detailEntity.tables.length,  
490 - shrinkWrap: true,  
491 - scrollDirection: Axis.horizontal,  
492 - ),  
493 - ),  
494 - )),  
495 - RowMultiText("客户姓名", detailEntity.rnameStr),  
496 - RowMultiText(  
497 - "客户电话", detailEntity.phone ?? ""),  
498 - MyDivider(double.infinity,  
499 - ScreenUtil().setHeight(1)),  
500 - Container(  
501 - color: MyColours.color_ffffff,  
502 - width: double.infinity,  
503 - height: ScreenUtil().setHeight(80),  
504 - alignment: Alignment.center,  
505 - child: Stack(  
506 - alignment: Alignment.center,  
507 - children: <Widget>[  
508 - Positioned(  
509 - left: 0,  
510 - child: Text(  
511 - "客户经理",  
512 - style: TextStyle(  
513 - color: MyColours.color_828282,  
514 - fontSize:  
515 - ScreenUtil().setSp(30)),  
516 - ),  
517 - ),  
518 - Positioned(  
519 - right: 0,  
520 - child: GestureDetector(  
521 - onTap: () async {  
522 - List<String> list = [];  
523 - for (Manager manager  
524 - in managers) {  
525 - list.add(manager.roleUserName);  
526 - }  
527 - DialogUtil.showSelectCusmanDialog(  
528 - context, list, (value) {  
529 - if (value != null) {  
530 - setState(() {  
531 - cusmanText =  
532 - managers[value.first]  
533 - .userName;  
534 - });  
535 - _setCurrManager();  
536 - }  
537 - }).then((value) {});  
538 - },  
539 - child: Text(  
540 - cusmanText,  
541 - style: TextStyle(  
542 - color: MyColours.color_353535,  
543 - fontSize:  
544 - ScreenUtil().setSp(30),  
545 - decoration:  
546 - TextDecoration.underline,  
547 - ), 424 + Image.asset(
  425 + detailEntity.statuImgAssets,
  426 + width: ScreenUtil().setWidth(100),
  427 + height: ScreenUtil().setWidth(30),
  428 + )
  429 + ],
  430 + ),
  431 + Offstage(
  432 + offstage: detailEntity.demands.length <= 0
  433 + ? true
  434 + : false,
  435 + child: Column(
  436 + children: <Widget>[
  437 + RowMultiText(
  438 + "包间需求",
  439 + (detailEntity.demands.length
  440 + .toString() +
  441 + "个") ??
  442 + ""),
  443 + Align(
  444 + alignment: Alignment.centerRight,
  445 + child: Offstage(
  446 + offstage:
  447 + detailEntity.demands.length >
  448 + 0
  449 + ? false
  450 + : true,
  451 + child: Container(
  452 + height:
  453 + ScreenUtil().setHeight(210),
  454 + child: ListView.builder(
  455 + itemBuilder:
  456 + (BuildContext contxt,
  457 + int index) {
  458 + return NeedItem(detailEntity
  459 + .demands[index]);
  460 + },
  461 + itemCount: detailEntity
  462 + .demands.length,
  463 + shrinkWrap: true,
  464 + scrollDirection:
  465 + Axis.horizontal,
548 ), 466 ),
549 ), 467 ),
550 - )  
551 - ],  
552 - ),  
553 - ),  
554 - Offstage(  
555 - offstage: detailEntity.note_name == '',  
556 - child: RowMultiText(  
557 - "记录人", detailEntity.note_name ?? ""),  
558 - ),  
559 - Offstage(  
560 - offstage: (detailEntity.status == "4" &&  
561 - detailEntity.cancel != null) 468 + ))
  469 + ],
  470 + ),
  471 + ),
  472 + RowMultiText(
  473 + "预订桌位",
  474 + (detailEntity.tables.length.toString() +
  475 + "个")),
  476 + Align(
  477 + alignment: Alignment.centerRight,
  478 + child: Offstage(
  479 + offstage: detailEntity.tables.length > 0
562 ? false 480 ? false
563 : true, 481 : true,
564 - child: Column(  
565 - children: <Widget>[  
566 - MyDivider(double.infinity,  
567 - ScreenUtil().setHeight(2)),  
568 - RowMultiText("取消原因",  
569 - detailEntity.cancel?.desc ?? "",  
570 - textAlign: TextAlign.left),  
571 - RowMultiText(  
572 - "取消时间",  
573 - detailEntity.cancel?.cdateStr ??  
574 - ""),  
575 - RowMultiText(  
576 - "操作人",  
577 - detailEntity.abolition == '2'  
578 - ? '顾客在线取消'  
579 - : detailEntity.cancel?.uname ??  
580 - ""),  
581 - ], 482 + child: Container(
  483 + height: ScreenUtil().setHeight(210),
  484 + child: ListView.builder(
  485 + itemBuilder: (BuildContext contxt,
  486 + int index) {
  487 + return TableItem(
  488 + detailEntity.tables[index]);
  489 + },
  490 + itemCount:
  491 + detailEntity.tables.length,
  492 + shrinkWrap: true,
  493 + scrollDirection: Axis.horizontal,
  494 + ),
582 ), 495 ),
583 - ),  
584 - ],  
585 - )),  
586 - ),  
587 - )),  
588 - ),  
589 - Offstage(  
590 - offstage: (detailEntity.status == "3" ||  
591 - detailEntity.status == "4" ||  
592 - detailEntity.status == "6")  
593 - ? true  
594 - : false,  
595 - child: Container(  
596 - width: double.infinity,  
597 - decoration: BoxDecoration(  
598 - color: MyColours.color_ffffff,  
599 - border: Border(  
600 - top: BorderSide(  
601 - color: MyColours.color_dbe3e3,  
602 - width: ScreenUtil().setWidth(1)))),  
603 - padding: EdgeInsets.symmetric(  
604 - horizontal: ScreenUtil().setHeight(40)),  
605 - margin: EdgeInsets.symmetric(  
606 - vertical: ScreenUtil().setHeight(20)),  
607 - child: CommonButton(  
608 - content: "通知客户",  
609 - width: 669,  
610 - height: 80,  
611 - fontSize: 34,  
612 - onPress: () {  
613 - DialogUtil.showShareDialog(context)?.then((value) {  
614 - switch (value) {  
615 - case 1: //微信  
616 - NavigatorUtil.goInvicationPage(  
617 - context,  
618 - detailEntity.id,  
619 - detailEntity.tableinfoStr,  
620 - detailEntity.ddate,  
621 - detailEntity.ddateStr);  
622 - break;  
623 - case 2: //短信  
624 - NavigatorUtil.goSmsPage(context, detailEntity.id);  
625 - break;  
626 - case 3: //电话  
627 - if (detailEntity.phone != null &&  
628 - detailEntity.phone.isNotEmpty) {  
629 - Utils.goPhone(detailEntity.phone);  
630 - } else {  
631 - Utils.showToast("没有客户电话!");  
632 - }  
633 - break;  
634 - }  
635 - });  
636 - }, 496 + )),
  497 + RowMultiText("客户姓名", detailEntity.rnameStr),
  498 + RowMultiText(
  499 + "客户电话", detailEntity.phone ?? ""),
  500 + MyDivider(double.infinity,
  501 + ScreenUtil().setHeight(1)),
  502 + Container(
  503 + color: MyColours.color_ffffff,
  504 + width: double.infinity,
  505 + height: ScreenUtil().setHeight(80),
  506 + alignment: Alignment.center,
  507 + child: Stack(
  508 + alignment: Alignment.center,
  509 + children: <Widget>[
  510 + Positioned(
  511 + left: 0,
  512 + child: Text(
  513 + "客户经理",
  514 + style: TextStyle(
  515 + color: MyColours.color_828282,
  516 + fontSize:
  517 + ScreenUtil().setSp(30)),
  518 + ),
  519 + ),
  520 + Positioned(
  521 + right: 0,
  522 + child: GestureDetector(
  523 + onTap: () async {
  524 + List<String> list = [];
  525 + for (Manager manager
  526 + in managers) {
  527 + list.add(manager.roleUserName);
  528 + }
  529 + DialogUtil.showSelectCusmanDialog(
  530 + context, list, (value) {
  531 + if (value != null) {
  532 + setState(() {
  533 + cusmanText =
  534 + managers[value.first]
  535 + .userName;
  536 + });
  537 + _setCurrManager();
  538 + }
  539 + }).then((value) {});
  540 + },
  541 + child: Text(
  542 + cusmanText,
  543 + style: TextStyle(
  544 + color: MyColours.color_353535,
  545 + fontSize:
  546 + ScreenUtil().setSp(30),
  547 + decoration:
  548 + TextDecoration.underline,
  549 + ),
  550 + ),
  551 + ),
  552 + )
  553 + ],
  554 + ),
  555 + ),
  556 + Offstage(
  557 + offstage: detailEntity.note_name == '',
  558 + child: RowMultiText(
  559 + "记录人", detailEntity.note_name ?? ""),
  560 + ),
  561 + Offstage(
  562 + offstage: (detailEntity.status == "4" &&
  563 + detailEntity.cancel != null)
  564 + ? false
  565 + : true,
  566 + child: Column(
  567 + children: <Widget>[
  568 + MyDivider(double.infinity,
  569 + ScreenUtil().setHeight(2)),
  570 + RowMultiText("取消原因",
  571 + detailEntity.cancel?.desc ?? "",
  572 + textAlign: TextAlign.left),
  573 + RowMultiText(
  574 + "取消时间",
  575 + detailEntity.cancel?.cdateStr ??
  576 + ""),
  577 + RowMultiText(
  578 + "操作人",
  579 + detailEntity.abolition == '2'
  580 + ? '顾客在线取消'
  581 + : detailEntity.cancel?.uname ??
  582 + ""),
  583 + ],
  584 + ),
  585 + ),
  586 + ],
  587 + )),
637 ), 588 ),
638 - ), 589 + )),
  590 + ),
  591 + Offstage(
  592 + offstage: (detailEntity.status == "3" ||
  593 + detailEntity.status == "4" ||
  594 + detailEntity.status == "6")
  595 + ? true
  596 + : false,
  597 + child: Container(
  598 + width: double.infinity,
  599 + decoration: BoxDecoration(
  600 + color: MyColours.color_ffffff,
  601 + border: Border(
  602 + top: BorderSide(
  603 + color: MyColours.color_dbe3e3,
  604 + width: ScreenUtil().setWidth(1)))),
  605 + padding: EdgeInsets.symmetric(
  606 + horizontal: ScreenUtil().setHeight(40)),
  607 + margin: EdgeInsets.symmetric(
  608 + vertical: ScreenUtil().setHeight(20)),
  609 + child: CommonButton(
  610 + content: "通知客户",
  611 + width: 669,
  612 + height: 80,
  613 + fontSize: 34,
  614 + onPress: () {
  615 + DialogUtil.showShareDialog(context)?.then((value) {
  616 + switch (value) {
  617 + case 1: //微信
  618 + NavigatorUtil.goInvicationPage(
  619 + context,
  620 + detailEntity.id,
  621 + detailEntity.tableinfoStr,
  622 + detailEntity.ddate,
  623 + detailEntity.ddateStr);
  624 + break;
  625 + case 2: //短信
  626 + NavigatorUtil.goSmsPage(context, detailEntity.id);
  627 + break;
  628 + case 3: //电话
  629 + if (detailEntity.phone != null &&
  630 + detailEntity.phone.isNotEmpty) {
  631 + Utils.goPhone(detailEntity.phone);
  632 + } else {
  633 + Utils.showToast("没有客户电话!");
  634 + }
  635 + break;
  636 + }
  637 + });
  638 + },
639 ), 639 ),
640 - Offstage(  
641 - offstage: (detailEntity.status == "3" ||  
642 - detailEntity.status == "4" ||  
643 - detailEntity.status == "6")  
644 - ? true  
645 - : false,  
646 - child: Container(  
647 - width: double.infinity,  
648 - height: ScreenUtil().setWidth(80),  
649 - margin: EdgeInsets.symmetric(  
650 - horizontal: ScreenUtil().setHeight(40)),  
651 - decoration: BoxDecoration(  
652 - border: Border.all(  
653 - color: MyColours.color_199095,  
654 - width: ScreenUtil().setWidth(2)),  
655 - borderRadius:  
656 - BorderRadius.circular(ScreenUtil().setWidth(5)),  
657 - ),  
658 - // child: Text('fff'),  
659 - child: Material(  
660 - child: Row( 640 + ),
  641 + ),
  642 + Offstage(
  643 + offstage: (detailEntity.status == "3" ||
  644 + detailEntity.status == "4" ||
  645 + detailEntity.status == "6")
  646 + ? true
  647 + : false,
  648 + child: Container(
  649 + width: double.infinity,
  650 + height: ScreenUtil().setWidth(80),
  651 + margin: EdgeInsets.symmetric(
  652 + horizontal: ScreenUtil().setHeight(40)),
  653 + decoration: BoxDecoration(
  654 + border: Border.all(
  655 + color: MyColours.color_199095,
  656 + width: ScreenUtil().setWidth(2)),
  657 + borderRadius:
  658 + BorderRadius.circular(ScreenUtil().setWidth(5)),
  659 + ),
  660 + // child: Text('fff'),
  661 + child: Material(
  662 + child: Row(
661 children: [ 663 children: [
662 Expanded( 664 Expanded(
663 child: _cancelAndChangeBtn(() { 665 child: _cancelAndChangeBtn(() {
664 - print('点击变更预订');  
665 - NavigatorUtil.goNoteBookChangePage(  
666 - context, detailEntity, widget.rid);  
667 - }, '变更预订')), 666 + print('点击变更预订');
  667 + NavigatorUtil.goNoteBookChangePage(
  668 + context, detailEntity, widget.rid);
  669 + }, '变更预订')),
668 MyDivider( 670 MyDivider(
669 ScreenUtil().setWidth(2), 671 ScreenUtil().setWidth(2),
670 ScreenUtil().setWidth(50), 672 ScreenUtil().setWidth(50),
@@ -672,15 +674,24 @@ class NotebookDetailPageState extends State<NotebookDetailPage> { @@ -672,15 +674,24 @@ class NotebookDetailPageState extends State<NotebookDetailPage> {
672 ), 674 ),
673 Expanded( 675 Expanded(
674 child: _cancelAndChangeBtn(() { 676 child: _cancelAndChangeBtn(() {
675 - _showCancelWidget(context);  
676 - }, '取消预订')), 677 + _showCancelWidget(context);
  678 + }, '取消预订')),
677 ], 679 ],
678 )), 680 )),
679 - ),  
680 - ),  
681 - VEmptyView(ScreenUtil().setWidth(60))  
682 - ], 681 + ),
683 ), 682 ),
684 - ); 683 + VEmptyView(ScreenUtil().setWidth(60))
  684 + ],
  685 + ),
  686 + ),
  687 + onWillPop: ()async{
  688 + if(widget.fromNotify){
  689 + NavigatorUtil.goHomePage(context,initialIndex: 0);
  690 + return true;
  691 + }
  692 + Navigator.of(context).pop();
  693 + return true;
  694 + },
  695 + );
685 } 696 }
686 } 697 }
@@ -12,20 +12,21 @@ import 'package:one_key/provider/message_dialog_model.dart'; @@ -12,20 +12,21 @@ import 'package:one_key/provider/message_dialog_model.dart';
12 import 'package:one_key/provider/message_model.dart'; 12 import 'package:one_key/provider/message_model.dart';
13 import 'package:one_key/provider/my_model.dart'; 13 import 'package:one_key/provider/my_model.dart';
14 import 'package:one_key/provider/notebook_model.dart'; 14 import 'package:one_key/provider/notebook_model.dart';
  15 +import 'package:one_key/provider/tools.dart';
15 import 'package:one_key/provider/update_model.dart'; 16 import 'package:one_key/provider/update_model.dart';
16 import 'package:one_key/provider/user_model.dart'; 17 import 'package:one_key/provider/user_model.dart';
17 import 'package:one_key/res/colors.dart'; 18 import 'package:one_key/res/colors.dart';
18 import 'package:one_key/utils/log_util.dart'; 19 import 'package:one_key/utils/log_util.dart';
  20 +import 'package:one_key/utils/navigator_util.dart';
19 import 'package:one_key/utils/utils.dart'; 21 import 'package:one_key/utils/utils.dart';
20 import 'package:provider/provider.dart'; 22 import 'package:provider/provider.dart';
21 import 'package:shared_preferences/shared_preferences.dart'; 23 import 'package:shared_preferences/shared_preferences.dart';
22 import 'package:tpns_flutter_plugin/tpns_flutter_plugin.dart'; 24 import 'package:tpns_flutter_plugin/tpns_flutter_plugin.dart';
23 25
24 -class HomePage extends StatefulWidget{ 26 +class HomePage extends StatefulWidget {
  27 + final int initialIndex; //初始tab
25 28
26 - final int initialIndex;//初始tab  
27 -  
28 - HomePage({this.initialIndex=1}); 29 + HomePage({this.initialIndex = 1});
29 30
30 @override 31 @override
31 State<StatefulWidget> createState() { 32 State<StatefulWidget> createState() {
@@ -34,9 +35,7 @@ class HomePage extends StatefulWidget{ @@ -34,9 +35,7 @@ class HomePage extends StatefulWidget{
34 } 35 }
35 } 36 }
36 37
37 -class HomePageState extends State<HomePage> with WidgetsBindingObserver{  
38 -  
39 - 38 +class HomePageState extends State<HomePage> with WidgetsBindingObserver {
40 List<Widget> pages = List<Widget>(); 39 List<Widget> pages = List<Widget>();
41 int _currIndex = 1; 40 int _currIndex = 1;
42 Color _activeColor = MyColours.color_2bb5b7; 41 Color _activeColor = MyColours.color_2bb5b7;
@@ -44,7 +43,7 @@ class HomePageState extends State<HomePage> with WidgetsBindingObserver{ @@ -44,7 +43,7 @@ class HomePageState extends State<HomePage> with WidgetsBindingObserver{
44 43
45 Timer timer; 44 Timer timer;
46 45
47 - int xgCount=1;//注册信鸽次数,最多5次 46 + int xgCount = 1; //注册信鸽次数,最多5次
48 47
49 @override 48 @override
50 void initState() { 49 void initState() {
@@ -52,40 +51,58 @@ class HomePageState extends State<HomePage> with WidgetsBindingObserver{ @@ -52,40 +51,58 @@ class HomePageState extends State<HomePage> with WidgetsBindingObserver{
52 super.initState(); 51 super.initState();
53 LogUtil.v("home_initState"); 52 LogUtil.v("home_initState");
54 WidgetsBinding.instance.addObserver(this); 53 WidgetsBinding.instance.addObserver(this);
55 - _currIndex=widget.initialIndex; 54 + _currIndex = widget.initialIndex;
56 pages 55 pages
57 ..add(ChangeNotifierProvider<MessageModel>( 56 ..add(ChangeNotifierProvider<MessageModel>(
58 - create: (_)=>MessageModel(), 57 + create: (_) => MessageModel(),
59 child: MessagePage(), 58 child: MessagePage(),
60 )) 59 ))
61 ..add(ChangeNotifierProvider<NoteBookModel>( 60 ..add(ChangeNotifierProvider<NoteBookModel>(
62 - create: (_)=>NoteBookModel(), 61 + create: (_) => NoteBookModel(),
63 child: NoteBookPage(), 62 child: NoteBookPage(),
64 )) 63 ))
65 ..add(ChangeNotifierProvider<MyModel>( 64 ..add(ChangeNotifierProvider<MyModel>(
66 - create: (_)=>MyModel(), 65 + create: (_) => MyModel(),
67 child: MyPage(), 66 child: MyPage(),
68 )); 67 ));
69 - WidgetsBinding.instance.addPostFrameCallback((_){  
70 - if(widget.initialIndex==0)return;  
71 - Future.delayed(Duration(milliseconds: 300),(){ 68 + WidgetsBinding.instance.addPostFrameCallback((_) {
  69 + if (widget.initialIndex == 0) return;
  70 + _getIntent();
  71 + Future.delayed(Duration(milliseconds: 300), () {
72 initPlatformState(); 72 initPlatformState();
73 }); 73 });
74 - Future.delayed(Duration(milliseconds: 30000),(){ 74 + Future.delayed(Duration(milliseconds: 30000), () {
75 ContactModel.getInstance().uploadLocalContact(context); 75 ContactModel.getInstance().uploadLocalContact(context);
76 }); 76 });
77 getUntreatedMessage(); 77 getUntreatedMessage();
78 - timer=Timer.periodic(Duration(minutes: 3), (_){ 78 + timer = Timer.periodic(Duration(minutes: 3), (_) {
79 getUntreatedMessage(); 79 getUntreatedMessage();
80 }); 80 });
81 - UpdateModel updateModel=new UpdateModel();  
82 - updateModel.checkUpdate(context,showToast: false); 81 + UpdateModel updateModel = new UpdateModel();
  82 + updateModel.checkUpdate(context, showToast: false);
83 }); 83 });
84 } 84 }
85 85
86 - //初始化信鸽推送  
87 - initPlatformState(){ 86 + _getIntent() async {
  87 + Map notifyParam = await Tools().getIntent();
  88 + LogUtil.v(notifyParam.toString());
  89 + if (notifyParam != null && notifyParam.isNotEmpty) {
  90 + switch (notifyParam["messageType"]) {
  91 + case "10":
  92 + NavigatorUtil.goNotebookDetailPage(context, notifyParam['rid'],
  93 + fromNotify: true);
  94 + break;
  95 + case "11":
  96 + NavigatorUtil.goHandleOnlinePage(
  97 + context, notifyParam["rid"], notifyParam['mid'],
  98 + fromNotify: true);
  99 + break;
  100 + }
  101 + }
  102 + }
88 103
  104 + //初始化信鸽推送
  105 + initPlatformState() {
89 /// 开启DEBUG 106 /// 开启DEBUG
90 XgFlutterPlugin().setEnableDebug(false); 107 XgFlutterPlugin().setEnableDebug(false);
91 108
@@ -95,18 +112,18 @@ class HomePageState extends State<HomePage> with WidgetsBindingObserver{ @@ -95,18 +112,18 @@ class HomePageState extends State<HomePage> with WidgetsBindingObserver{
95 print("flutter onRegisteredDeviceToken: $msg"); 112 print("flutter onRegisteredDeviceToken: $msg");
96 }, 113 },
97 onRegisteredDone: (String msg) async { 114 onRegisteredDone: (String msg) async {
98 - String token="";  
99 - try{  
100 - token=await XgFlutterPlugin.xgToken;  
101 - }catch(e){ 115 + String token = "";
  116 + try {
  117 + token = await XgFlutterPlugin.xgToken;
  118 + } catch (e) {
102 LogUtil.v("注册失败:${e.toString()}"); 119 LogUtil.v("注册失败:${e.toString()}");
103 // Utils.showToast("注册失败:${e.toString()}"); 120 // Utils.showToast("注册失败:${e.toString()}");
104 } 121 }
105 - if(token==null||token.isEmpty){ 122 + if (token == null || token.isEmpty) {
106 LogUtil.v("注册失败:${xgCount.toString()}"); 123 LogUtil.v("注册失败:${xgCount.toString()}");
107 // Utils.showToast("注册失败:${xgCount.toString()}"); 124 // Utils.showToast("注册失败:${xgCount.toString()}");
108 registerPush(); 125 registerPush();
109 - }else{ 126 + } else {
110 LogUtil.v("注册成功:$token"); 127 LogUtil.v("注册成功:$token");
111 // Utils.showToast("注册成功:$token"); 128 // Utils.showToast("注册成功:$token");
112 userTokenInit(token); 129 userTokenInit(token);
@@ -124,6 +141,7 @@ class HomePageState extends State<HomePage> with WidgetsBindingObserver{ @@ -124,6 +141,7 @@ class HomePageState extends State<HomePage> with WidgetsBindingObserver{
124 }, 141 },
125 xgPushDidSetBadge: (String msg) async { 142 xgPushDidSetBadge: (String msg) async {
126 print("flutter xgPushDidSetBadge: $msg"); 143 print("flutter xgPushDidSetBadge: $msg");
  144 +
127 /// 在此可设置应用角标 145 /// 在此可设置应用角标
128 XgFlutterPlugin().setAppBadge(0); 146 XgFlutterPlugin().setAppBadge(0);
129 }, 147 },
@@ -140,7 +158,22 @@ class HomePageState extends State<HomePage> with WidgetsBindingObserver{ @@ -140,7 +158,22 @@ class HomePageState extends State<HomePage> with WidgetsBindingObserver{
140 print("flutter xgPushDidClearAllIdentifiers: $msg"); 158 print("flutter xgPushDidClearAllIdentifiers: $msg");
141 }, 159 },
142 xgPushClickAction: (Map<String, dynamic> msg) async { 160 xgPushClickAction: (Map<String, dynamic> msg) async {
143 - print("flutter xgPushClickAction $msg"); 161 + print("flutter xgPushClickAction ${msg['custom']}");
  162 + if (Platform.isIOS && msg != null && msg['custom'] != null) {
  163 + Map<String, dynamic> custom = msg['custom'];
  164 + switch (custom["messageType"].toString()) {
  165 + case "10":
  166 + NavigatorUtil.goNotebookDetailPage(
  167 + context, custom['rid'].toString(),
  168 + fromNotify: true);
  169 + break;
  170 + case "11":
  171 + NavigatorUtil.goHandleOnlinePage(
  172 + context, custom["rid"].toString(), custom['mid'],
  173 + fromNotify: true);
  174 + break;
  175 + }
  176 + }
144 }, 177 },
145 ); 178 );
146 registerPush(); 179 registerPush();
@@ -148,51 +181,58 @@ class HomePageState extends State<HomePage> with WidgetsBindingObserver{ @@ -148,51 +181,58 @@ class HomePageState extends State<HomePage> with WidgetsBindingObserver{
148 181
149 //注册信鸽 182 //注册信鸽
150 registerPush() async { 183 registerPush() async {
151 - if(xgCount>5)return;  
152 - if(Platform.isAndroid){ 184 + if (xgCount > 5) return;
  185 + if (Platform.isAndroid) {
153 /// 设置OPPO AppKey 和 AppSecret 186 /// 设置OPPO AppKey 和 AppSecret
154 - if(await XgFlutterPlugin().getXgAndroidApi().isOppoRom()){  
155 - XgFlutterPlugin().getXgAndroidApi().enableOppoNotification();  
156 - XgFlutterPlugin().getXgAndroidApi().setOppoPushAppId(appId:"30260281");  
157 - XgFlutterPlugin().getXgAndroidApi().setOppoPushAppKey(appKey: "9b7e372f93794593953f93f118619570");  
158 - }  
159 - // 设置小米 AppID 和 AppKey。  
160 - if(await XgFlutterPlugin().getXgAndroidApi().isMiuiRom()){  
161 - XgFlutterPlugin().getXgAndroidApi().setMiPushAppId(appId:"2882303761518639456");  
162 - XgFlutterPlugin().getXgAndroidApi().setMiPushAppKey(appKey: "5231863961456");  
163 - }  
164 - XgFlutterPlugin().getXgAndroidApi().enableOtherPush(); 187 + if (await XgFlutterPlugin().getXgAndroidApi().isOppoRom()) {
  188 + XgFlutterPlugin().getXgAndroidApi().enableOppoNotification();
  189 + XgFlutterPlugin().getXgAndroidApi().setOppoPushAppId(appId: "30260281");
  190 + XgFlutterPlugin()
  191 + .getXgAndroidApi()
  192 + .setOppoPushAppKey(appKey: "9b7e372f93794593953f93f118619570");
  193 + }
  194 + // 设置小米 AppID 和 AppKey。
  195 + if (await XgFlutterPlugin().getXgAndroidApi().isMiuiRom()) {
  196 + XgFlutterPlugin()
  197 + .getXgAndroidApi()
  198 + .setMiPushAppId(appId: "2882303761518639456");
  199 + XgFlutterPlugin()
  200 + .getXgAndroidApi()
  201 + .setMiPushAppKey(appKey: "5231863961456");
  202 + }
  203 + XgFlutterPlugin().getXgAndroidApi().enableOtherPush();
165 } 204 }
  205 +
166 /// 启动TPNS服务 206 /// 启动TPNS服务
167 LogUtil.v("register:${xgCount.toString()}"); 207 LogUtil.v("register:${xgCount.toString()}");
168 XgFlutterPlugin().startXg("1600012876", "INUIMFK21WGH"); 208 XgFlutterPlugin().startXg("1600012876", "INUIMFK21WGH");
169 xgCount++; 209 xgCount++;
170 } 210 }
171 211
172 -  
173 //初始化推送token 212 //初始化推送token
174 - userTokenInit(String token){  
175 - UserModel userModel=Provider.of<UserModel>(context,listen: false);  
176 - userModel.token=token;  
177 - Map<String,String> params={  
178 - "sid":userModel.user.sellerid,  
179 - "account":userModel.user.account,  
180 - "user_token":Platform.isAndroid?"Android_$token":"Ios_$token" 213 + userTokenInit(String token) {
  214 + UserModel userModel = Provider.of<UserModel>(context, listen: false);
  215 + userModel.token = token;
  216 + Map<String, String> params = {
  217 + "sid": userModel.user.sellerid,
  218 + "account": userModel.user.account,
  219 + "user_token": Platform.isAndroid ? "Android_$token" : "Ios_$token"
181 }; 220 };
182 userModel.userTokenInit(context, params); 221 userModel.userTokenInit(context, params);
183 } 222 }
184 223
185 //获取未处理在线预订消息 224 //获取未处理在线预订消息
186 - getUntreatedMessage(){  
187 - UserModel userModel=Provider.of<UserModel>(context,listen: false);  
188 - Map<String,String> params={  
189 - "sid":userModel.user.sellerid,  
190 - "type_id":"10",//10 在线预订  
191 - "status":"0",//未处理  
192 - "offset":"0",  
193 - "limit":"100", 225 + getUntreatedMessage() {
  226 + UserModel userModel = Provider.of<UserModel>(context, listen: false);
  227 + Map<String, String> params = {
  228 + "sid": userModel.user.sellerid,
  229 + "type_id": "10", //10 在线预订
  230 + "status": "0", //未处理
  231 + "offset": "0",
  232 + "limit": "100",
194 }; 233 };
195 - MessageDialogModel messageModel=Provider.of<MessageDialogModel>(context,listen: false); 234 + MessageDialogModel messageModel =
  235 + Provider.of<MessageDialogModel>(context, listen: false);
196 messageModel.getUntreatedMsg(context, params); 236 messageModel.getUntreatedMsg(context, params);
197 } 237 }
198 238
@@ -200,9 +240,11 @@ class HomePageState extends State<HomePage> with WidgetsBindingObserver{ @@ -200,9 +240,11 @@ class HomePageState extends State<HomePage> with WidgetsBindingObserver{
200 void didChangeAppLifecycleState(AppLifecycleState state) { 240 void didChangeAppLifecycleState(AppLifecycleState state) {
201 // TODO: implement didChangeAppLifecycleState 241 // TODO: implement didChangeAppLifecycleState
202 super.didChangeAppLifecycleState(state); 242 super.didChangeAppLifecycleState(state);
203 - switch(state){  
204 - case AppLifecycleState.resumed://应用前台可见  
205 - getUntreatedMessage(); 243 + switch (state) {
  244 + case AppLifecycleState.resumed: //应用前台可见
  245 + getUntreatedMessage();
  246 + break;
  247 + default:
206 break; 248 break;
207 } 249 }
208 } 250 }
@@ -231,7 +273,8 @@ class HomePageState extends State<HomePage> with WidgetsBindingObserver{ @@ -231,7 +273,8 @@ class HomePageState extends State<HomePage> with WidgetsBindingObserver{
231 title: Text( 273 title: Text(
232 "消息中心", 274 "消息中心",
233 style: TextStyle( 275 style: TextStyle(
234 - color: _currIndex == 0 ? _activeColor : _defaultColor,fontSize: ScreenUtil().setSp(22)), 276 + color: _currIndex == 0 ? _activeColor : _defaultColor,
  277 + fontSize: ScreenUtil().setSp(22)),
235 ), 278 ),
236 ), 279 ),
237 BottomNavigationBarItem( 280 BottomNavigationBarItem(
@@ -248,7 +291,8 @@ class HomePageState extends State<HomePage> with WidgetsBindingObserver{ @@ -248,7 +291,8 @@ class HomePageState extends State<HomePage> with WidgetsBindingObserver{
248 title: Text( 291 title: Text(
249 "预定本", 292 "预定本",
250 style: TextStyle( 293 style: TextStyle(
251 - color: _currIndex == 1 ? _activeColor : _defaultColor,fontSize: ScreenUtil().setSp(22)), 294 + color: _currIndex == 1 ? _activeColor : _defaultColor,
  295 + fontSize: ScreenUtil().setSp(22)),
252 ), 296 ),
253 ), 297 ),
254 BottomNavigationBarItem( 298 BottomNavigationBarItem(
@@ -265,7 +309,8 @@ class HomePageState extends State<HomePage> with WidgetsBindingObserver{ @@ -265,7 +309,8 @@ class HomePageState extends State<HomePage> with WidgetsBindingObserver{
265 title: Text( 309 title: Text(
266 "我的", 310 "我的",
267 style: TextStyle( 311 style: TextStyle(
268 - color: _currIndex == 2 ? _activeColor : _defaultColor,fontSize: ScreenUtil().setSp(22)), 312 + color: _currIndex == 2 ? _activeColor : _defaultColor,
  313 + fontSize: ScreenUtil().setSp(22)),
269 ), 314 ),
270 ), 315 ),
271 ], 316 ],
@@ -276,9 +321,9 @@ class HomePageState extends State<HomePage> with WidgetsBindingObserver{ @@ -276,9 +321,9 @@ class HomePageState extends State<HomePage> with WidgetsBindingObserver{
276 setState(() { 321 setState(() {
277 _currIndex = index; 322 _currIndex = index;
278 }); 323 });
279 - if(_currIndex==2){ 324 + if (_currIndex == 2) {
280 Utils.changeStatusColor(color: MyColours.color_2bb5b7); 325 Utils.changeStatusColor(color: MyColours.color_2bb5b7);
281 - }else{ 326 + } else {
282 Utils.changeStatusColor(color: MyColours.color_ffffff); 327 Utils.changeStatusColor(color: MyColours.color_ffffff);
283 } 328 }
284 } 329 }
@@ -293,11 +338,10 @@ class HomePageState extends State<HomePage> with WidgetsBindingObserver{ @@ -293,11 +338,10 @@ class HomePageState extends State<HomePage> with WidgetsBindingObserver{
293 // TODO: implement dispose 338 // TODO: implement dispose
294 super.dispose(); 339 super.dispose();
295 LogUtil.v("home_dispose"); 340 LogUtil.v("home_dispose");
296 - if(timer!=null){ 341 + if (timer != null) {
297 timer.cancel(); 342 timer.cancel();
298 } 343 }
299 XgFlutterPlugin().stopXg(); 344 XgFlutterPlugin().stopXg();
300 WidgetsBinding.instance.removeObserver(this); 345 WidgetsBinding.instance.removeObserver(this);
301 -  
302 } 346 }
303 } 347 }
@@ -50,7 +50,7 @@ class MessageDialogItem extends StatelessWidget { @@ -50,7 +50,7 @@ class MessageDialogItem extends StatelessWidget {
50 crossAxisAlignment: CrossAxisAlignment.center, 50 crossAxisAlignment: CrossAxisAlignment.center,
51 children: <Widget>[ 51 children: <Widget>[
52 Text( 52 Text(
53 - "在线预订", 53 + message.message_type=="10"?"在线预订":"取消预订",
54 style: TextStyle( 54 style: TextStyle(
55 color: textColor, 55 color: textColor,
56 fontSize: ScreenUtil().setSp(28)), 56 fontSize: ScreenUtil().setSp(28)),
@@ -51,7 +51,7 @@ class MessageItem extends StatelessWidget { @@ -51,7 +51,7 @@ class MessageItem extends StatelessWidget {
51 crossAxisAlignment: CrossAxisAlignment.center, 51 crossAxisAlignment: CrossAxisAlignment.center,
52 children: <Widget>[ 52 children: <Widget>[
53 Text( 53 Text(
54 - "在线预订", 54 + message.message_type=="10"?"在线预订":"取消预订",
55 style: TextStyle( 55 style: TextStyle(
56 color: textColor, 56 color: textColor,
57 fontSize: ScreenUtil().setSp(28)), 57 fontSize: ScreenUtil().setSp(28)),
@@ -49,13 +49,14 @@ class NoteBookPageState extends State<NoteBookPage> { @@ -49,13 +49,14 @@ class NoteBookPageState extends State<NoteBookPage> {
49 _getReserveList(); 49 _getReserveList();
50 _reserveCountDay(); 50 _reserveCountDay();
51 bus.on("refresh_book_list", (args) { 51 bus.on("refresh_book_list", (args) {
52 - _getReserveList(); 52 + _getReserveList();
53 }); 53 });
54 }); 54 });
55 } 55 }
56 56
57 - @override 57 + @override
58 void dispose() { 58 void dispose() {
  59 + super.dispose();
59 bus.off("refresh_book_list"); 60 bus.off("refresh_book_list");
60 } 61 }
61 62
@@ -315,63 +316,63 @@ class NoteBookPageState extends State<NoteBookPage> { @@ -315,63 +316,63 @@ class NoteBookPageState extends State<NoteBookPage> {
315 crossAxisAlignment: CrossAxisAlignment.center, 316 crossAxisAlignment: CrossAxisAlignment.center,
316 children: <Widget>[ 317 children: <Widget>[
317 Offstage( 318 Offstage(
318 - offstage: morning == "00:00-00:00" ? true : false,  
319 - child: Padding(  
320 - padding: EdgeInsets.symmetric(  
321 - horizontal: ScreenUtil().setWidth(10)),  
322 - child: CommonButton(  
323 - content: "早市",  
324 - state: currTimeIndex == 1 ? 1 : 0,  
325 - width: ScreenUtil().setWidth(180),  
326 - height: ScreenUtil().setHeight(100),  
327 - fontSize: 32,  
328 - onPress: () {  
329 - if (currTimeIndex == 1) return;  
330 - setState(() {  
331 - currTimeIndex = 1;  
332 - });  
333 - _getReserveList();  
334 - },  
335 - ))  
336 - ),  
337 - Offstage(  
338 - offstage: noon == "00:00-00:00" ? true : false, 319 + offstage: morning == "00:00-00:00" ? true : false,
339 child: Padding( 320 child: Padding(
340 padding: EdgeInsets.symmetric( 321 padding: EdgeInsets.symmetric(
341 horizontal: ScreenUtil().setWidth(10)), 322 horizontal: ScreenUtil().setWidth(10)),
342 child: CommonButton( 323 child: CommonButton(
343 - content: "午市",  
344 - state: currTimeIndex == 2 ? 1 : 0, 324 + content: "早市",
  325 + state: currTimeIndex == 1 ? 1 : 0,
345 width: ScreenUtil().setWidth(180), 326 width: ScreenUtil().setWidth(180),
346 height: ScreenUtil().setHeight(100), 327 height: ScreenUtil().setHeight(100),
347 fontSize: 32, 328 fontSize: 32,
348 onPress: () { 329 onPress: () {
349 - if (currTimeIndex == 2) return; 330 + if (currTimeIndex == 1) return;
350 setState(() { 331 setState(() {
351 - currTimeIndex = 2; 332 + currTimeIndex = 1;
352 }); 333 });
353 _getReserveList(); 334 _getReserveList();
354 }, 335 },
355 ))), 336 ))),
356 Offstage( 337 Offstage(
357 - offstage: night == "00:00-00:00" ? true : false, 338 + offstage: noon == "00:00-00:00" ? true : false,
358 child: Padding( 339 child: Padding(
359 padding: EdgeInsets.symmetric( 340 padding: EdgeInsets.symmetric(
360 horizontal: ScreenUtil().setWidth(10)), 341 horizontal: ScreenUtil().setWidth(10)),
361 child: CommonButton( 342 child: CommonButton(
362 - content: "晚市",  
363 - state: currTimeIndex == 3 ? 1 : 0, 343 + content: "午市",
  344 + state: currTimeIndex == 2 ? 1 : 0,
364 width: ScreenUtil().setWidth(180), 345 width: ScreenUtil().setWidth(180),
365 height: ScreenUtil().setHeight(100), 346 height: ScreenUtil().setHeight(100),
366 fontSize: 32, 347 fontSize: 32,
367 onPress: () { 348 onPress: () {
368 - if (currTimeIndex == 3) return; 349 + if (currTimeIndex == 2) return;
369 setState(() { 350 setState(() {
370 - currTimeIndex = 3; 351 + currTimeIndex = 2;
371 }); 352 });
372 _getReserveList(); 353 _getReserveList();
373 }, 354 },
374 - )),), 355 + ))),
  356 + Offstage(
  357 + offstage: night == "00:00-00:00" ? true : false,
  358 + child: Padding(
  359 + padding: EdgeInsets.symmetric(
  360 + horizontal: ScreenUtil().setWidth(10)),
  361 + child: CommonButton(
  362 + content: "晚市",
  363 + state: currTimeIndex == 3 ? 1 : 0,
  364 + width: ScreenUtil().setWidth(180),
  365 + height: ScreenUtil().setHeight(100),
  366 + fontSize: 32,
  367 + onPress: () {
  368 + if (currTimeIndex == 3) return;
  369 + setState(() {
  370 + currTimeIndex = 3;
  371 + });
  372 + _getReserveList();
  373 + },
  374 + )),
  375 + ),
375 ], 376 ],
376 ), 377 ),
377 ) 378 )
  1 +import 'dart:convert';
  2 +
  3 +import 'package:flutter/services.dart';
  4 +import 'package:one_key/utils/utils.dart';
  5 +
  6 +class Tools {
  7 + static const MethodChannel _channel = MethodChannel("com.naji/book");
  8 +
  9 + Future<Map> getIntent() async {
  10 + Map result = await _channel.invokeMethod("getIntent");
  11 + // Utils.showToast(json.encode(result));
  12 + return result;
  13 + }
  14 +}
@@ -36,11 +36,12 @@ var homeHandler = new Handler( @@ -36,11 +36,12 @@ var homeHandler = new Handler(
36 ); 36 );
37 }); 37 });
38 38
39 -// 跳转到处理在线预订 39 +// 跳转预订详情页
40 var reserveDetailHandler = new Handler( 40 var reserveDetailHandler = new Handler(
41 handlerFunc: (BuildContext context, Map<String, List<Object>> params) { 41 handlerFunc: (BuildContext context, Map<String, List<Object>> params) {
42 String rid = params['rid'].first; 42 String rid = params['rid'].first;
43 - return NotebookDetailPage(rid); 43 + bool fromNotify=FluroConvertUtils.string2bool(params["fromNotify"].first);
  44 + return NotebookDetailPage(rid,fromNotify: fromNotify,);
44 }); 45 });
45 46
46 // 跳转到处理在线预订 47 // 跳转到处理在线预订
@@ -48,7 +49,8 @@ var handleOnlineHandler = new Handler( @@ -48,7 +49,8 @@ var handleOnlineHandler = new Handler(
48 handlerFunc: (BuildContext context, Map<String, List<Object>> params) { 49 handlerFunc: (BuildContext context, Map<String, List<Object>> params) {
49 String rid = params['rid'].first; 50 String rid = params['rid'].first;
50 String mid = params["mid"].first; 51 String mid = params["mid"].first;
51 - return HandleOnlinePage(rid, mid); 52 + bool fromNotify=FluroConvertUtils.string2bool(params["fromNotify"].first);
  53 + return HandleOnlinePage(rid, mid,fromNotify: fromNotify,);
52 }); 54 });
53 55
54 // 跳转到选择桌位 56 // 跳转到选择桌位
@@ -39,14 +39,14 @@ class NavigatorUtil { @@ -39,14 +39,14 @@ class NavigatorUtil {
39 39
40 /// 订单详情 40 /// 订单详情
41 static void goNotebookDetailPage(BuildContext context, String rid, 41 static void goNotebookDetailPage(BuildContext context, String rid,
42 - {replace = false}) {  
43 - _navigateTo(context, "${Routes.reserve_detail}?rid=$rid", replace: replace); 42 + {bool fromNotify=false,replace = false}) {
  43 + _navigateTo(context, "${Routes.reserve_detail}?rid=$rid&fromNotify=$fromNotify", replace: replace);
44 } 44 }
45 45
46 /// 处理在线预订 46 /// 处理在线预订
47 static void goHandleOnlinePage(BuildContext context, String rid, String mid, 47 static void goHandleOnlinePage(BuildContext context, String rid, String mid,
48 - {replace = false}) {  
49 - _navigateTo(context, "${Routes.handle_online_page}?rid=$rid&mid=$mid", 48 + {fromNotify=false,replace = false}) {
  49 + _navigateTo(context, "${Routes.handle_online_page}?rid=$rid&mid=$mid&fromNotify=$fromNotify",
50 replace: replace); 50 replace: replace);
51 } 51 }
52 52