From 3d790bd36a63dad9553d0d7d1190d73c99df787e Mon Sep 17 00:00:00 2001 From: dzc <2388224167@qq.com> Date: Wed, 3 Sep 2025 11:43:49 +0800 Subject: [PATCH] feat:bug --- lib/common/models/api/hard_api_models.dart | 4 ++++ lib/common/models/api/hard_api_models.g.dart | 2 ++ lib/common/widgets/order/select_pay_type_dialog.dart | 10 +++++++--- lib/pages/supermarket_order/controller.dart | 6 ++---- lib/sub_screen/page/sub_product.dart | 2 +- 5 files changed, 16 insertions(+), 8 deletions(-) diff --git a/lib/common/models/api/hard_api_models.dart b/lib/common/models/api/hard_api_models.dart index f572f15..52fe46d 100644 --- a/lib/common/models/api/hard_api_models.dart +++ b/lib/common/models/api/hard_api_models.dart @@ -233,6 +233,9 @@ class ServiceHardOrder { /// 支付方式 final String? payType; + /// 支付方式 + final String? walletId; + ServiceHardOrder({ this.userId, this.username, @@ -241,6 +244,7 @@ class ServiceHardOrder { this.orderType, this.orderStatus, this.payType, + this.walletId, }); factory ServiceHardOrder.fromJson(Map json) => diff --git a/lib/common/models/api/hard_api_models.g.dart b/lib/common/models/api/hard_api_models.g.dart index 9e51f3e..c221a6c 100644 --- a/lib/common/models/api/hard_api_models.g.dart +++ b/lib/common/models/api/hard_api_models.g.dart @@ -128,6 +128,7 @@ ServiceHardOrder _$ServiceHardOrderFromJson(Map json) => orderType: json['orderType'] as String?, orderStatus: json['orderStatus'] as String?, payType: json['payType'] as String?, + walletId: json['walletId'] as String?, ); Map _$ServiceHardOrderToJson(ServiceHardOrder instance) => @@ -139,6 +140,7 @@ Map _$ServiceHardOrderToJson(ServiceHardOrder instance) => 'orderType': instance.orderType, 'orderStatus': instance.orderStatus, 'payType': instance.payType, + 'walletId': instance.walletId, }; ServiceOpenCard _$ServiceOpenCardFromJson(Map json) => diff --git a/lib/common/widgets/order/select_pay_type_dialog.dart b/lib/common/widgets/order/select_pay_type_dialog.dart index d46ebf4..0460395 100644 --- a/lib/common/widgets/order/select_pay_type_dialog.dart +++ b/lib/common/widgets/order/select_pay_type_dialog.dart @@ -37,7 +37,7 @@ class SelectPayTypeDialogController extends GetxController { )? onQrCodeScanRecognition; // |"二维码扫一扫支付" "支付成功"| - Future Function()? onQrCodeScanPaySuccess; + Future Function(ServiceUser? payUser)? onQrCodeScanPaySuccess; // |取消|的回调 VoidCallback? onCancel; @@ -520,12 +520,16 @@ class SelectPayTypeDialogController extends GetxController { Toast.error(msg: "未支付,请检查用户是否扫码支付"); return; } + // 设置支付用户 + payUser.value?.walletId = order.walletId; SubScreenPlugin.sendMsgToViceScreen( SubScreenAction.qrCodeScanSuccess.name, ); // 支付成功 - await onQrCodeScanPaySuccess?.call(); + await onQrCodeScanPaySuccess?.call(payUser.value); isRecognition.value = false; + _closeStatus(); + Navigator.of(Get.context!).pop(); }, ); } catch (error, stack) { @@ -559,7 +563,7 @@ class SelectPayTypeDialogController extends GetxController { continue; } if (order.orderStatus == OrderStatus.PAY.code) { - logger.e( + logger.i( "|$_tag|轮训查询二维码订单状态,订单支付成功,sqlOrderId|$serviceOrderId|orderJson|${order.toJson()}|", ); return order; diff --git a/lib/pages/supermarket_order/controller.dart b/lib/pages/supermarket_order/controller.dart index f6294e5..6c8518c 100644 --- a/lib/pages/supermarket_order/controller.dart +++ b/lib/pages/supermarket_order/controller.dart @@ -281,10 +281,8 @@ class SupermarketOrderController extends GetxController with OrderMixin { }; // |"二维码扫一扫支付" "支付成功"| - payTypeSelect.onQrCodeScanPaySuccess = () async { - // 校验 - final validPayUser = _validatePayUser(); - if (!validPayUser) return; + payTypeSelect.onQrCodeScanPaySuccess = (payUser) async { + if (payUser != null) this.payUser.value = payUser; final validShopCar = _validateShopCar(); if (!validShopCar) return; // 总金额 diff --git a/lib/sub_screen/page/sub_product.dart b/lib/sub_screen/page/sub_product.dart index bdb8710..cacf05f 100644 --- a/lib/sub_screen/page/sub_product.dart +++ b/lib/sub_screen/page/sub_product.dart @@ -85,7 +85,7 @@ class _SubProductPageState extends State { context, controller: qrCodeController, qrData: subScreenEvent.qrCodeData, - countDownSeconds: 30, + countDownSeconds: 300, onFinished: () {}, ); }