diff --git a/lib/pages/card_active/controller.dart b/lib/pages/card_active/controller.dart index 18fdff7..7b1133b 100644 --- a/lib/pages/card_active/controller.dart +++ b/lib/pages/card_active/controller.dart @@ -26,6 +26,9 @@ class CardActiveController extends GetxController { // 写卡 RxBool writeLoading = false.obs; + // 卡号 + final carNumberC = TextEditingController(); + _initData() { update(["card_active"]); } @@ -45,13 +48,24 @@ class CardActiveController extends GetxController { @override void onClose() { super.onClose(); + carNumberC.dispose(); } Future doPage({int? page}) async { if (page != null) currentPage.value = page; + // 收起键盘 + FocusManager.instance.primaryFocus?.unfocus(); getTableList(); } + Future doReset() async { + currentPage.value = 1; + carNumberC.clear(); + // 收起键盘 + FocusManager.instance.primaryFocus?.unfocus(); + await getTableList(); + } + Future getTableList() async { EasyLoading.show( status: '查询中...', @@ -65,6 +79,7 @@ class CardActiveController extends GetxController { "size": pageSize.value, "deptId": "", "walletTypeId": "", + "cardNumber": carNumberC.text, }; final data = await WalletApi.openCardList(pa); if (data == null) return; diff --git a/lib/pages/card_active/view.dart b/lib/pages/card_active/view.dart index 6429f64..af0ab42 100644 --- a/lib/pages/card_active/view.dart +++ b/lib/pages/card_active/view.dart @@ -22,6 +22,37 @@ class CardActivePage extends GetView { onTap: () => Get.offAndToNamed(RouteNames.panel), ), const Spacer(), + FTextField( + controller: controller.carNumberC, + hint: '请输入卡号', + maxLines: 1, + ).width(300.w), + FButton( + prefix: FIcon( + FAssets.icons.ban, + size: theme.typography.base.fontSize, + ), + label: Text( + '重置', + style: theme.typography.base.copyWith( + color: theme.colorScheme.secondary, + ), + ), + onPress: () => controller.doReset(), + ), + FButton( + prefix: FIcon( + FAssets.icons.search, + size: theme.typography.base.fontSize, + ), + label: Text( + '搜索', + style: theme.typography.base.copyWith( + color: theme.colorScheme.secondary, + ), + ), + onPress: () => controller.doPage(page: 1), + ), FButton( prefix: FIcon( FAssets.icons.idCard, @@ -34,21 +65,7 @@ class CardActivePage extends GetView { style: FButtonStyle.secondary, onPress: () => controller.doReadCard(), ), - SizedBox(width: 20.w), - FButton( - prefix: FIcon( - FAssets.icons.search, - size: theme.typography.base.fontSize, - ), - label: Text( - '搜索', - style: theme.typography.base.copyWith( - color: theme.colorScheme.secondary, - ), - ), - onPress: () => controller.doPage(), - ), - ].toRow(); + ].toRowSpace(space: 15.w); } // 主视图