From 19a170f0dfcbb42f9a245db3c71f304f2fc3eb7e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E5=AD=90=E8=B4=A4?= Date: Tue, 25 Nov 2025 14:35:49 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AF=B9=E6=8E=A5=E9=92=B1=E5=8C=85=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3=EF=BC=8C=E5=AF=B9=E6=8E=A5=E9=92=B1=E5=8C=85=E6=B5=81?= =?UTF-8?q?=E6=B0=B4=E6=8E=A5=E5=8F=A3=EF=BC=8C=E4=BC=98=E5=8C=96=E5=87=A0?= =?UTF-8?q?=E4=B8=AA=E4=B8=8B=E6=8B=89=E5=8A=A0=E8=BD=BD=E5=88=97=E8=A1=A8?= =?UTF-8?q?=EF=BC=8C=E4=BC=98=E5=8C=96=E7=BC=96=E8=BE=91=E5=A4=B4=E5=83=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/controller/mine/edit_info_controller.dart | 4 +- lib/controller/mine/my_wallet_controller.dart | 108 ++++ .../mine/rose_history_controller.dart | 13 +- .../mine/withdraw_history_controller.dart | 13 + lib/model/mine/user_data.dart | 6 +- lib/model/mine/wallet_account_data.dart | 40 ++ .../mine/wallet_account_record_data.dart | 72 +++ lib/network/api_urls.dart | 4 + lib/network/user_api.dart | 31 +- lib/network/user_api.g.dart | 83 +++ lib/pages/mine/edit_info_page.dart | 5 + lib/pages/mine/my_wallet_page.dart | 586 ++++++++++-------- lib/pages/mine/rose_history_page.dart | 35 +- lib/pages/mine/withdraw_history_page.dart | 63 +- lib/pages/mine/withdraw_page.dart | 5 +- 15 files changed, 772 insertions(+), 296 deletions(-) create mode 100644 lib/controller/mine/my_wallet_controller.dart create mode 100644 lib/model/mine/wallet_account_data.dart create mode 100644 lib/model/mine/wallet_account_record_data.dart diff --git a/lib/controller/mine/edit_info_controller.dart b/lib/controller/mine/edit_info_controller.dart index 765fd38..3bbb56c 100644 --- a/lib/controller/mine/edit_info_controller.dart +++ b/lib/controller/mine/edit_info_controller.dart @@ -542,7 +542,9 @@ class EditInfoController extends GetxController { }; final avatarAuditResp = await _userApi.saveCertificationAudit(avatarPayload); if (avatarAuditResp.data.isSuccess) { - + userData.value?.auditProfilePhoto = { + "auditStatus": 0 + }; } else{ SmartDialog.showToast(avatarAuditResp.data.message); diff --git a/lib/controller/mine/my_wallet_controller.dart b/lib/controller/mine/my_wallet_controller.dart new file mode 100644 index 0000000..90c156e --- /dev/null +++ b/lib/controller/mine/my_wallet_controller.dart @@ -0,0 +1,108 @@ +import 'package:dating_touchme_app/model/mine/wallet_account_data.dart'; +import 'package:dating_touchme_app/network/user_api.dart'; +import 'package:easy_refresh/easy_refresh.dart'; +import 'package:flutter_smart_dialog/flutter_smart_dialog.dart'; +import 'package:get/get.dart'; + +import '../../model/mine/wallet_account_record_data.dart'; + +class MyWalletController extends GetxController { + + final timeActive = 1.obs; + + final walletData = WalletAccountData().obs; + + final walletHistoryList = [].obs; + + final page = 1.obs; + + final size = 10.obs; + + late UserApi _userApi; + + late final EasyRefreshController listRefreshController; + + @override + void onInit() { + super.onInit(); + _userApi = Get.find(); + + listRefreshController = EasyRefreshController( + controlFinishRefresh: true, + controlFinishLoad: true, + ); + getWalletData(); + getHistoryList(); + print(formatStartTimestamp(DateTime.now().millisecondsSinceEpoch - 86400000 * 30)); + print(formatStartTimestamp(DateTime.now().millisecondsSinceEpoch - 86400000 * 90)); + print(formatStartTimestamp(DateTime.now().millisecondsSinceEpoch - 86400000 * 180)); + } + + String formatStartTimestamp(int ms) { + final dt = DateTime.fromMillisecondsSinceEpoch(ms); + String two(int n) => n.toString().padLeft(2, '0'); + + return "${dt.year}-${two(dt.month)}-${two(dt.day)} " + "00:00:00"; + } + + String formatEndTimestamp(int ms) { + final dt = DateTime.fromMillisecondsSinceEpoch(ms); + String two(int n) => n.toString().padLeft(2, '0'); + + return "${dt.year}-${two(dt.month)}-${two(dt.day)} " + "23:59:59"; + } + + + getWalletData() async { + try { + final response = await _userApi.getWalletAccount({}); + if (response.data.isSuccess && response.data.data != null) { + walletData.value = response.data.data ?? WalletAccountData(); + } else { + + // 响应失败,抛出异常 + throw Exception(response.data.message ?? '获取数据失败'); + } + } catch(e){ + print('钱包数据获取失败: $e'); + SmartDialog.showToast('钱包数据获取失败'); + rethrow; + + } + } + + getHistoryList() async { + try { + final response = await _userApi.getWalletAccountRecord( + pageNum: page.value, + pageSize: size.value, + recordTimeFrom: timeActive.value == 1 ? + formatStartTimestamp(DateTime.now().millisecondsSinceEpoch - 86400000 * 30) : + timeActive.value == 2 ? formatStartTimestamp(DateTime.now().millisecondsSinceEpoch - 86400000 * 90) : + timeActive.value == 3 ? formatStartTimestamp(DateTime.now().millisecondsSinceEpoch - 86400000 * 180) : + "", + recordTimeTo: formatEndTimestamp(DateTime.now().millisecondsSinceEpoch), + ); + if (response.data.isSuccess && response.data.data != null) { + walletHistoryList.addAll(response.data.data?.records ?? []); + if((response.data.data?.records?.length ?? 0) == size.value){ + + listRefreshController.finishLoad(IndicatorResult.success); + } else { + listRefreshController.finishLoad(IndicatorResult.noMore); + } + } else { + + // 响应失败,抛出异常 + throw Exception(response.data.message ?? '获取数据失败'); + } + } catch(e){ + print('钱包流水获取失败: $e'); + SmartDialog.showToast('钱包流水获取失败'); + rethrow; + + } + } +} \ No newline at end of file diff --git a/lib/controller/mine/rose_history_controller.dart b/lib/controller/mine/rose_history_controller.dart index 282dcc0..53a29cf 100644 --- a/lib/controller/mine/rose_history_controller.dart +++ b/lib/controller/mine/rose_history_controller.dart @@ -13,6 +13,8 @@ class RoseHistoryController extends GetxController { final roseHistoryList = [].obs; + final page = 1.obs; + final size = 10.obs; late final EasyRefreshController listRefreshController; @@ -32,20 +34,27 @@ class RoseHistoryController extends GetxController { changeNavTab(int i) async { roseHistoryList.clear(); friendNavActive.value = i; + page.value = 1; getHistoryList(); } getHistoryList() async { try{ final response = await _userApi.pageVirtualAccountRecord( - pageNum: 1, - pageSize: 10, + pageNum: page.value, + pageSize: size.value, tradeType: friendNavActive.value == 0 ? 202 : friendNavActive.value == 1 ? null : 201 ); if (response.data.isSuccess && response.data.data != null) { final data = response.data.data?.records ?? []; roseHistoryList.addAll(data.toList()); + if((data.length ?? 0) == size.value){ + + listRefreshController.finishLoad(IndicatorResult.success); + } else { + listRefreshController.finishLoad(IndicatorResult.noMore); + } } else { // 响应失败,抛出异常 diff --git a/lib/controller/mine/withdraw_history_controller.dart b/lib/controller/mine/withdraw_history_controller.dart index 8628b52..9799c1e 100644 --- a/lib/controller/mine/withdraw_history_controller.dart +++ b/lib/controller/mine/withdraw_history_controller.dart @@ -1,4 +1,5 @@ import 'package:dating_touchme_app/network/user_api.dart'; +import 'package:easy_refresh/easy_refresh.dart'; import 'package:get/get.dart'; import 'package:get/get_state_manager/src/simple/get_controllers.dart'; @@ -14,9 +15,15 @@ class WithdrawHistoryController extends GetxController { final hasMore = true.obs; + late final EasyRefreshController listRefreshController; + @override void onInit() { super.onInit(); + listRefreshController = EasyRefreshController( + controlFinishRefresh: true, + controlFinishLoad: true, + ); _userApi = Get.find(); getHistoryList(); } @@ -30,6 +37,12 @@ class WithdrawHistoryController extends GetxController { final data = response.data.data?.records ?? []; historyList.addAll(data.toList()); + if((data.length ?? 0) == 10){ + + listRefreshController.finishLoad(IndicatorResult.success); + } else { + listRefreshController.finishLoad(IndicatorResult.noMore); + } } else { // 响应失败,抛出异常 diff --git a/lib/model/mine/user_data.dart b/lib/model/mine/user_data.dart index bb35567..7f8f284 100644 --- a/lib/model/mine/user_data.dart +++ b/lib/model/mine/user_data.dart @@ -8,6 +8,7 @@ class UserData { String? profilePhoto; String? identityCard; int? genderCode; + Map? auditProfilePhoto; final String? genderValue; final String? homeCountryCode; final String? homeCountry; @@ -73,6 +74,7 @@ class UserData { this.profilePhoto, this.identityCard, this.genderCode, + this.auditProfilePhoto, this.genderValue, this.homeCountryCode, this.homeCountry, @@ -141,6 +143,7 @@ class UserData { profilePhoto: json['profilePhoto'], identityCard: json['identityCard'], genderCode: json['genderCode'] ?? 0, + auditProfilePhoto: json['auditProfilePhoto'] ?? null, genderValue: json['genderValue'] ?? '', homeCountryCode: json['homeCountryCode'], homeCountry: json['homeCountry'], @@ -207,6 +210,7 @@ class UserData { 'profilePhoto': profilePhoto, 'identityCard': identityCard, 'genderCode': genderCode, + 'auditProfilePhoto': auditProfilePhoto, 'genderValue': genderValue, 'homeCountryCode': homeCountryCode, 'homeCountry': homeCountry, @@ -266,6 +270,6 @@ class UserData { @override String toString() { - return 'UserData(id: $id, nickName: $nickName, genderCode: $genderCode, genderValue: $genderValue, birthYear: $birthYear, photoList: $photoList)'; + return 'UserData(id: $id, nickName: $nickName, genderCode: $genderCode, auditProfilePhoto: $auditProfilePhoto, genderValue: $genderValue, birthYear: $birthYear, photoList: $photoList)'; } } \ No newline at end of file diff --git a/lib/model/mine/wallet_account_data.dart b/lib/model/mine/wallet_account_data.dart new file mode 100644 index 0000000..c41a013 --- /dev/null +++ b/lib/model/mine/wallet_account_data.dart @@ -0,0 +1,40 @@ +class WalletAccountData { + String? id; + num? totalBalance; + num? availableBalance; + num? frozenBalance; + num? availableWithdrawBalance; + num? settlementBalance; + num? totalWithdrawBalance; + + WalletAccountData( + {this.id, + this.totalBalance, + this.availableBalance, + this.frozenBalance, + this.availableWithdrawBalance, + this.settlementBalance, + this.totalWithdrawBalance}); + + WalletAccountData.fromJson(Map json) { + id = json['id']; + totalBalance = json['totalBalance']; + availableBalance = json['availableBalance']; + frozenBalance = json['frozenBalance']; + availableWithdrawBalance = json['availableWithdrawBalance']; + settlementBalance = json['settlementBalance']; + totalWithdrawBalance = json['totalWithdrawBalance']; + } + + Map toJson() { + final Map data = new Map(); + data['id'] = this.id; + data['totalBalance'] = this.totalBalance; + data['availableBalance'] = this.availableBalance; + data['frozenBalance'] = this.frozenBalance; + data['availableWithdrawBalance'] = this.availableWithdrawBalance; + data['settlementBalance'] = this.settlementBalance; + data['totalWithdrawBalance'] = this.totalWithdrawBalance; + return data; + } +} diff --git a/lib/model/mine/wallet_account_record_data.dart b/lib/model/mine/wallet_account_record_data.dart new file mode 100644 index 0000000..77b3dae --- /dev/null +++ b/lib/model/mine/wallet_account_record_data.dart @@ -0,0 +1,72 @@ +class WalletAccountRecordData { + List? records; + int? total; + int? size; + int? current; + int? pages; + + WalletAccountRecordData( + {this.records, this.total, this.size, this.current, this.pages}); + + WalletAccountRecordData.fromJson(Map json) { + if (json['records'] != null) { + records = []; + json['records'].forEach((v) { + records!.add(new Records.fromJson(v)); + }); + } + total = json['total']; + size = json['size']; + current = json['current']; + pages = json['pages']; + } + + Map toJson() { + final Map data = new Map(); + if (this.records != null) { + data['records'] = this.records!.map((v) => v.toJson()).toList(); + } + data['total'] = this.total; + data['size'] = this.size; + data['current'] = this.current; + data['pages'] = this.pages; + return data; + } +} + +class Records { + String? id; + String? walletAccountId; + String? createTime; + int? tradeType; + double? tradeAmount; + bool? isIncome; + + Records( + {this.id, + this.walletAccountId, + this.createTime, + this.tradeType, + this.tradeAmount, + this.isIncome}); + + Records.fromJson(Map json) { + id = json['id']; + walletAccountId = json['walletAccountId']; + createTime = json['createTime']; + tradeType = json['tradeType']; + tradeAmount = json['tradeAmount']; + isIncome = json['isIncome']; + } + + Map toJson() { + final Map data = new Map(); + data['id'] = this.id; + data['walletAccountId'] = this.walletAccountId; + data['createTime'] = this.createTime; + data['tradeType'] = this.tradeType; + data['tradeAmount'] = this.tradeAmount; + data['isIncome'] = this.isIncome; + return data; + } +} diff --git a/lib/network/api_urls.dart b/lib/network/api_urls.dart index 0864030..f789a3f 100644 --- a/lib/network/api_urls.dart +++ b/lib/network/api_urls.dart @@ -72,6 +72,10 @@ class ApiUrls { 'dating-agency-mall/user/page/withdraw-audit'; static const String getMarriageInformationDetailsById = 'dating-agency-service/user/get/marriage/information/details/byid'; + static const String getWalletAccount = + 'dating-agency-mall/user/get/wallet-account'; + static const String getWalletAccountRecord = + 'dating-agency-mall/user/page/wallet-account-record'; //首页相关接口 static const String getMarriageList = diff --git a/lib/network/user_api.dart b/lib/network/user_api.dart index 3b24be6..bf624ae 100644 --- a/lib/network/user_api.dart +++ b/lib/network/user_api.dart @@ -10,6 +10,8 @@ import 'package:dating_touchme_app/model/mine/rose_history_data.dart'; import 'package:dating_touchme_app/model/mine/user_base_data.dart'; import 'package:dating_touchme_app/model/mine/user_data.dart'; import 'package:dating_touchme_app/model/mine/user_rose_data.dart'; +import 'package:dating_touchme_app/model/mine/wallet_account_data.dart'; +import 'package:dating_touchme_app/model/mine/wallet_account_record_data.dart'; import 'package:dating_touchme_app/model/mine/withdraw_audit_data.dart'; import 'package:dating_touchme_app/model/mine/withdraw_data.dart'; import 'package:dating_touchme_app/network/response_model.dart'; @@ -125,27 +127,27 @@ abstract class UserApi { @GET(ApiUrls.listBankCardByIndividual) Future>>> listBankCardByIndividual( @Body() Map data, - ); + ); @POST(ApiUrls.createBankCardByIndividual) Future>> createBankCardByIndividual( @Body() Map data, - ); + ); @POST(ApiUrls.recognizeBankCard) Future>> recognizeBankCard( @Body() Map data, - ); + ); @POST(ApiUrls.calculateWithdrawServiceFee) Future>> calculateWithdrawServiceFee( @Body() Map data, - ); + ); @POST(ApiUrls.applyWalletAccountWithdraw) Future>> applyWalletAccountWithdraw( @Body() Map data, - ); + ); @GET(ApiUrls.pageWithdrawAudit) Future>> pageWithdrawAudit( @@ -153,12 +155,27 @@ abstract class UserApi { @Query('pageNum') required int pageNum, @Query('pageSize') required int pageSize, } - ); + ); @GET(ApiUrls.getMarriageInformationDetailsById) Future>> getMarriageInformationDetailsById( { @Query('miId') required String miId, } - ); + ); + + @GET(ApiUrls.getWalletAccount) + Future>> getWalletAccount( + @Body() Map data, + ); + + @GET(ApiUrls.getWalletAccountRecord) + Future>> getWalletAccountRecord( + { + @Query('pageNum') required int pageNum, + @Query('pageSize') required int pageSize, + @Query('recordTimeFrom') required String recordTimeFrom, + @Query('recordTimeTo') required String recordTimeTo, + } + ); } diff --git a/lib/network/user_api.g.dart b/lib/network/user_api.g.dart index 911d22a..817676b 100644 --- a/lib/network/user_api.g.dart +++ b/lib/network/user_api.g.dart @@ -1014,6 +1014,89 @@ class _UserApi implements UserApi { return httpResponse; } + @override + Future>> getWalletAccount( + Map data, + ) async { + final _extra = {}; + final queryParameters = {}; + final _headers = {}; + final _data = {}; + _data.addAll(data); + final _options = + _setStreamType>>( + Options(method: 'GET', headers: _headers, extra: _extra) + .compose( + _dio.options, + 'dating-agency-mall/user/get/wallet-account', + queryParameters: queryParameters, + data: _data, + ) + .copyWith( + baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl), + ), + ); + final _result = await _dio.fetch>(_options); + late BaseResponse _value; + try { + _value = BaseResponse.fromJson( + _result.data!, + (json) => WalletAccountData.fromJson(json as Map), + ); + } on Object catch (e, s) { + errorLogger?.logError(e, s, _options); + rethrow; + } + final httpResponse = HttpResponse(_value, _result); + return httpResponse; + } + + @override + Future>> + getWalletAccountRecord({ + required int pageNum, + required int pageSize, + required String recordTimeFrom, + required String recordTimeTo, + }) async { + final _extra = {}; + final queryParameters = { + r'pageNum': pageNum, + r'pageSize': pageSize, + r'recordTimeFrom': recordTimeFrom, + r'recordTimeTo': recordTimeTo, + }; + final _headers = {}; + const Map? _data = null; + final _options = + _setStreamType>>( + Options(method: 'GET', headers: _headers, extra: _extra) + .compose( + _dio.options, + 'dating-agency-mall/user/page/wallet-account-record', + queryParameters: queryParameters, + data: _data, + ) + .copyWith( + baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl), + ), + ); + final _result = await _dio.fetch>(_options); + late BaseResponse _value; + try { + _value = BaseResponse.fromJson( + _result.data!, + (json) => + WalletAccountRecordData.fromJson(json as Map), + ); + } on Object catch (e, s) { + errorLogger?.logError(e, s, _options); + rethrow; + } + final httpResponse = HttpResponse(_value, _result); + return httpResponse; + } + RequestOptions _setStreamType(RequestOptions requestOptions) { if (T != dynamic && !(requestOptions.responseType == ResponseType.bytes || diff --git a/lib/pages/mine/edit_info_page.dart b/lib/pages/mine/edit_info_page.dart index 0f75b29..f970f99 100644 --- a/lib/pages/mine/edit_info_page.dart +++ b/lib/pages/mine/edit_info_page.dart @@ -204,6 +204,11 @@ class _EditInfoPageState extends State { ) ], ).onTap(() { + if(controller.userData.value?.auditProfilePhoto != null){ + + SmartDialog.showToast('当前头像正在审核中,请勿重复提交'); + return; + } _showAvatarOptions(controller, 1); }), SizedBox(height: 20.w,), diff --git a/lib/pages/mine/my_wallet_page.dart b/lib/pages/mine/my_wallet_page.dart index 2f0ea70..ba22618 100644 --- a/lib/pages/mine/my_wallet_page.dart +++ b/lib/pages/mine/my_wallet_page.dart @@ -1,271 +1,319 @@ 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'; -class MyWalletPage extends StatefulWidget { - const MyWalletPage({super.key}); - - @override - State createState() => _MyWalletPageState(); -} +import '../../model/mine/wallet_account_record_data.dart'; -class _MyWalletPageState extends State { +class MyWalletPage extends StatelessWidget { + const MyWalletPage({super.key}); - int timeActive = 1; @override Widget build(BuildContext context) { - return Scaffold( - appBar: PageAppbar(title: "我的钱包"), - body: 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, timeActive == 1 ? 1 : 0) - ) - ) - ), - child: Center( - child: Text( - "最近一个月", - style: TextStyle( - fontSize: 14.w, - color: Color.fromRGBO(51, 51, 51, timeActive == 1 ? 1 : .5), - fontWeight: timeActive == 1 ? FontWeight.w700 : FontWeight.w400 - ), - ), - ), - ).onTap(() { - timeActive = 1; - setState(() { - - }); - }), - Container( - width: 72.w, - height: 44.w, - decoration: BoxDecoration( - border: Border( - bottom: BorderSide( - width: 1, - color: Color.fromRGBO(117, 98, 249, timeActive == 2 ? 1 : 0) - ) - ) - ), - child: Center( - child: Text( - "3个月", - style: TextStyle( - fontSize: 14.w, - color: Color.fromRGBO(51, 51, 51, timeActive == 2 ? 1 : .5), - fontWeight: timeActive == 2 ? FontWeight.w700 : FontWeight.w400 - ), - ), - ), - ).onTap(() { - timeActive = 2; - setState(() { - - }); - }), - Container( - width: 72.w, - height: 44.w, - decoration: BoxDecoration( - border: Border( - bottom: BorderSide( - width: 1, - color: Color.fromRGBO(117, 98, 249, timeActive == 3 ? 1 : 0) - ) - ) - ), - child: Center( - child: Text( - "6个月", - style: TextStyle( - fontSize: 14.w, - color: Color.fromRGBO(51, 51, 51, timeActive == 13 ? 1 : .5), - fontWeight: timeActive == 3 ? FontWeight.w700 : FontWeight.w400 - ), - ), - ), - ).onTap(() { - timeActive = 3; - setState(() { - - }); - }), - Container( - width: 72.w, - height: 44.w, - decoration: BoxDecoration( - border: Border( - bottom: BorderSide( - width: 1, - color: Color.fromRGBO(117, 98, 249, timeActive == 4 ? 1 : 0) - ) - ) - ), - child: Center( - child: Text( - "全部", - style: TextStyle( - fontSize: 14.w, - color: Color.fromRGBO(51, 51, 51, timeActive == 4 ? 1 : .5), - fontWeight: timeActive == 4 ? FontWeight.w700 : FontWeight.w400 - ), - ), - ), - ).onTap(() { - timeActive = 4; - setState(() { - - }); - }), - ], - ), + 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 ), - 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) - ), + 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( - mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Container( - width: 255.w, - padding: EdgeInsets.symmetric( - horizontal: 16.w + height: 44.w, + margin: EdgeInsets.only( + top: 9.w, + bottom: 16.w ), child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - "100.00", + 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: 20.w, - fontWeight: FontWeight.w500 + fontSize: 14.w, + color: Color.fromRGBO(51, 51, 51, controller.timeActive.value == 1 ? 1 : .5), + fontWeight: controller.timeActive.value == 1 ? FontWeight.w700 : FontWeight.w400 ), ), - SizedBox(height: 6.w,), - Text( - "营收(元)", + ), + ).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: 13.w, - color: const Color.fromRGBO(102, 102, 102, 1) + fontSize: 14.w, + color: Color.fromRGBO(51, 51, 51, controller.timeActive.value == 2 ? 1 : .5), + fontWeight: controller.timeActive.value == 2 ? FontWeight.w700 : FontWeight.w400 ), - ) - ], - ), - Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - "5.00", + ), + ), + ).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: 20.w, - fontWeight: FontWeight.w500, - color: const Color.fromRGBO(117, 98, 249, 1) + fontSize: 14.w, + color: Color.fromRGBO(51, 51, 51, controller.timeActive.value == 13 ? 1 : .5), + fontWeight: controller.timeActive.value == 3 ? FontWeight.w700 : FontWeight.w400 ), ), - SizedBox(height: 6.w,), - Text( - "营收(元)", + ), + ).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: 13.w, - color: const Color.fromRGBO(102, 102, 102, 1) + 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: 255.w, - height: 42.w, + 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(42.w)), - color: const Color.fromRGBO(117, 98, 249, 1) + borderRadius: BorderRadius.all(Radius.circular(10.w)), + color: const Color.fromRGBO(247, 247, 247, 1) ), - child: Center( - child: Text( - "提现", - style: TextStyle( - fontSize: 14.w, - fontWeight: FontWeight.w500, - color: Colors.white + 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)); + }) + ], ), - ).onTap(() { - Get.to(() => WithdrawPage()); - }) - ], - ), - ), - Padding( - padding: EdgeInsetsGeometry.symmetric( - horizontal: 10.w - ), - child: Row( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - "流水明细", - style: TextStyle( - fontSize: 13.w, - fontWeight: FontWeight.w500 + ), + 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,); + }), ], ), ), - SizedBox(height: 22.w,), - InfoItem(), - InfoItem(), - InfoItem(), - InfoItem(), - InfoItem(), - ], - ), - ), + ), + ); + }, ); } } + class InfoItem extends StatefulWidget { - const InfoItem({super.key}); + final Records item; + const InfoItem({super.key, required this.item}); @override State createState() => _InfoItemState(); @@ -297,7 +345,19 @@ class _InfoItemState extends State { 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, ), @@ -310,10 +370,10 @@ class _InfoItemState extends State { ), children: [ TextSpan( - text: "提现金额:", + text: "金额:", ), TextSpan( - text: "680.00", + text: "${(widget.item.isIncome ?? false) ? "" : "-"}${widget.item.tradeAmount}", style: TextStyle( color: const Color.fromRGBO(117, 98, 249, 1) ) @@ -323,55 +383,55 @@ class _InfoItemState extends State { ) ], ), + // 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( - "服务嘉宾:张三", - 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( - "时间:2024-04-23 15:23:48", + "时间:${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) - ), - ), + // Text( + // "查看打款凭证", + // style: TextStyle( + // fontSize: 12.w, + // color: const Color.fromRGBO(25, 114, 248, 1) + // ), + // ), ], ) ], diff --git a/lib/pages/mine/rose_history_page.dart b/lib/pages/mine/rose_history_page.dart index 5fbef6f..ce6d880 100644 --- a/lib/pages/mine/rose_history_page.dart +++ b/lib/pages/mine/rose_history_page.dart @@ -21,21 +21,40 @@ class RoseHistoryPage extends StatelessWidget { 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('推荐列表下拉刷新被触发'); - Future.delayed(Duration(seconds: 3), () { - print("3 秒后执行"); - controller.listRefreshController.finishRefresh(IndicatorResult.success); - }); + controller.page.value = 1; + controller.roseHistoryList.clear(); + await controller.getHistoryList(); + controller.listRefreshController.finishRefresh(IndicatorResult.success); + controller.listRefreshController.finishLoad(IndicatorResult.none); }, // 上拉加载更多 onLoad: () async { print('推荐列表上拉加载被触发, hasMore: '); - Future.delayed(Duration(seconds: 3), () { - print("3 秒后执行"); - controller.listRefreshController.finishLoad(IndicatorResult.success); - }); + controller.page.value += 1; + controller.getHistoryList(); }, child: SingleChildScrollView( child: Container( diff --git a/lib/pages/mine/withdraw_history_page.dart b/lib/pages/mine/withdraw_history_page.dart index 1172974..5625f44 100644 --- a/lib/pages/mine/withdraw_history_page.dart +++ b/lib/pages/mine/withdraw_history_page.dart @@ -1,6 +1,7 @@ import 'package:dating_touchme_app/components/page_appbar.dart'; import 'package:dating_touchme_app/controller/mine/withdraw_history_controller.dart'; import 'package:dating_touchme_app/extension/ex_widget.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'; @@ -18,18 +19,56 @@ class WithdrawHistoryPage extends StatelessWidget { builder: (controller){ return Scaffold( appBar: PageAppbar(title: "提现"), - body: SingleChildScrollView( - child: Container( - padding: EdgeInsetsGeometry.symmetric( - vertical: 11.w, - horizontal: 16.w - ), - child: Column( - children: [ - ...controller.historyList.map((e){ - return historyItem(e, context); - }), - ], + 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.historyList.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: Container( + padding: EdgeInsetsGeometry.symmetric( + vertical: 11.w, + horizontal: 16.w + ), + child: Column( + children: [ + ...controller.historyList.map((e){ + return historyItem(e, context); + }), + ], + ), ), ), ), diff --git a/lib/pages/mine/withdraw_page.dart b/lib/pages/mine/withdraw_page.dart index cc5952f..a8eeabe 100644 --- a/lib/pages/mine/withdraw_page.dart +++ b/lib/pages/mine/withdraw_page.dart @@ -12,7 +12,8 @@ import 'package:get/get.dart'; import 'package:tdesign_flutter/tdesign_flutter.dart'; class WithdrawPage extends StatelessWidget { - const WithdrawPage({super.key}); + final num availableWithdrawBalance; + const WithdrawPage({super.key, required this.availableWithdrawBalance}); String maskKeepLast(String s, int keep) { if (s.length <= keep) return s; @@ -234,7 +235,7 @@ class WithdrawPage extends StatelessWidget { mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Text( - "可提现金额:${controller.money}元", + "可提现金额:${availableWithdrawBalance}元", style: TextStyle( fontSize: 12.w, color: const Color.fromRGBO(153, 153, 153, 1)