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.
59 lines
1.4 KiB
59 lines
1.4 KiB
import 'package:dating_touchme_app/model/mine/rose_history_data.dart';
|
|
import 'package:dating_touchme_app/network/user_api.dart';
|
|
import 'package:easy_refresh/easy_refresh.dart';
|
|
import 'package:get/get.dart';
|
|
|
|
class RoseHistoryController extends GetxController {
|
|
|
|
late UserApi _userApi;
|
|
|
|
List<String> friendNavList = ["赠送记录", "收支详情", "聊天券记录"].obs;
|
|
|
|
final friendNavActive = 0.obs;
|
|
|
|
final roseHistoryList = <Records>[].obs;
|
|
|
|
|
|
late final EasyRefreshController listRefreshController;
|
|
|
|
|
|
@override
|
|
void onInit() {
|
|
super.onInit();
|
|
|
|
listRefreshController = EasyRefreshController(
|
|
controlFinishRefresh: true,
|
|
controlFinishLoad: true,
|
|
);
|
|
_userApi = Get.find<UserApi>();
|
|
getHistoryList();
|
|
}
|
|
|
|
changeNavTab(int i) async {
|
|
roseHistoryList.clear();
|
|
friendNavActive.value = i;
|
|
getHistoryList();
|
|
}
|
|
|
|
getHistoryList() async {
|
|
try{
|
|
final response = await _userApi.pageVirtualAccountRecord(
|
|
pageNum: 1,
|
|
pageSize: 10,
|
|
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());
|
|
} else {
|
|
|
|
// 响应失败,抛出异常
|
|
throw Exception(response.data.message ?? '获取数据失败');
|
|
}
|
|
} catch(e) {
|
|
|
|
}
|
|
}
|
|
|
|
}
|