From 191865b92ae9b5ab34f4609522ce32e05618f17e Mon Sep 17 00:00:00 2001 From: Jolie <> Date: Thu, 18 Dec 2025 17:45:06 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8E=BB=E6=8E=89=E6=94=AF=E4=BB=98=E5=AE=9D?= =?UTF-8?q?=E6=94=AF=E4=BB=98=EF=BC=8C=E9=80=80=E5=87=BA=E5=8F=96=E6=B6=88?= =?UTF-8?q?=E5=BC=B9=E6=A1=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/controller/mine/rose_controller.dart | 35 ++++----- lib/pages/message/chat_page.dart | 2 + lib/widget/live/live_recharge_popup.dart | 98 ++++-------------------- 3 files changed, 35 insertions(+), 100 deletions(-) diff --git a/lib/controller/mine/rose_controller.dart b/lib/controller/mine/rose_controller.dart index c4047aa..26d3bcc 100644 --- a/lib/controller/mine/rose_controller.dart +++ b/lib/controller/mine/rose_controller.dart @@ -4,7 +4,6 @@ import 'package:flutter/material.dart'; import 'package:flutter_smart_dialog/flutter_smart_dialog.dart'; import 'package:fluwx/fluwx.dart'; import 'package:get/get.dart'; -import 'package:url_launcher/url_launcher_string.dart'; class RoseController extends GetxController with WidgetsBindingObserver { @@ -14,7 +13,7 @@ class RoseController extends GetxController with WidgetsBindingObserver { final roseNum = 0.obs; - final payChecked = true.obs; + final payChecked = false.obs; final activePay = 0.obs; @@ -142,9 +141,11 @@ class RoseController extends GetxController with WidgetsBindingObserver { roseList.addAll(data?.toList() ?? []); } else { - // 响应失败,抛出异常 - throw Exception(response.data.message ?? '获取数据失败'); + final errorMessage = response.data.message.isNotEmpty + ? response.data.message + : '获取数据失败'; + throw Exception(errorMessage); } } catch (e) { print('玫瑰列表获取失败: $e'); @@ -176,24 +177,22 @@ class RoseController extends GetxController with WidgetsBindingObserver { "productSpecId": roseList[activePay.value].productSpecId }); if (response.data.isSuccess && response.data.data != null) { - final data = response.data.data; - if(payChecked.value){ - var e = await launchUrlString("alipays://platformapi/startapp?appId=20000067&url=https://www.baidu.com"); - } else { - orderId.value = data!.paymentOrderId ?? ""; - fluwx.open(target: MiniProgram( - username: 'gh_9ea8d46add6f', - miniProgramType: WXMiniProgramType.preview, - path:"pages/index/index?amount=${roseList[activePay.value].unitSellingPrice}&paymentOrderId=${data!.paymentOrderId}&url=touchme-fee" - )); - launchWX.value = true; - } + final data = response.data.data!; + orderId.value = data.paymentOrderId ?? ""; + fluwx.open(target: MiniProgram( + username: 'gh_9ea8d46add6f', + miniProgramType: WXMiniProgramType.preview, + path:"pages/index/index?amount=${roseList[activePay.value].unitSellingPrice}&paymentOrderId=${data.paymentOrderId}&url=touchme-fee" + )); + launchWX.value = true; SmartDialog.showToast('下单成功'); } else { - // 响应失败,抛出异常 - throw Exception(response.data.message ?? '获取数据失败'); + final errorMessage = response.data.message.isNotEmpty + ? response.data.message + : '获取数据失败'; + throw Exception(errorMessage); } } catch (e) { print('玫瑰列表获取失败: $e'); diff --git a/lib/pages/message/chat_page.dart b/lib/pages/message/chat_page.dart index d8dfb75..06986d0 100644 --- a/lib/pages/message/chat_page.dart +++ b/lib/pages/message/chat_page.dart @@ -140,6 +140,8 @@ class _ChatPageState extends State { onWillPop: () async { // 退出页面时停止播放并销毁播放器 await VoicePlayerManager.instance.stop(); + // 关闭礼物弹框 + SmartDialog.dismiss(); return true; }, child: Scaffold( diff --git a/lib/widget/live/live_recharge_popup.dart b/lib/widget/live/live_recharge_popup.dart index a8fa362..ffb22ae 100644 --- a/lib/widget/live/live_recharge_popup.dart +++ b/lib/widget/live/live_recharge_popup.dart @@ -145,62 +145,6 @@ class LiveRechargePopup extends StatelessWidget { color: const Color.fromRGBO(219, 219, 219, 1), ), SizedBox(height: 15.w), - // 支付宝支付 - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Row( - children: [ - Image.asset( - Assets.imagesAliPay, - width: 20.w, - height: 20.w, - ), - SizedBox(width: 6.w), - Text( - "支付宝支付", - style: TextStyle( - fontSize: 13.w, - color: const Color.fromRGBO(51, 51, 51, 1), - fontWeight: FontWeight.w500, - ), - ), - ], - ), - Obx(() { - final checked = controller.payChecked.value; - return GestureDetector( - onTap: () => controller.payChecked.value = true, - child: Container( - width: 18.w, - height: 18.w, - decoration: BoxDecoration( - shape: BoxShape.circle, - color: checked - ? const Color.fromRGBO(117, 98, 249, 1) - : Colors.white, - border: Border.all( - width: 1, - color: checked - ? const Color.fromRGBO(117, 98, 249, 1) - : const Color.fromRGBO(188, 188, 188, 1), - ), - ), - child: checked - ? Center( - child: Icon( - Icons.check, - size: 12.w, - color: Colors.white, - ), - ) - : null, - ), - ); - }), - ], - ), - SizedBox(height: 15.w), // 微信支付 Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, @@ -224,33 +168,23 @@ class LiveRechargePopup extends StatelessWidget { ], ), Obx(() { - final checked = !controller.payChecked.value; - return GestureDetector( - onTap: () => controller.payChecked.value = false, - child: Container( - width: 18.w, - height: 18.w, - decoration: BoxDecoration( - shape: BoxShape.circle, - color: checked - ? const Color.fromRGBO(117, 98, 249, 1) - : Colors.white, - border: Border.all( - width: 1, - color: checked - ? const Color.fromRGBO(117, 98, 249, 1) - : const Color.fromRGBO(188, 188, 188, 1), - ), + return Container( + width: 18.w, + height: 18.w, + decoration: BoxDecoration( + shape: BoxShape.circle, + color: const Color.fromRGBO(117, 98, 249, 1), + border: Border.all( + width: 1, + color: const Color.fromRGBO(117, 98, 249, 1), + ), + ), + child: Center( + child: Icon( + Icons.check, + size: 12.w, + color: Colors.white, ), - child: checked - ? Center( - child: Icon( - Icons.check, - size: 12.w, - color: Colors.white, - ), - ) - : null, ), ); }),