Browse Source
首页用户概览板块更改成会员管理,并新增会员概览,会员列表,会员充值流水三个选项板块,并增加会员更多数据板块跳转; 首页接口优化更改; 订单页面更改,新增票券板块选项; 订单列表页面ui高度边距优化; 票券详情页面票券状态显示优化; 扫一扫页面ui优化; 新增余额变动,会员列表,会员充值流水,实体类; 新增会员页面,会员列表,会员充值流水,会员余额变动页面; 订单页面更改,单独新增订单页面; 新增tab下划线长度文件;(可用于自定义tab下划线长短,颜色等)wr_2023_business
wurong
1 year ago
26 changed files with 8665 additions and 291 deletions
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,867 @@
|
||||
import 'package:dio/dio.dart'; |
||||
import 'package:flutter/cupertino.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/view_widget/classic_header.dart'; |
||||
import 'package:huixiang/view_widget/my_footer.dart'; |
||||
import 'package:pull_to_refresh/pull_to_refresh.dart'; |
||||
import 'package:flutter_screenutil/flutter_screenutil.dart'; |
||||
import 'package:shimmer/shimmer.dart'; |
||||
|
||||
import '../../../generated/l10n.dart'; |
||||
import '../../../retrofit/business_api.dart'; |
||||
import '../../../retrofit/data/base_data.dart'; |
||||
import '../../../retrofit/data/business_vip_list.dart'; |
||||
import '../../../utils/business_instance.dart'; |
||||
import '../../../utils/flutter_utils.dart'; |
||||
import '../../../utils/font_weight.dart'; |
||||
import '../../../view_widget/no_data_view.dart'; |
||||
|
||||
class BusVipList extends StatefulWidget { |
||||
final String storeId; |
||||
|
||||
BusVipList( |
||||
Key key, |
||||
this.storeId, |
||||
) : super(key: key); |
||||
|
||||
@override |
||||
State<StatefulWidget> createState() { |
||||
return _BusVipList(); |
||||
} |
||||
} |
||||
|
||||
class _BusVipList extends State<BusVipList> { |
||||
final RefreshController _refreshController = RefreshController(); |
||||
BusinessApiService businessService; |
||||
List<Records> records = []; |
||||
int _current = 1; |
||||
String networkError = ""; |
||||
int networkStatus = 0; |
||||
final TextEditingController editingController = TextEditingController(); |
||||
FocusNode _focusNode = FocusNode(); |
||||
bool isKeyBoardShow = false; |
||||
|
||||
///离开页面记着销毁和清除 |
||||
@override |
||||
void dispose() { |
||||
super.dispose(); |
||||
_refreshController.dispose(); |
||||
_focusNode.unfocus(); |
||||
} |
||||
|
||||
@override |
||||
void initState() { |
||||
super.initState(); |
||||
WidgetsBinding.instance.addPostFrameCallback((_) { |
||||
setState(() { |
||||
print("object: ${MediaQuery.of(context).viewInsets.bottom}"); |
||||
if (MediaQuery.of(context).viewInsets.bottom == 0) { |
||||
if (isKeyBoardShow) { |
||||
isKeyBoardShow = false; |
||||
//关闭键盘 软键盘关闭了, 清除输入控件的焦点, 否则重新进入页面会导致软键盘再弹出问题 |
||||
FocusScope.of(context).requestFocus(FocusNode()); |
||||
} |
||||
} else { |
||||
isKeyBoardShow = true; |
||||
} |
||||
}); |
||||
}); |
||||
_onRefresh(); |
||||
} |
||||
|
||||
_onRefresh({bool isShowLoad = true}) async { |
||||
if (isShowLoad) |
||||
EasyLoading.show( |
||||
status: S.current.zhengzaijiazai, |
||||
maskType: EasyLoadingMaskType.black); |
||||
await queryVipList(isRefreshData: false); |
||||
EasyLoading.dismiss(); |
||||
if (!mounted) return; |
||||
if (_refreshController.isRefresh) _refreshController.refreshCompleted(); |
||||
setState(() {}); |
||||
} |
||||
|
||||
queryVipList({isRefreshData = true}) async { |
||||
try { |
||||
if (businessService == null) { |
||||
businessService = BusinessApiService(Dio(), |
||||
context: context, |
||||
token: BusinessInstance.instance.businessToken, |
||||
tenant: BusinessInstance.instance.businessTenant, |
||||
storeId: widget.storeId); |
||||
} |
||||
BaseData<BusinessVipList> baseData = await businessService.vipDataList({ |
||||
"map": {"nickname": "", "phone":editingController?.text ?? "", "source": "", "hasMoney": "2"}, |
||||
"model": {"tenantCode": null}, |
||||
"date": "", |
||||
"sort": "id", |
||||
"size": 10, |
||||
"current": _current |
||||
}).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; |
||||
} else { |
||||
SmartDialog.showToast(baseData.msg, alignment: Alignment.center); |
||||
} |
||||
} finally { |
||||
if (isRefreshData) |
||||
setState(() {}); |
||||
} |
||||
} |
||||
|
||||
@override |
||||
Widget build(BuildContext context) { |
||||
return Column( |
||||
children: [ |
||||
Container( |
||||
width: double.infinity, |
||||
height: 1.h, |
||||
color: Color(0xFFD8D8D8), |
||||
), |
||||
vipSearch(), |
||||
Expanded( |
||||
child: SmartRefresher( |
||||
controller: _refreshController, |
||||
enablePullDown: true, |
||||
enablePullUp: records.length == 0 ? false : true, |
||||
header: MyHeader(color: Color(0xFF30415B)), |
||||
physics: BouncingScrollPhysics(), |
||||
footer: CustomFooter( |
||||
builder: (context, mode) { |
||||
return MyFooter(mode); |
||||
}, |
||||
), |
||||
onRefresh: () { |
||||
_current = 1; |
||||
records.clear(); |
||||
_onRefresh(isShowLoad: false); |
||||
}, |
||||
onLoading: () { |
||||
_current++; |
||||
_onRefresh(isShowLoad: false); |
||||
}, |
||||
child: SingleChildScrollView( |
||||
physics: NeverScrollableScrollPhysics(), |
||||
child: Column( |
||||
children: [ |
||||
Padding( |
||||
padding: EdgeInsets.only( |
||||
left: 20.w,top: 16.h |
||||
), |
||||
child: Row( |
||||
children: [ |
||||
Container( |
||||
width: 4.w, |
||||
height: 16.h, |
||||
color: Color(0xFF30415B), |
||||
margin: EdgeInsets.only(right: 12.w), |
||||
), |
||||
Expanded( |
||||
child: Text( |
||||
"会员管理", |
||||
style: TextStyle( |
||||
fontSize: 15.sp, |
||||
fontWeight: MyFontWeight.semi_bold, |
||||
color: Color(0xFF0D0D0D), |
||||
), |
||||
), |
||||
), |
||||
], |
||||
), |
||||
), |
||||
networkStatus == -1 |
||||
? noNetwork() |
||||
: ((networkStatus == 0) |
||||
? ListView.builder( |
||||
padding: EdgeInsets.zero, |
||||
itemCount: 10, |
||||
scrollDirection: Axis.vertical, |
||||
shrinkWrap: true, |
||||
physics: BouncingScrollPhysics(), |
||||
itemBuilder: (context, position) { |
||||
return vipListItemSm(); |
||||
}, |
||||
) |
||||
: ((records == null || records.length == 0) |
||||
? NoDataView( |
||||
src: |
||||
"assets/image/bs_no data_logo.webp", |
||||
isShowBtn: false, |
||||
text: "暂无数据", |
||||
fontSize: 16.sp, |
||||
iconHeight: 120.h, |
||||
margin: EdgeInsets.all(50.h), |
||||
) |
||||
: Padding( |
||||
padding: EdgeInsets.only(top: 16.h), |
||||
child: Expanded( |
||||
child: ListView.builder( |
||||
itemCount: records?.length ?? 0, |
||||
physics: BouncingScrollPhysics(), |
||||
shrinkWrap: true, |
||||
itemBuilder: (context, position) { |
||||
return GestureDetector( |
||||
behavior: |
||||
HitTestBehavior.opaque, |
||||
onTap: () { |
||||
if (isKeyBoardShow) |
||||
FocusScope.of(context) |
||||
.requestFocus( |
||||
FocusNode()); |
||||
return; |
||||
}, |
||||
child: vipListItem( |
||||
records[position], |
||||
position), |
||||
); |
||||
}, |
||||
), |
||||
), |
||||
))), |
||||
], |
||||
)))), |
||||
], |
||||
); |
||||
} |
||||
|
||||
/// 搜索框 |
||||
Widget vipSearch() { |
||||
return Container( |
||||
color: Colors.white, |
||||
child: Container( |
||||
height: 40.h, |
||||
margin: |
||||
EdgeInsets.only(left: 20.w, right: 17.w, top: 10.h, bottom: 15.h), |
||||
decoration: BoxDecoration( |
||||
color: Color(0xFFF7F8FA), |
||||
borderRadius: BorderRadius.circular(2), |
||||
), |
||||
child: TextField( |
||||
focusNode: _focusNode, |
||||
textInputAction: TextInputAction.search, |
||||
onEditingComplete: () { |
||||
FocusScope.of(context).requestFocus(FocusNode()); |
||||
records.clear(); |
||||
_onRefresh(); |
||||
}, |
||||
style: TextStyle( |
||||
fontSize: 15.sp, |
||||
fontWeight: MyFontWeight.regular, |
||||
color: Color(0xFF808080), |
||||
), |
||||
controller: editingController, |
||||
decoration: InputDecoration( |
||||
hintText: "会员手机号", |
||||
hintStyle: TextStyle( |
||||
color: Color(0xFF808080), |
||||
fontSize: 15.sp, |
||||
fontWeight: MyFontWeight.regular), |
||||
contentPadding: EdgeInsets.symmetric( |
||||
vertical: 12.h, |
||||
), |
||||
prefixIcon: Image.asset( |
||||
"assets/image/bs_goods_search.webp", |
||||
width: 20, |
||||
height: 20, |
||||
), |
||||
border: InputBorder.none, |
||||
), |
||||
), |
||||
), |
||||
); |
||||
} |
||||
|
||||
Widget vipListItem(Records records, index) { |
||||
return Container( |
||||
decoration: BoxDecoration( |
||||
color: Colors.white, |
||||
borderRadius: BorderRadius.circular(8), |
||||
), |
||||
margin: EdgeInsets.only(left: 16.w, right: 16.w, bottom: 12.h), |
||||
padding: EdgeInsets.only( |
||||
left: 12.h, |
||||
top: 16.h, |
||||
bottom: 16.h, |
||||
), |
||||
child: Row( |
||||
crossAxisAlignment: CrossAxisAlignment.end, |
||||
mainAxisAlignment: MainAxisAlignment.center, |
||||
children: [ |
||||
Expanded(child: Column( |
||||
children: [ |
||||
Padding( |
||||
padding: EdgeInsets.only( |
||||
bottom: 12.h, |
||||
), |
||||
child: Row( |
||||
crossAxisAlignment: CrossAxisAlignment.center, |
||||
mainAxisAlignment: MainAxisAlignment.center, |
||||
children: [ |
||||
Expanded( |
||||
child: Text( |
||||
"会员名称: ", |
||||
style: TextStyle( |
||||
fontSize: 12.sp, |
||||
color: Color(0xFF1A1A1A), |
||||
fontWeight: MyFontWeight.regular), |
||||
), |
||||
flex: 1, |
||||
), |
||||
Expanded( |
||||
child: Text( |
||||
records?.nickname ?? "", |
||||
style: TextStyle( |
||||
fontSize: 12.sp, |
||||
color: Color(0xFF1A1A1A), |
||||
fontWeight: MyFontWeight.regular), |
||||
), |
||||
flex: 3, |
||||
), |
||||
], |
||||
), |
||||
), |
||||
Padding( |
||||
padding: EdgeInsets.only( |
||||
bottom: 12.h, |
||||
), |
||||
child: Row( |
||||
children: [ |
||||
Expanded( |
||||
child: Text( |
||||
"手机号: ", |
||||
style: TextStyle( |
||||
fontSize: 12.sp, |
||||
color: Color(0xFF1A1A1A), |
||||
fontWeight: MyFontWeight.regular), |
||||
), |
||||
flex: 1, |
||||
), |
||||
Expanded( |
||||
child: Text( |
||||
records?.phone ?? "", |
||||
style: TextStyle( |
||||
fontSize: 12.sp, |
||||
color: Color(0xFF1A1A1A), |
||||
fontWeight: MyFontWeight.regular), |
||||
), |
||||
flex: 3, |
||||
), |
||||
], |
||||
), |
||||
), |
||||
Padding( |
||||
padding: EdgeInsets.only( |
||||
bottom: 12.h, |
||||
), |
||||
child: Row( |
||||
children: [ |
||||
Expanded( |
||||
child: Text( |
||||
"加入时间: ", |
||||
style: TextStyle( |
||||
fontSize: 12.sp, |
||||
color: Color(0xFF1A1A1A), |
||||
fontWeight: MyFontWeight.regular), |
||||
), |
||||
flex: 1, |
||||
), |
||||
Expanded( |
||||
child: Text( |
||||
records?.createTime ?? "", |
||||
style: TextStyle( |
||||
fontSize: 12.sp, |
||||
color: Color(0xFF1A1A1A), |
||||
fontWeight: MyFontWeight.regular), |
||||
), |
||||
flex: 3, |
||||
), |
||||
], |
||||
), |
||||
), |
||||
if(records.isShow) |
||||
Padding( |
||||
padding: EdgeInsets.only( |
||||
bottom: 12.h, |
||||
), |
||||
child: Row( |
||||
children: [ |
||||
Expanded( |
||||
flex: 1, |
||||
child: Text( |
||||
"充值金额: ", |
||||
style: TextStyle( |
||||
fontSize: 12.sp, |
||||
color: Color(0xFF1A1A1A), |
||||
fontWeight: MyFontWeight.regular), |
||||
)), |
||||
Expanded( |
||||
flex: 3, |
||||
child: Text( |
||||
"¥${records?.realRecharge ?? ""}", |
||||
style: TextStyle( |
||||
fontSize: 12.sp, |
||||
color: Color(0xFF1A1A1A), |
||||
fontWeight: MyFontWeight.regular), |
||||
)), |
||||
], |
||||
), |
||||
), |
||||
if(records.isShow) |
||||
Padding( |
||||
padding: EdgeInsets.only( |
||||
bottom: 12.h, |
||||
), |
||||
child: Row( |
||||
children: [ |
||||
Expanded( |
||||
flex: 1, |
||||
child: Text( |
||||
"赠送金额: ", |
||||
style: TextStyle( |
||||
fontSize: 12.sp, |
||||
color: Color(0xFF1A1A1A), |
||||
fontWeight: MyFontWeight.regular), |
||||
)), |
||||
Expanded( |
||||
flex: 3, |
||||
child: Text( |
||||
"¥${records?.giftRecharge ?? ""}", |
||||
style: TextStyle( |
||||
fontSize: 12.sp, |
||||
color: Color(0xFF1A1A1A), |
||||
fontWeight: MyFontWeight.regular), |
||||
)), |
||||
], |
||||
), |
||||
), |
||||
if (records.isShow) |
||||
Padding( |
||||
padding: EdgeInsets.only( |
||||
bottom: 12.h, |
||||
), |
||||
child: Row( |
||||
children: [ |
||||
Expanded( |
||||
flex: 1, |
||||
child: Text( |
||||
"商户余额: ", |
||||
style: TextStyle( |
||||
fontSize: 12.sp, |
||||
color: Color(0xFF1A1A1A), |
||||
fontWeight: MyFontWeight.regular), |
||||
)), |
||||
Expanded( |
||||
flex: 3, |
||||
child: Text( |
||||
"¥${records?.realRecharge ?? ""}", |
||||
style: TextStyle( |
||||
fontSize: 12.sp, |
||||
color: Color(0xFF1A1A1A), |
||||
fontWeight: MyFontWeight.regular), |
||||
)), |
||||
], |
||||
), |
||||
), |
||||
if(records.isShow) |
||||
Padding( |
||||
padding: EdgeInsets.only( |
||||
bottom: 12.h, |
||||
), |
||||
child: Row( |
||||
children: [ |
||||
Expanded( |
||||
flex: 1, |
||||
child: Text( |
||||
"平台余额: ", |
||||
style: TextStyle( |
||||
fontSize: 12.sp, |
||||
color: Color(0xFF1A1A1A), |
||||
fontWeight: MyFontWeight.regular), |
||||
)), |
||||
Expanded( |
||||
flex: 3, |
||||
child: Text( |
||||
"¥${records?.money ?? ""}", |
||||
style: TextStyle( |
||||
fontSize: 12.sp, |
||||
color: Color(0xFF1A1A1A), |
||||
fontWeight: MyFontWeight.regular), |
||||
)), |
||||
], |
||||
)), |
||||
], |
||||
)), |
||||
GestureDetector( |
||||
behavior: HitTestBehavior.opaque, |
||||
onTap: () { |
||||
setState(() { |
||||
records.isShow = !records.isShow; |
||||
}); |
||||
}, |
||||
child: Container( |
||||
padding: EdgeInsets.symmetric(horizontal: 24.w, vertical: 6.h), |
||||
child: Icon( |
||||
records.isShow |
||||
? Icons.keyboard_arrow_up |
||||
: Icons.keyboard_arrow_down, |
||||
color: Color(0xFF0D0D0D), |
||||
size: 24, |
||||
)), |
||||
), |
||||
], |
||||
), |
||||
); |
||||
} |
||||
|
||||
Widget vipListItemSm() { |
||||
return Container( |
||||
decoration: BoxDecoration( |
||||
color: Colors.white, |
||||
borderRadius: BorderRadius.circular(8), |
||||
), |
||||
margin: EdgeInsets.only(left: 16.w, right: 16.w, bottom: 12.h), |
||||
padding: EdgeInsets.only( |
||||
left: 12.h, |
||||
top: 16.h, |
||||
bottom: 16.h, |
||||
), |
||||
child: Row( |
||||
crossAxisAlignment: CrossAxisAlignment.end, |
||||
mainAxisAlignment: MainAxisAlignment.center, |
||||
children: [ |
||||
Expanded( |
||||
flex: 1, |
||||
child: Column( |
||||
crossAxisAlignment: CrossAxisAlignment.start, |
||||
children: [ |
||||
Padding( |
||||
padding: EdgeInsets.only(bottom: 12), |
||||
child: Shimmer.fromColors( |
||||
baseColor: Color(0XFFD8D8D8), |
||||
highlightColor: Color(0XFFD8D8D8), |
||||
child: Container( |
||||
decoration: BoxDecoration( |
||||
color: Color(0XFFD8D8D8), |
||||
borderRadius: BorderRadius.circular(2), |
||||
), |
||||
width: 60.w, |
||||
height: 18.h, |
||||
), |
||||
), |
||||
), |
||||
Padding( |
||||
padding: EdgeInsets.only(bottom: 12), |
||||
child: Shimmer.fromColors( |
||||
baseColor: Color(0XFFD8D8D8), |
||||
highlightColor: Color(0XFFD8D8D8), |
||||
child: Container( |
||||
decoration: BoxDecoration( |
||||
color: Color(0XFFD8D8D8), |
||||
borderRadius: BorderRadius.circular(2), |
||||
), |
||||
width: 40.w, |
||||
height: 18.h, |
||||
), |
||||
), |
||||
), |
||||
Padding( |
||||
padding: EdgeInsets.only(bottom: 12), |
||||
child: Shimmer.fromColors( |
||||
baseColor: Color(0XFFD8D8D8), |
||||
highlightColor: Color(0XFFD8D8D8), |
||||
child: Container( |
||||
decoration: BoxDecoration( |
||||
color: Color(0XFFD8D8D8), |
||||
borderRadius: BorderRadius.circular(2), |
||||
), |
||||
width: 52.w, |
||||
height: 18.h, |
||||
), |
||||
), |
||||
), |
||||
Padding( |
||||
padding: EdgeInsets.only(bottom: 12), |
||||
child: Shimmer.fromColors( |
||||
baseColor: Color(0XFFD8D8D8), |
||||
highlightColor: Color(0XFFD8D8D8), |
||||
child: Container( |
||||
decoration: BoxDecoration( |
||||
color: Color(0XFFD8D8D8), |
||||
borderRadius: BorderRadius.circular(2), |
||||
), |
||||
width: 52.w, |
||||
height: 18.h, |
||||
), |
||||
), |
||||
), |
||||
Padding( |
||||
padding: EdgeInsets.only(bottom: 12), |
||||
child: Shimmer.fromColors( |
||||
baseColor: Color(0XFFD8D8D8), |
||||
highlightColor: Color(0XFFD8D8D8), |
||||
child: Container( |
||||
decoration: BoxDecoration( |
||||
color: Color(0XFFD8D8D8), |
||||
borderRadius: BorderRadius.circular(2), |
||||
), |
||||
width: 52.w, |
||||
height: 18.h, |
||||
), |
||||
), |
||||
), |
||||
Padding( |
||||
padding: EdgeInsets.only(bottom: 12), |
||||
child: Shimmer.fromColors( |
||||
baseColor: Color(0XFFD8D8D8), |
||||
highlightColor: Color(0XFFD8D8D8), |
||||
child: Container( |
||||
decoration: BoxDecoration( |
||||
color: Color(0XFFD8D8D8), |
||||
borderRadius: BorderRadius.circular(2), |
||||
), |
||||
width: 52.w, |
||||
height: 18.h, |
||||
), |
||||
), |
||||
), |
||||
Padding( |
||||
padding: EdgeInsets.only(bottom: 12), |
||||
child: Shimmer.fromColors( |
||||
baseColor: Color(0XFFD8D8D8), |
||||
highlightColor: Color(0XFFD8D8D8), |
||||
child: Container( |
||||
decoration: BoxDecoration( |
||||
color: Color(0XFFD8D8D8), |
||||
borderRadius: BorderRadius.circular(2), |
||||
), |
||||
width: 52.w, |
||||
height: 18.h, |
||||
), |
||||
), |
||||
), |
||||
Padding( |
||||
padding: EdgeInsets.only(bottom: 12), |
||||
child: Shimmer.fromColors( |
||||
baseColor: Color(0XFFD8D8D8), |
||||
highlightColor: Color(0XFFD8D8D8), |
||||
child: Container( |
||||
decoration: BoxDecoration( |
||||
color: Color(0XFFD8D8D8), |
||||
borderRadius: BorderRadius.circular(2), |
||||
), |
||||
width: 52.w, |
||||
height: 18.h, |
||||
), |
||||
), |
||||
), |
||||
], |
||||
)), |
||||
Expanded( |
||||
flex: 3, |
||||
child: Column( |
||||
crossAxisAlignment: CrossAxisAlignment.start, |
||||
children: [ |
||||
Padding( |
||||
padding: EdgeInsets.only(bottom: 12), |
||||
child: |
||||
Shimmer.fromColors( |
||||
baseColor: Color(0XFFD8D8D8), |
||||
highlightColor: Color(0XFFD8D8D8), |
||||
child: Container( |
||||
decoration: BoxDecoration( |
||||
color: Color(0XFFD8D8D8), |
||||
borderRadius: BorderRadius.circular(2), |
||||
), |
||||
width: 48.w, |
||||
height: 18.h, |
||||
), |
||||
), |
||||
), |
||||
Padding( |
||||
padding: EdgeInsets.only(bottom: 12), |
||||
child: Shimmer.fromColors( |
||||
baseColor: Color(0XFFD8D8D8), |
||||
highlightColor: Color(0XFFD8D8D8), |
||||
child: Container( |
||||
decoration: BoxDecoration( |
||||
color: Color(0XFFD8D8D8), |
||||
borderRadius: BorderRadius.circular(2), |
||||
), |
||||
width: 77.w, |
||||
height: 18.h, |
||||
), |
||||
), |
||||
), |
||||
Padding( |
||||
padding: EdgeInsets.only(bottom: 12), |
||||
child: Shimmer.fromColors( |
||||
baseColor: Color(0XFFD8D8D8), |
||||
highlightColor: Color(0XFFD8D8D8), |
||||
child: Container( |
||||
decoration: BoxDecoration( |
||||
color: Color(0XFFD8D8D8), |
||||
borderRadius: BorderRadius.circular(2), |
||||
), |
||||
width: 120.w, |
||||
height: 18.h, |
||||
), |
||||
), |
||||
), |
||||
Padding( |
||||
padding: EdgeInsets.only(bottom: 12), |
||||
child: Shimmer.fromColors( |
||||
baseColor: Color(0XFFD8D8D8), |
||||
highlightColor: Color(0XFFD8D8D8), |
||||
child: Container( |
||||
decoration: BoxDecoration( |
||||
color: Color(0XFFD8D8D8), |
||||
borderRadius: BorderRadius.circular(2), |
||||
), |
||||
width: 44.w, |
||||
height: 18.h, |
||||
), |
||||
), |
||||
), |
||||
Padding( |
||||
padding: EdgeInsets.only(bottom: 12), |
||||
child: Shimmer.fromColors( |
||||
baseColor: Color(0XFFD8D8D8), |
||||
highlightColor: Color(0XFFD8D8D8), |
||||
child: Container( |
||||
decoration: BoxDecoration( |
||||
color: Color(0XFFD8D8D8), |
||||
borderRadius: BorderRadius.circular(2), |
||||
), |
||||
width: 44.w, |
||||
height: 18.h, |
||||
), |
||||
), |
||||
), |
||||
Padding( |
||||
padding: EdgeInsets.only(bottom: 12), |
||||
child: Shimmer.fromColors( |
||||
baseColor: Color(0XFFD8D8D8), |
||||
highlightColor: Color(0XFFD8D8D8), |
||||
child: Container( |
||||
decoration: BoxDecoration( |
||||
color: Color(0XFFD8D8D8), |
||||
borderRadius: BorderRadius.circular(2), |
||||
), |
||||
width: 44.w, |
||||
height: 18.h, |
||||
), |
||||
), |
||||
), |
||||
Padding( |
||||
padding: EdgeInsets.only(bottom: 12), |
||||
child: Shimmer.fromColors( |
||||
baseColor: Color(0XFFD8D8D8), |
||||
highlightColor: Color(0XFFD8D8D8), |
||||
child: Container( |
||||
decoration: BoxDecoration( |
||||
color: Color(0XFFD8D8D8), |
||||
borderRadius: BorderRadius.circular(2), |
||||
), |
||||
width: 44.w, |
||||
height: 18.h, |
||||
), |
||||
), |
||||
), |
||||
Padding( |
||||
padding: EdgeInsets.only(bottom: 12), |
||||
child: Shimmer.fromColors( |
||||
baseColor: Color(0XFFD8D8D8), |
||||
highlightColor: Color(0XFFD8D8D8), |
||||
child: Container( |
||||
decoration: BoxDecoration( |
||||
color: Color(0XFFD8D8D8), |
||||
borderRadius: BorderRadius.circular(2), |
||||
), |
||||
width: 44.w, |
||||
height: 18.h, |
||||
), |
||||
), |
||||
), |
||||
], |
||||
)), |
||||
Shimmer.fromColors( |
||||
baseColor: Color(0XFFD8D8D8), |
||||
highlightColor: Color(0XFFD8D8D8), |
||||
child: Container( |
||||
margin: EdgeInsets.only(right: 24.w), |
||||
decoration: BoxDecoration( |
||||
color: Color(0XFFD8D8D8), |
||||
borderRadius: BorderRadius.circular(2), |
||||
), |
||||
width: 16.w, |
||||
height: 16.h, |
||||
), |
||||
), |
||||
], |
||||
), |
||||
); |
||||
} |
||||
|
||||
Widget noNetwork() { |
||||
return Container( |
||||
margin: EdgeInsets.only(top: 120.h), |
||||
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,117 @@
|
||||
import 'package:flutter/cupertino.dart'; |
||||
import 'package:flutter/material.dart'; |
||||
import 'package:huixiang/business_system/home/vip/vip_recharge_flow.dart'; |
||||
import 'package:huixiang/business_system/order/ticket/ticket_tab.dart'; |
||||
import 'package:flutter_screenutil/flutter_screenutil.dart'; |
||||
import '../../../view_widget/my_appbar.dart'; |
||||
import '../../../view_widget/my_tab.dart'; |
||||
import 'balance_change_record.dart'; |
||||
import 'bus_vip_list.dart'; |
||||
|
||||
class BusinessVipPage extends StatefulWidget { |
||||
final Map<String, dynamic> arguments; |
||||
|
||||
BusinessVipPage({this.arguments}); |
||||
|
||||
@override |
||||
State<StatefulWidget> createState() { |
||||
return _BusinessVipPage(); |
||||
} |
||||
} |
||||
|
||||
class _BusinessVipPage extends State<BusinessVipPage> |
||||
with SingleTickerProviderStateMixin { |
||||
List<GlobalKey> _allKey = []; |
||||
String storeId; |
||||
TabController tabController; |
||||
|
||||
@override |
||||
void initState() { |
||||
super.initState(); |
||||
tabController = TabController(length: 3, vsync: this); |
||||
tabController.addListener(() { |
||||
if (!tabController.indexIsChanging) { |
||||
setState(() {}); |
||||
FocusScope.of(context).requestFocus(FocusNode()); |
||||
} |
||||
}); |
||||
loadFinish(); |
||||
storeId = widget.arguments["storeId"]; |
||||
} |
||||
|
||||
loadFinish() { |
||||
_allKey = [GlobalKey(), GlobalKey(), GlobalKey()]; |
||||
setState(() {}); |
||||
} |
||||
|
||||
|
||||
@override |
||||
Widget build(BuildContext context) { |
||||
return GestureDetector( |
||||
behavior: HitTestBehavior.opaque, |
||||
onTap: () { |
||||
FocusScope.of(context).requestFocus(FocusNode()); |
||||
}, |
||||
child: Column( |
||||
children: [ |
||||
Expanded(child: DefaultTabController( |
||||
length: 3, |
||||
child: Scaffold( |
||||
resizeToAvoidBottomInset: false, |
||||
appBar: MyAppBar( |
||||
title: "", |
||||
leadingColor: Colors.black, |
||||
background: Colors.white, |
||||
toolbarHeight: kToolbarHeight + MediaQuery.of(context).padding.top, |
||||
bottom: TabBar ( |
||||
// isScrollable: true, //可滚动 |
||||
//去掉按钮阴影 |
||||
overlayColor: MaterialStateProperty.all(Colors.white), |
||||
indicator: const TicketTab( |
||||
width: 44, |
||||
borderSide: |
||||
BorderSide(width: 2.0, color: Color(0xFF30415B))), |
||||
labelColor: Colors.black, |
||||
labelStyle: TextStyle( |
||||
fontSize: 15.sp, |
||||
fontWeight: FontWeight.bold, |
||||
), |
||||
unselectedLabelStyle: TextStyle( |
||||
fontSize: 15.sp, |
||||
fontWeight: FontWeight.normal, |
||||
color: Color(0xFF666666)), |
||||
controller: tabController, |
||||
//未选中文字颜色 |
||||
unselectedLabelColor: Color(0xFF666666), |
||||
//指示器与文字等宽 |
||||
tabs: <Widget>[ |
||||
MyTab(text: "会员列表"), |
||||
MyTab(text: "会员充值流水"), |
||||
MyTab(text: "会员余额变动"), |
||||
], |
||||
), |
||||
), |
||||
body: TabBarView( |
||||
controller: tabController, |
||||
children: [ |
||||
BusVipList( |
||||
_allKey[0], |
||||
storeId), |
||||
VipRechargeFlow( |
||||
_allKey[1], |
||||
storeId), |
||||
BalanceChangeRecord( |
||||
_allKey[2], |
||||
storeId,), |
||||
], |
||||
), |
||||
), |
||||
)), |
||||
// SizedBox( |
||||
// height: 76.h, |
||||
// ), |
||||
], |
||||
), |
||||
); |
||||
} |
||||
} |
@ -0,0 +1,988 @@
|
||||
import 'package:dio/dio.dart'; |
||||
import 'package:flutter/cupertino.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/view_widget/classic_header.dart'; |
||||
import 'package:huixiang/view_widget/my_footer.dart'; |
||||
import 'package:pull_to_refresh/pull_to_refresh.dart'; |
||||
import 'package:flutter_screenutil/flutter_screenutil.dart'; |
||||
import 'package:shimmer/shimmer.dart'; |
||||
|
||||
import '../../../generated/l10n.dart'; |
||||
import '../../../retrofit/business_api.dart'; |
||||
import '../../../retrofit/data/base_data.dart'; |
||||
import '../../../retrofit/data/recharge_flow_list.dart'; |
||||
import '../../../utils/business_instance.dart'; |
||||
import '../../../utils/flutter_utils.dart'; |
||||
import '../../../utils/font_weight.dart'; |
||||
import '../../../view_widget/no_data_view.dart'; |
||||
|
||||
class VipRechargeFlow extends StatefulWidget { |
||||
final String storeId; |
||||
|
||||
VipRechargeFlow( |
||||
Key key, |
||||
this.storeId, |
||||
) : super(key: key); |
||||
|
||||
@override |
||||
State<StatefulWidget> createState() { |
||||
return _VipRechargeFlow(); |
||||
} |
||||
} |
||||
|
||||
class _VipRechargeFlow extends State<VipRechargeFlow> { |
||||
final RefreshController _refreshController = RefreshController(); |
||||
BusinessApiService businessService; |
||||
List<Records> records = []; |
||||
int _current = 1; |
||||
String networkError = ""; |
||||
int networkStatus = 0; |
||||
final TextEditingController editingController = TextEditingController(); |
||||
FocusNode _focusNode = FocusNode(); |
||||
bool isKeyBoardShow = false; |
||||
|
||||
///离开页面记着销毁和清除 |
||||
@override |
||||
void dispose() { |
||||
super.dispose(); |
||||
_refreshController.dispose(); |
||||
_focusNode.unfocus(); |
||||
} |
||||
|
||||
@override |
||||
void initState() { |
||||
super.initState(); |
||||
WidgetsBinding.instance.addPostFrameCallback((_) { |
||||
setState(() { |
||||
print("object: ${MediaQuery.of(context).viewInsets.bottom}"); |
||||
if (MediaQuery.of(context).viewInsets.bottom == 0) { |
||||
if (isKeyBoardShow) { |
||||
isKeyBoardShow = false; |
||||
//关闭键盘 软键盘关闭了, 清除输入控件的焦点, 否则重新进入页面会导致软键盘再弹出问题 |
||||
FocusScope.of(context).requestFocus(FocusNode()); |
||||
} |
||||
} else { |
||||
isKeyBoardShow = true; |
||||
} |
||||
}); |
||||
}); |
||||
_onRefresh(); |
||||
} |
||||
|
||||
_onRefresh({bool isShowLoad = true}) async { |
||||
if (isShowLoad) |
||||
EasyLoading.show( |
||||
status: S.current.zhengzaijiazai, |
||||
maskType: EasyLoadingMaskType.black); |
||||
await queryRechargeFlow(isRefreshData: false); |
||||
EasyLoading.dismiss(); |
||||
if (!mounted) return; |
||||
if (_refreshController.isRefresh) _refreshController.refreshCompleted(); |
||||
setState(() {}); |
||||
} |
||||
|
||||
queryRechargeFlow({isRefreshData = true}) async { |
||||
try { |
||||
if (businessService == null) { |
||||
businessService = BusinessApiService(Dio(), |
||||
context: context, |
||||
token: BusinessInstance.instance.businessToken, |
||||
tenant: BusinessInstance.instance.businessTenant, |
||||
storeId: widget.storeId); |
||||
} |
||||
BaseData<RechargeFlowList> baseData = await businessService.rechargeFlow({ |
||||
"size": 10, |
||||
"pageSize": 10, |
||||
"current": _current, |
||||
"currentPage": 1, |
||||
"sort": "id", |
||||
"order": "descending", |
||||
"model": {"id": editingController?.text ?? ""}, |
||||
// "map": {"startDate": "", "endDate": ""}, |
||||
"timeRange": null |
||||
}).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; |
||||
} else { |
||||
SmartDialog.showToast(baseData.msg, alignment: Alignment.center); |
||||
} |
||||
} finally { |
||||
if (isRefreshData) setState(() {}); |
||||
} |
||||
} |
||||
|
||||
@override |
||||
Widget build(BuildContext context) { |
||||
return Column( |
||||
children: [ |
||||
Container( |
||||
width: double.infinity, |
||||
height: 1.h, |
||||
color: Color(0xFFD8D8D8), |
||||
), |
||||
rechargeFlowSearch(), |
||||
Expanded( |
||||
child: SmartRefresher( |
||||
controller: _refreshController, |
||||
enablePullDown: true, |
||||
enablePullUp: records.length == 0 ? false : true, |
||||
header: MyHeader(color: Color(0xFF30415B)), |
||||
physics: BouncingScrollPhysics(), |
||||
footer: CustomFooter( |
||||
builder: (context, mode) { |
||||
return MyFooter(mode); |
||||
}, |
||||
), |
||||
onRefresh: () { |
||||
_current = 1; |
||||
records.clear(); |
||||
_onRefresh(isShowLoad: false); |
||||
}, |
||||
onLoading: () { |
||||
_current++; |
||||
_onRefresh(isShowLoad: false); |
||||
}, |
||||
child: SingleChildScrollView( |
||||
physics: NeverScrollableScrollPhysics(), |
||||
child: Column( |
||||
children: [ |
||||
Padding( |
||||
padding: EdgeInsets.only(left: 20.w, top: 16.h), |
||||
child: Row( |
||||
children: [ |
||||
Container( |
||||
width: 4.w, |
||||
height: 16.h, |
||||
color: Color(0xFF30415B), |
||||
margin: EdgeInsets.only(right: 12.w), |
||||
), |
||||
Expanded( |
||||
child: Text( |
||||
"充值流水", |
||||
style: TextStyle( |
||||
fontSize: 15.sp, |
||||
fontWeight: MyFontWeight.semi_bold, |
||||
color: Color(0xFF0D0D0D), |
||||
), |
||||
), |
||||
), |
||||
], |
||||
), |
||||
), |
||||
networkStatus == -1 |
||||
? noNetwork() |
||||
: ((networkStatus == 0) |
||||
? ListView.builder( |
||||
padding: EdgeInsets.zero, |
||||
itemCount: 10, |
||||
scrollDirection: Axis.vertical, |
||||
shrinkWrap: true, |
||||
physics: BouncingScrollPhysics(), |
||||
itemBuilder: (context, position) { |
||||
return rechargeFlowItemSm(); |
||||
}, |
||||
) |
||||
: ((records == null || records.length == 0) |
||||
? NoDataView( |
||||
src: |
||||
"assets/image/bs_no data_logo.webp", |
||||
isShowBtn: false, |
||||
text: "暂无数据", |
||||
fontSize: 16.sp, |
||||
iconHeight: 120.h, |
||||
margin: EdgeInsets.all(50.h), |
||||
) |
||||
: Padding( |
||||
padding: EdgeInsets.only(top: 16.h), |
||||
child: Expanded( |
||||
child: ListView.builder( |
||||
itemCount: records?.length ?? 0, |
||||
physics: BouncingScrollPhysics(), |
||||
shrinkWrap: true, |
||||
itemBuilder: (context, position) { |
||||
return GestureDetector( |
||||
behavior: |
||||
HitTestBehavior.opaque, |
||||
onTap: () { |
||||
if (isKeyBoardShow) |
||||
FocusScope.of(context) |
||||
.requestFocus( |
||||
FocusNode()); |
||||
return; |
||||
}, |
||||
child: rechargeFlowItem( |
||||
records[position], |
||||
position), |
||||
); |
||||
}, |
||||
), |
||||
), |
||||
))), |
||||
], |
||||
)))), |
||||
], |
||||
); |
||||
} |
||||
|
||||
/// 搜索框 |
||||
Widget rechargeFlowSearch() { |
||||
return Container( |
||||
color: Colors.white, |
||||
child: Container( |
||||
height: 40.h, |
||||
margin: |
||||
EdgeInsets.only(left: 20.w, right: 17.w, top: 10.h, bottom: 15.h), |
||||
decoration: BoxDecoration( |
||||
color: Color(0xFFF7F8FA), |
||||
borderRadius: BorderRadius.circular(2), |
||||
), |
||||
child: TextField( |
||||
focusNode: _focusNode, |
||||
textInputAction: TextInputAction.search, |
||||
onEditingComplete: () { |
||||
FocusScope.of(context).requestFocus(FocusNode()); |
||||
records.clear(); |
||||
_onRefresh(); |
||||
}, |
||||
style: TextStyle( |
||||
fontSize: 15.sp, |
||||
fontWeight: MyFontWeight.regular, |
||||
color: Color(0xFF808080), |
||||
), |
||||
controller: editingController, |
||||
decoration: InputDecoration( |
||||
hintText: "订单编号", |
||||
hintStyle: TextStyle( |
||||
color: Color(0xFF808080), |
||||
fontSize: 15.sp, |
||||
fontWeight: MyFontWeight.regular), |
||||
contentPadding: EdgeInsets.symmetric( |
||||
vertical: 12.h, |
||||
), |
||||
prefixIcon: Image.asset( |
||||
"assets/image/bs_goods_search.webp", |
||||
width: 20, |
||||
height: 20, |
||||
), |
||||
border: InputBorder.none, |
||||
), |
||||
), |
||||
), |
||||
); |
||||
} |
||||
|
||||
Widget rechargeFlowItem(Records records, index) { |
||||
return Container( |
||||
decoration: BoxDecoration( |
||||
color: Colors.white, |
||||
borderRadius: BorderRadius.circular(8), |
||||
), |
||||
margin: EdgeInsets.only(left: 16.w, right: 16.w, bottom: 12.h), |
||||
padding: EdgeInsets.only( |
||||
top: 13.h, |
||||
bottom: 16.h, |
||||
), |
||||
child: Column( |
||||
mainAxisAlignment: MainAxisAlignment.center, |
||||
crossAxisAlignment: CrossAxisAlignment.start, |
||||
children: [ |
||||
Padding( |
||||
padding: EdgeInsets.only( |
||||
left: 12.h, |
||||
), |
||||
child: Text( |
||||
"订单编号: ${records?.id ?? ""}", |
||||
style: TextStyle( |
||||
fontSize: 14.sp, |
||||
color: Color(0xFF1A1A1A), |
||||
fontWeight: MyFontWeight.bold), |
||||
), |
||||
), |
||||
Container( |
||||
height: 1.h, |
||||
width: double.infinity, |
||||
color: Color(0xFFF4F6F7), |
||||
margin: EdgeInsets.symmetric(vertical: 13.h), |
||||
), |
||||
Row( |
||||
crossAxisAlignment: CrossAxisAlignment.end, |
||||
mainAxisAlignment: MainAxisAlignment.center, |
||||
children: [ |
||||
Expanded( |
||||
child: Column( |
||||
children: [ |
||||
Padding( |
||||
padding: EdgeInsets.only( |
||||
bottom: 12.h, |
||||
left: 12.w, |
||||
), |
||||
child: Row( |
||||
crossAxisAlignment: CrossAxisAlignment.center, |
||||
mainAxisAlignment: MainAxisAlignment.center, |
||||
children: [ |
||||
Expanded( |
||||
child: Text( |
||||
"充值用户: ", |
||||
style: TextStyle( |
||||
fontSize: 12.sp, |
||||
color: Color(0xFF1A1A1A), |
||||
fontWeight: MyFontWeight.regular), |
||||
), |
||||
flex: 1, |
||||
), |
||||
Expanded( |
||||
child: Text( |
||||
records?.createPerson ?? "", |
||||
style: TextStyle( |
||||
fontSize: 12.sp, |
||||
color: Color(0xFF1A1A1A), |
||||
fontWeight: MyFontWeight.regular), |
||||
), |
||||
flex: 2, |
||||
), |
||||
], |
||||
), |
||||
), |
||||
Padding( |
||||
padding: EdgeInsets.only( |
||||
bottom: 12.h, |
||||
left: 12.w, |
||||
), |
||||
child: Row( |
||||
children: [ |
||||
Expanded( |
||||
child: Text( |
||||
"手机号: ", |
||||
style: TextStyle( |
||||
fontSize: 12.sp, |
||||
color: Color(0xFF1A1A1A), |
||||
fontWeight: MyFontWeight.regular), |
||||
), |
||||
flex: 1, |
||||
), |
||||
Expanded( |
||||
child: Text( |
||||
records?.phone ?? "", |
||||
style: TextStyle( |
||||
fontSize: 12.sp, |
||||
color: Color(0xFF1A1A1A), |
||||
fontWeight: MyFontWeight.regular), |
||||
), |
||||
flex: 2, |
||||
), |
||||
], |
||||
), |
||||
), |
||||
Padding( |
||||
padding: EdgeInsets.only( |
||||
bottom: 12.h, |
||||
left: 12.w, |
||||
), |
||||
child: Row( |
||||
children: [ |
||||
Expanded( |
||||
child: Text( |
||||
"充值实付金额: ", |
||||
style: TextStyle( |
||||
fontSize: 12.sp, |
||||
color: Color(0xFF1A1A1A), |
||||
fontWeight: MyFontWeight.regular), |
||||
), |
||||
flex: 1, |
||||
), |
||||
Expanded( |
||||
child: Text( |
||||
"¥${records?.rechargeMoney ?? ""}", |
||||
style: TextStyle( |
||||
fontSize: 12.sp, |
||||
color: Color(0xFF1A1A1A), |
||||
fontWeight: MyFontWeight.regular), |
||||
), |
||||
flex: 2, |
||||
), |
||||
], |
||||
), |
||||
), |
||||
Padding( |
||||
padding: EdgeInsets.only( |
||||
bottom: 12.h, |
||||
left: 12.w, |
||||
), |
||||
child: Row( |
||||
children: [ |
||||
Expanded( |
||||
flex: 1, |
||||
child: Text( |
||||
"充值实赠金额: ", |
||||
style: TextStyle( |
||||
fontSize: 12.sp, |
||||
color: Color(0xFF1A1A1A), |
||||
fontWeight: MyFontWeight.regular), |
||||
)), |
||||
Expanded( |
||||
flex: 2, |
||||
child: Text( |
||||
"¥${records?.giftdMoney ?? ""}", |
||||
style: TextStyle( |
||||
fontSize: 12.sp, |
||||
color: Color(0xFF1A1A1A), |
||||
fontWeight: MyFontWeight.regular), |
||||
)), |
||||
], |
||||
), |
||||
), |
||||
if (records.isShow) |
||||
Padding( |
||||
padding: EdgeInsets.only( |
||||
bottom: 12.h, |
||||
left: 12.w, |
||||
), |
||||
child: Row( |
||||
children: [ |
||||
Expanded( |
||||
flex: 1, |
||||
child: Text( |
||||
"充值门店: ", |
||||
style: TextStyle( |
||||
fontSize: 12.sp, |
||||
color: Color(0xFF1A1A1A), |
||||
fontWeight: MyFontWeight.regular), |
||||
)), |
||||
Expanded( |
||||
flex: 2, |
||||
child: Text( |
||||
records?.storeName ?? "", |
||||
style: TextStyle( |
||||
fontSize: 12.sp, |
||||
color: Color(0xFF1A1A1A), |
||||
fontWeight: MyFontWeight.regular), |
||||
)), |
||||
], |
||||
), |
||||
), |
||||
if (records.isShow) |
||||
Padding( |
||||
padding: EdgeInsets.only( |
||||
bottom: 12.h, |
||||
left: 12.w, |
||||
), |
||||
child: Row( |
||||
children: [ |
||||
Expanded( |
||||
flex: 1, |
||||
child: Text( |
||||
"充值方式: ", |
||||
style: TextStyle( |
||||
fontSize: 12.sp, |
||||
color: Color(0xFF1A1A1A), |
||||
fontWeight: MyFontWeight.regular), |
||||
)), |
||||
Expanded( |
||||
flex: 2, |
||||
child: Text( |
||||
records?.rechargeName ?? "", |
||||
style: TextStyle( |
||||
fontSize: 12.sp, |
||||
color: Color(0xFF1A1A1A), |
||||
fontWeight: MyFontWeight.regular), |
||||
)), |
||||
], |
||||
), |
||||
), |
||||
Padding( |
||||
padding: EdgeInsets.only( |
||||
bottom: 12.h, |
||||
left: 12.w, |
||||
), |
||||
child: Row( |
||||
children: [ |
||||
Expanded( |
||||
flex: 1, |
||||
child: Text( |
||||
"入账时间: ", |
||||
style: TextStyle( |
||||
fontSize: 12.sp, |
||||
color: Color(0xFF1A1A1A), |
||||
fontWeight: MyFontWeight.regular), |
||||
)), |
||||
Expanded( |
||||
flex: 2, |
||||
child: Text( |
||||
records?.createTime ?? "", |
||||
style: TextStyle( |
||||
fontSize: 12.sp, |
||||
color: Color(0xFF1A1A1A), |
||||
fontWeight: MyFontWeight.regular), |
||||
)), |
||||
], |
||||
)), |
||||
], |
||||
)), |
||||
GestureDetector( |
||||
behavior: HitTestBehavior.opaque, |
||||
onTap: () { |
||||
setState(() { |
||||
records.isShow = !records.isShow; |
||||
}); |
||||
}, |
||||
child: Container( |
||||
padding: |
||||
EdgeInsets.symmetric(horizontal: 24.w, vertical: 6.h), |
||||
child: Icon( |
||||
records.isShow |
||||
? Icons.keyboard_arrow_up |
||||
: Icons.keyboard_arrow_down, |
||||
color: Color(0xFF0D0D0D), |
||||
size: 24, |
||||
)), |
||||
), |
||||
], |
||||
) |
||||
], |
||||
), |
||||
); |
||||
} |
||||
|
||||
Widget rechargeFlowItemSm() { |
||||
return Container( |
||||
decoration: BoxDecoration( |
||||
color: Colors.white, |
||||
borderRadius: BorderRadius.circular(8), |
||||
), |
||||
margin: EdgeInsets.only(left: 16.w, right: 16.w, bottom: 12.h), |
||||
padding: EdgeInsets.only( |
||||
top: 13.h, |
||||
bottom: 16.h, |
||||
), |
||||
child: Column( |
||||
children: [ |
||||
Container( |
||||
padding: EdgeInsets.only( |
||||
left: 12.h, |
||||
), |
||||
child: Row( |
||||
children: [ |
||||
Shimmer.fromColors( |
||||
baseColor: Color(0XFFD8D8D8), |
||||
highlightColor: Color(0XFFD8D8D8), |
||||
child: Container( |
||||
decoration: BoxDecoration( |
||||
color: Color(0XFFD8D8D8), |
||||
borderRadius: BorderRadius.circular(2), |
||||
), |
||||
width: 60.w, |
||||
height: 18.h, |
||||
), |
||||
), |
||||
SizedBox( |
||||
width: 15.w, |
||||
), |
||||
Shimmer.fromColors( |
||||
baseColor: Color(0XFFD8D8D8), |
||||
highlightColor: Color(0XFFD8D8D8), |
||||
child: Container( |
||||
decoration: BoxDecoration( |
||||
color: Color(0XFFD8D8D8), |
||||
borderRadius: BorderRadius.circular(2), |
||||
), |
||||
width: 198.w, |
||||
height: 18.h, |
||||
), |
||||
), |
||||
], |
||||
), |
||||
), |
||||
Container( |
||||
height: 1.h, |
||||
width: double.infinity, |
||||
color: Color(0xFFF4F6F7), |
||||
margin: EdgeInsets.symmetric(vertical: 13.h), |
||||
), |
||||
Row( |
||||
crossAxisAlignment: CrossAxisAlignment.end, |
||||
mainAxisAlignment: MainAxisAlignment.center, |
||||
children: [ |
||||
Expanded( |
||||
flex: 1, |
||||
child: Column( |
||||
crossAxisAlignment: CrossAxisAlignment.start, |
||||
children: [ |
||||
Padding( |
||||
padding: EdgeInsets.only( |
||||
bottom: 12, |
||||
left: 12.h, |
||||
), |
||||
child: Shimmer.fromColors( |
||||
baseColor: Color(0XFFD8D8D8), |
||||
highlightColor: Color(0XFFD8D8D8), |
||||
child: Container( |
||||
decoration: BoxDecoration( |
||||
color: Color(0XFFD8D8D8), |
||||
borderRadius: BorderRadius.circular(2), |
||||
), |
||||
width: 60.w, |
||||
height: 18.h, |
||||
), |
||||
), |
||||
), |
||||
Padding( |
||||
padding: EdgeInsets.only( |
||||
bottom: 12, |
||||
left: 12.h, |
||||
), |
||||
child: Shimmer.fromColors( |
||||
baseColor: Color(0XFFD8D8D8), |
||||
highlightColor: Color(0XFFD8D8D8), |
||||
child: Container( |
||||
decoration: BoxDecoration( |
||||
color: Color(0XFFD8D8D8), |
||||
borderRadius: BorderRadius.circular(2), |
||||
), |
||||
width: 77.w, |
||||
height: 18.h, |
||||
), |
||||
), |
||||
), |
||||
Padding( |
||||
padding: EdgeInsets.only( |
||||
bottom: 12, |
||||
left: 12.h, |
||||
), |
||||
child: Shimmer.fromColors( |
||||
baseColor: Color(0XFFD8D8D8), |
||||
highlightColor: Color(0XFFD8D8D8), |
||||
child: Container( |
||||
decoration: BoxDecoration( |
||||
color: Color(0XFFD8D8D8), |
||||
borderRadius: BorderRadius.circular(2), |
||||
), |
||||
width: 52.w, |
||||
height: 18.h, |
||||
), |
||||
), |
||||
), |
||||
Padding( |
||||
padding: EdgeInsets.only( |
||||
bottom: 12, |
||||
left: 12.h, |
||||
), |
||||
child: Shimmer.fromColors( |
||||
baseColor: Color(0XFFD8D8D8), |
||||
highlightColor: Color(0XFFD8D8D8), |
||||
child: Container( |
||||
decoration: BoxDecoration( |
||||
color: Color(0XFFD8D8D8), |
||||
borderRadius: BorderRadius.circular(2), |
||||
), |
||||
width: 52.w, |
||||
height: 18.h, |
||||
), |
||||
), |
||||
), |
||||
Padding( |
||||
padding: EdgeInsets.only( |
||||
bottom: 12, |
||||
left: 12.h, |
||||
), |
||||
child: Shimmer.fromColors( |
||||
baseColor: Color(0XFFD8D8D8), |
||||
highlightColor: Color(0XFFD8D8D8), |
||||
child: Container( |
||||
decoration: BoxDecoration( |
||||
color: Color(0XFFD8D8D8), |
||||
borderRadius: BorderRadius.circular(2), |
||||
), |
||||
width: 52.w, |
||||
height: 18.h, |
||||
), |
||||
), |
||||
), |
||||
Padding( |
||||
padding: EdgeInsets.only( |
||||
bottom: 12, |
||||
left: 12.h, |
||||
), |
||||
child: Shimmer.fromColors( |
||||
baseColor: Color(0XFFD8D8D8), |
||||
highlightColor: Color(0XFFD8D8D8), |
||||
child: Container( |
||||
decoration: BoxDecoration( |
||||
color: Color(0XFFD8D8D8), |
||||
borderRadius: BorderRadius.circular(2), |
||||
), |
||||
width: 52.w, |
||||
height: 18.h, |
||||
), |
||||
), |
||||
), |
||||
Padding( |
||||
padding: EdgeInsets.only( |
||||
bottom: 12, |
||||
left: 12.h, |
||||
), |
||||
child: Shimmer.fromColors( |
||||
baseColor: Color(0XFFD8D8D8), |
||||
highlightColor: Color(0XFFD8D8D8), |
||||
child: Container( |
||||
decoration: BoxDecoration( |
||||
color: Color(0XFFD8D8D8), |
||||
borderRadius: BorderRadius.circular(2), |
||||
), |
||||
width: 52.w, |
||||
height: 18.h, |
||||
), |
||||
), |
||||
), |
||||
Padding( |
||||
padding: EdgeInsets.only( |
||||
bottom: 12, |
||||
left: 12.h, |
||||
), |
||||
child: Shimmer.fromColors( |
||||
baseColor: Color(0XFFD8D8D8), |
||||
highlightColor: Color(0XFFD8D8D8), |
||||
child: Container( |
||||
decoration: BoxDecoration( |
||||
color: Color(0XFFD8D8D8), |
||||
borderRadius: BorderRadius.circular(2), |
||||
), |
||||
width: 52.w, |
||||
height: 18.h, |
||||
), |
||||
), |
||||
), |
||||
], |
||||
)), |
||||
Expanded( |
||||
flex: 2, |
||||
child: Column( |
||||
crossAxisAlignment: CrossAxisAlignment.start, |
||||
children: [ |
||||
Padding( |
||||
padding: EdgeInsets.only( |
||||
bottom: 12, |
||||
left: 12.h, |
||||
), |
||||
child: Shimmer.fromColors( |
||||
baseColor: Color(0XFFD8D8D8), |
||||
highlightColor: Color(0XFFD8D8D8), |
||||
child: Container( |
||||
decoration: BoxDecoration( |
||||
color: Color(0XFFD8D8D8), |
||||
borderRadius: BorderRadius.circular(2), |
||||
), |
||||
width: 48.w, |
||||
height: 18.h, |
||||
), |
||||
), |
||||
), |
||||
Padding( |
||||
padding: EdgeInsets.only( |
||||
bottom: 12, |
||||
left: 12.h, |
||||
), |
||||
child: Shimmer.fromColors( |
||||
baseColor: Color(0XFFD8D8D8), |
||||
highlightColor: Color(0XFFD8D8D8), |
||||
child: Container( |
||||
decoration: BoxDecoration( |
||||
color: Color(0XFFD8D8D8), |
||||
borderRadius: BorderRadius.circular(2), |
||||
), |
||||
width: 77.w, |
||||
height: 18.h, |
||||
), |
||||
), |
||||
), |
||||
Padding( |
||||
padding: EdgeInsets.only( |
||||
bottom: 12, |
||||
left: 12.h, |
||||
), |
||||
child: Shimmer.fromColors( |
||||
baseColor: Color(0XFFD8D8D8), |
||||
highlightColor: Color(0XFFD8D8D8), |
||||
child: Container( |
||||
decoration: BoxDecoration( |
||||
color: Color(0XFFD8D8D8), |
||||
borderRadius: BorderRadius.circular(2), |
||||
), |
||||
width: 120.w, |
||||
height: 18.h, |
||||
), |
||||
), |
||||
), |
||||
Padding( |
||||
padding: EdgeInsets.only( |
||||
bottom: 12, |
||||
left: 12.h, |
||||
), |
||||
child: Shimmer.fromColors( |
||||
baseColor: Color(0XFFD8D8D8), |
||||
highlightColor: Color(0XFFD8D8D8), |
||||
child: Container( |
||||
decoration: BoxDecoration( |
||||
color: Color(0XFFD8D8D8), |
||||
borderRadius: BorderRadius.circular(2), |
||||
), |
||||
width: 44.w, |
||||
height: 18.h, |
||||
), |
||||
), |
||||
), |
||||
Padding( |
||||
padding: EdgeInsets.only( |
||||
bottom: 12, |
||||
left: 12.h, |
||||
), |
||||
child: Shimmer.fromColors( |
||||
baseColor: Color(0XFFD8D8D8), |
||||
highlightColor: Color(0XFFD8D8D8), |
||||
child: Container( |
||||
decoration: BoxDecoration( |
||||
color: Color(0XFFD8D8D8), |
||||
borderRadius: BorderRadius.circular(2), |
||||
), |
||||
width: 44.w, |
||||
height: 18.h, |
||||
), |
||||
), |
||||
), |
||||
Padding( |
||||
padding: EdgeInsets.only( |
||||
bottom: 12, |
||||
left: 12.h, |
||||
), |
||||
child: Shimmer.fromColors( |
||||
baseColor: Color(0XFFD8D8D8), |
||||
highlightColor: Color(0XFFD8D8D8), |
||||
child: Container( |
||||
decoration: BoxDecoration( |
||||
color: Color(0XFFD8D8D8), |
||||
borderRadius: BorderRadius.circular(2), |
||||
), |
||||
width: 44.w, |
||||
height: 18.h, |
||||
), |
||||
), |
||||
), |
||||
Padding( |
||||
padding: EdgeInsets.only( |
||||
bottom: 12, |
||||
left: 12.h, |
||||
), |
||||
child: Shimmer.fromColors( |
||||
baseColor: Color(0XFFD8D8D8), |
||||
highlightColor: Color(0XFFD8D8D8), |
||||
child: Container( |
||||
decoration: BoxDecoration( |
||||
color: Color(0XFFD8D8D8), |
||||
borderRadius: BorderRadius.circular(2), |
||||
), |
||||
width: 44.w, |
||||
height: 18.h, |
||||
), |
||||
), |
||||
), |
||||
Padding( |
||||
padding: EdgeInsets.only( |
||||
bottom: 12, |
||||
left: 12.h, |
||||
), |
||||
child: Shimmer.fromColors( |
||||
baseColor: Color(0XFFD8D8D8), |
||||
highlightColor: Color(0XFFD8D8D8), |
||||
child: Container( |
||||
decoration: BoxDecoration( |
||||
color: Color(0XFFD8D8D8), |
||||
borderRadius: BorderRadius.circular(2), |
||||
), |
||||
width: 44.w, |
||||
height: 18.h, |
||||
), |
||||
), |
||||
), |
||||
], |
||||
)), |
||||
Shimmer.fromColors( |
||||
baseColor: Color(0XFFD8D8D8), |
||||
highlightColor: Color(0XFFD8D8D8), |
||||
child: Container( |
||||
margin: EdgeInsets.only(right: 24.w), |
||||
decoration: BoxDecoration( |
||||
color: Color(0XFFD8D8D8), |
||||
borderRadius: BorderRadius.circular(2), |
||||
), |
||||
width: 16.w, |
||||
height: 16.h, |
||||
), |
||||
), |
||||
], |
||||
) |
||||
], |
||||
), |
||||
); |
||||
} |
||||
|
||||
Widget noNetwork() { |
||||
return Container( |
||||
margin: EdgeInsets.only(top: 120.h), |
||||
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,232 @@
|
||||
import 'package:flutter/cupertino.dart'; |
||||
import 'package:flutter/material.dart'; |
||||
import 'package:intl/intl.dart'; |
||||
import 'package:pull_to_refresh/pull_to_refresh.dart'; |
||||
import 'package:flutter_screenutil/flutter_screenutil.dart'; |
||||
import '../../../utils/font_weight.dart'; |
||||
import '../../view_widget/my_appbar.dart'; |
||||
import '../../view_widget/my_tab.dart'; |
||||
import 'order_list.dart'; |
||||
|
||||
class OrderListPage extends StatefulWidget { |
||||
final String storeId; |
||||
|
||||
OrderListPage(this.storeId); |
||||
|
||||
@override |
||||
State<StatefulWidget> createState() { |
||||
return _OrderListPage(); |
||||
} |
||||
} |
||||
|
||||
class _OrderListPage extends State<OrderListPage> { |
||||
final RefreshController refreshController = RefreshController(); |
||||
final ScrollController scrollController = ScrollController(); |
||||
final TextEditingController editingController = TextEditingController(); |
||||
FocusNode _focusNode = FocusNode(); |
||||
bool isKeyBoardShow = false; |
||||
List<GlobalKey> _allKey = []; |
||||
String selectTimeDate = ""; |
||||
String selectTimeDateNum = |
||||
"${DateFormat("yyyy年MM月dd日 00:00:00").format(DateTime.now().subtract(Duration(days: 2)))} 至 " |
||||
"${DateFormat("yyyy年MM月dd日 23:59:59").format(DateTime.now())}"; |
||||
|
||||
@override |
||||
void initState() { |
||||
super.initState(); |
||||
WidgetsBinding.instance.addPostFrameCallback((_) { |
||||
setState(() { |
||||
print("object: ${MediaQuery.of(context).viewInsets.bottom}"); |
||||
if (MediaQuery.of(context).viewInsets.bottom == 0) { |
||||
if (isKeyBoardShow) { |
||||
isKeyBoardShow = false; |
||||
//关闭键盘 软键盘关闭了, 清除输入控件的焦点, 否则重新进入页面会导致软键盘再弹出问题 |
||||
FocusScope.of(context).requestFocus(FocusNode()); |
||||
} |
||||
} else { |
||||
isKeyBoardShow = true; |
||||
} |
||||
}); |
||||
}); |
||||
loadFinish(); |
||||
} |
||||
|
||||
loadFinish() { |
||||
_allKey = [GlobalKey(), GlobalKey(), GlobalKey(), GlobalKey()]; |
||||
setState(() {}); |
||||
} |
||||
|
||||
///离开页面记着销毁和清除 |
||||
@override |
||||
void dispose() { |
||||
_focusNode.unfocus(); |
||||
super.dispose(); |
||||
} |
||||
|
||||
@override |
||||
Widget build(BuildContext context) { |
||||
return GestureDetector( |
||||
behavior: HitTestBehavior.opaque, |
||||
onTap: () { |
||||
FocusScope.of(context).requestFocus(FocusNode()); |
||||
}, |
||||
child: Column( |
||||
children: [ |
||||
Container( |
||||
width: double.infinity, |
||||
height: 1.h, |
||||
color: Color(0xFFD8D8D8), |
||||
), |
||||
orderSearch(), |
||||
timeSelect(), |
||||
Expanded( |
||||
child: DefaultTabController( |
||||
length: 4, |
||||
child: Scaffold( |
||||
resizeToAvoidBottomInset: false, |
||||
appBar: MyAppBar( |
||||
title: "", |
||||
leading: false, |
||||
background: Colors.white, |
||||
// toolbarHeight: MediaQuery.of(context).size.height >= 750 ? (kToolbarHeight + 15.h) : kToolbarHeight, |
||||
bottom: TabBar( |
||||
// isScrollable: true, //可滚动 |
||||
//去掉按钮阴影 |
||||
overlayColor: MaterialStateProperty.all(Colors.white), |
||||
indicatorColor: Color(0xFF30415B), |
||||
labelColor: Colors.black, |
||||
labelStyle: TextStyle( |
||||
fontSize: 15.sp, |
||||
fontWeight: FontWeight.bold, |
||||
), |
||||
unselectedLabelStyle: TextStyle( |
||||
fontSize: 15.sp, |
||||
fontWeight: FontWeight.normal, |
||||
color: Color(0xFF666666)), |
||||
// controller: tabController, |
||||
//未选中文字颜色 |
||||
unselectedLabelColor: Color(0xffA29E9E), |
||||
indicatorSize: TabBarIndicatorSize.label, |
||||
//指示器与文字等宽 |
||||
tabs: <Widget>[ |
||||
MyTab(text: "全部"), |
||||
MyTab(text: "未付款"), |
||||
MyTab(text: "已付款"), |
||||
MyTab(text: "已退款"), |
||||
], |
||||
), |
||||
), |
||||
body: TabBarView( |
||||
children: [ |
||||
OrderList(_allKey[0], 0, widget.storeId, |
||||
editingController.text, selectTime(),MediaQuery.of(context).viewInsets.bottom != 0 ? isKeyBoardShow = true: isKeyBoardShow = false), |
||||
OrderList(_allKey[1], 1, widget.storeId, |
||||
editingController.text, selectTime(),MediaQuery.of(context).viewInsets.bottom != 0 ? isKeyBoardShow = true: isKeyBoardShow = false), |
||||
OrderList(_allKey[2], 2, widget.storeId, |
||||
editingController.text, selectTime(),MediaQuery.of(context).viewInsets.bottom != 0 ? isKeyBoardShow = true: isKeyBoardShow = false), |
||||
OrderList(_allKey[3], 3, widget.storeId, |
||||
editingController.text, selectTime(),MediaQuery.of(context).viewInsets.bottom != 0 ? isKeyBoardShow = true: isKeyBoardShow = false), |
||||
], |
||||
), |
||||
), |
||||
), |
||||
), |
||||
SizedBox( |
||||
height: 76.h, |
||||
), |
||||
], |
||||
), |
||||
); |
||||
} |
||||
|
||||
/// 搜索框 |
||||
Widget orderSearch() { |
||||
return Container( |
||||
color: Colors.white, |
||||
child: Container( |
||||
height: 40.h, |
||||
margin: EdgeInsets.only( |
||||
left: 18.w, |
||||
right: 18.w, |
||||
top: 6.h, |
||||
), |
||||
decoration: BoxDecoration( |
||||
color: Color(0xFFF7F8FA), |
||||
borderRadius: BorderRadius.circular(2), |
||||
), |
||||
child: TextField( |
||||
focusNode: _focusNode, |
||||
textInputAction: TextInputAction.search, |
||||
onEditingComplete: () { |
||||
FocusScope.of(context).requestFocus(FocusNode()); |
||||
loadFinish(); |
||||
}, |
||||
style: TextStyle( |
||||
fontSize: 15.sp, |
||||
fontWeight: MyFontWeight.regular, |
||||
color: Color(0xFF808080), |
||||
), |
||||
controller: editingController, |
||||
decoration: InputDecoration( |
||||
hintText: "请输入订单ID", |
||||
hintStyle: TextStyle( |
||||
color: Color(0xFF808080), |
||||
fontSize: 15.sp, |
||||
fontWeight: MyFontWeight.regular), |
||||
contentPadding: EdgeInsets.symmetric( |
||||
vertical: 12.h, |
||||
), |
||||
prefixIcon: Image.asset( |
||||
"assets/image/bs_goods_search.webp", |
||||
width: 20, |
||||
height: 20, |
||||
), |
||||
border: InputBorder.none, |
||||
), |
||||
), |
||||
), |
||||
); |
||||
} |
||||
|
||||
Widget timeSelect() { |
||||
return Container( |
||||
color: Colors.white, |
||||
child: GestureDetector( |
||||
onTap: () { |
||||
Navigator.of(context).pushNamed('/router/custom_page').then((value) { |
||||
selectTimeDate = value; |
||||
loadFinish(); |
||||
}); |
||||
}, |
||||
child: Container( |
||||
decoration: BoxDecoration( |
||||
color: Color(0xFFF7F8FA), |
||||
borderRadius: BorderRadius.circular(2), |
||||
), |
||||
margin: |
||||
EdgeInsets.only(left: 18.w, right: 18.w, top: 13.h,), |
||||
padding: EdgeInsets.symmetric(horizontal: 14.w, vertical: 12.h), |
||||
child: Row( |
||||
mainAxisAlignment: MainAxisAlignment.center, |
||||
children: [ |
||||
Text( |
||||
("${selectTime().substring(0, 11)} ${selectTime().substring(21, 34)}"), |
||||
style: TextStyle( |
||||
fontSize: 14.sp, |
||||
color: Color(0xFF30415B), |
||||
fontWeight: MyFontWeight.regular), |
||||
), |
||||
], |
||||
), |
||||
), |
||||
), |
||||
); |
||||
} |
||||
|
||||
String selectTime() { |
||||
if (selectTimeDate == "" || selectTimeDate == null) { |
||||
return selectTimeDateNum; |
||||
} else |
||||
return selectTimeDate; |
||||
} |
||||
} |
@ -0,0 +1,612 @@
|
||||
import 'package:dio/dio.dart'; |
||||
import 'package:flutter/cupertino.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/view_widget/classic_header.dart'; |
||||
import 'package:huixiang/view_widget/my_footer.dart'; |
||||
import 'package:pull_to_refresh/pull_to_refresh.dart'; |
||||
import 'package:flutter_screenutil/flutter_screenutil.dart'; |
||||
import 'package:shimmer/shimmer.dart'; |
||||
|
||||
import '../../../generated/l10n.dart'; |
||||
import '../../../retrofit/business_api.dart'; |
||||
import '../../../retrofit/data/base_data.dart'; |
||||
import '../../../retrofit/data/ticket_details.dart'; |
||||
import '../../../retrofit/data/ticket_show.dart'; |
||||
import '../../../utils/business_instance.dart'; |
||||
import '../../../utils/flutter_utils.dart'; |
||||
import '../../../utils/font_weight.dart'; |
||||
import '../../../view_widget/no_data_view.dart'; |
||||
|
||||
class TicketList extends StatefulWidget { |
||||
final String ticketState; |
||||
final String ticketType; |
||||
final String storeId; |
||||
final String keyword; |
||||
final bool typeScreen; |
||||
final bool stateScreen; |
||||
final bool isKeyBoardShow; |
||||
|
||||
TicketList(Key key, this.ticketState, this.ticketType, this.storeId, this.keyword,this.typeScreen,this.stateScreen, |
||||
this.isKeyBoardShow) |
||||
: super(key: key); |
||||
|
||||
@override |
||||
State<StatefulWidget> createState() { |
||||
return _TicketList(); |
||||
} |
||||
} |
||||
|
||||
class _TicketList extends State<TicketList> { |
||||
final RefreshController _refreshController = RefreshController(); |
||||
ScrollPhysics scrollPhysics = NeverScrollableScrollPhysics(); |
||||
final ScrollController controller = ScrollController(); |
||||
BusinessApiService businessService; |
||||
List<TicketShowList> ticketShowList = []; |
||||
int _pageNum = 1; |
||||
String networkError = ""; |
||||
int networkStatus = 0; |
||||
TicketDetails ticketDetails; |
||||
|
||||
@override |
||||
void dispose() { |
||||
super.dispose(); |
||||
_refreshController.dispose(); |
||||
} |
||||
|
||||
@override |
||||
void initState() { |
||||
super.initState(); |
||||
_onRefresh(); |
||||
} |
||||
|
||||
_onRefresh({bool isShowLoad = true}) async { |
||||
if (isShowLoad) |
||||
EasyLoading.show( |
||||
status: S.current.zhengzaijiazai, |
||||
maskType: EasyLoadingMaskType.black); |
||||
await queryTicketList(isRefreshData: false); |
||||
EasyLoading.dismiss(); |
||||
if (!mounted) return; |
||||
if (_refreshController.isRefresh) _refreshController.refreshCompleted(); |
||||
setState(() {}); |
||||
} |
||||
|
||||
queryTicketList({String queryName,isRefreshData = true}) async { |
||||
try { |
||||
if (businessService == null) { |
||||
businessService = BusinessApiService(Dio(), |
||||
context: context, |
||||
token: BusinessInstance.instance.businessToken, |
||||
tenant: BusinessInstance.instance.businessTenant, |
||||
storeId: widget.storeId); |
||||
} |
||||
BaseData<TicketShow> baseData = await businessService.showList({ |
||||
"pageNum": _pageNum, |
||||
"pageSize": 10, |
||||
"productId": 0, |
||||
"productSkuId": 0, |
||||
"searchKey": widget.keyword == "" ? (queryName ?? "") : widget.keyword, |
||||
"state": widget?.ticketState ?? "", |
||||
"storeId": widget?.storeId ?? "", |
||||
"ticketCode": "", |
||||
"ticketId": 0, |
||||
"ticketItemIds": [], |
||||
"type": widget?.ticketType ?? "" |
||||
}).catchError((error) { |
||||
networkError = AppUtils.dioErrorTypeToString(error.type); |
||||
networkStatus = -1; |
||||
setState(() {}); |
||||
_refreshController.refreshFailed(); |
||||
_refreshController.loadFailed(); |
||||
}); |
||||
if (!mounted) return; |
||||
if (baseData != null && baseData.isSuccess) { |
||||
ticketShowList.addAll(baseData?.data?.list ?? []); |
||||
if ((baseData?.data?.list ?? []).isEmpty || |
||||
ticketShowList.length.toString() == baseData.data.total) |
||||
_refreshController.loadNoData(); |
||||
else |
||||
_refreshController.loadComplete(); |
||||
networkStatus = 1; |
||||
} else { |
||||
SmartDialog.showToast(baseData.msg, alignment: Alignment.center); |
||||
} |
||||
} finally { |
||||
if (isRefreshData) setState(() {}); |
||||
} |
||||
} |
||||
|
||||
///票券详情 |
||||
queryTicketDetails(code) async { |
||||
if (businessService == null) { |
||||
businessService = BusinessApiService(Dio(), |
||||
context: context, |
||||
token: BusinessInstance.instance.businessToken, |
||||
tenant: BusinessInstance.instance.businessTenant, |
||||
storeId: widget.storeId); |
||||
} |
||||
BaseData<TicketDetails> baseData = |
||||
await businessService.ticketCode(code).catchError((error) {}); |
||||
if (baseData != null && baseData.isSuccess) { |
||||
ticketDetails = baseData.data; |
||||
if(ticketDetails.state != 9){ |
||||
Navigator.of(context) |
||||
.pushNamed('/router/order_write_off', arguments: { |
||||
"ticketDetails": ticketDetails, |
||||
}).then((value) async { |
||||
queryTicketList(queryName: ticketDetails.name); |
||||
}); |
||||
} |
||||
else{ |
||||
Navigator.of(context) |
||||
.pushNamed('/router/order_write_off', arguments: { |
||||
"ticketDetails": ticketDetails, |
||||
}); |
||||
} |
||||
} else { |
||||
SmartDialog.showToast(baseData.msg, alignment: Alignment.center); |
||||
} |
||||
} |
||||
|
||||
@override |
||||
Widget build(BuildContext context) { |
||||
return SmartRefresher( |
||||
controller: _refreshController, |
||||
enablePullDown: true, |
||||
enablePullUp: ticketShowList.length == 0 ? false : true, |
||||
header: MyHeader(color: Color(0xFF30415B)), |
||||
physics: BouncingScrollPhysics(), |
||||
footer: CustomFooter( |
||||
builder: (context, mode) { |
||||
return MyFooter(mode); |
||||
}, |
||||
), |
||||
onRefresh: () { |
||||
_pageNum = 1; |
||||
ticketShowList.clear(); |
||||
_onRefresh(isShowLoad: false); |
||||
}, |
||||
onLoading: () { |
||||
_pageNum++; |
||||
_onRefresh(isShowLoad: false); |
||||
}, |
||||
child: networkStatus == -1 |
||||
? noNetwork() |
||||
: ((networkStatus == 0) |
||||
? ListView.builder( |
||||
padding: EdgeInsets.zero, |
||||
itemCount: 10, |
||||
scrollDirection: Axis.vertical, |
||||
shrinkWrap: true, |
||||
physics: BouncingScrollPhysics(), |
||||
itemBuilder: (context, position) { |
||||
return ticketListSm(); |
||||
}, |
||||
) |
||||
: ((ticketShowList == null || ticketShowList.length == 0) |
||||
? NoDataView( |
||||
src: "assets/image/bs_no data_logo.webp", |
||||
isShowBtn: false, |
||||
text: "暂无数据", |
||||
fontSize: 16.sp, |
||||
iconHeight: 120.h, |
||||
margin: EdgeInsets.all(50.h), |
||||
) |
||||
: Padding( |
||||
padding: EdgeInsets.only(top: 16.h), |
||||
child: ListView.builder( |
||||
itemCount: ticketShowList?.length ?? 0, |
||||
physics: BouncingScrollPhysics(), |
||||
shrinkWrap: true, |
||||
itemBuilder: (context, position) { |
||||
return GestureDetector( |
||||
behavior: HitTestBehavior.opaque, |
||||
onTap: () { |
||||
if (widget.isKeyBoardShow || widget.stateScreen == true || widget.typeScreen == true) { |
||||
FocusScope.of(context) |
||||
.requestFocus(FocusNode()); |
||||
return; |
||||
} else { |
||||
queryTicketDetails(ticketShowList[position].code ?? ""); |
||||
} |
||||
}, |
||||
child: ticketListItem(ticketShowList[position],position), |
||||
); |
||||
}, |
||||
), |
||||
))), |
||||
); |
||||
} |
||||
|
||||
Widget ticketListItem(TicketShowList ticketShowList,index) { |
||||
return Container( |
||||
decoration: BoxDecoration( |
||||
color: Colors.white, |
||||
borderRadius: BorderRadius.circular(8), |
||||
), |
||||
margin: EdgeInsets.only(left: 16.w, right: 16.w, bottom: 16.h), |
||||
padding: EdgeInsets.symmetric(vertical: 12.h), |
||||
child: Column( |
||||
children: [ |
||||
Padding( |
||||
padding: EdgeInsets.only(left: 12.w, right: 12.w, bottom: 13.h), |
||||
child: Row( |
||||
crossAxisAlignment: CrossAxisAlignment.center, |
||||
children: [ |
||||
Expanded( |
||||
child: Text( |
||||
ticketShowList.name ?? "", |
||||
overflow: TextOverflow.ellipsis, |
||||
maxLines: 1, |
||||
style: TextStyle( |
||||
fontSize: 14.sp, |
||||
color: Colors.black, |
||||
fontWeight: MyFontWeight.bold), |
||||
), |
||||
), |
||||
Text( |
||||
ticketState(index), |
||||
style: TextStyle( |
||||
fontSize: 14.sp, |
||||
color: Color(0xFFFA5151), |
||||
fontWeight: MyFontWeight.bold), |
||||
) |
||||
], |
||||
), |
||||
), |
||||
Container( |
||||
width: double.infinity, |
||||
height: 1.h, |
||||
color: Color(0xFFF4F6F7), |
||||
), |
||||
Padding( |
||||
padding: EdgeInsets.only(top: 13.h, left: 12.w), |
||||
child: Row( |
||||
children: [ |
||||
Text( |
||||
"联系人:", |
||||
style: TextStyle( |
||||
fontSize: 12.sp, |
||||
color: Color(0xFF7A797F), |
||||
fontWeight: MyFontWeight.regular), |
||||
), |
||||
SizedBox( |
||||
width: 26.w, |
||||
), |
||||
Text( |
||||
ticketShowList?.nickName ?? "", |
||||
style: TextStyle( |
||||
fontSize: 12.sp, |
||||
color: Color(0xFF7A797F), |
||||
fontWeight: MyFontWeight.regular), |
||||
) |
||||
], |
||||
)), |
||||
Padding( |
||||
padding: EdgeInsets.only(top: 12.h, left: 12.w), |
||||
child: Row( |
||||
children: [ |
||||
Text( |
||||
"手机号:", |
||||
style: TextStyle( |
||||
fontSize: 12.sp, |
||||
color: Color(0xFF7A797F), |
||||
fontWeight: MyFontWeight.regular), |
||||
), |
||||
SizedBox( |
||||
width: 26.w, |
||||
), |
||||
Text( |
||||
ticketShowList?.userPhone ?? "", |
||||
style: TextStyle( |
||||
fontSize: 12.sp, |
||||
color: Color(0xFF7A797F), |
||||
fontWeight: MyFontWeight.regular), |
||||
) |
||||
], |
||||
), |
||||
), |
||||
Container( |
||||
width: double.infinity, |
||||
height: 1.h, |
||||
color: Color(0xFFF4F6F7), |
||||
margin: EdgeInsets.symmetric(vertical: 12.h), |
||||
), |
||||
Padding( |
||||
padding: EdgeInsets.symmetric(horizontal: 12.w), |
||||
child: Row( |
||||
children: [ |
||||
Text( |
||||
"票券编号: ", |
||||
style: TextStyle( |
||||
fontSize: 12.sp, |
||||
color: Color(0xFF7A797F), |
||||
fontWeight: MyFontWeight.regular), |
||||
), |
||||
Expanded( |
||||
child: Text( |
||||
ticketShowList?.code ??"", |
||||
style: TextStyle( |
||||
fontSize: 12.sp, |
||||
color: Color(0xFF808080), |
||||
fontWeight: MyFontWeight.regular), |
||||
)), |
||||
Text( |
||||
ticketShowList?.amount ??"", |
||||
style: TextStyle( |
||||
fontSize: 14.sp, |
||||
color: Color(0xFF181818), |
||||
fontWeight: MyFontWeight.bold), |
||||
) |
||||
], |
||||
)), |
||||
if(ticketShowList.state == 1 || ticketShowList?.state == 2) |
||||
Row( |
||||
mainAxisAlignment: MainAxisAlignment.end, |
||||
children: [ |
||||
GestureDetector( |
||||
behavior: HitTestBehavior.opaque, |
||||
onTap: () { |
||||
queryTicketDetails(ticketShowList.code ?? ""); |
||||
}, |
||||
child: Container( |
||||
decoration: BoxDecoration( |
||||
color: Color(0xFF30415B), |
||||
borderRadius: BorderRadius.circular(4), |
||||
), |
||||
padding: |
||||
EdgeInsets.symmetric(vertical: 5.h, horizontal: 26.w), |
||||
margin: EdgeInsets.only(top: 16.h, right:12.w), |
||||
child: Text( |
||||
"核销", |
||||
style: TextStyle( |
||||
fontSize: 12.sp, |
||||
color: Colors.white, |
||||
fontWeight: MyFontWeight.regular), |
||||
), |
||||
), |
||||
) |
||||
], |
||||
), |
||||
], |
||||
), |
||||
); |
||||
} |
||||
|
||||
String ticketState(index){ |
||||
if (ticketShowList[index].state == 1 || ticketShowList[index].state == 2) { |
||||
return "可使用"; |
||||
} else if (ticketShowList[index].state == 7) { |
||||
return "已取消"; |
||||
} else if (ticketShowList[index].state == 8) { |
||||
return "已失效"; |
||||
}else if (ticketShowList[index].state == 9) { |
||||
return "已使用"; |
||||
} |
||||
} |
||||
|
||||
Widget ticketListSm() { |
||||
return Container( |
||||
decoration: BoxDecoration( |
||||
color: Colors.white, |
||||
borderRadius: BorderRadius.circular(8), |
||||
), |
||||
margin: EdgeInsets.all(16), |
||||
padding: EdgeInsets.symmetric(vertical: 12.h), |
||||
child: Column( |
||||
children: [ |
||||
Padding( |
||||
padding: EdgeInsets.only(left: 12.w, right: 12.w, bottom: 13.h), |
||||
child: Row( |
||||
crossAxisAlignment: CrossAxisAlignment.center, |
||||
children: [ |
||||
Shimmer.fromColors( |
||||
baseColor: Color(0XFFD8D8D8), |
||||
highlightColor: Color(0XFFD8D8D8), |
||||
child: Container( |
||||
decoration: BoxDecoration( |
||||
color: Color(0XFFD8D8D8), |
||||
borderRadius: BorderRadius.circular(2), |
||||
), |
||||
width: 154.w, |
||||
height: 18.h, |
||||
), |
||||
), |
||||
Spacer(), |
||||
Shimmer.fromColors( |
||||
baseColor: Color(0XFFD8D8D8), |
||||
highlightColor: Color(0XFFD8D8D8), |
||||
child: Container( |
||||
decoration: BoxDecoration( |
||||
color: Color(0XFFD8D8D8), |
||||
borderRadius: BorderRadius.circular(2), |
||||
), |
||||
width: 42.w, |
||||
height: 18.h, |
||||
), |
||||
), |
||||
], |
||||
), |
||||
), |
||||
Container( |
||||
width: double.infinity, |
||||
height: 1.h, |
||||
color: Color(0xFFF4F6F7), |
||||
), |
||||
Padding( |
||||
padding: EdgeInsets.only(top: 13.h, left: 12.w), |
||||
child: Row( |
||||
children: [ |
||||
Shimmer.fromColors( |
||||
baseColor: Color(0XFFD8D8D8), |
||||
highlightColor: Color(0XFFD8D8D8), |
||||
child: Container( |
||||
decoration: BoxDecoration( |
||||
color: Color(0XFFD8D8D8), |
||||
borderRadius: BorderRadius.circular(2), |
||||
), |
||||
width: 40.w, |
||||
height: 17.h, |
||||
), |
||||
), |
||||
SizedBox( |
||||
width: 26.w, |
||||
), |
||||
Shimmer.fromColors( |
||||
baseColor: Color(0XFFD8D8D8), |
||||
highlightColor: Color(0XFFD8D8D8), |
||||
child: Container( |
||||
decoration: BoxDecoration( |
||||
color: Color(0XFFD8D8D8), |
||||
borderRadius: BorderRadius.circular(2), |
||||
), |
||||
width: 24.w, |
||||
height: 17.h, |
||||
), |
||||
), |
||||
], |
||||
)), |
||||
Padding( |
||||
padding: EdgeInsets.only(top: 12.h, left: 12.w), |
||||
child: Row( |
||||
children: [ |
||||
Shimmer.fromColors( |
||||
baseColor: Color(0XFFD8D8D8), |
||||
highlightColor: Color(0XFFD8D8D8), |
||||
child: Container( |
||||
decoration: BoxDecoration( |
||||
color: Color(0XFFD8D8D8), |
||||
borderRadius: BorderRadius.circular(2), |
||||
), |
||||
width: 40.w, |
||||
height: 17.h, |
||||
), |
||||
), |
||||
SizedBox( |
||||
width: 26.w, |
||||
), |
||||
Shimmer.fromColors( |
||||
baseColor: Color(0XFFD8D8D8), |
||||
highlightColor: Color(0XFFD8D8D8), |
||||
child: Container( |
||||
decoration: BoxDecoration( |
||||
color: Color(0XFFD8D8D8), |
||||
borderRadius: BorderRadius.circular(2), |
||||
), |
||||
width: 77.w, |
||||
height: 17.h, |
||||
), |
||||
), |
||||
], |
||||
), |
||||
), |
||||
Container( |
||||
width: double.infinity, |
||||
height: 1.h, |
||||
color: Color(0xFFF4F6F7), |
||||
margin: EdgeInsets.symmetric(vertical: 12.h), |
||||
), |
||||
Padding( |
||||
padding: EdgeInsets.symmetric(horizontal: 12.w), |
||||
child: Row( |
||||
children: [ |
||||
Shimmer.fromColors( |
||||
baseColor: Color(0XFFD8D8D8), |
||||
highlightColor: Color(0XFFD8D8D8), |
||||
child: Container( |
||||
decoration: BoxDecoration( |
||||
color: Color(0XFFD8D8D8), |
||||
borderRadius: BorderRadius.circular(2), |
||||
), |
||||
width: 52.w, |
||||
height: 17.h, |
||||
), |
||||
), |
||||
SizedBox(width:14.w,), |
||||
Shimmer.fromColors( |
||||
baseColor: Color(0XFFD8D8D8), |
||||
highlightColor: Color(0XFFD8D8D8), |
||||
child: Container( |
||||
decoration: BoxDecoration( |
||||
color: Color(0XFFD8D8D8), |
||||
borderRadius: BorderRadius.circular(2), |
||||
), |
||||
width: 115.w, |
||||
height: 17.h, |
||||
), |
||||
), |
||||
], |
||||
)), |
||||
Row( |
||||
mainAxisAlignment: MainAxisAlignment.end, |
||||
children: [ |
||||
Shimmer.fromColors( |
||||
baseColor: Color(0XFFD8D8D8), |
||||
highlightColor: Color(0XFFD8D8D8), |
||||
child: Container( |
||||
margin: EdgeInsets.only(right: 20.w,top:16.h), |
||||
decoration: BoxDecoration( |
||||
color: Color(0XFFD8D8D8), |
||||
borderRadius: BorderRadius.circular(2), |
||||
), |
||||
width: 76.w, |
||||
height: 27.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,634 @@
|
||||
import 'package:flutter/cupertino.dart'; |
||||
import 'package:flutter/material.dart'; |
||||
import 'package:huixiang/business_system/order/ticket/ticket_list.dart'; |
||||
import 'package:huixiang/business_system/order/ticket/ticket_records_page.dart'; |
||||
import 'package:huixiang/business_system/order/ticket/ticket_statistics_page.dart'; |
||||
import 'package:huixiang/business_system/order/ticket/ticket_tab.dart'; |
||||
import 'package:intl/intl.dart'; |
||||
import 'package:pull_to_refresh/pull_to_refresh.dart'; |
||||
import 'package:flutter_screenutil/flutter_screenutil.dart'; |
||||
import '../../../utils/font_weight.dart'; |
||||
import '../../../view_widget/my_appbar.dart'; |
||||
import '../../../view_widget/my_tab.dart'; |
||||
|
||||
class TicketPage extends StatefulWidget { |
||||
final String storeId; |
||||
|
||||
TicketPage(this.storeId); |
||||
|
||||
@override |
||||
State<StatefulWidget> createState() { |
||||
return _TicketPage(); |
||||
} |
||||
} |
||||
|
||||
class _TicketPage extends State<TicketPage> |
||||
with SingleTickerProviderStateMixin { |
||||
final RefreshController refreshController = RefreshController(); |
||||
final ScrollController scrollController = ScrollController(); |
||||
final TextEditingController editingController = TextEditingController(); |
||||
FocusNode _focusNode = FocusNode(); |
||||
bool isKeyBoardShow = false; |
||||
List<GlobalKey> _allKey = []; |
||||
String selectTimeDate = ""; |
||||
String selectTimeDateNum = |
||||
"${DateFormat("yyyy年MM月dd日 00:00:00").format(DateTime.now().subtract(Duration(days:5)))} 至 " |
||||
"${DateFormat("yyyy年MM月dd日 23:59:59").format(DateTime.now())}"; |
||||
bool typeScreen = false; |
||||
bool stateScreen = false; |
||||
String ticketType; |
||||
String ticketState = "-1"; |
||||
TabController tabController; |
||||
|
||||
@override |
||||
void initState() { |
||||
super.initState(); |
||||
tabController = TabController(length: 3, vsync: this); |
||||
tabController.addListener(() { |
||||
if (!tabController.indexIsChanging) { |
||||
setState(() {}); |
||||
FocusScope.of(context).requestFocus(FocusNode()); |
||||
} |
||||
}); |
||||
WidgetsBinding.instance.addPostFrameCallback((_) { |
||||
setState(() { |
||||
print("object: ${MediaQuery.of(context).viewInsets.bottom}"); |
||||
if (MediaQuery.of(context).viewInsets.bottom == 0) { |
||||
if (isKeyBoardShow) { |
||||
isKeyBoardShow = false; |
||||
//关闭键盘 软键盘关闭了, 清除输入控件的焦点, 否则重新进入页面会导致软键盘再弹出问题 |
||||
FocusScope.of(context).requestFocus(FocusNode()); |
||||
} |
||||
} else { |
||||
isKeyBoardShow = true; |
||||
} |
||||
}); |
||||
}); |
||||
loadFinish(); |
||||
} |
||||
|
||||
loadFinish() { |
||||
_allKey = [GlobalKey(), GlobalKey(), GlobalKey()]; |
||||
setState(() {}); |
||||
} |
||||
|
||||
///离开页面记着销毁和清除 |
||||
@override |
||||
void dispose() { |
||||
_focusNode.unfocus(); |
||||
super.dispose(); |
||||
} |
||||
|
||||
@override |
||||
Widget build(BuildContext context) { |
||||
return GestureDetector( |
||||
behavior: HitTestBehavior.opaque, |
||||
onTap: () { |
||||
FocusScope.of(context).requestFocus(FocusNode()); |
||||
}, |
||||
child: Stack( |
||||
children: [ |
||||
Column( |
||||
children: [ |
||||
Container( |
||||
width: double.infinity, |
||||
height: 1.h, |
||||
color: Color(0xFFD8D8D8), |
||||
), |
||||
ticketSearch(), |
||||
tabController.index == 0 ? screen() : timeSelect(), |
||||
Expanded( |
||||
child: DefaultTabController( |
||||
length: 3, |
||||
child: Scaffold( |
||||
resizeToAvoidBottomInset: false, |
||||
appBar: MyAppBar( |
||||
title: "", |
||||
leading: false, |
||||
background: Colors.white, |
||||
bottom: TabBar( |
||||
// isScrollable: true, //可滚动 |
||||
//去掉按钮阴影 |
||||
overlayColor: MaterialStateProperty.all(Colors.white), |
||||
indicator: const TicketTab( |
||||
width: 33, |
||||
borderSide: BorderSide( |
||||
width: 2.0, color: Color(0xFF30415B))), |
||||
labelColor: Colors.black, |
||||
labelStyle: TextStyle( |
||||
fontSize: 15.sp, |
||||
fontWeight: FontWeight.bold, |
||||
), |
||||
unselectedLabelStyle: TextStyle( |
||||
fontSize: 15.sp, |
||||
fontWeight: FontWeight.normal, |
||||
color: Color(0xFF666666)), |
||||
controller: tabController, |
||||
//未选中文字颜色 |
||||
unselectedLabelColor: Color(0xFF0D0D0D), |
||||
//指示器与文字等宽 |
||||
tabs: <Widget>[ |
||||
MyTab(text: "票券列表"), |
||||
MyTab(text: "核销记录"), |
||||
MyTab(text: "核销统计"), |
||||
], |
||||
), |
||||
), |
||||
body: TabBarView( |
||||
controller: tabController, |
||||
children: [ |
||||
TicketList( |
||||
_allKey[0], |
||||
ticketState == "-1" ? "0" : ticketState, |
||||
ticketType, |
||||
widget.storeId, |
||||
editingController.text, |
||||
typeScreen, |
||||
stateScreen, |
||||
MediaQuery.of(context).viewInsets.bottom != 0 |
||||
? isKeyBoardShow = true |
||||
: isKeyBoardShow = false), |
||||
TicketRecordPage( |
||||
_allKey[1], |
||||
1, |
||||
widget.storeId, |
||||
editingController.text, |
||||
(selectTimeDate == "" || selectTimeDate == null) ? "" :selectTimeDate, |
||||
MediaQuery.of(context).viewInsets.bottom != 0 |
||||
? isKeyBoardShow = true |
||||
: isKeyBoardShow = false), |
||||
TicketStatisticsPage( |
||||
_allKey[2], |
||||
2, |
||||
widget.storeId, |
||||
editingController.text, |
||||
selectTime(), |
||||
MediaQuery.of(context).viewInsets.bottom != 0 |
||||
? isKeyBoardShow = true |
||||
: isKeyBoardShow = false), |
||||
], |
||||
), |
||||
), |
||||
), |
||||
), |
||||
SizedBox( |
||||
height: 76.h, |
||||
), |
||||
], |
||||
), |
||||
Container( |
||||
padding: EdgeInsets.symmetric(horizontal: 18.w), |
||||
child: Row( |
||||
crossAxisAlignment: CrossAxisAlignment.start, |
||||
children: [ |
||||
if (typeScreen && tabController.index == 0) |
||||
Expanded( |
||||
child: Container( |
||||
height: 176.h, |
||||
decoration: BoxDecoration( |
||||
color: Colors.white, |
||||
border: Border.all( |
||||
color: Color(0x29000000), |
||||
width: 0.5.w, |
||||
), |
||||
borderRadius: BorderRadius.circular(2), |
||||
), |
||||
margin: EdgeInsets.only(top: 108.h), |
||||
padding: EdgeInsets.symmetric( |
||||
horizontal: 16.w, vertical: 8.h), |
||||
child: Column( |
||||
crossAxisAlignment: CrossAxisAlignment.start, |
||||
children: [ |
||||
GestureDetector( |
||||
behavior: HitTestBehavior.opaque, |
||||
onTap: () { |
||||
setState(() { |
||||
ticketType = ""; |
||||
typeScreen = false; |
||||
loadFinish(); |
||||
}); |
||||
}, |
||||
child: Container( |
||||
width: double.infinity, |
||||
padding: |
||||
EdgeInsets.symmetric(vertical: 8.h), |
||||
child: Text( |
||||
"所有", |
||||
style: TextStyle( |
||||
color: Color(0xFF808080), |
||||
fontSize: 15.sp, |
||||
fontWeight: MyFontWeight.regular), |
||||
)), |
||||
), |
||||
GestureDetector( |
||||
behavior: HitTestBehavior.opaque, |
||||
onTap: () { |
||||
setState(() { |
||||
ticketType = "ADOPT_WARRANT"; |
||||
typeScreen = false; |
||||
loadFinish(); |
||||
}); |
||||
}, |
||||
child: Container( |
||||
width: double.infinity, |
||||
padding: |
||||
EdgeInsets.symmetric(vertical: 8.h), |
||||
child: Text( |
||||
"认领凭证", |
||||
style: TextStyle( |
||||
color: Color(0xFF808080), |
||||
fontSize: 15.sp, |
||||
fontWeight: MyFontWeight.regular), |
||||
), |
||||
)), |
||||
GestureDetector( |
||||
behavior: HitTestBehavior.opaque, |
||||
onTap: () { |
||||
setState(() { |
||||
ticketType = "IDENTITY_CARD"; |
||||
typeScreen = false; |
||||
loadFinish(); |
||||
}); |
||||
}, |
||||
child: Container( |
||||
width: double.infinity, |
||||
padding: |
||||
EdgeInsets.symmetric(vertical: 8.h), |
||||
child: Text( |
||||
"身份卡片", |
||||
style: TextStyle( |
||||
color: Color(0xFF808080), |
||||
fontSize: 15.sp, |
||||
fontWeight: MyFontWeight.regular), |
||||
), |
||||
)), |
||||
GestureDetector( |
||||
behavior: HitTestBehavior.opaque, |
||||
onTap: () { |
||||
setState(() { |
||||
ticketType = "NORMAL"; |
||||
typeScreen = false; |
||||
loadFinish(); |
||||
}); |
||||
}, |
||||
child: Container( |
||||
width: double.infinity, |
||||
padding: |
||||
EdgeInsets.symmetric(vertical: 8.h), |
||||
child: Text( |
||||
"常规票券", |
||||
style: TextStyle( |
||||
color: Color(0xFF808080), |
||||
fontSize: 15.sp, |
||||
fontWeight: MyFontWeight.regular), |
||||
))), |
||||
], |
||||
))), |
||||
if (!typeScreen || !stateScreen) Expanded(child: Container()), |
||||
SizedBox( |
||||
width: 14.w, |
||||
), |
||||
if (stateScreen && tabController.index == 0) |
||||
Expanded( |
||||
child: Container( |
||||
height: 210.h, |
||||
decoration: BoxDecoration( |
||||
color: Colors.white, |
||||
border: Border.all( |
||||
color: Color(0x29000000), |
||||
width: 0.5.w, |
||||
), |
||||
borderRadius: BorderRadius.circular(2), |
||||
), |
||||
margin: EdgeInsets.only(top: 108.h), |
||||
padding: EdgeInsets.symmetric( |
||||
horizontal: 16.w, vertical: 8.h), |
||||
child: Column( |
||||
crossAxisAlignment: CrossAxisAlignment.start, |
||||
children: [ |
||||
GestureDetector( |
||||
behavior: HitTestBehavior.opaque, |
||||
onTap: () { |
||||
setState(() { |
||||
ticketState = "0"; |
||||
stateScreen = false; |
||||
loadFinish(); |
||||
}); |
||||
}, |
||||
child: Container( |
||||
width: double.infinity, |
||||
padding: |
||||
EdgeInsets.symmetric(vertical: 8.h), |
||||
child: Text( |
||||
"全部", |
||||
style: TextStyle( |
||||
color: Color(0xFF808080), |
||||
fontSize: 15.sp, |
||||
fontWeight: MyFontWeight.regular), |
||||
))), |
||||
GestureDetector( |
||||
behavior: HitTestBehavior.opaque, |
||||
onTap: () { |
||||
setState(() { |
||||
ticketState = "1"; |
||||
stateScreen = false; |
||||
loadFinish(); |
||||
}); |
||||
}, |
||||
child: Container( |
||||
width: double.infinity, |
||||
padding: |
||||
EdgeInsets.symmetric(vertical: 8.h), |
||||
child: Text( |
||||
"可使用", |
||||
style: TextStyle( |
||||
color: Color(0xFF808080), |
||||
fontSize: 15.sp, |
||||
fontWeight: MyFontWeight.regular), |
||||
), |
||||
)), |
||||
GestureDetector( |
||||
behavior: HitTestBehavior.opaque, |
||||
onTap: () { |
||||
setState(() { |
||||
ticketState = "7"; |
||||
stateScreen = false; |
||||
loadFinish(); |
||||
}); |
||||
}, |
||||
child: Container( |
||||
width: double.infinity, |
||||
padding: |
||||
EdgeInsets.symmetric(vertical: 8.h), |
||||
child: Text( |
||||
"已取消", |
||||
style: TextStyle( |
||||
color: Color(0xFF808080), |
||||
fontSize: 15.sp, |
||||
fontWeight: MyFontWeight.regular), |
||||
), |
||||
)), |
||||
GestureDetector( |
||||
behavior: HitTestBehavior.opaque, |
||||
onTap: () { |
||||
setState(() { |
||||
ticketState = "8"; |
||||
stateScreen = false; |
||||
loadFinish(); |
||||
}); |
||||
}, |
||||
child: Container( |
||||
width: double.infinity, |
||||
padding: |
||||
EdgeInsets.symmetric(vertical: 8.h), |
||||
child: Text( |
||||
"已失效", |
||||
style: TextStyle( |
||||
color: Color(0xFF808080), |
||||
fontSize: 15.sp, |
||||
fontWeight: MyFontWeight.regular), |
||||
), |
||||
)), |
||||
GestureDetector( |
||||
behavior: HitTestBehavior.opaque, |
||||
onTap: () { |
||||
setState(() { |
||||
ticketState = "9"; |
||||
stateScreen = false; |
||||
loadFinish(); |
||||
}); |
||||
}, |
||||
child: Container( |
||||
width: double.infinity, |
||||
padding: |
||||
EdgeInsets.symmetric(vertical: 8.h), |
||||
child: Text( |
||||
"已使用", |
||||
style: TextStyle( |
||||
color: Color(0xFF808080), |
||||
fontSize: 15.sp, |
||||
fontWeight: MyFontWeight.regular), |
||||
), |
||||
)), |
||||
], |
||||
))), |
||||
], |
||||
), |
||||
), |
||||
], |
||||
), |
||||
); |
||||
} |
||||
|
||||
/// 搜索框 |
||||
Widget ticketSearch() { |
||||
return Container( |
||||
color: Colors.white, |
||||
child: Container( |
||||
height: 40.h, |
||||
margin: |
||||
EdgeInsets.only(left: 18.w, right: 18.w, top: 6.h, bottom: 13.h), |
||||
decoration: BoxDecoration( |
||||
color: Color(0xFFF7F8FA), |
||||
borderRadius: BorderRadius.circular(2), |
||||
), |
||||
child: TextField( |
||||
focusNode: _focusNode, |
||||
textInputAction: TextInputAction.search, |
||||
onTap: () { |
||||
typeScreen = false; |
||||
stateScreen = false; |
||||
}, |
||||
onEditingComplete: () { |
||||
FocusScope.of(context).requestFocus(FocusNode()); |
||||
loadFinish(); |
||||
}, |
||||
style: TextStyle( |
||||
fontSize: 15.sp, |
||||
fontWeight: MyFontWeight.regular, |
||||
color: Color(0xFF808080), |
||||
), |
||||
controller: editingController, |
||||
decoration: InputDecoration( |
||||
hintText: "请输入票券名称/用户名/手机号", |
||||
hintStyle: TextStyle( |
||||
color: Color(0xFF808080), |
||||
fontSize: 15.sp, |
||||
fontWeight: MyFontWeight.regular), |
||||
contentPadding: EdgeInsets.symmetric( |
||||
vertical: 12.h, |
||||
), |
||||
prefixIcon: Image.asset( |
||||
"assets/image/bs_goods_search.webp", |
||||
width: 20, |
||||
height: 20, |
||||
), |
||||
border: InputBorder.none, |
||||
), |
||||
), |
||||
), |
||||
); |
||||
} |
||||
|
||||
///筛选框 |
||||
Widget screen() { |
||||
return Container( |
||||
color: Colors.white, |
||||
width: double.infinity, |
||||
padding: EdgeInsets.only(left: 18.w, right: 18.w), |
||||
child: Row( |
||||
children: [ |
||||
Expanded( |
||||
child: GestureDetector( |
||||
onTap: () { |
||||
setState(() { |
||||
typeScreen = !typeScreen; |
||||
FocusScope.of(context).requestFocus(FocusNode()); |
||||
stateScreen = false; |
||||
}); |
||||
}, |
||||
child: Container( |
||||
decoration: BoxDecoration( |
||||
color: Color(0XFFF7F8FA), |
||||
borderRadius: BorderRadius.circular(2), |
||||
), |
||||
padding: EdgeInsets.symmetric(horizontal: 9.w, vertical: 11.h), |
||||
child: Row( |
||||
children: [ |
||||
Expanded( |
||||
child: Text( |
||||
ticketType == null ? "类型筛选" : shopTypeSelect(), |
||||
style: TextStyle( |
||||
color: Color(0xFF808080), |
||||
fontSize: 18.sp, |
||||
fontWeight: MyFontWeight.regular), |
||||
)), |
||||
Icon( |
||||
(typeScreen != null && !typeScreen) |
||||
? Icons.keyboard_arrow_down |
||||
: Icons.keyboard_arrow_up, |
||||
color: Color(0xFF808080), |
||||
size: 24, |
||||
), |
||||
], |
||||
), |
||||
), |
||||
), |
||||
), |
||||
SizedBox( |
||||
width: 14.w, |
||||
), |
||||
Expanded( |
||||
child: GestureDetector( |
||||
onTap: () { |
||||
setState(() { |
||||
stateScreen = !stateScreen; |
||||
FocusScope.of(context).requestFocus(FocusNode()); |
||||
typeScreen = false; |
||||
}); |
||||
}, |
||||
child: Container( |
||||
decoration: BoxDecoration( |
||||
color: Color(0XFFF7F8FA), |
||||
borderRadius: BorderRadius.circular(2), |
||||
), |
||||
padding: |
||||
EdgeInsets.symmetric(horizontal: 9.w, vertical: 11.h), |
||||
child: Row( |
||||
children: [ |
||||
Expanded( |
||||
child: Text( |
||||
ticketState == "-1" ? "状态筛选" : shopStateSelect(), |
||||
style: TextStyle( |
||||
color: Color(0xFF808080), |
||||
fontSize: 18.sp, |
||||
fontWeight: MyFontWeight.regular), |
||||
)), |
||||
Icon( |
||||
(stateScreen != null && !stateScreen) |
||||
? Icons.keyboard_arrow_down |
||||
: Icons.keyboard_arrow_up, |
||||
color: Color(0xFF808080), |
||||
size: 24, |
||||
), |
||||
], |
||||
), |
||||
))), |
||||
], |
||||
), |
||||
); |
||||
} |
||||
|
||||
///类型筛选 |
||||
String shopTypeSelect() { |
||||
if (ticketType == "") { |
||||
return "所有"; |
||||
} else if (ticketType == "ADOPT_WARRANT") { |
||||
return "认领凭证"; |
||||
} else if (ticketType == "IDENTITY_CARD") { |
||||
return "身份卡片"; |
||||
} else if (ticketType == "NORMAL") { |
||||
return "常规票券"; |
||||
} |
||||
} |
||||
|
||||
///类型筛选 |
||||
String shopStateSelect() { |
||||
if (ticketState == "0") { |
||||
return "全部"; |
||||
} else if (ticketState == "1") { |
||||
return "可使用"; |
||||
} else if (ticketState == "7") { |
||||
return "已取消"; |
||||
} else if (ticketState == "8") { |
||||
return "已失效"; |
||||
} else if (ticketState == "9") { |
||||
return "已使用"; |
||||
} |
||||
} |
||||
|
||||
///时间选择 |
||||
Widget timeSelect() { |
||||
return Container( |
||||
color: Colors.white, |
||||
child: GestureDetector( |
||||
onTap: () { |
||||
Navigator.of(context).pushNamed('/router/custom_page').then((value) { |
||||
selectTimeDate = value; |
||||
loadFinish(); |
||||
}); |
||||
}, |
||||
child: Container( |
||||
decoration: BoxDecoration( |
||||
color: Color(0xFFF7F8FA), |
||||
borderRadius: BorderRadius.circular(2), |
||||
), |
||||
margin: EdgeInsets.only( |
||||
left: 18.w, |
||||
right: 18.w, |
||||
), |
||||
padding: EdgeInsets.symmetric(horizontal: 14.w, vertical: 12.h), |
||||
child: Row( |
||||
mainAxisAlignment: MainAxisAlignment.center, |
||||
children: [ |
||||
Text( |
||||
(tabController.index == 1 && (selectTimeDate == "" || selectTimeDate == null)) ? "开始时间 至 结束时间" :"${selectTime().substring(0, 11)} ${selectTime().substring(21, 34)}", |
||||
style: TextStyle( |
||||
fontSize: 14.sp, |
||||
color: Color(0xFF30415B), |
||||
fontWeight: MyFontWeight.regular), |
||||
), |
||||
], |
||||
), |
||||
), |
||||
), |
||||
); |
||||
} |
||||
|
||||
String selectTime() { |
||||
if (selectTimeDate == "" || selectTimeDate == null) { |
||||
return selectTimeDateNum; |
||||
} else |
||||
return selectTimeDate; |
||||
} |
||||
} |
@ -0,0 +1,622 @@
|
||||
import 'package:dio/dio.dart'; |
||||
import 'package:flutter/cupertino.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/view_widget/classic_header.dart'; |
||||
import 'package:huixiang/view_widget/my_footer.dart'; |
||||
import 'package:pull_to_refresh/pull_to_refresh.dart'; |
||||
import 'package:flutter_screenutil/flutter_screenutil.dart'; |
||||
import 'package:shimmer/shimmer.dart'; |
||||
|
||||
import '../../../generated/l10n.dart'; |
||||
import '../../../retrofit/business_api.dart'; |
||||
import '../../../retrofit/data/base_data.dart'; |
||||
import '../../../retrofit/data/ticket_record.dart'; |
||||
import '../../../utils/business_instance.dart'; |
||||
import '../../../utils/flutter_utils.dart'; |
||||
import '../../../utils/font_weight.dart'; |
||||
import '../../../view_widget/no_data_view.dart'; |
||||
|
||||
class TicketRecordPage extends StatefulWidget { |
||||
final int status; |
||||
final String storeId; |
||||
final String keyword; |
||||
final String time; |
||||
final bool isKeyBoardShow; |
||||
|
||||
TicketRecordPage(Key key, this.status, this.storeId, this.keyword, this.time, |
||||
this.isKeyBoardShow) |
||||
: super(key: key); |
||||
|
||||
@override |
||||
State<StatefulWidget> createState() { |
||||
return _TicketRecordPage(); |
||||
} |
||||
} |
||||
|
||||
class _TicketRecordPage extends State<TicketRecordPage> { |
||||
final RefreshController _refreshController = RefreshController(); |
||||
ScrollPhysics scrollPhysics = NeverScrollableScrollPhysics(); |
||||
final ScrollController controller = ScrollController(); |
||||
BusinessApiService businessService; |
||||
List<TicketRecordList> ticketRecordList = []; |
||||
int _pageNum = 1; |
||||
String networkError = ""; |
||||
int networkStatus = 0; |
||||
|
||||
@override |
||||
void dispose() { |
||||
super.dispose(); |
||||
_refreshController.dispose(); |
||||
} |
||||
|
||||
@override |
||||
void initState() { |
||||
super.initState(); |
||||
_onRefresh(); |
||||
} |
||||
|
||||
_onRefresh({bool isShowLoad = true}) async { |
||||
if (isShowLoad) |
||||
EasyLoading.show( |
||||
status: S.current.zhengzaijiazai, |
||||
maskType: EasyLoadingMaskType.black); |
||||
await queryRecordsList(isRefreshData: false); |
||||
EasyLoading.dismiss(); |
||||
if (!mounted) return; |
||||
if (_refreshController.isRefresh) _refreshController.refreshCompleted(); |
||||
setState(() {}); |
||||
} |
||||
|
||||
queryRecordsList({isRefreshData = true}) async { |
||||
try { |
||||
if (businessService == null) { |
||||
businessService = BusinessApiService(Dio(), |
||||
context: context, |
||||
token: BusinessInstance.instance.businessToken, |
||||
tenant: BusinessInstance.instance.businessTenant, |
||||
storeId: widget.storeId); |
||||
} |
||||
BaseData<TicketRecord> baseData = await businessService.wipedRecord({ |
||||
"pageNum":_pageNum, |
||||
"pageSize": 10, |
||||
"searchKey": widget?.keyword ?? "", |
||||
"startTime": widget.time == "" ? "" :widget.time |
||||
.replaceAll("年", "-") |
||||
.replaceAll("月", "-") |
||||
.replaceAll("日", "") |
||||
.substring(0, 19), |
||||
"endTime": widget.time == "" ? "" :widget.time |
||||
.replaceAll("年", "-") |
||||
.replaceAll("月", "-") |
||||
.replaceAll("日", "") |
||||
.substring(widget.time.length >= 21 ? 22 : 0, |
||||
widget.time.length >= 21 ? 41 : 0), |
||||
}).catchError((error) { |
||||
networkError = AppUtils.dioErrorTypeToString(error.type); |
||||
networkStatus = -1; |
||||
setState(() {}); |
||||
_refreshController.refreshFailed(); |
||||
_refreshController.loadFailed(); |
||||
}); |
||||
if (!mounted) return; |
||||
if (baseData != null && baseData.isSuccess) { |
||||
ticketRecordList.addAll(baseData?.data?.list ?? []); |
||||
if ((baseData?.data?.list ?? []).isEmpty || |
||||
ticketRecordList.length.toString() == baseData.data.total) |
||||
_refreshController.loadNoData(); |
||||
else |
||||
_refreshController.loadComplete(); |
||||
networkStatus = 1; |
||||
} else { |
||||
SmartDialog.showToast(baseData.msg, alignment: Alignment.center); |
||||
} |
||||
} finally { |
||||
if (isRefreshData) setState(() {}); |
||||
} |
||||
} |
||||
|
||||
@override |
||||
Widget build(BuildContext context) { |
||||
return SmartRefresher( |
||||
controller: _refreshController, |
||||
enablePullDown: true, |
||||
enablePullUp: ticketRecordList.length == 0 ? false : true, |
||||
header: MyHeader(color: Color(0xFF30415B)), |
||||
physics: BouncingScrollPhysics(), |
||||
footer: CustomFooter( |
||||
builder: (context, mode) { |
||||
return MyFooter(mode); |
||||
}, |
||||
), |
||||
onRefresh: () { |
||||
_pageNum = 1; |
||||
ticketRecordList.clear(); |
||||
_onRefresh(isShowLoad: false); |
||||
}, |
||||
onLoading: () { |
||||
_pageNum++; |
||||
_onRefresh(isShowLoad: false); |
||||
}, |
||||
child: networkStatus == -1 |
||||
? noNetwork() |
||||
: ((networkStatus==0) |
||||
? ListView.builder( |
||||
padding: EdgeInsets.zero, |
||||
itemCount: 10, |
||||
scrollDirection: Axis.vertical, |
||||
shrinkWrap: true, |
||||
physics: BouncingScrollPhysics(), |
||||
itemBuilder: (context, position) { |
||||
return recordsSm(); |
||||
}, |
||||
) |
||||
: ((ticketRecordList == null || ticketRecordList.length == 0) |
||||
? NoDataView( |
||||
src: "assets/image/bs_no data_logo.webp", |
||||
isShowBtn: false, |
||||
text: "暂无数据", |
||||
fontSize: 16.sp, |
||||
iconHeight: 120.h, |
||||
margin: EdgeInsets.all(50.h), |
||||
) |
||||
: Padding( |
||||
padding: EdgeInsets.only(top: 16.h), |
||||
child: ListView.builder( |
||||
itemCount: ticketRecordList?.length ?? 0, |
||||
physics: BouncingScrollPhysics(), |
||||
shrinkWrap: true, |
||||
itemBuilder: (context, position) { |
||||
return GestureDetector( |
||||
behavior: HitTestBehavior.opaque, |
||||
onTap: () { |
||||
if (widget.isKeyBoardShow) |
||||
FocusScope.of(context) |
||||
.requestFocus(FocusNode()); |
||||
return; |
||||
}, |
||||
child: recordsItem(ticketRecordList[position],position), |
||||
); |
||||
}, |
||||
), |
||||
))), |
||||
); |
||||
} |
||||
|
||||
Widget recordsItem(TicketRecordList ticketRecordList,index) { |
||||
return Container( |
||||
decoration: BoxDecoration( |
||||
color: Colors.white, |
||||
borderRadius: BorderRadius.circular(8), |
||||
), |
||||
margin: EdgeInsets.only(left: 16.w, right: 16.w, bottom: 16.h), |
||||
padding: EdgeInsets.symmetric(vertical: 12.h), |
||||
child: Column( |
||||
children: [ |
||||
Padding(padding:EdgeInsets.only(left: 12.w,right: 18.w,bottom:13.h), |
||||
child: Row( |
||||
children: [ |
||||
Expanded(child:Text( |
||||
ticketRecordList?.ticketName ?? "", |
||||
overflow: TextOverflow.ellipsis, |
||||
maxLines: 1, |
||||
style: TextStyle( |
||||
fontSize: 14.sp, |
||||
color: Colors.black, |
||||
fontWeight: MyFontWeight.bold), |
||||
)), |
||||
Text( |
||||
"核销次数: ${ticketRecordList?.ticketItems[0]?.canWipedNumber ?? "0"}", |
||||
style: TextStyle( |
||||
fontSize: 12.sp, |
||||
color: Color(0xFF7A797F), |
||||
fontWeight: MyFontWeight.regular), |
||||
) |
||||
], |
||||
),), |
||||
Container( |
||||
width: double.infinity, |
||||
height: 1.h, |
||||
color: Color(0xFFF4F6F7), |
||||
), |
||||
Padding(padding:EdgeInsets.only(top:13.h,left:12.w), |
||||
child:Row( |
||||
children: [ |
||||
Text( |
||||
"联系人:", |
||||
style: TextStyle( |
||||
fontSize: 12.sp, |
||||
color: Color(0xFF1A1A1A), |
||||
fontWeight: MyFontWeight.regular), |
||||
), |
||||
SizedBox(width: 26.w,), |
||||
Text( |
||||
ticketRecordList?.userName ?? "", |
||||
style: TextStyle( |
||||
fontSize: 12.sp, |
||||
color: Color(0xFF1A1A1A), |
||||
fontWeight: MyFontWeight.regular), |
||||
) |
||||
], |
||||
)), |
||||
Padding(padding:EdgeInsets.only(top:12.h,left:12.w), |
||||
child:Row( |
||||
children: [ |
||||
Text( |
||||
"手机号:", |
||||
style: TextStyle( |
||||
fontSize: 12.sp, |
||||
color: Color(0xFF1A1A1A), |
||||
fontWeight: MyFontWeight.regular), |
||||
), |
||||
Text( |
||||
ticketRecordList?.userPhone ?? "", |
||||
style: TextStyle( |
||||
fontSize: 12.sp, |
||||
color: Color(0xFF1A1A1A), |
||||
fontWeight: MyFontWeight.regular), |
||||
) |
||||
], |
||||
),), |
||||
Container( |
||||
width: double.infinity, |
||||
height: 1.h, |
||||
color: Color(0xFFF4F6F7), |
||||
margin: EdgeInsets.symmetric(vertical:12.h), |
||||
), |
||||
Padding(padding:EdgeInsets.only(left:12.w), |
||||
child:Row( |
||||
children: [ |
||||
Text( |
||||
"核销店铺:", |
||||
style: TextStyle( |
||||
fontSize: 12.sp, |
||||
color: Color(0xFF7A797F), |
||||
fontWeight: MyFontWeight.regular), |
||||
), |
||||
SizedBox(width: 14.w,), |
||||
Text( |
||||
ticketRecordList?.wipedUserName ?? "", |
||||
style: TextStyle( |
||||
fontSize: 12.sp, |
||||
color: Color(0xFF808080), |
||||
fontWeight: MyFontWeight.regular), |
||||
) |
||||
], |
||||
)), |
||||
Padding(padding:EdgeInsets.only(left:12.w), |
||||
child:Row( |
||||
children: [ |
||||
Text( |
||||
"票券编号:", |
||||
style: TextStyle( |
||||
fontSize: 12.sp, |
||||
color: Color(0xFF7A797F), |
||||
fontWeight: MyFontWeight.regular), |
||||
), |
||||
SizedBox(width: 14.w,), |
||||
Text( |
||||
ticketRecordList?.ticketCode ?? "", |
||||
style: TextStyle( |
||||
fontSize: 12.sp, |
||||
color: Color(0xFF808080), |
||||
fontWeight: MyFontWeight.regular), |
||||
) |
||||
], |
||||
)), |
||||
Padding(padding:EdgeInsets.symmetric(horizontal:12.w), |
||||
child:Row( |
||||
children: [ |
||||
Text( |
||||
"核销时间:", |
||||
style: TextStyle( |
||||
fontSize: 12.sp, |
||||
color: Color(0xFF7A797F), |
||||
fontWeight: MyFontWeight.regular), |
||||
), |
||||
SizedBox(width: 14.w,), |
||||
Expanded(child:Text( |
||||
ticketRecordList?.ticketItems[0]?.finishTime ??"", |
||||
style: TextStyle( |
||||
fontSize: 12.sp, |
||||
color: Color(0xFF808080), |
||||
fontWeight: MyFontWeight.regular), |
||||
)), |
||||
Text( |
||||
ticketRecordList?.ticket?.amount ??"", |
||||
style: TextStyle( |
||||
fontSize: 14.sp, |
||||
color: Color(0xFF181818), |
||||
fontWeight: MyFontWeight.bold), |
||||
) |
||||
], |
||||
)), |
||||
], |
||||
), |
||||
); |
||||
} |
||||
|
||||
Widget recordsSm() { |
||||
return Container( |
||||
decoration: BoxDecoration( |
||||
color: Colors.white, |
||||
borderRadius: BorderRadius.circular(8), |
||||
), |
||||
margin: EdgeInsets.all(16), |
||||
padding: EdgeInsets.symmetric(vertical: 12.h), |
||||
child: Column( |
||||
children: [ |
||||
Padding(padding:EdgeInsets.only(left: 12.w,right: 18.w,bottom:13.h), |
||||
child: Row( |
||||
children: [ |
||||
Shimmer.fromColors( |
||||
baseColor: Color(0XFFD8D8D8), |
||||
highlightColor: Color(0XFFD8D8D8), |
||||
child: Container( |
||||
decoration: BoxDecoration( |
||||
color: Color(0XFFD8D8D8), |
||||
borderRadius: BorderRadius.circular(2), |
||||
), |
||||
width: 154.w, |
||||
height: 18.h, |
||||
), |
||||
), |
||||
Spacer(), |
||||
Shimmer.fromColors( |
||||
baseColor: Color(0XFFD8D8D8), |
||||
highlightColor: Color(0XFFD8D8D8), |
||||
child: Container( |
||||
decoration: BoxDecoration( |
||||
color: Color(0XFFD8D8D8), |
||||
borderRadius: BorderRadius.circular(2), |
||||
), |
||||
width: 52.w, |
||||
height: 18.h, |
||||
), |
||||
), |
||||
Shimmer.fromColors( |
||||
baseColor: Color(0XFFD8D8D8), |
||||
highlightColor: Color(0XFFD8D8D8), |
||||
child: Container( |
||||
decoration: BoxDecoration( |
||||
color: Color(0XFFD8D8D8), |
||||
borderRadius: BorderRadius.circular(2), |
||||
), |
||||
width: 10.w, |
||||
height: 18.h, |
||||
margin: EdgeInsets.only(left: 14.w), |
||||
), |
||||
), |
||||
], |
||||
),), |
||||
Container( |
||||
width: double.infinity, |
||||
height: 1.h, |
||||
color: Color(0xFFF4F6F7), |
||||
), |
||||
Padding(padding:EdgeInsets.only(top:13.h,left:12.w), |
||||
child:Row( |
||||
children: [ |
||||
Shimmer.fromColors( |
||||
baseColor: Color(0XFFD8D8D8), |
||||
highlightColor: Color(0XFFD8D8D8), |
||||
child: Container( |
||||
decoration: BoxDecoration( |
||||
color: Color(0XFFD8D8D8), |
||||
borderRadius: BorderRadius.circular(2), |
||||
), |
||||
width: 40.w, |
||||
height: 18.h, |
||||
), |
||||
), |
||||
SizedBox(width: 26.w,), |
||||
Shimmer.fromColors( |
||||
baseColor: Color(0XFFD8D8D8), |
||||
highlightColor: Color(0XFFD8D8D8), |
||||
child: Container( |
||||
decoration: BoxDecoration( |
||||
color: Color(0XFFD8D8D8), |
||||
borderRadius: BorderRadius.circular(2), |
||||
), |
||||
width: 24.w, |
||||
height: 18.h, |
||||
), |
||||
), |
||||
], |
||||
)), |
||||
Padding(padding:EdgeInsets.only(top:12.h,left:12.w), |
||||
child:Row( |
||||
children: [ |
||||
Shimmer.fromColors( |
||||
baseColor: Color(0XFFD8D8D8), |
||||
highlightColor: Color(0XFFD8D8D8), |
||||
child: Container( |
||||
decoration: BoxDecoration( |
||||
color: Color(0XFFD8D8D8), |
||||
borderRadius: BorderRadius.circular(2), |
||||
), |
||||
width: 40.w, |
||||
height: 18.h, |
||||
), |
||||
), |
||||
SizedBox(width: 26.w,), |
||||
Shimmer.fromColors( |
||||
baseColor: Color(0XFFD8D8D8), |
||||
highlightColor: Color(0XFFD8D8D8), |
||||
child: Container( |
||||
decoration: BoxDecoration( |
||||
color: Color(0XFFD8D8D8), |
||||
borderRadius: BorderRadius.circular(2), |
||||
), |
||||
width: 77.w, |
||||
height: 18.h, |
||||
), |
||||
), |
||||
], |
||||
),), |
||||
Container( |
||||
width: double.infinity, |
||||
height: 1.h, |
||||
color: Color(0xFFF4F6F7), |
||||
margin: EdgeInsets.symmetric(vertical:12.h), |
||||
), |
||||
Container( |
||||
padding:EdgeInsets.only(left:12.w), |
||||
margin: EdgeInsets.only(bottom: 6.h), |
||||
child:Row( |
||||
children: [ |
||||
Shimmer.fromColors( |
||||
baseColor: Color(0XFFD8D8D8), |
||||
highlightColor: Color(0XFFD8D8D8), |
||||
child: Container( |
||||
decoration: BoxDecoration( |
||||
color: Color(0XFFD8D8D8), |
||||
borderRadius: BorderRadius.circular(2), |
||||
), |
||||
width: 52.w, |
||||
height: 18.h, |
||||
), |
||||
), |
||||
SizedBox(width: 14.w,), |
||||
Shimmer.fromColors( |
||||
baseColor: Color(0XFFD8D8D8), |
||||
highlightColor: Color(0XFFD8D8D8), |
||||
child: Container( |
||||
decoration: BoxDecoration( |
||||
color: Color(0XFFD8D8D8), |
||||
borderRadius: BorderRadius.circular(2), |
||||
), |
||||
width: 84.w, |
||||
height: 18.h, |
||||
), |
||||
), |
||||
], |
||||
)), |
||||
Container(padding:EdgeInsets.only(left:12.w), |
||||
margin: EdgeInsets.only(bottom: 6.h), |
||||
child:Row( |
||||
children: [ |
||||
Shimmer.fromColors( |
||||
baseColor: Color(0XFFD8D8D8), |
||||
highlightColor: Color(0XFFD8D8D8), |
||||
child: Container( |
||||
decoration: BoxDecoration( |
||||
color: Color(0XFFD8D8D8), |
||||
borderRadius: BorderRadius.circular(2), |
||||
), |
||||
width: 52.w, |
||||
height: 18.h, |
||||
), |
||||
), |
||||
SizedBox(width: 14.w,), |
||||
Shimmer.fromColors( |
||||
baseColor: Color(0XFFD8D8D8), |
||||
highlightColor: Color(0XFFD8D8D8), |
||||
child: Container( |
||||
decoration: BoxDecoration( |
||||
color: Color(0XFFD8D8D8), |
||||
borderRadius: BorderRadius.circular(2), |
||||
), |
||||
width: 107.w, |
||||
height: 18.h, |
||||
), |
||||
), |
||||
], |
||||
)), |
||||
Padding(padding:EdgeInsets.symmetric(horizontal:12.w), |
||||
child:Row( |
||||
children: [ |
||||
Shimmer.fromColors( |
||||
baseColor: Color(0XFFD8D8D8), |
||||
highlightColor: Color(0XFFD8D8D8), |
||||
child: Container( |
||||
decoration: BoxDecoration( |
||||
color: Color(0XFFD8D8D8), |
||||
borderRadius: BorderRadius.circular(2), |
||||
), |
||||
width: 52.w, |
||||
height: 18.h, |
||||
), |
||||
), |
||||
SizedBox(width: 14.w,), |
||||
Shimmer.fromColors( |
||||
baseColor: Color(0XFFD8D8D8), |
||||
highlightColor: Color(0XFFD8D8D8), |
||||
child: Container( |
||||
decoration: BoxDecoration( |
||||
color: Color(0XFFD8D8D8), |
||||
borderRadius: BorderRadius.circular(2), |
||||
), |
||||
width: 107.w, |
||||
height: 18.h, |
||||
), |
||||
), |
||||
Spacer(), |
||||
Shimmer.fromColors( |
||||
baseColor: Color(0XFFD8D8D8), |
||||
highlightColor: Color(0XFFD8D8D8), |
||||
child: Container( |
||||
decoration: BoxDecoration( |
||||
color: Color(0XFFD8D8D8), |
||||
borderRadius: BorderRadius.circular(2), |
||||
), |
||||
width: 36.w, |
||||
height: 18.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,588 @@
|
||||
import 'package:dio/dio.dart'; |
||||
import 'package:flutter/cupertino.dart'; |
||||
import 'package:flutter/material.dart'; |
||||
import 'package:flutter_easyloading/flutter_easyloading.dart'; |
||||
import 'package:huixiang/view_widget/classic_header.dart'; |
||||
import 'package:huixiang/view_widget/my_footer.dart'; |
||||
import 'package:pull_to_refresh/pull_to_refresh.dart'; |
||||
import 'package:flutter_screenutil/flutter_screenutil.dart'; |
||||
import 'package:shimmer/shimmer.dart'; |
||||
|
||||
import '../../../generated/l10n.dart'; |
||||
import '../../../retrofit/business_api.dart'; |
||||
import '../../../retrofit/data/base_data.dart'; |
||||
import '../../../retrofit/data/ticket_stats_list.dart'; |
||||
import '../../../utils/business_instance.dart'; |
||||
import '../../../utils/flutter_utils.dart'; |
||||
import '../../../utils/font_weight.dart'; |
||||
import '../../../view_widget/no_data_view.dart'; |
||||
|
||||
class TicketStatisticsPage extends StatefulWidget { |
||||
final int status; |
||||
final String storeId; |
||||
final String keyword; |
||||
final String time; |
||||
final bool isKeyBoardShow; |
||||
|
||||
TicketStatisticsPage(Key key, this.status, this.storeId, this.keyword, |
||||
this.time, this.isKeyBoardShow) |
||||
: super(key: key); |
||||
|
||||
@override |
||||
State<StatefulWidget> createState() { |
||||
return _TicketStatisticsPage(); |
||||
} |
||||
} |
||||
|
||||
class _TicketStatisticsPage extends State<TicketStatisticsPage> { |
||||
final RefreshController _refreshController = RefreshController(); |
||||
ScrollPhysics scrollPhysics = NeverScrollableScrollPhysics(); |
||||
final ScrollController controller = ScrollController(); |
||||
BusinessApiService businessService; |
||||
List<InfoList> _infoList = []; |
||||
String networkError = ""; |
||||
int networkStatus = 0; |
||||
|
||||
@override |
||||
void dispose() { |
||||
super.dispose(); |
||||
_refreshController.dispose(); |
||||
} |
||||
|
||||
@override |
||||
void initState() { |
||||
super.initState(); |
||||
queryStatsList(); |
||||
} |
||||
|
||||
queryStatsList({isLoading = true}) async { |
||||
try { |
||||
if (isLoading) |
||||
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.storeId); |
||||
} |
||||
BaseData<List<TicketStatsList>> baseData = |
||||
await businessService.wipedStats({ |
||||
"searchKey": widget?.keyword ?? "", |
||||
"startDate": widget.time |
||||
.replaceAll("年", "-") |
||||
.replaceAll("月", "-") |
||||
.replaceAll("日", "") |
||||
.substring(0, 10), |
||||
"endDate": widget.time |
||||
.replaceAll("年", "-") |
||||
.replaceAll("月", "-") |
||||
.replaceAll("日", "") |
||||
.substring(widget.time.length >= 21 ? 22 : 0, |
||||
widget.time.length >= 21 ? 32 : 0), |
||||
}).catchError((error) { |
||||
networkError = AppUtils.dioErrorTypeToString(error.type); |
||||
networkStatus = -1; |
||||
_refreshController.refreshFailed(); |
||||
_refreshController.loadFailed(); |
||||
}); |
||||
_infoList.clear(); |
||||
if (baseData != null && baseData.isSuccess) { |
||||
baseData.data.forEach((e1) { |
||||
e1.infoList.forEach((e2) { |
||||
e2.wipedDate = e1.wipedDate; |
||||
_infoList.add(e2); |
||||
}); |
||||
}); |
||||
networkStatus = 1; |
||||
_refreshController.refreshCompleted(); |
||||
_refreshController.loadComplete(); |
||||
} |
||||
} finally { |
||||
if (isLoading) setState(() {}); |
||||
EasyLoading.dismiss(); |
||||
} |
||||
} |
||||
|
||||
@override |
||||
Widget build(BuildContext context) { |
||||
return SmartRefresher( |
||||
controller: _refreshController, |
||||
enablePullDown: true, |
||||
enablePullUp: false, |
||||
header: MyHeader(color: Color(0xFF30415B)), |
||||
physics: BouncingScrollPhysics(), |
||||
footer: CustomFooter( |
||||
builder: (context, mode) { |
||||
return MyFooter(mode); |
||||
}, |
||||
), |
||||
onRefresh: () { |
||||
queryStatsList(isLoading: false); |
||||
}, |
||||
child: networkStatus == -1 |
||||
? noNetwork() |
||||
: ((networkStatus == 0) |
||||
? ListView.builder( |
||||
padding: EdgeInsets.zero, |
||||
itemCount: 10, |
||||
scrollDirection: Axis.vertical, |
||||
shrinkWrap: true, |
||||
physics: BouncingScrollPhysics(), |
||||
itemBuilder: (context, position) { |
||||
return statisticsSm(); |
||||
}, |
||||
) |
||||
: ((_infoList.isEmpty) |
||||
? NoDataView( |
||||
src: "assets/image/bs_no data_logo.webp", |
||||
isShowBtn: false, |
||||
text: "暂无数据", |
||||
fontSize: 16.sp, |
||||
iconHeight: 120.h, |
||||
margin: EdgeInsets.all(50.h), |
||||
) |
||||
: Padding( |
||||
padding: EdgeInsets.only(top: 16.h), |
||||
child: ListView.builder( |
||||
itemCount: _infoList.length, |
||||
physics: BouncingScrollPhysics(), |
||||
shrinkWrap: true, |
||||
itemBuilder: (context, position) { |
||||
return GestureDetector( |
||||
behavior: HitTestBehavior.opaque, |
||||
onTap: () { |
||||
if (widget.isKeyBoardShow) |
||||
FocusScope.of(context) |
||||
.requestFocus(FocusNode()); |
||||
return; |
||||
}, |
||||
child: statisticsItem(_infoList[position]), |
||||
); |
||||
}, |
||||
), |
||||
))), |
||||
); |
||||
} |
||||
|
||||
Widget statisticsItem(InfoList infoList) { |
||||
return Container( |
||||
decoration: BoxDecoration( |
||||
color: Colors.white, |
||||
borderRadius: BorderRadius.circular(8), |
||||
), |
||||
margin: EdgeInsets.only(left: 16.w, right: 16.w, bottom: 16.h), |
||||
padding: EdgeInsets.symmetric(vertical: 12.h), |
||||
child: Column( |
||||
children: [ |
||||
Padding( |
||||
padding: EdgeInsets.only(left: 12.w, right: 18.w, bottom: 13.h), |
||||
child: Row( |
||||
children: [ |
||||
Expanded( |
||||
child: Text( |
||||
infoList?.ticketName ?? "", |
||||
overflow: TextOverflow.ellipsis, |
||||
maxLines: 1, |
||||
style: TextStyle( |
||||
fontSize: 14.sp, |
||||
color: Colors.black, |
||||
fontWeight: MyFontWeight.bold), |
||||
)), |
||||
Text( |
||||
"核销次数: ${infoList?.wipedNumber ?? 0}", |
||||
style: TextStyle( |
||||
fontSize: 12.sp, |
||||
color: Color(0xFF7A797F), |
||||
fontWeight: MyFontWeight.regular), |
||||
) |
||||
], |
||||
), |
||||
), |
||||
Container( |
||||
width: double.infinity, |
||||
height: 1.h, |
||||
color: Color(0xFFF4F6F7), |
||||
), |
||||
Padding( |
||||
padding: EdgeInsets.only(top: 13.h, left: 12.w), |
||||
child: Row( |
||||
children: [ |
||||
Text( |
||||
"核销项:", |
||||
style: TextStyle( |
||||
fontSize: 12.sp, |
||||
color: Color(0xFF1A1A1A), |
||||
fontWeight: MyFontWeight.regular), |
||||
), |
||||
SizedBox( |
||||
width: 13.w, |
||||
), |
||||
Text( |
||||
infoList?.ticketItemName ?? "", |
||||
style: TextStyle( |
||||
fontSize: 12.sp, |
||||
color: Color(0xFF1A1A1A), |
||||
fontWeight: MyFontWeight.regular), |
||||
) |
||||
], |
||||
)), |
||||
Padding( |
||||
padding: EdgeInsets.only(top: 12.h, left: 12.w), |
||||
child: Row( |
||||
children: [ |
||||
Text( |
||||
"手机号:", |
||||
style: TextStyle( |
||||
fontSize: 12.sp, |
||||
color: Color(0xFF1A1A1A), |
||||
fontWeight: MyFontWeight.regular), |
||||
), |
||||
SizedBox( |
||||
width: 13.w, |
||||
), |
||||
Text( |
||||
"12323227890", |
||||
style: TextStyle( |
||||
fontSize: 12.sp, |
||||
color: Color(0xFF1A1A1A), |
||||
fontWeight: MyFontWeight.regular), |
||||
) |
||||
], |
||||
), |
||||
), |
||||
Container( |
||||
width: double.infinity, |
||||
height: 1.h, |
||||
color: Color(0xFFF4F6F7), |
||||
margin: EdgeInsets.symmetric(vertical: 12.h), |
||||
), |
||||
Padding( |
||||
padding: EdgeInsets.only(left: 12.w), |
||||
child: Row( |
||||
children: [ |
||||
Text( |
||||
"核销时间 :", |
||||
style: TextStyle( |
||||
fontSize: 12.sp, |
||||
color: Color(0xFF7A797F), |
||||
fontWeight: MyFontWeight.regular), |
||||
), |
||||
SizedBox( |
||||
width: 14.w, |
||||
), |
||||
Text( |
||||
infoList?.wipedDate ?? "", |
||||
style: TextStyle( |
||||
fontSize: 12.sp, |
||||
color: Color(0xFF808080), |
||||
fontWeight: MyFontWeight.regular), |
||||
) |
||||
], |
||||
)), |
||||
], |
||||
), |
||||
); |
||||
} |
||||
|
||||
Widget statisticsSm() { |
||||
return Container( |
||||
decoration: BoxDecoration( |
||||
color: Colors.white, |
||||
borderRadius: BorderRadius.circular(8), |
||||
), |
||||
margin: EdgeInsets.all(16), |
||||
padding: EdgeInsets.symmetric(vertical: 12.h), |
||||
child: Column( |
||||
children: [ |
||||
Padding( |
||||
padding: EdgeInsets.only(left: 12.w, right: 18.w, bottom: 13.h), |
||||
child: Row( |
||||
children: [ |
||||
Shimmer.fromColors( |
||||
baseColor: Color(0XFFD8D8D8), |
||||
highlightColor: Color(0XFFD8D8D8), |
||||
child: Container( |
||||
decoration: BoxDecoration( |
||||
color: Color(0XFFD8D8D8), |
||||
borderRadius: BorderRadius.circular(2), |
||||
), |
||||
width: 154.w, |
||||
height: 18.h, |
||||
), |
||||
), |
||||
Spacer(), |
||||
Shimmer.fromColors( |
||||
baseColor: Color(0XFFD8D8D8), |
||||
highlightColor: Color(0XFFD8D8D8), |
||||
child: Container( |
||||
decoration: BoxDecoration( |
||||
color: Color(0XFFD8D8D8), |
||||
borderRadius: BorderRadius.circular(2), |
||||
), |
||||
width: 52.w, |
||||
height: 18.h, |
||||
), |
||||
), |
||||
Shimmer.fromColors( |
||||
baseColor: Color(0XFFD8D8D8), |
||||
highlightColor: Color(0XFFD8D8D8), |
||||
child: Container( |
||||
decoration: BoxDecoration( |
||||
color: Color(0XFFD8D8D8), |
||||
borderRadius: BorderRadius.circular(2), |
||||
), |
||||
width: 10.w, |
||||
height: 18.h, |
||||
margin: EdgeInsets.only(left: 14.w), |
||||
), |
||||
), |
||||
], |
||||
), |
||||
), |
||||
Container( |
||||
width: double.infinity, |
||||
height: 1.h, |
||||
color: Color(0xFFF4F6F7), |
||||
), |
||||
Padding( |
||||
padding: EdgeInsets.only(top: 13.h, left: 12.w), |
||||
child: Row( |
||||
children: [ |
||||
Shimmer.fromColors( |
||||
baseColor: Color(0XFFD8D8D8), |
||||
highlightColor: Color(0XFFD8D8D8), |
||||
child: Container( |
||||
decoration: BoxDecoration( |
||||
color: Color(0XFFD8D8D8), |
||||
borderRadius: BorderRadius.circular(2), |
||||
), |
||||
width: 40.w, |
||||
height: 18.h, |
||||
), |
||||
), |
||||
SizedBox( |
||||
width: 26.w, |
||||
), |
||||
Shimmer.fromColors( |
||||
baseColor: Color(0XFFD8D8D8), |
||||
highlightColor: Color(0XFFD8D8D8), |
||||
child: Container( |
||||
decoration: BoxDecoration( |
||||
color: Color(0XFFD8D8D8), |
||||
borderRadius: BorderRadius.circular(2), |
||||
), |
||||
width: 24.w, |
||||
height: 18.h, |
||||
), |
||||
), |
||||
], |
||||
)), |
||||
Padding( |
||||
padding: EdgeInsets.only(top: 12.h, left: 12.w), |
||||
child: Row( |
||||
children: [ |
||||
Shimmer.fromColors( |
||||
baseColor: Color(0XFFD8D8D8), |
||||
highlightColor: Color(0XFFD8D8D8), |
||||
child: Container( |
||||
decoration: BoxDecoration( |
||||
color: Color(0XFFD8D8D8), |
||||
borderRadius: BorderRadius.circular(2), |
||||
), |
||||
width: 40.w, |
||||
height: 18.h, |
||||
), |
||||
), |
||||
SizedBox( |
||||
width: 26.w, |
||||
), |
||||
Shimmer.fromColors( |
||||
baseColor: Color(0XFFD8D8D8), |
||||
highlightColor: Color(0XFFD8D8D8), |
||||
child: Container( |
||||
decoration: BoxDecoration( |
||||
color: Color(0XFFD8D8D8), |
||||
borderRadius: BorderRadius.circular(2), |
||||
), |
||||
width: 77.w, |
||||
height: 18.h, |
||||
), |
||||
), |
||||
], |
||||
), |
||||
), |
||||
Container( |
||||
width: double.infinity, |
||||
height: 1.h, |
||||
color: Color(0xFFF4F6F7), |
||||
margin: EdgeInsets.symmetric(vertical: 12.h), |
||||
), |
||||
Container( |
||||
padding: EdgeInsets.only(left: 12.w), |
||||
margin: EdgeInsets.only(bottom: 6.h), |
||||
child: Row( |
||||
children: [ |
||||
Shimmer.fromColors( |
||||
baseColor: Color(0XFFD8D8D8), |
||||
highlightColor: Color(0XFFD8D8D8), |
||||
child: Container( |
||||
decoration: BoxDecoration( |
||||
color: Color(0XFFD8D8D8), |
||||
borderRadius: BorderRadius.circular(2), |
||||
), |
||||
width: 52.w, |
||||
height: 18.h, |
||||
), |
||||
), |
||||
SizedBox( |
||||
width: 14.w, |
||||
), |
||||
Shimmer.fromColors( |
||||
baseColor: Color(0XFFD8D8D8), |
||||
highlightColor: Color(0XFFD8D8D8), |
||||
child: Container( |
||||
decoration: BoxDecoration( |
||||
color: Color(0XFFD8D8D8), |
||||
borderRadius: BorderRadius.circular(2), |
||||
), |
||||
width: 84.w, |
||||
height: 18.h, |
||||
), |
||||
), |
||||
], |
||||
)), |
||||
Container( |
||||
padding: EdgeInsets.only(left: 12.w), |
||||
margin: EdgeInsets.only(bottom: 6.h), |
||||
child: Row( |
||||
children: [ |
||||
Shimmer.fromColors( |
||||
baseColor: Color(0XFFD8D8D8), |
||||
highlightColor: Color(0XFFD8D8D8), |
||||
child: Container( |
||||
decoration: BoxDecoration( |
||||
color: Color(0XFFD8D8D8), |
||||
borderRadius: BorderRadius.circular(2), |
||||
), |
||||
width: 52.w, |
||||
height: 18.h, |
||||
), |
||||
), |
||||
SizedBox( |
||||
width: 14.w, |
||||
), |
||||
Shimmer.fromColors( |
||||
baseColor: Color(0XFFD8D8D8), |
||||
highlightColor: Color(0XFFD8D8D8), |
||||
child: Container( |
||||
decoration: BoxDecoration( |
||||
color: Color(0XFFD8D8D8), |
||||
borderRadius: BorderRadius.circular(2), |
||||
), |
||||
width: 107.w, |
||||
height: 18.h, |
||||
), |
||||
), |
||||
], |
||||
)), |
||||
Padding( |
||||
padding: EdgeInsets.symmetric(horizontal: 12.w), |
||||
child: Row( |
||||
children: [ |
||||
Shimmer.fromColors( |
||||
baseColor: Color(0XFFD8D8D8), |
||||
highlightColor: Color(0XFFD8D8D8), |
||||
child: Container( |
||||
decoration: BoxDecoration( |
||||
color: Color(0XFFD8D8D8), |
||||
borderRadius: BorderRadius.circular(2), |
||||
), |
||||
width: 52.w, |
||||
height: 18.h, |
||||
), |
||||
), |
||||
SizedBox( |
||||
width: 14.w, |
||||
), |
||||
Shimmer.fromColors( |
||||
baseColor: Color(0XFFD8D8D8), |
||||
highlightColor: Color(0XFFD8D8D8), |
||||
child: Container( |
||||
decoration: BoxDecoration( |
||||
color: Color(0XFFD8D8D8), |
||||
borderRadius: BorderRadius.circular(2), |
||||
), |
||||
width: 107.w, |
||||
height: 18.h, |
||||
), |
||||
), |
||||
Spacer(), |
||||
Shimmer.fromColors( |
||||
baseColor: Color(0XFFD8D8D8), |
||||
highlightColor: Color(0XFFD8D8D8), |
||||
child: Container( |
||||
decoration: BoxDecoration( |
||||
color: Color(0XFFD8D8D8), |
||||
borderRadius: BorderRadius.circular(2), |
||||
), |
||||
width: 36.w, |
||||
height: 18.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: () { |
||||
queryStatsList(); |
||||
}, |
||||
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,106 @@
|
||||
import 'package:flutter/material.dart'; |
||||
|
||||
class TicketTab extends Decoration { |
||||
/// Create an underline style selected tab indicator. |
||||
/// |
||||
/// The [borderSide] and [insets] arguments must not be null. |
||||
const TicketTab({ |
||||
this.width = 20, |
||||
this.strokeCap = StrokeCap.round, |
||||
this.borderSide = const BorderSide(width: 2.0, color: Colors.white), |
||||
this.insets = EdgeInsets.zero, |
||||
}) : assert(borderSide != null), |
||||
assert(insets != null); |
||||
|
||||
/// The color and weight of the horizontal line drawn below the selected tab. |
||||
final BorderSide borderSide; |
||||
|
||||
/// Locates the selected tab's underline relative to the tab's boundary. |
||||
/// |
||||
/// The [TabBar.indicatorSize] property can be used to define the tab |
||||
/// indicator's bounds in terms of its (centered) tab widget with |
||||
/// [TabBarIndicatorSize.label], or the entire tab with |
||||
/// [TabBarIndicatorSize.tab]. |
||||
final EdgeInsetsGeometry insets; |
||||
|
||||
///新增的属性 |
||||
final double width; // 控制器宽度 |
||||
final StrokeCap strokeCap; // 控制器边角形状 |
||||
|
||||
@override |
||||
Decoration lerpFrom(Decoration a, double t) { |
||||
if (a is TicketTab) { |
||||
return TicketTab( |
||||
borderSide: BorderSide.lerp(a.borderSide, borderSide, t), |
||||
insets: EdgeInsetsGeometry.lerp(a.insets, insets, t), |
||||
); |
||||
} |
||||
return super.lerpFrom(a, t); |
||||
} |
||||
|
||||
@override |
||||
Decoration lerpTo(Decoration b, double t) { |
||||
if (b is TicketTab) { |
||||
return TicketTab( |
||||
borderSide: BorderSide.lerp(borderSide, b.borderSide, t), |
||||
insets: EdgeInsetsGeometry.lerp(insets, b.insets, t), |
||||
); |
||||
} |
||||
return super.lerpTo(b, t); |
||||
} |
||||
|
||||
@override |
||||
BoxPainter createBoxPainter([VoidCallback onChanged]) { |
||||
return _UnderlinePainter(this, onChanged); |
||||
} |
||||
|
||||
///决定控制器宽度的方法 |
||||
Rect _indicatorRectFor(Rect rect, TextDirection textDirection) { |
||||
assert(rect != null); |
||||
assert(textDirection != null); |
||||
final Rect indicator = insets.resolve(textDirection).deflateRect(rect); |
||||
|
||||
// 希望的宽度 |
||||
double wantWidth = this.width; |
||||
// 取中间坐标 |
||||
double cw = (indicator.left + indicator.right) / 2; |
||||
|
||||
print( |
||||
'$cw,indicator left${indicator.left}, right ${indicator.right}, indicator top ${indicator.top},indicator bottom${indicator.bottom}, border width${borderSide.width}'); |
||||
//这里是核心代码 //下划线靠左 |
||||
// return Rect.fromLTWH(indicator.left, |
||||
// indicator.bottom - borderSide.width, wantWidth, borderSide.width); |
||||
|
||||
//下划线居中 |
||||
return Rect.fromLTWH(cw - wantWidth / 2, |
||||
indicator.bottom - borderSide.width, wantWidth, borderSide.width); |
||||
} |
||||
|
||||
@override |
||||
Path getClipPath(Rect rect, TextDirection textDirection) { |
||||
return Path()..addRect(_indicatorRectFor(rect, textDirection)); |
||||
} |
||||
} |
||||
|
||||
class _UnderlinePainter extends BoxPainter { |
||||
_UnderlinePainter(this.decoration, VoidCallback onChanged) |
||||
: assert(decoration != null), |
||||
super(onChanged); |
||||
|
||||
final TicketTab decoration; |
||||
|
||||
///决定控制器边角形状的方法 |
||||
@override |
||||
void paint(Canvas canvas, Offset offset, ImageConfiguration configuration) { |
||||
assert(configuration != null); |
||||
assert(configuration.size != null); |
||||
final Rect rect = offset & configuration.size; |
||||
final TextDirection textDirection = configuration.textDirection; |
||||
final Rect indicator = decoration |
||||
._indicatorRectFor(rect, textDirection) |
||||
.deflate(decoration.borderSide.width / 2.0); |
||||
final Paint paint = decoration.borderSide.toPaint() |
||||
..strokeCap = decoration.strokeCap; //这块更改为想要的形状 |
||||
canvas.drawLine(indicator.bottomLeft, indicator.bottomRight, paint); |
||||
} |
||||
} |
File diff suppressed because one or more lines are too long
@ -0,0 +1,374 @@
|
||||
/// records : [{"id":"1730229003043733504","createTime":"2023-11-30 22:15:15","createUser":"0","updateTime":"2023-11-30 22:15:15","updateUser":"0","mid":null,"openid":"otrgp5C7qpd-V2AHosRZOnN4NoEM","nickname":"","headimg":"","balance":"0.00","money":"0","realRecharge":"0.00","giftRecharge":"0.00","sex":"0","status":true,"loginTime":"2023-11-30 22:15:15","loginNum":1,"tenantCode":"1195","phone":"","source":0,"expendAmount":"0.00","buyTimes":0,"lastBuyTime":null,"onCredit":false},{"id":"1729813919708479488","createTime":"2023-11-29 18:45:52","createUser":"0","updateTime":"2023-11-29 18:45:52","updateUser":"0","mid":null,"openid":"otrgp5Brxv8c7fdZbIjmbUEaLBVM","nickname":"","headimg":"","balance":"0.00","money":"0","realRecharge":"0.00","giftRecharge":"0.00","sex":"0","status":true,"loginTime":"2023-11-29 18:45:52","loginNum":2,"tenantCode":"1195","phone":"","source":0,"expendAmount":"0.00","buyTimes":0,"lastBuyTime":null,"onCredit":false},{"id":"1729685559346987008","createTime":"2023-11-29 10:15:48","createUser":"0","updateTime":"2023-11-29 10:15:48","updateUser":"0","mid":null,"openid":"otrgp5M6pxBus4Ykh1XdeHHLiFBA","nickname":"","headimg":"","balance":"0.00","money":"0","realRecharge":"0.00","giftRecharge":"0.00","sex":"0","status":true,"loginTime":"2023-11-29 10:15:48","loginNum":1,"tenantCode":"1195","phone":"","source":0,"expendAmount":"0.00","buyTimes":0,"lastBuyTime":null,"onCredit":false},{"id":"1729685558696869888","createTime":"2023-11-29 10:15:48","createUser":"0","updateTime":"2023-11-29 10:15:48","updateUser":"0","mid":null,"openid":"otrgp5M6pxBus4Ykh1XdeHHLiFBA","nickname":"","headimg":"","balance":"0.00","money":"0","realRecharge":"0.00","giftRecharge":"0.00","sex":"0","status":true,"loginTime":"2023-11-29 10:15:48","loginNum":1,"tenantCode":"1195","phone":"","source":0,"expendAmount":"0.00","buyTimes":0,"lastBuyTime":null,"onCredit":false},{"id":"1729062974783488000","createTime":"2023-11-27 17:01:52","createUser":"0","updateTime":"2023-11-27 17:01:52","updateUser":"0","mid":null,"openid":null,"nickname":"","headimg":"","balance":"0.00","money":"0","realRecharge":"0.00","giftRecharge":"0.00","sex":"0","status":true,"loginTime":"2023-11-27 17:01:52","loginNum":0,"tenantCode":"1195","phone":"","source":1,"expendAmount":"0.00","buyTimes":0,"lastBuyTime":null,"onCredit":false},{"id":"1728984020596817920","createTime":"2023-11-27 11:48:08","createUser":"0","updateTime":"2023-11-27 11:48:08","updateUser":"0","mid":null,"openid":"otrgp5GG69LQo1_xaPpxNnpnds7A","nickname":"","headimg":"","balance":"0.00","money":"0","realRecharge":"0.00","giftRecharge":"0.00","sex":"0","status":true,"loginTime":"2023-11-27 11:48:08","loginNum":1,"tenantCode":"1195","phone":"","source":0,"expendAmount":"0.00","buyTimes":0,"lastBuyTime":null,"onCredit":false},{"id":"1728980774142607360","createTime":"2023-11-27 11:35:14","createUser":"0","updateTime":"2023-11-27 11:35:14","updateUser":"0","mid":null,"openid":"otrgp5NcFDlLRPi7RPpFolajayLQ","nickname":"","headimg":"","balance":"0.00","money":"0","realRecharge":"0.00","giftRecharge":"0.00","sex":"0","status":true,"loginTime":"2023-11-27 11:35:14","loginNum":1,"tenantCode":"1195","phone":"","source":0,"expendAmount":"0.00","buyTimes":0,"lastBuyTime":null,"onCredit":false},{"id":"1728297227396317184","createTime":"2023-11-25 14:19:04","createUser":"0","updateTime":"2023-11-25 14:19:04","updateUser":"0","mid":null,"openid":"otrgp5Obp61VrN7tyvXdT1MNsAL0","nickname":"","headimg":"","balance":"0.00","money":"0","realRecharge":"0.00","giftRecharge":"0.00","sex":"0","status":true,"loginTime":"2023-11-25 14:19:04","loginNum":1,"tenantCode":"1195","phone":"","source":0,"expendAmount":"0.00","buyTimes":0,"lastBuyTime":null,"onCredit":false},{"id":"1728274418079105024","createTime":"2023-11-25 12:48:26","createUser":"0","updateTime":"2023-11-25 12:48:26","updateUser":"0","mid":null,"openid":"otrgp5L0bMvf8DXFf_kdRCzPqpEM","nickname":"","headimg":"","balance":"0.00","money":"0","realRecharge":"0.00","giftRecharge":"0.00","sex":"0","status":true,"loginTime":"2023-11-25 12:48:26","loginNum":1,"tenantCode":"1195","phone":"","source":0,"expendAmount":"0.00","buyTimes":0,"lastBuyTime":null,"onCredit":false},{"id":"1727662634473357312","createTime":"2023-11-23 20:17:25","createUser":"0","updateTime":"2023-11-23 20:17:25","updateUser":"0","mid":null,"openid":"otrgp5Jxyl5zQOgIwZaYK3aHuF9g","nickname":"","headimg":"","balance":"0.00","money":"0","realRecharge":"0.00","giftRecharge":"0.00","sex":"0","status":true,"loginTime":"2023-11-23 20:17:25","loginNum":1,"tenantCode":"1195","phone":"","source":0,"expendAmount":"0.00","buyTimes":0,"lastBuyTime":null,"onCredit":false}] |
||||
/// total : "9378" |
||||
/// size : "10" |
||||
/// current : "1" |
||||
/// orders : [{"column":"id","asc":false}] |
||||
/// hitCount : false |
||||
/// searchCount : true |
||||
/// pages : "938" |
||||
|
||||
class BusinessVipList { |
||||
BusinessVipList({ |
||||
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; |
||||
} |
||||
|
||||
BusinessVipList.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; |
||||
BusinessVipList copyWith({ List<Records> records, |
||||
String total, |
||||
String size, |
||||
String current, |
||||
List<Orders> orders, |
||||
bool hitCount, |
||||
bool searchCount, |
||||
String pages, |
||||
}) => BusinessVipList( 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 : "1730229003043733504" |
||||
/// createTime : "2023-11-30 22:15:15" |
||||
/// createUser : "0" |
||||
/// updateTime : "2023-11-30 22:15:15" |
||||
/// updateUser : "0" |
||||
/// mid : null |
||||
/// openid : "otrgp5C7qpd-V2AHosRZOnN4NoEM" |
||||
/// nickname : "" |
||||
/// headimg : "" |
||||
/// balance : "0.00" |
||||
/// money : "0" |
||||
/// realRecharge : "0.00" |
||||
/// giftRecharge : "0.00" |
||||
/// sex : "0" |
||||
/// status : true |
||||
/// loginTime : "2023-11-30 22:15:15" |
||||
/// loginNum : 1 |
||||
/// tenantCode : "1195" |
||||
/// phone : "" |
||||
/// source : 0 |
||||
/// expendAmount : "0.00" |
||||
/// buyTimes : 0 |
||||
/// lastBuyTime : null |
||||
/// onCredit : false |
||||
|
||||
class Records { |
||||
Records({ |
||||
String id, |
||||
String createTime, |
||||
String createUser, |
||||
String updateTime, |
||||
String updateUser, |
||||
dynamic mid, |
||||
String openid, |
||||
String nickname, |
||||
String headimg, |
||||
String balance, |
||||
String money, |
||||
String realRecharge, |
||||
String giftRecharge, |
||||
String sex, |
||||
bool status, |
||||
String loginTime, |
||||
num loginNum, |
||||
String tenantCode, |
||||
String phone, |
||||
num source, |
||||
String expendAmount, |
||||
num buyTimes, |
||||
dynamic lastBuyTime, |
||||
bool onCredit,}){ |
||||
_id = id; |
||||
_createTime = createTime; |
||||
_createUser = createUser; |
||||
_updateTime = updateTime; |
||||
_updateUser = updateUser; |
||||
_mid = mid; |
||||
_openid = openid; |
||||
_nickname = nickname; |
||||
_headimg = headimg; |
||||
_balance = balance; |
||||
_money = money; |
||||
_realRecharge = realRecharge; |
||||
_giftRecharge = giftRecharge; |
||||
_sex = sex; |
||||
_status = status; |
||||
_loginTime = loginTime; |
||||
_loginNum = loginNum; |
||||
_tenantCode = tenantCode; |
||||
_phone = phone; |
||||
_source = source; |
||||
_expendAmount = expendAmount; |
||||
_buyTimes = buyTimes; |
||||
_lastBuyTime = lastBuyTime; |
||||
_onCredit = onCredit; |
||||
} |
||||
|
||||
Records.fromJson(dynamic json) { |
||||
_id = json['id']; |
||||
_createTime = json['createTime']; |
||||
_createUser = json['createUser']; |
||||
_updateTime = json['updateTime']; |
||||
_updateUser = json['updateUser']; |
||||
_mid = json['mid']; |
||||
_openid = json['openid']; |
||||
_nickname = json['nickname']; |
||||
_headimg = json['headimg']; |
||||
_balance = json['balance']; |
||||
_money = json['money']; |
||||
_realRecharge = json['realRecharge']; |
||||
_giftRecharge = json['giftRecharge']; |
||||
_sex = json['sex']; |
||||
_status = json['status']; |
||||
_loginTime = json['loginTime']; |
||||
_loginNum = json['loginNum']; |
||||
_tenantCode = json['tenantCode']; |
||||
_phone = json['phone']; |
||||
_source = json['source']; |
||||
_expendAmount = json['expendAmount']; |
||||
_buyTimes = json['buyTimes']; |
||||
_lastBuyTime = json['lastBuyTime']; |
||||
_onCredit = json['onCredit']; |
||||
} |
||||
String _id; |
||||
String _createTime; |
||||
String _createUser; |
||||
String _updateTime; |
||||
String _updateUser; |
||||
dynamic _mid; |
||||
String _openid; |
||||
String _nickname; |
||||
String _headimg; |
||||
String _balance; |
||||
String _money; |
||||
String _realRecharge; |
||||
String _giftRecharge; |
||||
String _sex; |
||||
bool _status; |
||||
String _loginTime; |
||||
num _loginNum; |
||||
String _tenantCode; |
||||
String _phone; |
||||
num _source; |
||||
String _expendAmount; |
||||
num _buyTimes; |
||||
dynamic _lastBuyTime; |
||||
bool _onCredit; |
||||
Records copyWith({ String id, |
||||
String createTime, |
||||
String createUser, |
||||
String updateTime, |
||||
String updateUser, |
||||
dynamic mid, |
||||
String openid, |
||||
String nickname, |
||||
String headimg, |
||||
String balance, |
||||
String money, |
||||
String realRecharge, |
||||
String giftRecharge, |
||||
String sex, |
||||
bool status, |
||||
String loginTime, |
||||
num loginNum, |
||||
String tenantCode, |
||||
String phone, |
||||
num source, |
||||
String expendAmount, |
||||
num buyTimes, |
||||
dynamic lastBuyTime, |
||||
bool onCredit, |
||||
}) => Records( id: id ?? _id, |
||||
createTime: createTime ?? _createTime, |
||||
createUser: createUser ?? _createUser, |
||||
updateTime: updateTime ?? _updateTime, |
||||
updateUser: updateUser ?? _updateUser, |
||||
mid: mid ?? _mid, |
||||
openid: openid ?? _openid, |
||||
nickname: nickname ?? _nickname, |
||||
headimg: headimg ?? _headimg, |
||||
balance: balance ?? _balance, |
||||
money: money ?? _money, |
||||
realRecharge: realRecharge ?? _realRecharge, |
||||
giftRecharge: giftRecharge ?? _giftRecharge, |
||||
sex: sex ?? _sex, |
||||
status: status ?? _status, |
||||
loginTime: loginTime ?? _loginTime, |
||||
loginNum: loginNum ?? _loginNum, |
||||
tenantCode: tenantCode ?? _tenantCode, |
||||
phone: phone ?? _phone, |
||||
source: source ?? _source, |
||||
expendAmount: expendAmount ?? _expendAmount, |
||||
buyTimes: buyTimes ?? _buyTimes, |
||||
lastBuyTime: lastBuyTime ?? _lastBuyTime, |
||||
onCredit: onCredit ?? _onCredit, |
||||
); |
||||
String get id => _id; |
||||
String get createTime => _createTime; |
||||
String get createUser => _createUser; |
||||
String get updateTime => _updateTime; |
||||
String get updateUser => _updateUser; |
||||
dynamic get mid => _mid; |
||||
String get openid => _openid; |
||||
String get nickname => _nickname; |
||||
String get headimg => _headimg; |
||||
String get balance => _balance; |
||||
String get money => _money; |
||||
String get realRecharge => _realRecharge; |
||||
String get giftRecharge => _giftRecharge; |
||||
String get sex => _sex; |
||||
bool get status => _status; |
||||
String get loginTime => _loginTime; |
||||
num get loginNum => _loginNum; |
||||
String get tenantCode => _tenantCode; |
||||
String get phone => _phone; |
||||
num get source => _source; |
||||
String get expendAmount => _expendAmount; |
||||
num get buyTimes => _buyTimes; |
||||
dynamic get lastBuyTime => _lastBuyTime; |
||||
bool get onCredit => _onCredit; |
||||
bool _isShow = false; |
||||
|
||||
bool get isShow => _isShow; |
||||
|
||||
set isShow(bool value) { |
||||
_isShow = value; |
||||
} |
||||
|
||||
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['openid'] = _openid; |
||||
map['nickname'] = _nickname; |
||||
map['headimg'] = _headimg; |
||||
map['balance'] = _balance; |
||||
map['money'] = _money; |
||||
map['realRecharge'] = _realRecharge; |
||||
map['giftRecharge'] = _giftRecharge; |
||||
map['sex'] = _sex; |
||||
map['status'] = _status; |
||||
map['loginTime'] = _loginTime; |
||||
map['loginNum'] = _loginNum; |
||||
map['tenantCode'] = _tenantCode; |
||||
map['phone'] = _phone; |
||||
map['source'] = _source; |
||||
map['expendAmount'] = _expendAmount; |
||||
map['buyTimes'] = _buyTimes; |
||||
map['lastBuyTime'] = _lastBuyTime; |
||||
map['onCredit'] = _onCredit; |
||||
return map; |
||||
} |
||||
|
||||
} |
@ -0,0 +1,329 @@
|
||||
/// records : [{"id":"1726114100938801152","rechargeType":2,"rechargeName":"微信","source":0,"createTime":"2023-11-19 13:44:06","createTimeFormat":null,"createPerson":"","phone":"18537827823","tenantCode":"1195","storeName":"","rechargeMoney":"50.00","giftdMoney":"20.00","sumMoney":"70.00","createMemberId":null,"rechargePreferentialId":null,"rechargeStatus":0,"refuseReason":null,"balance":"0.00","realRecharge":"0.00"},{"id":"1726114054612713472","rechargeType":2,"rechargeName":"微信","source":0,"createTime":"2023-11-19 13:43:55","createTimeFormat":null,"createPerson":"","phone":"18537827823","tenantCode":"1195","storeName":"","rechargeMoney":"50.00","giftdMoney":"20.00","sumMoney":"70.00","createMemberId":null,"rechargePreferentialId":null,"rechargeStatus":0,"refuseReason":null,"balance":"0.00","realRecharge":"0.00"},{"id":"1726113414083772416","rechargeType":2,"rechargeName":"微信","source":0,"createTime":"2023-11-19 13:41:22","createTimeFormat":null,"createPerson":"","phone":"18537827823","tenantCode":"1195","storeName":"","rechargeMoney":"50.00","giftdMoney":"20.00","sumMoney":"70.00","createMemberId":null,"rechargePreferentialId":null,"rechargeStatus":0,"refuseReason":null,"balance":"0.00","realRecharge":"0.00"},{"id":"1726113338053623808","rechargeType":2,"rechargeName":"微信","source":0,"createTime":"2023-11-19 13:41:04","createTimeFormat":null,"createPerson":"","phone":"18537827823","tenantCode":"1195","storeName":"","rechargeMoney":"50.00","giftdMoney":"20.00","sumMoney":"70.00","createMemberId":null,"rechargePreferentialId":null,"rechargeStatus":0,"refuseReason":null,"balance":"0.00","realRecharge":"0.00"},{"id":"1726113287562592256","rechargeType":2,"rechargeName":"微信","source":0,"createTime":"2023-11-19 13:40:52","createTimeFormat":null,"createPerson":"","phone":"18537827823","tenantCode":"1195","storeName":"","rechargeMoney":"50.00","giftdMoney":"20.00","sumMoney":"70.00","createMemberId":null,"rechargePreferentialId":null,"rechargeStatus":0,"refuseReason":null,"balance":"0.00","realRecharge":"0.00"},{"id":"1725756687412887552","rechargeType":2,"rechargeName":"微信","source":0,"createTime":"2023-11-18 14:03:52","createTimeFormat":null,"createPerson":"","phone":"17813120251","tenantCode":"1195","storeName":"","rechargeMoney":"50.00","giftdMoney":"20.00","sumMoney":"70.00","createMemberId":null,"rechargePreferentialId":null,"rechargeStatus":0,"refuseReason":null,"balance":"27.00","realRecharge":"27.00"},{"id":"1725730560917110784","rechargeType":2,"rechargeName":"微信","source":0,"createTime":"2023-11-18 12:20:03","createTimeFormat":null,"createPerson":"","phone":"15837166590","tenantCode":"1195","storeName":"","rechargeMoney":"50.00","giftdMoney":"20.00","sumMoney":"70.00","createMemberId":null,"rechargePreferentialId":null,"rechargeStatus":0,"refuseReason":null,"balance":"39.60","realRecharge":"39.60"},{"id":"1724976129296564224","rechargeType":2,"rechargeName":"微信","source":0,"createTime":"2023-11-16 10:22:12","createTimeFormat":null,"createPerson":"","phone":"15836615333","tenantCode":"1195","storeName":"","rechargeMoney":"50.00","giftdMoney":"20.00","sumMoney":"70.00","createMemberId":null,"rechargePreferentialId":null,"rechargeStatus":0,"refuseReason":null,"balance":"58.00","realRecharge":"50.00"},{"id":"1723958918691946496","rechargeType":2,"rechargeName":"微信","source":0,"createTime":"2023-11-13 15:00:10","createTimeFormat":null,"createPerson":"","phone":"17813120251","tenantCode":"1195","storeName":"","rechargeMoney":"50.00","giftdMoney":"20.00","sumMoney":"70.00","createMemberId":null,"rechargePreferentialId":null,"rechargeStatus":0,"refuseReason":null,"balance":"27.00","realRecharge":"27.00"},{"id":"1723682257861869568","rechargeType":1,"rechargeName":"现金","source":1,"createTime":"2023-11-12 20:40:49","createTimeFormat":null,"createPerson":"","phone":"13253333210","tenantCode":"1195","storeName":"台北牛肉面","rechargeMoney":"0.00","giftdMoney":"500.00","sumMoney":"500.00","createMemberId":null,"rechargePreferentialId":null,"rechargeStatus":0,"refuseReason":null,"balance":"1000.00","realRecharge":"0.00"}] |
||||
/// total : "21" |
||||
/// size : "10" |
||||
/// current : "1" |
||||
/// orders : [{"column":"id","asc":false}] |
||||
/// hitCount : false |
||||
/// searchCount : true |
||||
/// pages : "3" |
||||
|
||||
class RechargeFlowList { |
||||
RechargeFlowList({ |
||||
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; |
||||
} |
||||
|
||||
RechargeFlowList.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; |
||||
RechargeFlowList copyWith({ List<Records> records, |
||||
String total, |
||||
String size, |
||||
String current, |
||||
List<Orders> orders, |
||||
bool hitCount, |
||||
bool searchCount, |
||||
String pages, |
||||
}) => RechargeFlowList( 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 : "1726114100938801152" |
||||
/// rechargeType : 2 |
||||
/// rechargeName : "微信" |
||||
/// source : 0 |
||||
/// createTime : "2023-11-19 13:44:06" |
||||
/// createTimeFormat : null |
||||
/// createPerson : "" |
||||
/// phone : "18537827823" |
||||
/// tenantCode : "1195" |
||||
/// storeName : "" |
||||
/// rechargeMoney : "50.00" |
||||
/// giftdMoney : "20.00" |
||||
/// sumMoney : "70.00" |
||||
/// createMemberId : null |
||||
/// rechargePreferentialId : null |
||||
/// rechargeStatus : 0 |
||||
/// refuseReason : null |
||||
/// balance : "0.00" |
||||
/// realRecharge : "0.00" |
||||
|
||||
class Records { |
||||
Records({ |
||||
String id, |
||||
num rechargeType, |
||||
String rechargeName, |
||||
num source, |
||||
String createTime, |
||||
dynamic createTimeFormat, |
||||
String createPerson, |
||||
String phone, |
||||
String tenantCode, |
||||
String storeName, |
||||
String rechargeMoney, |
||||
String giftdMoney, |
||||
String sumMoney, |
||||
dynamic createMemberId, |
||||
dynamic rechargePreferentialId, |
||||
num rechargeStatus, |
||||
dynamic refuseReason, |
||||
String balance, |
||||
String realRecharge,}){ |
||||
_id = id; |
||||
_rechargeType = rechargeType; |
||||
_rechargeName = rechargeName; |
||||
_source = source; |
||||
_createTime = createTime; |
||||
_createTimeFormat = createTimeFormat; |
||||
_createPerson = createPerson; |
||||
_phone = phone; |
||||
_tenantCode = tenantCode; |
||||
_storeName = storeName; |
||||
_rechargeMoney = rechargeMoney; |
||||
_giftdMoney = giftdMoney; |
||||
_sumMoney = sumMoney; |
||||
_createMemberId = createMemberId; |
||||
_rechargePreferentialId = rechargePreferentialId; |
||||
_rechargeStatus = rechargeStatus; |
||||
_refuseReason = refuseReason; |
||||
_balance = balance; |
||||
_realRecharge = realRecharge; |
||||
} |
||||
|
||||
Records.fromJson(dynamic json) { |
||||
_id = json['id']; |
||||
_rechargeType = json['rechargeType']; |
||||
_rechargeName = json['rechargeName']; |
||||
_source = json['source']; |
||||
_createTime = json['createTime']; |
||||
_createTimeFormat = json['createTimeFormat']; |
||||
_createPerson = json['createPerson']; |
||||
_phone = json['phone']; |
||||
_tenantCode = json['tenantCode']; |
||||
_storeName = json['storeName']; |
||||
_rechargeMoney = json['rechargeMoney']; |
||||
_giftdMoney = json['giftdMoney']; |
||||
_sumMoney = json['sumMoney']; |
||||
_createMemberId = json['createMemberId']; |
||||
_rechargePreferentialId = json['rechargePreferentialId']; |
||||
_rechargeStatus = json['rechargeStatus']; |
||||
_refuseReason = json['refuseReason']; |
||||
_balance = json['balance']; |
||||
_realRecharge = json['realRecharge']; |
||||
} |
||||
String _id; |
||||
num _rechargeType; |
||||
String _rechargeName; |
||||
num _source; |
||||
String _createTime; |
||||
dynamic _createTimeFormat; |
||||
String _createPerson; |
||||
String _phone; |
||||
String _tenantCode; |
||||
String _storeName; |
||||
String _rechargeMoney; |
||||
String _giftdMoney; |
||||
String _sumMoney; |
||||
dynamic _createMemberId; |
||||
dynamic _rechargePreferentialId; |
||||
num _rechargeStatus; |
||||
dynamic _refuseReason; |
||||
String _balance; |
||||
String _realRecharge; |
||||
Records copyWith({ String id, |
||||
num rechargeType, |
||||
String rechargeName, |
||||
num source, |
||||
String createTime, |
||||
dynamic createTimeFormat, |
||||
String createPerson, |
||||
String phone, |
||||
String tenantCode, |
||||
String storeName, |
||||
String rechargeMoney, |
||||
String giftdMoney, |
||||
String sumMoney, |
||||
dynamic createMemberId, |
||||
dynamic rechargePreferentialId, |
||||
num rechargeStatus, |
||||
dynamic refuseReason, |
||||
String balance, |
||||
String realRecharge, |
||||
}) => Records( id: id ?? _id, |
||||
rechargeType: rechargeType ?? _rechargeType, |
||||
rechargeName: rechargeName ?? _rechargeName, |
||||
source: source ?? _source, |
||||
createTime: createTime ?? _createTime, |
||||
createTimeFormat: createTimeFormat ?? _createTimeFormat, |
||||
createPerson: createPerson ?? _createPerson, |
||||
phone: phone ?? _phone, |
||||
tenantCode: tenantCode ?? _tenantCode, |
||||
storeName: storeName ?? _storeName, |
||||
rechargeMoney: rechargeMoney ?? _rechargeMoney, |
||||
giftdMoney: giftdMoney ?? _giftdMoney, |
||||
sumMoney: sumMoney ?? _sumMoney, |
||||
createMemberId: createMemberId ?? _createMemberId, |
||||
rechargePreferentialId: rechargePreferentialId ?? _rechargePreferentialId, |
||||
rechargeStatus: rechargeStatus ?? _rechargeStatus, |
||||
refuseReason: refuseReason ?? _refuseReason, |
||||
balance: balance ?? _balance, |
||||
realRecharge: realRecharge ?? _realRecharge, |
||||
); |
||||
String get id => _id; |
||||
num get rechargeType => _rechargeType; |
||||
String get rechargeName => _rechargeName; |
||||
num get source => _source; |
||||
String get createTime => _createTime; |
||||
dynamic get createTimeFormat => _createTimeFormat; |
||||
String get createPerson => _createPerson; |
||||
String get phone => _phone; |
||||
String get tenantCode => _tenantCode; |
||||
String get storeName => _storeName; |
||||
String get rechargeMoney => _rechargeMoney; |
||||
String get giftdMoney => _giftdMoney; |
||||
String get sumMoney => _sumMoney; |
||||
dynamic get createMemberId => _createMemberId; |
||||
dynamic get rechargePreferentialId => _rechargePreferentialId; |
||||
num get rechargeStatus => _rechargeStatus; |
||||
dynamic get refuseReason => _refuseReason; |
||||
String get balance => _balance; |
||||
String get realRecharge => _realRecharge; |
||||
bool _isShow = false; |
||||
|
||||
bool get isShow => _isShow; |
||||
|
||||
set isShow(bool value) { |
||||
_isShow = value; |
||||
} |
||||
|
||||
Map<String, dynamic> toJson() { |
||||
final map = <String, dynamic>{}; |
||||
map['id'] = _id; |
||||
map['rechargeType'] = _rechargeType; |
||||
map['rechargeName'] = _rechargeName; |
||||
map['source'] = _source; |
||||
map['createTime'] = _createTime; |
||||
map['createTimeFormat'] = _createTimeFormat; |
||||
map['createPerson'] = _createPerson; |
||||
map['phone'] = _phone; |
||||
map['tenantCode'] = _tenantCode; |
||||
map['storeName'] = _storeName; |
||||
map['rechargeMoney'] = _rechargeMoney; |
||||
map['giftdMoney'] = _giftdMoney; |
||||
map['sumMoney'] = _sumMoney; |
||||
map['createMemberId'] = _createMemberId; |
||||
map['rechargePreferentialId'] = _rechargePreferentialId; |
||||
map['rechargeStatus'] = _rechargeStatus; |
||||
map['refuseReason'] = _refuseReason; |
||||
map['balance'] = _balance; |
||||
map['realRecharge'] = _realRecharge; |
||||
return map; |
||||
} |
||||
|
||||
} |
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -0,0 +1,90 @@
|
||||
/// wipedDate : "2023-11-10" |
||||
/// infoList : [{"ticketName":"四神汤 ","ticketItemName":"测试规格222","wipedNumber":1},{"ticketName":"四神汤 ","ticketItemName":"测试规格","wipedNumber":1}] |
||||
|
||||
class TicketStatsList { |
||||
TicketStatsList({ |
||||
String wipedDate, |
||||
List<InfoList> infoList,}){ |
||||
_wipedDate = wipedDate; |
||||
_infoList = infoList; |
||||
} |
||||
|
||||
TicketStatsList.fromJson(dynamic json) { |
||||
_wipedDate = json['wipedDate']; |
||||
if (json['infoList'] != null) { |
||||
_infoList = []; |
||||
json['infoList'].forEach((v) { |
||||
_infoList.add(InfoList.fromJson(v)); |
||||
}); |
||||
} |
||||
} |
||||
String _wipedDate; |
||||
List<InfoList> _infoList; |
||||
TicketStatsList copyWith({ String wipedDate, |
||||
List<InfoList> infoList, |
||||
}) => TicketStatsList( wipedDate: wipedDate ?? _wipedDate, |
||||
infoList: infoList ?? _infoList, |
||||
); |
||||
String get wipedDate => _wipedDate; |
||||
List<InfoList> get infoList => _infoList; |
||||
|
||||
Map<String, dynamic> toJson() { |
||||
final map = <String, dynamic>{}; |
||||
map['wipedDate'] = _wipedDate; |
||||
if (_infoList != null) { |
||||
map['infoList'] = _infoList.map((v) => v.toJson()).toList(); |
||||
} |
||||
return map; |
||||
} |
||||
|
||||
} |
||||
|
||||
/// ticketName : "四神汤 " |
||||
/// ticketItemName : "测试规格222" |
||||
/// wipedNumber : 1 |
||||
|
||||
class InfoList { |
||||
InfoList({ |
||||
String ticketName, |
||||
String ticketItemName, |
||||
num wipedNumber,}){ |
||||
_ticketName = ticketName; |
||||
_ticketItemName = ticketItemName; |
||||
_wipedNumber = wipedNumber; |
||||
} |
||||
|
||||
InfoList.fromJson(dynamic json) { |
||||
_ticketName = json['ticketName']; |
||||
_ticketItemName = json['ticketItemName']; |
||||
_wipedNumber = json['wipedNumber']; |
||||
} |
||||
String _ticketName; |
||||
String _ticketItemName; |
||||
num _wipedNumber; |
||||
String _wipedDate; |
||||
InfoList copyWith({ String ticketName, |
||||
String ticketItemName, |
||||
num wipedNumber, |
||||
}) => InfoList( ticketName: ticketName ?? _ticketName, |
||||
ticketItemName: ticketItemName ?? _ticketItemName, |
||||
wipedNumber: wipedNumber ?? _wipedNumber, |
||||
); |
||||
String get ticketName => _ticketName; |
||||
String get ticketItemName => _ticketItemName; |
||||
num get wipedNumber => _wipedNumber; |
||||
|
||||
String get wipedDate => _wipedDate; |
||||
|
||||
set wipedDate(String value) { |
||||
_wipedDate = value; |
||||
} |
||||
|
||||
Map<String, dynamic> toJson() { |
||||
final map = <String, dynamic>{}; |
||||
map['ticketName'] = _ticketName; |
||||
map['ticketItemName'] = _ticketItemName; |
||||
map['wipedNumber'] = _wipedNumber; |
||||
return map; |
||||
} |
||||
|
||||
} |
Loading…
Reference in new issue