You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

441 lines
19 KiB

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/generated/assets.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<MyWalletController>(
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();
await controller.getWalletData();
controller.listRefreshController.finishRefresh(IndicatorResult.success);
controller.listRefreshController.finishLoad(IndicatorResult.none);
},
// 上拉加载更多
onLoad: () async {
print('推荐列表上拉加载被触发, hasMore: ');
controller.page.value += 1;
controller.getHistoryList();
},
child: SingleChildScrollView(
child: ConstrainedBox(
constraints: BoxConstraints(
minHeight: MediaQuery.of(context).size.height - MediaQuery.of(context).padding.top,
),
child: Column(
children: [
Stack(
children: [
Image.asset(
Assets.imagesMyWalletBg,
width: 346.w,
height: 168.w,
),
Container(
width: 346.w,
height: 168.w,
margin: EdgeInsets.only(
bottom: 19.w
),
padding: EdgeInsets.only(
top: 17.w,
right: 13.w,
left: 13.w
),
decoration: BoxDecoration(
borderRadius: BorderRadius.all(Radius.circular(8.w)),
),
child: Column(
children: [
Row(
children: [
Text(
"钱包余额(元)",
style: TextStyle(
fontSize: 14.w,
color: Colors.white,
fontWeight: FontWeight.w500
),
),
SizedBox(width: 9.w,),
Icon(
controller.visibility.value ? Icons.visibility : Icons.visibility_off,
size: 16.w,
color: Colors.white,
).onTap((){
controller.visibility.value = !controller.visibility.value;
})
],
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
if(controller.walletData.value.id != null) Text(
controller.visibility.value ? "${controller.walletData.value.totalBalance?.toStringAsFixed(2)}" : controller.walletData.value.totalBalance!.toStringAsFixed(2).replaceAll(RegExp(r'\d'), '*'),
style: TextStyle(
fontSize: 30.w,
color: Colors.white,
fontWeight: FontWeight.w700
),
),
if(controller.walletData.value.id == null) Text(
controller.visibility.value ? "0.00" : "*.**",
style: TextStyle(
fontSize: 30.w,
color: Colors.white,
fontWeight: FontWeight.w700
),
),
Container(
width: 108.w,
height: 32.w,
decoration: BoxDecoration(
borderRadius: BorderRadius.all(Radius.circular(32.w)),
color: Colors.white
),
child: Center(
child: Text(
"提现",
style: TextStyle(
fontSize: 15.w,
color: const Color.fromRGBO(64, 136, 225, 1),
fontWeight: FontWeight.w500
),
),
),
).onTap(() {
Get.to(() => WithdrawPage(availableWithdrawBalance: controller.walletData.value.availableWithdrawBalance ?? 0))?.then((e) async {
controller.page.value = 1;
controller.walletHistoryList.clear();
await controller.getHistoryList();
await controller.getWalletData();
controller.listRefreshController.finishRefresh(IndicatorResult.success);
controller.listRefreshController.finishLoad(IndicatorResult.none);
});
})
],
),
SizedBox(height: 15.w,),
Row(
children: [
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
"可提现(元)",
style: TextStyle(
fontSize: 9.w,
color: Colors.white,
fontWeight: FontWeight.w500
),
),
Text(
"${controller.walletData.value.id != null ? controller.walletData.value.availableWithdrawBalance?.toStringAsFixed(2) : "0.00"}",
style: TextStyle(
fontSize: 13.w,
color: Colors.white,
fontWeight: FontWeight.w700
),
)
],
),
Container(
width: 1,
height: 32.w,
color: const Color.fromRGBO(255, 255, 255, .2),
margin: EdgeInsets.symmetric(
horizontal: 20.w
),
),
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
"计算中(元)",
style: TextStyle(
fontSize: 9.w,
color: Colors.white,
fontWeight: FontWeight.w500
),
),
Text(
"${controller.walletData.value.id != null ? controller.walletData.value.settlementBalance?.toStringAsFixed(2) : "0.00"}",
style: TextStyle(
fontSize: 13.w,
color: Colors.white,
fontWeight: FontWeight.w700
),
)
],
),
Container(
width: 1,
height: 32.w,
color: const Color.fromRGBO(255, 255, 255, .2),
margin: EdgeInsets.symmetric(
horizontal: 20.w
),
),
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
"提现中(元)",
style: TextStyle(
fontSize: 9.w,
color: Colors.white,
fontWeight: FontWeight.w500
),
),
Text(
"${controller.walletData.value.id != null ? controller.walletData.value.frozenBalance?.toStringAsFixed(2) : "0.00"}",
style: TextStyle(
fontSize: 13.w,
color: Colors.white,
fontWeight: FontWeight.w700
),
)
],
),
],
),
Container(
height: 1,
margin: EdgeInsets.only(
top: 16.w,
bottom: 5.w
),
color: const Color.fromRGBO(255, 255, 255, .2),
),
Opacity(
opacity: .6,
child: Row(
children: [
Image.asset(
Assets.imagesQuestionIcon,
width: 13.w,
),
SizedBox(
width: 5.w,
),
Text(
"提现说明:收益到账后满 3 天方可申请提现,提现金额最低 50 元",
style: TextStyle(
fontSize: 9.w,
color: Colors.white
),
)
],
),
)
],
),
),
],
),
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<InfoItem> createState() => _InfoItemState();
}
class _InfoItemState extends State<InfoItem> {
@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 == 112 ? "礼物收益" :
widget.item.tradeType == 113 ? "邀请分成" :
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)
// ),
// ),
],
)
],
),
);
}
}