import 'package:dating_touchme_app/components/page_appbar.dart'; import 'package:dating_touchme_app/controller/mine/my_wallet_controller.dart'; import 'package:dating_touchme_app/extension/ex_widget.dart'; import 'package:dating_touchme_app/pages/mine/withdraw_page.dart'; import 'package:easy_refresh/easy_refresh.dart'; import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:get/get.dart'; import '../../model/mine/wallet_account_record_data.dart'; class MyWalletPage extends StatelessWidget { const MyWalletPage({super.key}); @override Widget build(BuildContext context) { return GetX( init: MyWalletController(), builder: (controller){ return Scaffold( appBar: PageAppbar(title: "我的钱包"), body: EasyRefresh( controller: controller.listRefreshController, header: const ClassicHeader( dragText: '下拉刷新', armedText: '释放刷新', readyText: '刷新中...', processingText: '刷新中...', processedText: '刷新完成', failedText: '刷新失败', noMoreText: '没有更多数据', showMessage: false ), footer: ClassicFooter( dragText: '上拉加载', armedText: '释放加载', readyText: '加载中...', processingText: '加载中...', processedText: '加载完成', failedText: '加载失败', noMoreText: '没有更多数据', showMessage: false ), // 下拉刷新 onRefresh: () async { print('推荐列表下拉刷新被触发'); controller.page.value = 1; controller.walletHistoryList.clear(); await controller.getHistoryList(); controller.listRefreshController.finishRefresh(IndicatorResult.success); controller.listRefreshController.finishLoad(IndicatorResult.none); }, // 上拉加载更多 onLoad: () async { print('推荐列表上拉加载被触发, hasMore: '); controller.page.value += 1; controller.getHistoryList(); }, child: SingleChildScrollView( child: Column( children: [ Container( height: 44.w, margin: EdgeInsets.only( top: 9.w, bottom: 16.w ), child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Container( width: 72.w, height: 44.w, decoration: BoxDecoration( border: Border( bottom: BorderSide( width: 1, color: Color.fromRGBO(117, 98, 249, controller.timeActive.value == 1 ? 1 : 0) ) ) ), child: Center( child: Text( "最近一个月", style: TextStyle( fontSize: 14.w, color: Color.fromRGBO(51, 51, 51, controller.timeActive.value == 1 ? 1 : .5), fontWeight: controller.timeActive.value == 1 ? FontWeight.w700 : FontWeight.w400 ), ), ), ).onTap(() async { controller.timeActive.value = 1; controller.page.value = 1; controller.walletHistoryList.clear(); await controller.getHistoryList(); controller.listRefreshController.finishRefresh(IndicatorResult.success); controller.listRefreshController.finishLoad(IndicatorResult.none); }), Container( width: 72.w, height: 44.w, decoration: BoxDecoration( border: Border( bottom: BorderSide( width: 1, color: Color.fromRGBO(117, 98, 249, controller.timeActive.value == 2 ? 1 : 0) ) ) ), child: Center( child: Text( "3个月", style: TextStyle( fontSize: 14.w, color: Color.fromRGBO(51, 51, 51, controller.timeActive.value == 2 ? 1 : .5), fontWeight: controller.timeActive.value == 2 ? FontWeight.w700 : FontWeight.w400 ), ), ), ).onTap(() async { controller.timeActive.value = 2; controller.page.value = 1; controller.walletHistoryList.clear(); await controller.getHistoryList(); controller.listRefreshController.finishRefresh(IndicatorResult.success); controller.listRefreshController.finishLoad(IndicatorResult.none); }), Container( width: 72.w, height: 44.w, decoration: BoxDecoration( border: Border( bottom: BorderSide( width: 1, color: Color.fromRGBO(117, 98, 249, controller.timeActive.value == 3 ? 1 : 0) ) ) ), child: Center( child: Text( "6个月", style: TextStyle( fontSize: 14.w, color: Color.fromRGBO(51, 51, 51, controller.timeActive.value == 13 ? 1 : .5), fontWeight: controller.timeActive.value == 3 ? FontWeight.w700 : FontWeight.w400 ), ), ), ).onTap(() async { controller.timeActive.value = 3; controller.page.value = 1; controller.walletHistoryList.clear(); await controller.getHistoryList(); controller.listRefreshController.finishRefresh(IndicatorResult.success); controller.listRefreshController.finishLoad(IndicatorResult.none); }), Container( width: 72.w, height: 44.w, decoration: BoxDecoration( border: Border( bottom: BorderSide( width: 1, color: Color.fromRGBO(117, 98, 249, controller.timeActive.value == 4 ? 1 : 0) ) ) ), child: Center( child: Text( "全部", style: TextStyle( fontSize: 14.w, color: Color.fromRGBO(51, 51, 51, controller.timeActive.value == 4 ? 1 : .5), fontWeight: controller.timeActive.value == 4 ? FontWeight.w700 : FontWeight.w400 ), ), ), ).onTap(() async { controller.timeActive.value = 4; controller.page.value = 1; controller.walletHistoryList.clear(); await controller.getHistoryList(); controller.listRefreshController.finishRefresh(IndicatorResult.success); controller.listRefreshController.finishLoad(IndicatorResult.none); }), ], ), ), Container( width: 355.w, height: 129.w, margin: EdgeInsets.only( bottom: 24.w ), padding: EdgeInsets.symmetric( vertical: 12.w ), decoration: BoxDecoration( borderRadius: BorderRadius.all(Radius.circular(10.w)), color: const Color.fromRGBO(247, 247, 247, 1) ), child: Column( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Container( width: 255.w, padding: EdgeInsets.symmetric( horizontal: 16.w ), child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( "${controller.walletData.value.totalBalance ?? ""}", style: TextStyle( fontSize: 20.w, fontWeight: FontWeight.w500 ), ), SizedBox(height: 6.w,), Text( "总余额(元)", style: TextStyle( fontSize: 13.w, color: const Color.fromRGBO(102, 102, 102, 1) ), ) ], ), Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( "${controller.walletData.value.settlementBalance ?? ""}", style: TextStyle( fontSize: 20.w, fontWeight: FontWeight.w500, color: const Color.fromRGBO(117, 98, 249, 1) ), ), SizedBox(height: 6.w,), Text( "结算中金额(元)", style: TextStyle( fontSize: 13.w, color: const Color.fromRGBO(102, 102, 102, 1) ), ) ], ), ], ), ), Container( width: 255.w, height: 42.w, decoration: BoxDecoration( borderRadius: BorderRadius.all(Radius.circular(42.w)), color: const Color.fromRGBO(117, 98, 249, 1) ), child: Center( child: Text( "提现", style: TextStyle( fontSize: 14.w, fontWeight: FontWeight.w500, color: Colors.white ), ), ), ).onTap(() { Get.to(() => WithdrawPage(availableWithdrawBalance: controller.walletData.value.availableWithdrawBalance ?? 0)); }) ], ), ), Padding( padding: EdgeInsetsGeometry.symmetric( horizontal: 10.w ), child: Row( crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( "流水明细", style: TextStyle( fontSize: 13.w, fontWeight: FontWeight.w500 ), ) ], ), ), SizedBox(height: 22.w,), ...controller.walletHistoryList.map((e){ return InfoItem(item: e,); }), ], ), ), ), ); }, ); } } class InfoItem extends StatefulWidget { final Records item; const InfoItem({super.key, required this.item}); @override State createState() => _InfoItemState(); } class _InfoItemState extends State { @override Widget build(BuildContext context) { return Container( padding: EdgeInsetsGeometry.only( left: 16.w, right: 16.w, bottom: 12.w, ), margin: EdgeInsets.only( bottom: 16.w ), decoration: BoxDecoration( border: Border( bottom: BorderSide( width: 1, color: const Color.fromRGBO(235, 238, 238, 1) ) ) ), child: Column( children: [ Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Text( "订单类型:${widget.item.tradeType == 101 ? "嘉宾实名认证" : widget.item.tradeType == 102 ? "发布悬赏招亲" : widget.item.tradeType == 103 ? "匹配悬赏招亲" : widget.item.tradeType == 104 ? "红娘入驻推荐" : widget.item.tradeType == 105 ? "悬赏招亲见面费用" : widget.item.tradeType == 106 ? "抽奖活动奖励" : widget.item.tradeType == 107 ? "活动邀约佣金" : widget.item.tradeType == 108 ? "服务商入驻推荐" : widget.item.tradeType == 109 ? "管道收益" : widget.item.tradeType == 110 ? "红娘新手任务奖励" : widget.item.tradeType == 111 ? "聊天收益" : widget.item.tradeType == 201 ? "平台服务费" : widget.item.tradeType == 202 ? "提现" : ""}", style: TextStyle( fontSize: 14.w, ), ), RichText( text: TextSpan( style: TextStyle( fontSize: 14.w, fontWeight: FontWeight.w500 ), children: [ TextSpan( text: "金额:", ), TextSpan( text: "${(widget.item.isIncome ?? false) ? "" : "-"}${widget.item.tradeAmount}", style: TextStyle( color: const Color.fromRGBO(117, 98, 249, 1) ) ), ] ), ) ], ), // SizedBox(height: 8.w,), // Row( // mainAxisAlignment: MainAxisAlignment.spaceBetween, // children: [ // Text( // "服务嘉宾:张三", // style: TextStyle( // fontSize: 12.w, // ), // ), // RichText( // text: TextSpan( // style: TextStyle( // fontSize: 12.w, // fontWeight: FontWeight.w500 // ), // children: [ // TextSpan( // text: "营收:", // ), // TextSpan( // text: "680.00", // style: TextStyle( // color: const Color.fromRGBO(117, 98, 249, 1) // ) // ), // ] // ), // ) // ], // ), SizedBox(height: 8.w,), Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Text( "时间:${widget.item.createTime}", style: TextStyle( fontSize: 12.w, color: const Color.fromRGBO(153, 153, 153, 1) ), ), // Text( // "查看打款凭证", // style: TextStyle( // fontSize: 12.w, // color: const Color.fromRGBO(25, 114, 248, 1) // ), // ), ], ) ], ), ); } }