wurong
1 year ago
7 changed files with 1535 additions and 246 deletions
@ -0,0 +1,540 @@
|
||||
import 'package:dio/dio.dart'; |
||||
import 'package:flutter/material.dart'; |
||||
import 'package:flutter_easyloading/flutter_easyloading.dart'; |
||||
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart'; |
||||
import 'package:huixiang/utils/font_weight.dart'; |
||||
import 'package:huixiang/view_widget/my_appbar.dart'; |
||||
import 'package:flutter_screenutil/flutter_screenutil.dart'; |
||||
import 'package:pull_to_refresh/pull_to_refresh.dart'; |
||||
|
||||
import '../../../generated/l10n.dart'; |
||||
import '../../../retrofit/business_api.dart'; |
||||
import '../../../retrofit/data/base_data.dart'; |
||||
import '../../../retrofit/data/phone_query_member_info.dart'; |
||||
import '../../../utils/business_instance.dart'; |
||||
import '../../../utils/flutter_utils.dart'; |
||||
import '../../../view_widget/classic_header.dart'; |
||||
import '../../../view_widget/custom_image.dart'; |
||||
import '../../../view_widget/my_footer.dart'; |
||||
import '../../../view_widget/settlement_tips_dialog.dart'; |
||||
|
||||
class MemberDetailsPage extends StatefulWidget { |
||||
final Map<String, dynamic> arguments; |
||||
|
||||
MemberDetailsPage({this.arguments}); |
||||
|
||||
@override |
||||
State<StatefulWidget> createState() { |
||||
return _MemberDetailsPage(); |
||||
} |
||||
} |
||||
|
||||
class _MemberDetailsPage extends State<MemberDetailsPage> { |
||||
final RefreshController refreshController = RefreshController(); |
||||
BusinessApiService businessService; |
||||
PhoneQueryMemberInfo phoneQueryMemberInfo; |
||||
String networkError = ""; |
||||
int networkStatus = 0; |
||||
|
||||
@override |
||||
void initState() { |
||||
super.initState(); |
||||
queryMemberPhoneInfo(widget?.arguments["phoneNum"] ?? ""); |
||||
} |
||||
|
||||
///根据手机号搜索用户信息 |
||||
queryMemberPhoneInfo(phoneNum, {isShow = true}) async { |
||||
try { |
||||
if (isShow) |
||||
EasyLoading.show( |
||||
status: S.current.zhengzaijiazai, |
||||
maskType: EasyLoadingMaskType.black); |
||||
if (businessService == null) { |
||||
businessService = BusinessApiService(Dio(), |
||||
context: context, |
||||
token: BusinessInstance.instance.businessToken, |
||||
tenant: BusinessInstance.instance.businessTenant, |
||||
storeId: widget.arguments["storeId"]); |
||||
} |
||||
BaseData<PhoneQueryMemberInfo> baseData = await businessService |
||||
.queryMemberInfo( |
||||
{"phoneNum": phoneNum, "isNewUser": false}).catchError((error) { |
||||
networkError = AppUtils.dioErrorTypeToString(error.type); |
||||
networkStatus = -1; |
||||
setState(() {}); |
||||
refreshController.refreshFailed(); |
||||
refreshController.loadFailed(); |
||||
}); |
||||
if (!mounted) return; |
||||
if (baseData != null && baseData.isSuccess) { |
||||
phoneQueryMemberInfo = baseData.data; |
||||
refreshController.loadComplete(); |
||||
refreshController.refreshCompleted(); |
||||
networkStatus = 1; |
||||
} else { |
||||
SmartDialog.showToast(baseData.msg, alignment: Alignment.center); |
||||
refreshController.refreshFailed(); |
||||
refreshController.loadFailed(); |
||||
} |
||||
} finally { |
||||
if (isShow) EasyLoading.dismiss(); |
||||
setState(() {}); |
||||
} |
||||
} |
||||
|
||||
@override |
||||
Widget build(BuildContext context) { |
||||
return Scaffold( |
||||
resizeToAvoidBottomInset: false, |
||||
appBar: MyAppBar( |
||||
title: "会员详情", |
||||
titleColor: Colors.black, |
||||
background: Colors.white, |
||||
leadingColor: Colors.black, |
||||
brightness: Brightness.dark, |
||||
), |
||||
body: |
||||
networkStatus == -1 |
||||
? noNetwork() : |
||||
SmartRefresher( |
||||
controller: refreshController, |
||||
enablePullDown: true, |
||||
enablePullUp: false, |
||||
header: MyHeader( |
||||
color: Color(0xFF30415B), |
||||
), |
||||
footer: CustomFooter( |
||||
builder: (context, mode) { |
||||
return MyFooter(mode); |
||||
}, |
||||
), |
||||
onRefresh: () { |
||||
queryMemberPhoneInfo(widget?.arguments["phoneNum"] ?? "",isShow: false); |
||||
}, |
||||
physics: BouncingScrollPhysics(), |
||||
scrollController: ScrollController(), |
||||
child: Container( |
||||
padding: EdgeInsets.only(top:15.h,left: 16.w,right: 16.w), |
||||
child: Column( |
||||
children: [ |
||||
vipPlate(), |
||||
vipFunction(), |
||||
vipRecord() |
||||
], |
||||
)))); |
||||
} |
||||
|
||||
///会员信息板块 |
||||
Widget vipPlate() { |
||||
return Container( |
||||
width: double.infinity, |
||||
margin: EdgeInsets.only(bottom: 12.h), |
||||
padding: EdgeInsets.only(bottom: 15.h), |
||||
decoration: BoxDecoration( |
||||
color: Colors.white, |
||||
boxShadow: [ |
||||
BoxShadow( |
||||
color: Color(0x0F06152E), |
||||
offset: Offset(0, 2), |
||||
blurRadius: 4, |
||||
spreadRadius: 0, |
||||
) |
||||
], |
||||
borderRadius: BorderRadius.circular(8), |
||||
), |
||||
child: Column( |
||||
children: [ |
||||
Container( |
||||
width: double.infinity, |
||||
padding: EdgeInsets.only(left: 16.w, bottom: 33.h, top: 13.h), |
||||
margin: EdgeInsets.only(bottom: 10.h), |
||||
decoration: BoxDecoration( |
||||
color: Colors.white, |
||||
gradient: LinearGradient( |
||||
begin: Alignment.centerLeft, |
||||
end: Alignment.centerRight, |
||||
colors: [Color(0xFF30415B), Color(0xFF5171A4)]), |
||||
borderRadius: BorderRadius.vertical( |
||||
top: Radius.circular(8), |
||||
), |
||||
), |
||||
child: Row( |
||||
crossAxisAlignment: CrossAxisAlignment.start, |
||||
children: [ |
||||
Container( |
||||
width: 52.h, |
||||
height: 52.h, |
||||
margin: EdgeInsets.only(right: 15.w,), |
||||
decoration: BoxDecoration( |
||||
borderRadius: BorderRadius.circular(4), |
||||
), |
||||
child:MImage( |
||||
(phoneQueryMemberInfo?.headimg ?? |
||||
""), |
||||
width: double.infinity, |
||||
height: double.infinity, |
||||
fit: BoxFit.cover, |
||||
errorSrc: "assets/image/default_1.webp", |
||||
fadeSrc: "assets/image/default_1.webp", |
||||
), |
||||
), |
||||
Column( |
||||
crossAxisAlignment: CrossAxisAlignment.start, |
||||
children: [ |
||||
Padding( |
||||
padding: EdgeInsets.only(bottom: 8.h), |
||||
child: Text( |
||||
"会员名称:${phoneQueryMemberInfo?.nickName ?? ""}", |
||||
overflow: TextOverflow.ellipsis, |
||||
maxLines: 2, |
||||
style: TextStyle( |
||||
fontSize: 12.sp, |
||||
fontWeight: MyFontWeight.regular, |
||||
color: Colors.white, |
||||
), |
||||
)), |
||||
Text( |
||||
"手机号:${phoneQueryMemberInfo?.phoneNum ?? ""}", |
||||
style: TextStyle( |
||||
fontSize: 12.sp, |
||||
fontWeight: MyFontWeight.regular, |
||||
color: Colors.white, |
||||
), |
||||
) |
||||
], |
||||
), |
||||
], |
||||
), |
||||
), |
||||
Row( |
||||
mainAxisAlignment: MainAxisAlignment.center, |
||||
children: [ |
||||
Expanded( |
||||
child: Column( |
||||
crossAxisAlignment: CrossAxisAlignment.center, |
||||
mainAxisAlignment: MainAxisAlignment.center, |
||||
children: [ |
||||
Padding( |
||||
padding: EdgeInsets.only(bottom: 7.h), |
||||
child: Row( |
||||
mainAxisAlignment: MainAxisAlignment.center, |
||||
children: [ |
||||
Image.asset( |
||||
"assets/image/bus_vip_balance.webp", |
||||
width: 24.h, |
||||
height: 24.h, |
||||
fit: BoxFit.fill, |
||||
), |
||||
Padding( |
||||
padding: EdgeInsets.only(left: 7.w), |
||||
child: Text( |
||||
"会员余额", |
||||
style: TextStyle( |
||||
fontSize: 14.sp, |
||||
fontWeight: MyFontWeight.regular, |
||||
color: Color(0xFF252626), |
||||
), |
||||
)) |
||||
], |
||||
)), |
||||
Text( |
||||
phoneQueryMemberInfo?.balance ?? "0.00", |
||||
style: TextStyle( |
||||
fontSize: 14.sp, |
||||
fontWeight: MyFontWeight.medium, |
||||
color: Color(0xFF30415B), |
||||
), |
||||
) |
||||
], |
||||
)), |
||||
Expanded( |
||||
child: Column( |
||||
crossAxisAlignment: CrossAxisAlignment.center, |
||||
mainAxisAlignment: MainAxisAlignment.center, |
||||
children: [ |
||||
Padding( |
||||
padding: EdgeInsets.only(bottom: 7.h), |
||||
child: Row( |
||||
mainAxisAlignment: MainAxisAlignment.center, |
||||
children: [ |
||||
Image.asset( |
||||
"assets/image/bus_coupon.webp", |
||||
width: 20.w, |
||||
height: 18.h, |
||||
fit: BoxFit.fill, |
||||
), |
||||
Padding( |
||||
padding: EdgeInsets.only(left: 7.w), |
||||
child: Text( |
||||
"优惠券", |
||||
style: TextStyle( |
||||
fontSize: 14.sp, |
||||
fontWeight: MyFontWeight.regular, |
||||
color: Color(0xFF252626), |
||||
), |
||||
)) |
||||
], |
||||
)), |
||||
Text( |
||||
(phoneQueryMemberInfo?.useableConponList?.length ?? 0) |
||||
.toString(), |
||||
style: TextStyle( |
||||
fontSize: 14.sp, |
||||
fontWeight: MyFontWeight.medium, |
||||
color: Color(0xFF30415B), |
||||
), |
||||
) |
||||
], |
||||
)), |
||||
], |
||||
) |
||||
], |
||||
), |
||||
); |
||||
} |
||||
|
||||
///会员功能 |
||||
Widget vipFunction() { |
||||
return Container( |
||||
width: double.infinity, |
||||
margin: EdgeInsets.only(bottom: 12.h), |
||||
padding: EdgeInsets.only(bottom:17.h,top:27.h,), |
||||
decoration: BoxDecoration( |
||||
color: Colors.white, |
||||
boxShadow: [ |
||||
BoxShadow( |
||||
color: Color(0x0F06152E), |
||||
offset: Offset(0, 2), |
||||
blurRadius: 4, |
||||
spreadRadius: 0, |
||||
) |
||||
], |
||||
borderRadius: BorderRadius.circular(8), |
||||
), |
||||
child:Row( |
||||
children: [ |
||||
Expanded( |
||||
child:GestureDetector( |
||||
behavior: HitTestBehavior.opaque, |
||||
onTap: (){ |
||||
Navigator.of(context) |
||||
.pushNamed('/router/vip_recharge_page', arguments: { |
||||
"storeId": widget.arguments["storeId"] ??"", |
||||
}); |
||||
}, |
||||
child: Column( |
||||
crossAxisAlignment: CrossAxisAlignment.center, |
||||
mainAxisAlignment: MainAxisAlignment.center, |
||||
children: [ |
||||
Padding(padding:EdgeInsets.only(bottom: 12.h), |
||||
child: Image.asset( |
||||
"assets/image/bus_home_syt.webp", |
||||
width: 26.w, |
||||
height: 23.h, |
||||
fit: BoxFit.fill, |
||||
)), |
||||
Text( |
||||
"会员充值", |
||||
style: TextStyle( |
||||
fontSize: 14.sp, |
||||
fontWeight: MyFontWeight.medium, |
||||
color: Color(0xFF252626), |
||||
), |
||||
), |
||||
], |
||||
), |
||||
)), |
||||
Expanded( |
||||
child:GestureDetector( |
||||
behavior: HitTestBehavior.opaque, |
||||
onTap: (){ |
||||
if(widget.arguments["storeId"] == "0"){ |
||||
SmartDialog.show( |
||||
widget: SettlementTips( |
||||
() { |
||||
}, |
||||
text: "当前为所有门店状态,收银操作时,请将门店切换至要消费的门店!", |
||||
color: Color(0xFF30415B), |
||||
)); |
||||
}else{ |
||||
Navigator.of(context) |
||||
.pushNamed('/router/cashier_page', arguments: { |
||||
"storeId": widget.arguments["storeId"] ??"", |
||||
"phone":widget?.arguments["phoneNum"] ?? "" |
||||
}); |
||||
} |
||||
}, |
||||
child: Column( |
||||
crossAxisAlignment: CrossAxisAlignment.center, |
||||
mainAxisAlignment: MainAxisAlignment.center, |
||||
children: [ |
||||
Padding(padding:EdgeInsets.only(bottom: 12.h), |
||||
child: Image.asset( |
||||
"assets/image/bus_home_hyyetj.webp", |
||||
width: 23.h, |
||||
height: 23.h, |
||||
fit: BoxFit.fill, |
||||
)), |
||||
Text( |
||||
"会员收银", |
||||
style: TextStyle( |
||||
fontSize: 14.sp, |
||||
fontWeight: MyFontWeight.medium, |
||||
color: Color(0xFF252626), |
||||
), |
||||
), |
||||
], |
||||
))), |
||||
Spacer() |
||||
// Expanded( |
||||
// child:Column( |
||||
// crossAxisAlignment: CrossAxisAlignment.center, |
||||
// mainAxisAlignment: MainAxisAlignment.center, |
||||
// children: [ |
||||
// Padding(padding:EdgeInsets.only(bottom: 12.h), |
||||
// child: Image.asset( |
||||
// "assets/image/bus_vip_cc.webp", |
||||
// width: 24.h, |
||||
// height: 24.h, |
||||
// fit: BoxFit.fill, |
||||
// )), |
||||
// Text( |
||||
// "会员充次", |
||||
// style: TextStyle( |
||||
// fontSize: 14.sp, |
||||
// fontWeight: MyFontWeight.medium, |
||||
// color: Color(0xFF252626), |
||||
// ), |
||||
// ), |
||||
// ], |
||||
// )), |
||||
], |
||||
), |
||||
); |
||||
} |
||||
|
||||
///会员消费/充值/充次记录 |
||||
Widget vipRecord() { |
||||
return Container( |
||||
width: double.infinity, |
||||
margin: EdgeInsets.only(bottom: 12.h), |
||||
padding: EdgeInsets.only(bottom:17.h,top:11.h,left: 17.w,right: 16.w), |
||||
decoration: BoxDecoration( |
||||
color: Colors.white, |
||||
boxShadow: [ |
||||
BoxShadow( |
||||
color: Color(0x0F06152E), |
||||
offset: Offset(0, 2), |
||||
blurRadius: 4, |
||||
spreadRadius: 0, |
||||
) |
||||
], |
||||
borderRadius: BorderRadius.circular(8), |
||||
), |
||||
child:Column( |
||||
children: [ |
||||
vipRecordText("消费记录"), |
||||
Container( |
||||
width: double.infinity, |
||||
height: 1.h, |
||||
color: Color(0xFFEBECEF), |
||||
), |
||||
vipRecordText("充值记录"), |
||||
// Container( |
||||
// width: double.infinity, |
||||
// height: 1.h, |
||||
// color: Color(0xFFEBECEF), |
||||
// ), |
||||
// vipRecordText("充次记录"), |
||||
], |
||||
), |
||||
); |
||||
} |
||||
|
||||
Widget vipRecordText(String text){ |
||||
return GestureDetector( |
||||
behavior: HitTestBehavior.opaque, |
||||
onTap: (){ |
||||
Navigator.of(context).pushNamed( |
||||
'/router/record_details', |
||||
arguments: { |
||||
"storeId": widget.arguments["storeId"], |
||||
"titleName":text, |
||||
"mid":phoneQueryMemberInfo?.sid ??"", |
||||
"title":text == "消费记录" ?"bill_tenant_balance":"bill_tenant_balance", |
||||
"category":text == "消费记录" ?"bill_cate_buy":"bill_cate_rechange", |
||||
}); |
||||
}, |
||||
child: Container( |
||||
padding: EdgeInsets.symmetric(vertical: 16.h), |
||||
child: Row( |
||||
children: [ |
||||
Expanded( |
||||
child: Text( |
||||
text, |
||||
style: TextStyle( |
||||
fontSize: 14.sp, |
||||
color: Color(0xFF1A1A1A), |
||||
fontWeight: MyFontWeight.regular), |
||||
)), |
||||
Padding(padding: EdgeInsets.only(right: 9.w,),child: Image.asset( |
||||
"assets/image/icon_right_z.webp", |
||||
width: 16.h, |
||||
height: 16.h, |
||||
color: Color(0xFF353535), |
||||
)), |
||||
], |
||||
), |
||||
), |
||||
); |
||||
} |
||||
|
||||
///网络错误 |
||||
Widget noNetwork() { |
||||
return Container( |
||||
color: Colors.white, |
||||
width: double.infinity, |
||||
child: Column( |
||||
mainAxisAlignment: MainAxisAlignment.center, |
||||
children: [ |
||||
Text( |
||||
networkError.substring(0, networkError.indexOf(",")), |
||||
style: TextStyle( |
||||
fontSize: 14.sp, |
||||
color: Color(0xFF0D0D0D), |
||||
fontWeight: MyFontWeight.bold), |
||||
), |
||||
Padding( |
||||
padding: EdgeInsets.symmetric(vertical: 10.h), |
||||
child: Text( |
||||
"请检查网络设置或稍后重试", |
||||
style: TextStyle( |
||||
fontSize: 12.sp, |
||||
color: Color(0xFF7A797F), |
||||
fontWeight: MyFontWeight.regular), |
||||
), |
||||
), |
||||
GestureDetector( |
||||
behavior: HitTestBehavior.opaque, |
||||
onTap: () { |
||||
queryMemberPhoneInfo(widget?.arguments["phoneNum"] ?? ""); |
||||
}, |
||||
child: Container( |
||||
decoration: BoxDecoration( |
||||
color: Color(0xFF30415B), |
||||
borderRadius: BorderRadius.circular(15), |
||||
), |
||||
padding: EdgeInsets.symmetric(horizontal: 12.w, vertical: 3.h), |
||||
child: Text( |
||||
"重试", |
||||
style: TextStyle( |
||||
fontSize: 14.sp, |
||||
color: Colors.white, |
||||
fontWeight: MyFontWeight.regular), |
||||
)), |
||||
) |
||||
], |
||||
), |
||||
); |
||||
} |
||||
} |
@ -0,0 +1,350 @@
|
||||
import 'package:dio/dio.dart'; |
||||
import 'package:flutter/material.dart'; |
||||
import 'package:flutter_easyloading/flutter_easyloading.dart'; |
||||
import 'package:huixiang/view_widget/my_appbar.dart'; |
||||
import 'package:flutter_screenutil/flutter_screenutil.dart'; |
||||
import 'package:pull_to_refresh/pull_to_refresh.dart'; |
||||
import 'package:shimmer/shimmer.dart'; |
||||
import '../../../generated/l10n.dart'; |
||||
import '../../../retrofit/business_api.dart'; |
||||
import '../../../retrofit/data/base_data.dart'; |
||||
import '../../../retrofit/data/phone_query_member_info.dart'; |
||||
import '../../../retrofit/data/vip_record_details_list.dart'; |
||||
import '../../../utils/business_instance.dart'; |
||||
import '../../../utils/flutter_utils.dart'; |
||||
import '../../../utils/font_weight.dart'; |
||||
import '../../../view_widget/classic_header.dart'; |
||||
import '../../../view_widget/my_footer.dart'; |
||||
import '../../../view_widget/no_data_view.dart'; |
||||
|
||||
class RecordDetails extends StatefulWidget { |
||||
final Map<String, dynamic> arguments; |
||||
|
||||
RecordDetails({this.arguments}); |
||||
|
||||
@override |
||||
State<StatefulWidget> createState() { |
||||
return _RecordDetails(); |
||||
} |
||||
} |
||||
|
||||
class _RecordDetails extends State<RecordDetails> { |
||||
final RefreshController refreshController = RefreshController(); |
||||
BusinessApiService businessService; |
||||
PhoneQueryMemberInfo phoneQueryMemberInfo; |
||||
String networkError = ""; |
||||
int networkStatus = 0; |
||||
String titleName; |
||||
int _current = 1; |
||||
List<Records> records = []; |
||||
String mid; |
||||
String title; |
||||
String category; |
||||
|
||||
@override |
||||
void initState() { |
||||
super.initState(); |
||||
titleName = widget?.arguments["titleName"] ?? ""; |
||||
mid = widget?.arguments["mid"] ?? ""; |
||||
title = widget?.arguments["title"] ?? ""; |
||||
category = widget?.arguments["category"] ?? ""; |
||||
queryMemberSourceBillDetails(mid:mid,title:title,category:category); |
||||
} |
||||
|
||||
///查询会员消费/充值记录 |
||||
queryMemberSourceBillDetails({mid,title,category, isRefresh = true}) async { |
||||
try { |
||||
if (isRefresh) |
||||
EasyLoading.show( |
||||
status: S.current.zhengzaijiazai, |
||||
maskType: EasyLoadingMaskType.black); |
||||
if (businessService == null) { |
||||
businessService = BusinessApiService(Dio(), |
||||
context: context, |
||||
token: BusinessInstance.instance.businessToken, |
||||
tenant: BusinessInstance.instance.businessTenant, |
||||
storeId: widget.arguments["storeId"]); |
||||
} |
||||
BaseData<VipRecordDetailsList> baseData = |
||||
await businessService.getMemberSourceBillDetails({ |
||||
"model": { |
||||
"mid": mid, |
||||
"title":title, |
||||
"category": category |
||||
}, |
||||
"current": _current, |
||||
"size": 10 |
||||
}).catchError((error) { |
||||
networkError = AppUtils.dioErrorTypeToString(error.type); |
||||
networkStatus = -1; |
||||
setState(() {}); |
||||
refreshController.refreshFailed(); |
||||
refreshController.loadFailed(); |
||||
}); |
||||
if (!mounted) return; |
||||
if (baseData != null && baseData.isSuccess) { |
||||
records.addAll(baseData?.data?.records ?? []); |
||||
if ((baseData?.data?.records ?? []).isEmpty || |
||||
records.length.toString() == baseData.data.total) |
||||
refreshController.loadNoData(); |
||||
else |
||||
refreshController.loadComplete(); |
||||
networkStatus = 1; |
||||
} |
||||
} finally { |
||||
if (isRefresh) { |
||||
setState(() {}); |
||||
EasyLoading.dismiss(); |
||||
} |
||||
} |
||||
} |
||||
|
||||
@override |
||||
Widget build(BuildContext context) { |
||||
return Scaffold( |
||||
appBar: MyAppBar( |
||||
title: titleName, |
||||
titleColor: Colors.black, |
||||
background: Colors.white, |
||||
leadingColor: Colors.black, |
||||
brightness: Brightness.dark, |
||||
), |
||||
body: networkStatus == -1 |
||||
? noNetwork() |
||||
: SmartRefresher( |
||||
controller: refreshController, |
||||
enablePullDown: true, |
||||
enablePullUp: records.length == 0 ? false : true, |
||||
header: MyHeader( |
||||
color: Color(0xFF30415B), |
||||
), |
||||
footer: CustomFooter( |
||||
builder: (context, mode) { |
||||
return MyFooter(mode); |
||||
}, |
||||
), |
||||
onRefresh: () { |
||||
_current = 1; |
||||
records.clear(); |
||||
queryMemberSourceBillDetails(mid:mid,title:title,category:category,isRefresh: false); |
||||
}, |
||||
onLoading: () { |
||||
_current++; |
||||
queryMemberSourceBillDetails(mid:mid,title:title,category:category,isRefresh: false); |
||||
}, |
||||
physics: BouncingScrollPhysics(), |
||||
scrollController: ScrollController(), |
||||
child: Container( |
||||
child: |
||||
networkStatus == 0 |
||||
? ListView.builder( |
||||
itemCount: 10, |
||||
physics: BouncingScrollPhysics(), |
||||
shrinkWrap: true, |
||||
itemBuilder: (context, position) { |
||||
return GestureDetector( |
||||
behavior: HitTestBehavior.opaque, |
||||
onTap: () {}, |
||||
child: recordItemSm(), |
||||
); |
||||
}, |
||||
) |
||||
: ((records == null || records.length == 0) |
||||
? NoDataView( |
||||
src: "assets/image/bs_no data_logo.webp", |
||||
isShowBtn: false, |
||||
text: titleName == "消费记录"?"暂无消费记录":"暂无充值记录", |
||||
fontSize: 16.sp, |
||||
margin: EdgeInsets.all(20.h), |
||||
) : |
||||
Container( |
||||
margin: EdgeInsets.only(top: 16.h), |
||||
child: ListView.builder( |
||||
itemCount: records?.length ?? 0, |
||||
physics: BouncingScrollPhysics(), |
||||
shrinkWrap: true, |
||||
itemBuilder: (context, position) { |
||||
return GestureDetector( |
||||
behavior: HitTestBehavior.opaque, |
||||
onTap: () {}, |
||||
child: recordItem(records[position]), |
||||
); |
||||
}, |
||||
), |
||||
)), |
||||
), |
||||
)); |
||||
} |
||||
|
||||
Widget recordItem(Records records) { |
||||
return Container( |
||||
width: double.infinity, |
||||
margin: EdgeInsets.only(bottom: 12.h, left: 16.w, right: 16.w), |
||||
padding: EdgeInsets.only(bottom: 12.h, top: 12.h, left: 16.w), |
||||
decoration: BoxDecoration( |
||||
color: Colors.white, |
||||
boxShadow: [ |
||||
BoxShadow( |
||||
color: Color(0x0F06152E), |
||||
offset: Offset(0, 2), |
||||
blurRadius: 4, |
||||
spreadRadius: 0, |
||||
) |
||||
], |
||||
borderRadius: BorderRadius.circular(8), |
||||
), |
||||
child: Column( |
||||
crossAxisAlignment: CrossAxisAlignment.start, |
||||
children: [ |
||||
Padding( |
||||
padding: EdgeInsets.only(bottom: 20.h), |
||||
child: Text( |
||||
records?.createTime ?? "", |
||||
style: TextStyle( |
||||
fontSize: 14.sp, |
||||
color: Color(0xFF1A1A1A), |
||||
fontWeight: MyFontWeight.bold), |
||||
), |
||||
), |
||||
Text.rich( |
||||
TextSpan( |
||||
children: [ |
||||
TextSpan( |
||||
text: "金额:", |
||||
style: TextStyle( |
||||
fontSize: 14.sp, |
||||
fontWeight: MyFontWeight.regular, |
||||
color: Color(0xFF666666), |
||||
), |
||||
), |
||||
TextSpan( |
||||
text: titleName == "消费记录"?"- ${records?.number}":"+ ${records?.number}", |
||||
style: TextStyle( |
||||
fontSize: 14.sp, |
||||
fontWeight: MyFontWeight.bold, |
||||
color: Color(0xFFFA5151), |
||||
), |
||||
), |
||||
], |
||||
), |
||||
) |
||||
], |
||||
), |
||||
); |
||||
} |
||||
|
||||
Widget recordItemSm() { |
||||
return Container( |
||||
width: double.infinity, |
||||
margin: EdgeInsets.only(bottom: 12.h, left: 16.w, right: 16.w), |
||||
padding: EdgeInsets.only(bottom: 12.h, top: 12.h, left: 16.w), |
||||
decoration: BoxDecoration( |
||||
color: Colors.white, |
||||
boxShadow: [ |
||||
BoxShadow( |
||||
color: Color(0x0F06152E), |
||||
offset: Offset(0, 2), |
||||
blurRadius: 4, |
||||
spreadRadius: 0, |
||||
) |
||||
], |
||||
borderRadius: BorderRadius.circular(8), |
||||
), |
||||
child: Column( |
||||
crossAxisAlignment: CrossAxisAlignment.start, |
||||
children: [ |
||||
Shimmer.fromColors( |
||||
baseColor: Color(0XFFD8D8D8), |
||||
highlightColor: Color(0XFFD8D8D8), |
||||
child: Container( |
||||
margin: EdgeInsets.only(bottom: 16.h), |
||||
decoration: BoxDecoration( |
||||
color: Color(0XFFD8D8D8), |
||||
borderRadius: BorderRadius.circular(2), |
||||
), |
||||
width: 141.w, |
||||
height: 20.h, |
||||
), |
||||
), |
||||
Row( |
||||
children: [ |
||||
Shimmer.fromColors( |
||||
baseColor: Color(0XFFD8D8D8), |
||||
highlightColor: Color(0XFFD8D8D8), |
||||
child: Container( |
||||
margin: EdgeInsets.only(right:10.w), |
||||
decoration: BoxDecoration( |
||||
color: Color(0XFFD8D8D8), |
||||
borderRadius: BorderRadius.circular(2), |
||||
), |
||||
width: 42.w, |
||||
height: 20.h, |
||||
), |
||||
), |
||||
Shimmer.fromColors( |
||||
baseColor: Color(0XFFD8D8D8), |
||||
highlightColor: Color(0XFFD8D8D8), |
||||
child: Container( |
||||
decoration: BoxDecoration( |
||||
color: Color(0XFFD8D8D8), |
||||
borderRadius: BorderRadius.circular(2), |
||||
), |
||||
width: 55.w, |
||||
height: 20.h, |
||||
), |
||||
), |
||||
], |
||||
) |
||||
], |
||||
), |
||||
); |
||||
} |
||||
|
||||
///网络错误 |
||||
Widget noNetwork() { |
||||
return Container( |
||||
color: Colors.white, |
||||
child: Column( |
||||
mainAxisAlignment: MainAxisAlignment.center, |
||||
children: [ |
||||
Text( |
||||
networkError.substring(0, networkError.indexOf(",")), |
||||
style: TextStyle( |
||||
fontSize: 14.sp, |
||||
color: Color(0xFF0D0D0D), |
||||
fontWeight: MyFontWeight.bold), |
||||
), |
||||
Padding( |
||||
padding: EdgeInsets.symmetric(vertical: 10.h), |
||||
child: Text( |
||||
"请检查网络设置或稍后重试", |
||||
style: TextStyle( |
||||
fontSize: 12.sp, |
||||
color: Color(0xFF7A797F), |
||||
fontWeight: MyFontWeight.regular), |
||||
), |
||||
), |
||||
GestureDetector( |
||||
behavior: HitTestBehavior.opaque, |
||||
onTap: () { |
||||
// _onRefresh(); |
||||
}, |
||||
child: Container( |
||||
decoration: BoxDecoration( |
||||
color: Color(0xFF30415B), |
||||
borderRadius: BorderRadius.circular(15), |
||||
), |
||||
padding: EdgeInsets.symmetric(horizontal: 12.w, vertical: 3.h), |
||||
child: Text( |
||||
"重试", |
||||
style: TextStyle( |
||||
fontSize: 14.sp, |
||||
color: Colors.white, |
||||
fontWeight: MyFontWeight.regular), |
||||
)), |
||||
) |
||||
], |
||||
), |
||||
); |
||||
} |
||||
} |
@ -0,0 +1,349 @@
|
||||
/// records : [{"id":"1740270714188988416","createTime":"2023-12-28 15:17:26","createUser":"1659496253991419904","updateTime":"2023-12-28 15:17:26","updateUser":"1659496253991419904","mid":"1659496253991419904","linkId":"202312281517200005","pm":0,"title":"商户余额操作","category":"用户消费","type":"商户会员余额支付","number":"0.01","realNumber":"0.01","balance":"1109.94","mark":"","status":true,"isDeleted":false,"tenantName":"海峡姐妹茶膳坊","rechargeMoney":"0.01","giftMoney":"0.00","totalMoney":"0.01","balanceMoney":"1109.94"},{"id":"1740270550686629888","createTime":"2023-12-28 15:16:47","createUser":"1659496253991419904","updateTime":"2023-12-28 15:16:47","updateUser":"1659496253991419904","mid":"1659496253991419904","linkId":"202312281516420004","pm":0,"title":"商户余额操作","category":"用户消费","type":"商户会员余额支付","number":"0.01","realNumber":"0.01","balance":"1109.95","mark":"","status":true,"isDeleted":false,"tenantName":"海峡姐妹茶膳坊","rechargeMoney":"0.01","giftMoney":"0.00","totalMoney":"0.01","balanceMoney":"1109.95"},{"id":"1740270356993671168","createTime":"2023-12-28 15:16:00","createUser":"1659496253991419904","updateTime":"2023-12-28 15:16:00","updateUser":"1659496253991419904","mid":"1659496253991419904","linkId":"202312281515560003","pm":0,"title":"商户余额操作","category":"用户消费","type":"商户会员余额支付","number":"0.01","realNumber":"0.01","balance":"1109.96","mark":"","status":true,"isDeleted":false,"tenantName":"海峡姐妹茶膳坊","rechargeMoney":"0.01","giftMoney":"0.00","totalMoney":"0.01","balanceMoney":"1109.96"},{"id":"1740270215087783936","createTime":"2023-12-28 15:15:27","createUser":"1659496253991419904","updateTime":"2023-12-28 15:15:27","updateUser":"1659496253991419904","mid":"1659496253991419904","linkId":"202312281515230002","pm":0,"title":"商户余额操作","category":"用户消费","type":"商户会员余额支付","number":"0.01","realNumber":"0.01","balance":"1109.97","mark":"","status":true,"isDeleted":false,"tenantName":"海峡姐妹茶膳坊","rechargeMoney":"0.01","giftMoney":"0.00","totalMoney":"0.01","balanceMoney":"1109.97"},{"id":"1740270122343333888","createTime":"2023-12-28 15:15:04","createUser":"1659496253991419904","updateTime":"2023-12-28 15:15:04","updateUser":"1659496253991419904","mid":"1659496253991419904","linkId":"202312281515000001","pm":0,"title":"商户余额操作","category":"用户消费","type":"商户会员余额支付","number":"0.01","realNumber":"0.01","balance":"1109.98","mark":"","status":true,"isDeleted":false,"tenantName":"海峡姐妹茶膳坊","rechargeMoney":"0.01","giftMoney":"0.00","totalMoney":"0.01","balanceMoney":"1109.98"},{"id":"1740269600106348544","createTime":"2023-12-28 15:13:00","createUser":"1659496253991419904","updateTime":"2023-12-28 15:13:00","updateUser":"1659496253991419904","mid":"1659496253991419904","linkId":"202312281512530001","pm":0,"title":"商户余额操作","category":"用户消费","type":"商户会员余额支付","number":"0.01","realNumber":"0.01","balance":"1109.99","mark":"","status":true,"isDeleted":false,"tenantName":"海峡姐妹茶膳坊","rechargeMoney":"0.01","giftMoney":"0.00","totalMoney":"0.01","balanceMoney":"1109.99"}] |
||||
/// total : "6" |
||||
/// size : "10" |
||||
/// current : "1" |
||||
/// orders : [{"column":"id","asc":false}] |
||||
/// hitCount : false |
||||
/// searchCount : true |
||||
/// pages : "1" |
||||
|
||||
class VipRecordDetailsList { |
||||
VipRecordDetailsList({ |
||||
List<Records> records, |
||||
String total, |
||||
String size, |
||||
String current, |
||||
List<Orders> orders, |
||||
bool hitCount, |
||||
bool searchCount, |
||||
String pages,}){ |
||||
_records = records; |
||||
_total = total; |
||||
_size = size; |
||||
_current = current; |
||||
_orders = orders; |
||||
_hitCount = hitCount; |
||||
_searchCount = searchCount; |
||||
_pages = pages; |
||||
} |
||||
|
||||
VipRecordDetailsList.fromJson(dynamic json) { |
||||
if (json['records'] != null) { |
||||
_records = []; |
||||
json['records'].forEach((v) { |
||||
_records.add(Records.fromJson(v)); |
||||
}); |
||||
} |
||||
_total = json['total']; |
||||
_size = json['size']; |
||||
_current = json['current']; |
||||
if (json['orders'] != null) { |
||||
_orders = []; |
||||
json['orders'].forEach((v) { |
||||
_orders.add(Orders.fromJson(v)); |
||||
}); |
||||
} |
||||
_hitCount = json['hitCount']; |
||||
_searchCount = json['searchCount']; |
||||
_pages = json['pages']; |
||||
} |
||||
List<Records> _records; |
||||
String _total; |
||||
String _size; |
||||
String _current; |
||||
List<Orders> _orders; |
||||
bool _hitCount; |
||||
bool _searchCount; |
||||
String _pages; |
||||
VipRecordDetailsList copyWith({ List<Records> records, |
||||
String total, |
||||
String size, |
||||
String current, |
||||
List<Orders> orders, |
||||
bool hitCount, |
||||
bool searchCount, |
||||
String pages, |
||||
}) => VipRecordDetailsList( records: records ?? _records, |
||||
total: total ?? _total, |
||||
size: size ?? _size, |
||||
current: current ?? _current, |
||||
orders: orders ?? _orders, |
||||
hitCount: hitCount ?? _hitCount, |
||||
searchCount: searchCount ?? _searchCount, |
||||
pages: pages ?? _pages, |
||||
); |
||||
List<Records> get records => _records; |
||||
String get total => _total; |
||||
String get size => _size; |
||||
String get current => _current; |
||||
List<Orders> get orders => _orders; |
||||
bool get hitCount => _hitCount; |
||||
bool get searchCount => _searchCount; |
||||
String get pages => _pages; |
||||
|
||||
Map<String, dynamic> toJson() { |
||||
final map = <String, dynamic>{}; |
||||
if (_records != null) { |
||||
map['records'] = _records.map((v) => v.toJson()).toList(); |
||||
} |
||||
map['total'] = _total; |
||||
map['size'] = _size; |
||||
map['current'] = _current; |
||||
if (_orders != null) { |
||||
map['orders'] = _orders.map((v) => v.toJson()).toList(); |
||||
} |
||||
map['hitCount'] = _hitCount; |
||||
map['searchCount'] = _searchCount; |
||||
map['pages'] = _pages; |
||||
return map; |
||||
} |
||||
|
||||
} |
||||
|
||||
/// column : "id" |
||||
/// asc : false |
||||
|
||||
class Orders { |
||||
Orders({ |
||||
String column, |
||||
bool asc,}){ |
||||
_column = column; |
||||
_asc = asc; |
||||
} |
||||
|
||||
Orders.fromJson(dynamic json) { |
||||
_column = json['column']; |
||||
_asc = json['asc']; |
||||
} |
||||
String _column; |
||||
bool _asc; |
||||
Orders copyWith({ String column, |
||||
bool asc, |
||||
}) => Orders( column: column ?? _column, |
||||
asc: asc ?? _asc, |
||||
); |
||||
String get column => _column; |
||||
bool get asc => _asc; |
||||
|
||||
Map<String, dynamic> toJson() { |
||||
final map = <String, dynamic>{}; |
||||
map['column'] = _column; |
||||
map['asc'] = _asc; |
||||
return map; |
||||
} |
||||
|
||||
} |
||||
|
||||
/// id : "1740270714188988416" |
||||
/// createTime : "2023-12-28 15:17:26" |
||||
/// createUser : "1659496253991419904" |
||||
/// updateTime : "2023-12-28 15:17:26" |
||||
/// updateUser : "1659496253991419904" |
||||
/// mid : "1659496253991419904" |
||||
/// linkId : "202312281517200005" |
||||
/// pm : 0 |
||||
/// title : "商户余额操作" |
||||
/// category : "用户消费" |
||||
/// type : "商户会员余额支付" |
||||
/// number : "0.01" |
||||
/// realNumber : "0.01" |
||||
/// balance : "1109.94" |
||||
/// mark : "" |
||||
/// status : true |
||||
/// isDeleted : false |
||||
/// tenantName : "海峡姐妹茶膳坊" |
||||
/// rechargeMoney : "0.01" |
||||
/// giftMoney : "0.00" |
||||
/// totalMoney : "0.01" |
||||
/// balanceMoney : "1109.94" |
||||
|
||||
class Records { |
||||
Records({ |
||||
String id, |
||||
String createTime, |
||||
String createUser, |
||||
String updateTime, |
||||
String updateUser, |
||||
String mid, |
||||
String linkId, |
||||
num pm, |
||||
String title, |
||||
String category, |
||||
String type, |
||||
String number, |
||||
String realNumber, |
||||
String balance, |
||||
String mark, |
||||
bool status, |
||||
bool isDeleted, |
||||
String tenantName, |
||||
String rechargeMoney, |
||||
String giftMoney, |
||||
String totalMoney, |
||||
String balanceMoney,}){ |
||||
_id = id; |
||||
_createTime = createTime; |
||||
_createUser = createUser; |
||||
_updateTime = updateTime; |
||||
_updateUser = updateUser; |
||||
_mid = mid; |
||||
_linkId = linkId; |
||||
_pm = pm; |
||||
_title = title; |
||||
_category = category; |
||||
_type = type; |
||||
_number = number; |
||||
_realNumber = realNumber; |
||||
_balance = balance; |
||||
_mark = mark; |
||||
_status = status; |
||||
_isDeleted = isDeleted; |
||||
_tenantName = tenantName; |
||||
_rechargeMoney = rechargeMoney; |
||||
_giftMoney = giftMoney; |
||||
_totalMoney = totalMoney; |
||||
_balanceMoney = balanceMoney; |
||||
} |
||||
|
||||
Records.fromJson(dynamic json) { |
||||
_id = json['id']; |
||||
_createTime = json['createTime']; |
||||
_createUser = json['createUser']; |
||||
_updateTime = json['updateTime']; |
||||
_updateUser = json['updateUser']; |
||||
_mid = json['mid']; |
||||
_linkId = json['linkId']; |
||||
_pm = json['pm']; |
||||
_title = json['title']; |
||||
_category = json['category']; |
||||
_type = json['type']; |
||||
_number = json['number']; |
||||
_realNumber = json['realNumber']; |
||||
_balance = json['balance']; |
||||
_mark = json['mark']; |
||||
_status = json['status']; |
||||
_isDeleted = json['isDeleted']; |
||||
_tenantName = json['tenantName']; |
||||
_rechargeMoney = json['rechargeMoney']; |
||||
_giftMoney = json['giftMoney']; |
||||
_totalMoney = json['totalMoney']; |
||||
_balanceMoney = json['balanceMoney']; |
||||
} |
||||
String _id; |
||||
String _createTime; |
||||
String _createUser; |
||||
String _updateTime; |
||||
String _updateUser; |
||||
String _mid; |
||||
String _linkId; |
||||
num _pm; |
||||
String _title; |
||||
String _category; |
||||
String _type; |
||||
String _number; |
||||
String _realNumber; |
||||
String _balance; |
||||
String _mark; |
||||
bool _status; |
||||
bool _isDeleted; |
||||
String _tenantName; |
||||
String _rechargeMoney; |
||||
String _giftMoney; |
||||
String _totalMoney; |
||||
String _balanceMoney; |
||||
Records copyWith({ String id, |
||||
String createTime, |
||||
String createUser, |
||||
String updateTime, |
||||
String updateUser, |
||||
String mid, |
||||
String linkId, |
||||
num pm, |
||||
String title, |
||||
String category, |
||||
String type, |
||||
String number, |
||||
String realNumber, |
||||
String balance, |
||||
String mark, |
||||
bool status, |
||||
bool isDeleted, |
||||
String tenantName, |
||||
String rechargeMoney, |
||||
String giftMoney, |
||||
String totalMoney, |
||||
String balanceMoney, |
||||
}) => Records( id: id ?? _id, |
||||
createTime: createTime ?? _createTime, |
||||
createUser: createUser ?? _createUser, |
||||
updateTime: updateTime ?? _updateTime, |
||||
updateUser: updateUser ?? _updateUser, |
||||
mid: mid ?? _mid, |
||||
linkId: linkId ?? _linkId, |
||||
pm: pm ?? _pm, |
||||
title: title ?? _title, |
||||
category: category ?? _category, |
||||
type: type ?? _type, |
||||
number: number ?? _number, |
||||
realNumber: realNumber ?? _realNumber, |
||||
balance: balance ?? _balance, |
||||
mark: mark ?? _mark, |
||||
status: status ?? _status, |
||||
isDeleted: isDeleted ?? _isDeleted, |
||||
tenantName: tenantName ?? _tenantName, |
||||
rechargeMoney: rechargeMoney ?? _rechargeMoney, |
||||
giftMoney: giftMoney ?? _giftMoney, |
||||
totalMoney: totalMoney ?? _totalMoney, |
||||
balanceMoney: balanceMoney ?? _balanceMoney, |
||||
); |
||||
String get id => _id; |
||||
String get createTime => _createTime; |
||||
String get createUser => _createUser; |
||||
String get updateTime => _updateTime; |
||||
String get updateUser => _updateUser; |
||||
String get mid => _mid; |
||||
String get linkId => _linkId; |
||||
num get pm => _pm; |
||||
String get title => _title; |
||||
String get category => _category; |
||||
String get type => _type; |
||||
String get number => _number; |
||||
String get realNumber => _realNumber; |
||||
String get balance => _balance; |
||||
String get mark => _mark; |
||||
bool get status => _status; |
||||
bool get isDeleted => _isDeleted; |
||||
String get tenantName => _tenantName; |
||||
String get rechargeMoney => _rechargeMoney; |
||||
String get giftMoney => _giftMoney; |
||||
String get totalMoney => _totalMoney; |
||||
String get balanceMoney => _balanceMoney; |
||||
|
||||
Map<String, dynamic> toJson() { |
||||
final map = <String, dynamic>{}; |
||||
map['id'] = _id; |
||||
map['createTime'] = _createTime; |
||||
map['createUser'] = _createUser; |
||||
map['updateTime'] = _updateTime; |
||||
map['updateUser'] = _updateUser; |
||||
map['mid'] = _mid; |
||||
map['linkId'] = _linkId; |
||||
map['pm'] = _pm; |
||||
map['title'] = _title; |
||||
map['category'] = _category; |
||||
map['type'] = _type; |
||||
map['number'] = _number; |
||||
map['realNumber'] = _realNumber; |
||||
map['balance'] = _balance; |
||||
map['mark'] = _mark; |
||||
map['status'] = _status; |
||||
map['isDeleted'] = _isDeleted; |
||||
map['tenantName'] = _tenantName; |
||||
map['rechargeMoney'] = _rechargeMoney; |
||||
map['giftMoney'] = _giftMoney; |
||||
map['totalMoney'] = _totalMoney; |
||||
map['balanceMoney'] = _balanceMoney; |
||||
return map; |
||||
} |
||||
|
||||
} |
Loading…
Reference in new issue