王子贤 3 months ago
parent
commit
e53322e271
3 changed files with 35 additions and 100 deletions
  1. 35
      lib/controller/mine/rose_controller.dart
  2. 2
      lib/pages/message/chat_page.dart
  3. 98
      lib/widget/live/live_recharge_popup.dart

35
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');

2
lib/pages/message/chat_page.dart

@ -140,6 +140,8 @@ class _ChatPageState extends State<ChatPage> {
onWillPop: () async {
// 退
await VoicePlayerManager.instance.stop();
//
SmartDialog.dismiss();
return true;
},
child: Scaffold(

98
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,
),
);
}),

Loading…
Cancel
Save