diff --git a/lib/common/widgets/app/app_wallet_selector.dart b/lib/common/widgets/app/app_wallet_selector.dart index 6b66632..6f2efd1 100644 --- a/lib/common/widgets/app/app_wallet_selector.dart +++ b/lib/common/widgets/app/app_wallet_selector.dart @@ -16,7 +16,17 @@ Widget appWalletSelector( if (ObjectUtil.isEmpty(list)) { return const SizedBox(); } - ServiceWallet currentSelector = list[0]; + ServiceWallet? currentSelector = selector; + // 判断是为为自己的钱包 + if (currentSelector != null) { + final target = list.firstWhereOrNull( + (item) => item.userId == currentSelector!.userId, + ); + if (target == null) { + currentSelector = null; + } + } + currentSelector ??= list[0]; onChange(currentSelector); final theme = FTheme.of(context); return list diff --git a/lib/common/widgets/order/mixin/order_mixin.dart b/lib/common/widgets/order/mixin/order_mixin.dart index 5116e27..e69094e 100644 --- a/lib/common/widgets/order/mixin/order_mixin.dart +++ b/lib/common/widgets/order/mixin/order_mixin.dart @@ -455,17 +455,26 @@ mixin OrderMixin { void putOffSendSubScreen({int seconds = 5}) { if (putOffSendSubScreenDelayed != null) { - sendSubScreen(); + sendSubScreenBack(); putOffSendSubScreenDelayed = null; return; } putOffSendSubScreenDelayed = Future.delayed(Duration(seconds: seconds), () { - sendSubScreen(); + sendSubScreenBack(); putOffSendSubScreenDelayed = null; }); } + Future sendSubScreenBack() async { + await SubScreenPlugin.sendMsgToViceScreen( + SubScreenAction.jumpSubBack.name, + ); + } + Future sendSubScreen() async { + await SubScreenPlugin.sendMsgToViceScreen( + SubScreenAction.jumpSubPage.name, + ); final json = SubScreenProductEvent( shopList: shopCardList.map((e) => e.toJson()).toList(), sysType: _sysType, diff --git a/lib/common/widgets/order/select_pay_type_dialog.dart b/lib/common/widgets/order/select_pay_type_dialog.dart index 7ed8c85..143f66c 100644 --- a/lib/common/widgets/order/select_pay_type_dialog.dart +++ b/lib/common/widgets/order/select_pay_type_dialog.dart @@ -138,6 +138,7 @@ class SelectPayTypeDialogController extends GetxController { _closeStatus() { payUser.value = null; userWalletList.value = []; + currentWallet.value = null; isRecognition.value = false; globalQrCode = null; _faceCallbackLock = false; diff --git a/lib/sub_screen/common/key/navigator_key.dart b/lib/sub_screen/common/key/navigator_key.dart index 44e24b0..5b78357 100644 --- a/lib/sub_screen/common/key/navigator_key.dart +++ b/lib/sub_screen/common/key/navigator_key.dart @@ -1,5 +1,8 @@ import 'package:flutter/cupertino.dart'; +import '../routers/index.dart'; + abstract class SubNavigatorKey { static GlobalKey navigatorKey = GlobalKey(); + static String currentRouteName = SubRouteNames.root; } diff --git a/lib/sub_screen/common/utils/sub_page_tool.dart b/lib/sub_screen/common/utils/sub_page_tool.dart index 1f11b21..3dfa705 100644 --- a/lib/sub_screen/common/utils/sub_page_tool.dart +++ b/lib/sub_screen/common/utils/sub_page_tool.dart @@ -5,18 +5,27 @@ import 'package:pj_supermarket_cloud/sub_screen/common/index.dart'; class SubPageToool { static void switchJump(SubScreenAction type) { + // 判断是否要跳转的页面就是当前页面 switch (type) { case SubScreenAction.jumpSubPage: + if (SubNavigatorKey.currentRouteName == SubRouteNames.subProduct) { + return; + } SubNavigatorKey.navigatorKey.currentState?.pushNamedAndRemoveUntil( SubRouteNames.subProduct, (Route route) => false, ); + SubNavigatorKey.currentRouteName = SubRouteNames.subProduct; break; case SubScreenAction.jumpSubBack: + if (SubNavigatorKey.currentRouteName == SubRouteNames.root) { + return; + } SubNavigatorKey.navigatorKey.currentState?.pushNamedAndRemoveUntil( SubRouteNames.root, (Route route) => false, ); + SubNavigatorKey.currentRouteName = SubRouteNames.root; break; default: }