Browse Source

对接钱包接口,对接钱包流水接口,优化几个下拉加载列表,优化编辑头像

ios
王子贤 4 months ago
parent
commit
19a170f0df
15 changed files with 772 additions and 296 deletions
  1. 4
      lib/controller/mine/edit_info_controller.dart
  2. 108
      lib/controller/mine/my_wallet_controller.dart
  3. 13
      lib/controller/mine/rose_history_controller.dart
  4. 13
      lib/controller/mine/withdraw_history_controller.dart
  5. 6
      lib/model/mine/user_data.dart
  6. 40
      lib/model/mine/wallet_account_data.dart
  7. 72
      lib/model/mine/wallet_account_record_data.dart
  8. 4
      lib/network/api_urls.dart
  9. 31
      lib/network/user_api.dart
  10. 83
      lib/network/user_api.g.dart
  11. 5
      lib/pages/mine/edit_info_page.dart
  12. 586
      lib/pages/mine/my_wallet_page.dart
  13. 35
      lib/pages/mine/rose_history_page.dart
  14. 63
      lib/pages/mine/withdraw_history_page.dart
  15. 5
      lib/pages/mine/withdraw_page.dart

4
lib/controller/mine/edit_info_controller.dart

@ -542,7 +542,9 @@ class EditInfoController extends GetxController {
}; };
final avatarAuditResp = await _userApi.saveCertificationAudit(avatarPayload); final avatarAuditResp = await _userApi.saveCertificationAudit(avatarPayload);
if (avatarAuditResp.data.isSuccess) { if (avatarAuditResp.data.isSuccess) {
userData.value?.auditProfilePhoto = {
"auditStatus": 0
};
} else{ } else{
SmartDialog.showToast(avatarAuditResp.data.message); SmartDialog.showToast(avatarAuditResp.data.message);

108
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 = <Records>[].obs;
final page = 1.obs;
final size = 10.obs;
late UserApi _userApi;
late final EasyRefreshController listRefreshController;
@override
void onInit() {
super.onInit();
_userApi = Get.find<UserApi>();
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;
}
}
}

13
lib/controller/mine/rose_history_controller.dart

@ -13,6 +13,8 @@ class RoseHistoryController extends GetxController {
final roseHistoryList = <Records>[].obs; final roseHistoryList = <Records>[].obs;
final page = 1.obs;
final size = 10.obs;
late final EasyRefreshController listRefreshController; late final EasyRefreshController listRefreshController;
@ -32,20 +34,27 @@ class RoseHistoryController extends GetxController {
changeNavTab(int i) async { changeNavTab(int i) async {
roseHistoryList.clear(); roseHistoryList.clear();
friendNavActive.value = i; friendNavActive.value = i;
page.value = 1;
getHistoryList(); getHistoryList();
} }
getHistoryList() async { getHistoryList() async {
try{ try{
final response = await _userApi.pageVirtualAccountRecord( 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 tradeType: friendNavActive.value == 0 ? 202 : friendNavActive.value == 1 ? null : 201
); );
if (response.data.isSuccess && response.data.data != null) { if (response.data.isSuccess && response.data.data != null) {
final data = response.data.data?.records ?? []; final data = response.data.data?.records ?? [];
roseHistoryList.addAll(data.toList()); roseHistoryList.addAll(data.toList());
if((data.length ?? 0) == size.value){
listRefreshController.finishLoad(IndicatorResult.success);
} else {
listRefreshController.finishLoad(IndicatorResult.noMore);
}
} else { } else {
// //

13
lib/controller/mine/withdraw_history_controller.dart

@ -1,4 +1,5 @@
import 'package:dating_touchme_app/network/user_api.dart'; 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.dart';
import 'package:get/get_state_manager/src/simple/get_controllers.dart'; import 'package:get/get_state_manager/src/simple/get_controllers.dart';
@ -14,9 +15,15 @@ class WithdrawHistoryController extends GetxController {
final hasMore = true.obs; final hasMore = true.obs;
late final EasyRefreshController listRefreshController;
@override @override
void onInit() { void onInit() {
super.onInit(); super.onInit();
listRefreshController = EasyRefreshController(
controlFinishRefresh: true,
controlFinishLoad: true,
);
_userApi = Get.find<UserApi>(); _userApi = Get.find<UserApi>();
getHistoryList(); getHistoryList();
} }
@ -30,6 +37,12 @@ class WithdrawHistoryController extends GetxController {
final data = response.data.data?.records ?? []; final data = response.data.data?.records ?? [];
historyList.addAll(data.toList()); historyList.addAll(data.toList());
if((data.length ?? 0) == 10){
listRefreshController.finishLoad(IndicatorResult.success);
} else {
listRefreshController.finishLoad(IndicatorResult.noMore);
}
} else { } else {
// //

6
lib/model/mine/user_data.dart

@ -8,6 +8,7 @@ class UserData {
String? profilePhoto; String? profilePhoto;
String? identityCard; String? identityCard;
int? genderCode; int? genderCode;
Map? auditProfilePhoto;
final String? genderValue; final String? genderValue;
final String? homeCountryCode; final String? homeCountryCode;
final String? homeCountry; final String? homeCountry;
@ -73,6 +74,7 @@ class UserData {
this.profilePhoto, this.profilePhoto,
this.identityCard, this.identityCard,
this.genderCode, this.genderCode,
this.auditProfilePhoto,
this.genderValue, this.genderValue,
this.homeCountryCode, this.homeCountryCode,
this.homeCountry, this.homeCountry,
@ -141,6 +143,7 @@ class UserData {
profilePhoto: json['profilePhoto'], profilePhoto: json['profilePhoto'],
identityCard: json['identityCard'], identityCard: json['identityCard'],
genderCode: json['genderCode'] ?? 0, genderCode: json['genderCode'] ?? 0,
auditProfilePhoto: json['auditProfilePhoto'] ?? null,
genderValue: json['genderValue'] ?? '', genderValue: json['genderValue'] ?? '',
homeCountryCode: json['homeCountryCode'], homeCountryCode: json['homeCountryCode'],
homeCountry: json['homeCountry'], homeCountry: json['homeCountry'],
@ -207,6 +210,7 @@ class UserData {
'profilePhoto': profilePhoto, 'profilePhoto': profilePhoto,
'identityCard': identityCard, 'identityCard': identityCard,
'genderCode': genderCode, 'genderCode': genderCode,
'auditProfilePhoto': auditProfilePhoto,
'genderValue': genderValue, 'genderValue': genderValue,
'homeCountryCode': homeCountryCode, 'homeCountryCode': homeCountryCode,
'homeCountry': homeCountry, 'homeCountry': homeCountry,
@ -266,6 +270,6 @@ class UserData {
@override @override
String toString() { 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)';
} }
} }

40
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<String, dynamic> json) {
id = json['id'];
totalBalance = json['totalBalance'];
availableBalance = json['availableBalance'];
frozenBalance = json['frozenBalance'];
availableWithdrawBalance = json['availableWithdrawBalance'];
settlementBalance = json['settlementBalance'];
totalWithdrawBalance = json['totalWithdrawBalance'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
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;
}
}

72
lib/model/mine/wallet_account_record_data.dart

@ -0,0 +1,72 @@
class WalletAccountRecordData {
List<Records>? records;
int? total;
int? size;
int? current;
int? pages;
WalletAccountRecordData(
{this.records, this.total, this.size, this.current, this.pages});
WalletAccountRecordData.fromJson(Map<String, dynamic> json) {
if (json['records'] != null) {
records = <Records>[];
json['records'].forEach((v) {
records!.add(new Records.fromJson(v));
});
}
total = json['total'];
size = json['size'];
current = json['current'];
pages = json['pages'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
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<String, dynamic> json) {
id = json['id'];
walletAccountId = json['walletAccountId'];
createTime = json['createTime'];
tradeType = json['tradeType'];
tradeAmount = json['tradeAmount'];
isIncome = json['isIncome'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
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;
}
}

4
lib/network/api_urls.dart

@ -72,6 +72,10 @@ class ApiUrls {
'dating-agency-mall/user/page/withdraw-audit'; 'dating-agency-mall/user/page/withdraw-audit';
static const String getMarriageInformationDetailsById = static const String getMarriageInformationDetailsById =
'dating-agency-service/user/get/marriage/information/details/byid'; '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 = static const String getMarriageList =

31
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_base_data.dart';
import 'package:dating_touchme_app/model/mine/user_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/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_audit_data.dart';
import 'package:dating_touchme_app/model/mine/withdraw_data.dart'; import 'package:dating_touchme_app/model/mine/withdraw_data.dart';
import 'package:dating_touchme_app/network/response_model.dart'; import 'package:dating_touchme_app/network/response_model.dart';
@ -125,27 +127,27 @@ abstract class UserApi {
@GET(ApiUrls.listBankCardByIndividual) @GET(ApiUrls.listBankCardByIndividual)
Future<HttpResponse<BaseResponse<List<BankCardData>>>> listBankCardByIndividual( Future<HttpResponse<BaseResponse<List<BankCardData>>>> listBankCardByIndividual(
@Body() Map<String, dynamic> data, @Body() Map<String, dynamic> data,
);
);
@POST(ApiUrls.createBankCardByIndividual) @POST(ApiUrls.createBankCardByIndividual)
Future<HttpResponse<BaseResponse<dynamic>>> createBankCardByIndividual( Future<HttpResponse<BaseResponse<dynamic>>> createBankCardByIndividual(
@Body() Map<String, dynamic> data, @Body() Map<String, dynamic> data,
);
);
@POST(ApiUrls.recognizeBankCard) @POST(ApiUrls.recognizeBankCard)
Future<HttpResponse<BaseResponse<BankCardOcrData>>> recognizeBankCard( Future<HttpResponse<BaseResponse<BankCardOcrData>>> recognizeBankCard(
@Body() Map<String, dynamic> data, @Body() Map<String, dynamic> data,
);
);
@POST(ApiUrls.calculateWithdrawServiceFee) @POST(ApiUrls.calculateWithdrawServiceFee)
Future<HttpResponse<BaseResponse<WithdrawData>>> calculateWithdrawServiceFee( Future<HttpResponse<BaseResponse<WithdrawData>>> calculateWithdrawServiceFee(
@Body() Map<String, dynamic> data, @Body() Map<String, dynamic> data,
);
);
@POST(ApiUrls.applyWalletAccountWithdraw) @POST(ApiUrls.applyWalletAccountWithdraw)
Future<HttpResponse<BaseResponse<dynamic>>> applyWalletAccountWithdraw( Future<HttpResponse<BaseResponse<dynamic>>> applyWalletAccountWithdraw(
@Body() Map<String, dynamic> data, @Body() Map<String, dynamic> data,
);
);
@GET(ApiUrls.pageWithdrawAudit) @GET(ApiUrls.pageWithdrawAudit)
Future<HttpResponse<BaseResponse<WithdrawAuditData>>> pageWithdrawAudit( Future<HttpResponse<BaseResponse<WithdrawAuditData>>> pageWithdrawAudit(
@ -153,12 +155,27 @@ abstract class UserApi {
@Query('pageNum') required int pageNum, @Query('pageNum') required int pageNum,
@Query('pageSize') required int pageSize, @Query('pageSize') required int pageSize,
} }
);
);
@GET(ApiUrls.getMarriageInformationDetailsById) @GET(ApiUrls.getMarriageInformationDetailsById)
Future<HttpResponse<BaseResponse<UserInfoData>>> getMarriageInformationDetailsById( Future<HttpResponse<BaseResponse<UserInfoData>>> getMarriageInformationDetailsById(
{ {
@Query('miId') required String miId, @Query('miId') required String miId,
} }
);
);
@GET(ApiUrls.getWalletAccount)
Future<HttpResponse<BaseResponse<WalletAccountData>>> getWalletAccount(
@Body() Map<String, dynamic> data,
);
@GET(ApiUrls.getWalletAccountRecord)
Future<HttpResponse<BaseResponse<WalletAccountRecordData>>> getWalletAccountRecord(
{
@Query('pageNum') required int pageNum,
@Query('pageSize') required int pageSize,
@Query('recordTimeFrom') required String recordTimeFrom,
@Query('recordTimeTo') required String recordTimeTo,
}
);
} }

83
lib/network/user_api.g.dart

@ -1014,6 +1014,89 @@ class _UserApi implements UserApi {
return httpResponse; return httpResponse;
} }
@override
Future<HttpResponse<BaseResponse<WalletAccountData>>> getWalletAccount(
Map<String, dynamic> data,
) async {
final _extra = <String, dynamic>{};
final queryParameters = <String, dynamic>{};
final _headers = <String, dynamic>{};
final _data = <String, dynamic>{};
_data.addAll(data);
final _options =
_setStreamType<HttpResponse<BaseResponse<WalletAccountData>>>(
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<Map<String, dynamic>>(_options);
late BaseResponse<WalletAccountData> _value;
try {
_value = BaseResponse<WalletAccountData>.fromJson(
_result.data!,
(json) => WalletAccountData.fromJson(json as Map<String, dynamic>),
);
} on Object catch (e, s) {
errorLogger?.logError(e, s, _options);
rethrow;
}
final httpResponse = HttpResponse(_value, _result);
return httpResponse;
}
@override
Future<HttpResponse<BaseResponse<WalletAccountRecordData>>>
getWalletAccountRecord({
required int pageNum,
required int pageSize,
required String recordTimeFrom,
required String recordTimeTo,
}) async {
final _extra = <String, dynamic>{};
final queryParameters = <String, dynamic>{
r'pageNum': pageNum,
r'pageSize': pageSize,
r'recordTimeFrom': recordTimeFrom,
r'recordTimeTo': recordTimeTo,
};
final _headers = <String, dynamic>{};
const Map<String, dynamic>? _data = null;
final _options =
_setStreamType<HttpResponse<BaseResponse<WalletAccountRecordData>>>(
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<Map<String, dynamic>>(_options);
late BaseResponse<WalletAccountRecordData> _value;
try {
_value = BaseResponse<WalletAccountRecordData>.fromJson(
_result.data!,
(json) =>
WalletAccountRecordData.fromJson(json as Map<String, dynamic>),
);
} on Object catch (e, s) {
errorLogger?.logError(e, s, _options);
rethrow;
}
final httpResponse = HttpResponse(_value, _result);
return httpResponse;
}
RequestOptions _setStreamType<T>(RequestOptions requestOptions) { RequestOptions _setStreamType<T>(RequestOptions requestOptions) {
if (T != dynamic && if (T != dynamic &&
!(requestOptions.responseType == ResponseType.bytes || !(requestOptions.responseType == ResponseType.bytes ||

5
lib/pages/mine/edit_info_page.dart

@ -204,6 +204,11 @@ class _EditInfoPageState extends State<EditInfoPage> {
) )
], ],
).onTap(() { ).onTap(() {
if(controller.userData.value?.auditProfilePhoto != null){
SmartDialog.showToast('当前头像正在审核中,请勿重复提交');
return;
}
_showAvatarOptions(controller, 1); _showAvatarOptions(controller, 1);
}), }),
SizedBox(height: 20.w,), SizedBox(height: 20.w,),

586
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/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/extension/ex_widget.dart';
import 'package:dating_touchme_app/pages/mine/withdraw_page.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/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
class MyWalletPage extends StatefulWidget {
const MyWalletPage({super.key});
@override
State<MyWalletPage> createState() => _MyWalletPageState();
}
import '../../model/mine/wallet_account_record_data.dart';
class _MyWalletPageState extends State<MyWalletPage> {
class MyWalletPage extends StatelessWidget {
const MyWalletPage({super.key});
int timeActive = 1;
@override @override
Widget build(BuildContext context) { 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<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
), ),
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( child: Column(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [ children: [
Container( Container(
width: 255.w,
padding: EdgeInsets.symmetric(
horizontal: 16.w
height: 44.w,
margin: EdgeInsets.only(
top: 9.w,
bottom: 16.w
), ),
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [ 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( 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( 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( 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( 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( 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( 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 { class InfoItem extends StatefulWidget {
const InfoItem({super.key});
final Records item;
const InfoItem({super.key, required this.item});
@override @override
State<InfoItem> createState() => _InfoItemState(); State<InfoItem> createState() => _InfoItemState();
@ -297,7 +345,19 @@ class _InfoItemState extends State<InfoItem> {
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [ children: [
Text( 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( style: TextStyle(
fontSize: 14.w, fontSize: 14.w,
), ),
@ -310,10 +370,10 @@ class _InfoItemState extends State<InfoItem> {
), ),
children: [ children: [
TextSpan( TextSpan(
text: "提现金额:",
text: "金额:",
), ),
TextSpan( TextSpan(
text: "680.00",
text: "${(widget.item.isIncome ?? false) ? "" : "-"}${widget.item.tradeAmount}",
style: TextStyle( style: TextStyle(
color: const Color.fromRGBO(117, 98, 249, 1) color: const Color.fromRGBO(117, 98, 249, 1)
) )
@ -323,55 +383,55 @@ class _InfoItemState extends State<InfoItem> {
) )
], ],
), ),
// 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,), SizedBox(height: 8.w,),
Row( Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [ children: [
Text( 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( style: TextStyle(
fontSize: 12.w, fontSize: 12.w,
color: const Color.fromRGBO(153, 153, 153, 1) 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)
// ),
// ),
], ],
) )
], ],

35
lib/pages/mine/rose_history_page.dart

@ -21,21 +21,40 @@ class RoseHistoryPage extends StatelessWidget {
appBar: PageAppbar(title: "交易记录"), appBar: PageAppbar(title: "交易记录"),
body: EasyRefresh( body: EasyRefresh(
controller: controller.listRefreshController, 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 { onRefresh: () async {
print('推荐列表下拉刷新被触发'); 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 { onLoad: () async {
print('推荐列表上拉加载被触发, hasMore: '); print('推荐列表上拉加载被触发, hasMore: ');
Future.delayed(Duration(seconds: 3), () {
print("3 秒后执行");
controller.listRefreshController.finishLoad(IndicatorResult.success);
});
controller.page.value += 1;
controller.getHistoryList();
}, },
child: SingleChildScrollView( child: SingleChildScrollView(
child: Container( child: Container(

63
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/components/page_appbar.dart';
import 'package:dating_touchme_app/controller/mine/withdraw_history_controller.dart'; import 'package:dating_touchme_app/controller/mine/withdraw_history_controller.dart';
import 'package:dating_touchme_app/extension/ex_widget.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/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
@ -18,18 +19,56 @@ class WithdrawHistoryPage extends StatelessWidget {
builder: (controller){ builder: (controller){
return Scaffold( return Scaffold(
appBar: PageAppbar(title: "提现"), 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);
}),
],
),
), ),
), ),
), ),

5
lib/pages/mine/withdraw_page.dart

@ -12,7 +12,8 @@ import 'package:get/get.dart';
import 'package:tdesign_flutter/tdesign_flutter.dart'; import 'package:tdesign_flutter/tdesign_flutter.dart';
class WithdrawPage extends StatelessWidget { class WithdrawPage extends StatelessWidget {
const WithdrawPage({super.key});
final num availableWithdrawBalance;
const WithdrawPage({super.key, required this.availableWithdrawBalance});
String maskKeepLast(String s, int keep) { String maskKeepLast(String s, int keep) {
if (s.length <= keep) return s; if (s.length <= keep) return s;
@ -234,7 +235,7 @@ class WithdrawPage extends StatelessWidget {
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [ children: [
Text( Text(
"可提现金额:${controller.money}",
"可提现金额:${availableWithdrawBalance}",
style: TextStyle( style: TextStyle(
fontSize: 12.w, fontSize: 12.w,
color: const Color.fromRGBO(153, 153, 153, 1) color: const Color.fromRGBO(153, 153, 153, 1)

Loading…
Cancel
Save