zsw
6 months ago
10 changed files with 543 additions and 1 deletions
After Width: | Height: | Size: 739 B |
After Width: | Height: | Size: 457 B |
After Width: | Height: | Size: 1.0 KiB |
After Width: | Height: | Size: 552 B |
After Width: | Height: | Size: 400 B |
After Width: | Height: | Size: 294 B |
@ -0,0 +1,508 @@
|
||||
import 'package:dio/dio.dart'; |
||||
import 'package:flutter/material.dart'; |
||||
import 'package:flutter/services.dart'; |
||||
import 'package:flutter_easyloading/flutter_easyloading.dart'; |
||||
import 'package:flutter_screenutil/flutter_screenutil.dart'; |
||||
import 'package:intl/intl.dart'; |
||||
import 'package:pull_to_refresh/pull_to_refresh.dart'; |
||||
import 'package:shimmer/shimmer.dart'; |
||||
|
||||
import '../../generated/l10n.dart'; |
||||
import '../../utils/font_weight.dart'; |
||||
import '../../view_widget/classic_header.dart'; |
||||
import '../../view_widget/my_appbar.dart'; |
||||
import '../../view_widget/my_footer.dart'; |
||||
import '../../view_widget/no_data_view.dart'; |
||||
|
||||
class InvoicesManagePage extends StatefulWidget { |
||||
@override |
||||
State<StatefulWidget> createState() { |
||||
return _InvoicesManagePage(); |
||||
} |
||||
} |
||||
|
||||
class _InvoicesManagePage extends State<InvoicesManagePage> { |
||||
final RefreshController refreshController = RefreshController(); |
||||
String networkError = ""; |
||||
int networkStatus = 0; |
||||
int _pageNum = 1; |
||||
String total = "0"; |
||||
int _loadCount = 0; |
||||
int checkIndex = 0; |
||||
bool allCheckIndex = false; |
||||
|
||||
@override |
||||
void initState() { |
||||
super.initState(); |
||||
// _onRefresh(); |
||||
} |
||||
|
||||
///离开页面记着销毁和清除 |
||||
@override |
||||
void dispose() { |
||||
super.dispose(); |
||||
refreshController.dispose(); |
||||
} |
||||
|
||||
_onRefresh({bool isShowLoad = true}) async { |
||||
if (isShowLoad) |
||||
EasyLoading.show( |
||||
status: S.current.zhengzaijiazai, |
||||
maskType: EasyLoadingMaskType.black); |
||||
} |
||||
|
||||
addLoadCount() { |
||||
_loadCount += 1; |
||||
if (_loadCount == 2) { |
||||
_loadCount = 0; |
||||
EasyLoading.dismiss(); |
||||
if (refreshController.isRefresh) refreshController.refreshCompleted(); |
||||
if (mounted) setState(() {}); |
||||
} |
||||
} |
||||
|
||||
@override |
||||
Widget build(BuildContext context) { |
||||
return Scaffold( |
||||
resizeToAvoidBottomInset: false, |
||||
appBar: MyAppBar( |
||||
title: "发票管理", |
||||
titleColor: Colors.black, |
||||
background: Colors.white, |
||||
leadingColor: Colors.black, |
||||
), |
||||
body: |
||||
// networkStatus == -1 ? noNetwork() : |
||||
Column( |
||||
crossAxisAlignment: CrossAxisAlignment.start, |
||||
children: [ |
||||
Container( |
||||
color: Colors.white, |
||||
padding: EdgeInsets.only(top: 15.h,bottom:10.h), |
||||
margin: EdgeInsets.only(bottom: 12.h), |
||||
child: Row( |
||||
children: [ |
||||
Expanded(child:Column( |
||||
children: [ |
||||
Image.asset( |
||||
"assets/image/invoice_title.webp", |
||||
width: 26.h, |
||||
height: 26.h, |
||||
fit: BoxFit.fitWidth, |
||||
), |
||||
Padding(padding:EdgeInsets.only(top:7.6.h), |
||||
child:Text( |
||||
"抬头管理", |
||||
style: TextStyle( |
||||
color: Colors.black, |
||||
fontSize: 14.sp, |
||||
fontWeight: FontWeight.bold, |
||||
), |
||||
),) |
||||
], |
||||
)), |
||||
Expanded(child: Column( |
||||
children: [ |
||||
Image.asset( |
||||
"assets/image/invoice_history.webp", |
||||
width: 26.h, |
||||
height: 26.h, |
||||
fit: BoxFit.fitWidth, |
||||
), |
||||
Padding(padding:EdgeInsets.only(top:7.6.h), |
||||
child:Text( |
||||
"开票历史", |
||||
style: TextStyle( |
||||
color: Colors.black, |
||||
fontSize: 14.sp, |
||||
fontWeight: FontWeight.bold, |
||||
), |
||||
),) |
||||
], |
||||
)), |
||||
], |
||||
), |
||||
), |
||||
Padding(padding:EdgeInsets.only(left: 14.w,bottom: 6.h), |
||||
child: Text( |
||||
"可开票订单", |
||||
style: TextStyle( |
||||
color: Colors.black, |
||||
fontSize: 14.sp, |
||||
fontWeight: FontWeight.bold, |
||||
), |
||||
textAlign: TextAlign.left, |
||||
),), |
||||
Expanded( |
||||
child: Container( |
||||
child: SmartRefresher( |
||||
controller: refreshController, |
||||
enablePullDown: true, |
||||
// enablePullUp: records.length == 0 ? false : true, |
||||
header: MyHeader( |
||||
color: Color(0xFF30415B), |
||||
), |
||||
footer: CustomFooter( |
||||
builder: (context, mode) { |
||||
return MyFooter(mode); |
||||
}, |
||||
), |
||||
onRefresh: () { |
||||
// _current = 1; |
||||
// records.clear(); |
||||
_onRefresh(isShowLoad: false); |
||||
}, |
||||
onLoading: () { |
||||
// _current++; |
||||
_onRefresh(isShowLoad: false); |
||||
}, |
||||
physics: BouncingScrollPhysics(), |
||||
scrollController: ScrollController(), |
||||
child: Container( |
||||
child: |
||||
// networkStatus == 0 |
||||
// ? ListView.builder( |
||||
// itemCount: 10, |
||||
// physics: BouncingScrollPhysics(), |
||||
// shrinkWrap: true, |
||||
// itemBuilder: (context, position) { |
||||
// return GestureDetector( |
||||
// behavior: HitTestBehavior.opaque, |
||||
// onTap: () {}, |
||||
// child: invoicesOrderItemSm(), |
||||
// ); |
||||
// }, |
||||
// ) |
||||
// : |
||||
// ((records == null || records.length == 0) |
||||
// ? NoDataView( |
||||
// src: "assets/image/bs_no data_logo.webp", |
||||
// isShowBtn: false, |
||||
// text: "暂无商品分类", |
||||
// fontSize: 16, |
||||
// margin: EdgeInsets.all(20), |
||||
// ) |
||||
// : ListView.builder( |
||||
// itemCount: records?.length ?? 0, |
||||
// physics: BouncingScrollPhysics(), |
||||
// shrinkWrap: true, |
||||
// itemBuilder: (context, position) { |
||||
// return GestureDetector( |
||||
// behavior: HitTestBehavior.opaque, |
||||
// onTap: () {}, |
||||
// child: invoicesOrderItem(), |
||||
// ); |
||||
// }, |
||||
// )), |
||||
ListView.builder( |
||||
itemCount:6, |
||||
physics: BouncingScrollPhysics(), |
||||
shrinkWrap: true, |
||||
itemBuilder: (context, position) { |
||||
return GestureDetector( |
||||
behavior: HitTestBehavior.opaque, |
||||
onTap: () {}, |
||||
child: invoicesOrderItem(), |
||||
); |
||||
}, |
||||
) |
||||
), |
||||
), |
||||
)), |
||||
Container( |
||||
decoration: BoxDecoration( |
||||
color: Colors.white, |
||||
), |
||||
width: double.infinity, |
||||
padding: EdgeInsets.only(top: 16.h,bottom: 45.h,left: 14.w,right: 17.w), |
||||
child: Column( |
||||
children: [ |
||||
Padding(padding:EdgeInsets.only(bottom: 10.h), |
||||
child: Row( |
||||
crossAxisAlignment: CrossAxisAlignment.center, |
||||
children: [ |
||||
Padding(padding:EdgeInsets.only(right:6.w), |
||||
child: Text( |
||||
"已选3个订单合计:", |
||||
style: TextStyle( |
||||
color: Color(0xFF000000), |
||||
fontSize: 12.sp, |
||||
fontWeight: MyFontWeight.regular, |
||||
), |
||||
),), |
||||
Expanded(child:Text( |
||||
"¥20.4", |
||||
style: TextStyle( |
||||
color: Color(0xFF32A060), |
||||
fontSize: 20.sp, |
||||
fontWeight: MyFontWeight.medium, |
||||
), |
||||
)), |
||||
Text( |
||||
"开票金额以实际发票为准", |
||||
style: TextStyle( |
||||
color: Color(0xFF727272), |
||||
fontSize: 12.sp, |
||||
fontWeight: MyFontWeight.regular, |
||||
), |
||||
), |
||||
], |
||||
)), |
||||
Row( |
||||
crossAxisAlignment: CrossAxisAlignment.center, |
||||
children: [ |
||||
GestureDetector( |
||||
onTap:(){}, |
||||
child: Container(padding:EdgeInsets.only(right: 8.w), |
||||
child: Image.asset( |
||||
allCheckIndex == false |
||||
? "assets/image/icon_radio_unselected.webp" |
||||
: "assets/image/icon_radio_selected.webp", |
||||
width: 16.w, |
||||
height: 16.h, |
||||
)), |
||||
), |
||||
Expanded(child:Text( |
||||
"全选", |
||||
style: TextStyle( |
||||
color: Color(0xFF000000), |
||||
fontSize: 14.sp, |
||||
fontWeight: MyFontWeight.regular, |
||||
), |
||||
)), |
||||
Container( |
||||
decoration: BoxDecoration( |
||||
color: Color(0xFF32A060), |
||||
borderRadius: BorderRadius.circular(4), |
||||
), |
||||
alignment: Alignment.center, |
||||
padding: EdgeInsets.symmetric(horizontal: 23.w,vertical:8.h), |
||||
child: Text( |
||||
"去开票", |
||||
style: TextStyle( |
||||
color: Colors.white, |
||||
fontSize: 14.sp, |
||||
fontWeight: MyFontWeight.regular, |
||||
), |
||||
), |
||||
) |
||||
], |
||||
), |
||||
], |
||||
), |
||||
) |
||||
], |
||||
), |
||||
); |
||||
} |
||||
|
||||
///可开票订单list |
||||
Widget invoicesOrderItem() { |
||||
return Container( |
||||
padding: EdgeInsets.only(top: 12.h, bottom: 12.h,), |
||||
margin: EdgeInsets.symmetric(horizontal: 16.w, vertical: 6.h), |
||||
decoration: BoxDecoration( |
||||
color: Colors.white, |
||||
boxShadow: [ |
||||
BoxShadow( |
||||
color: Color(0x0F06152E), |
||||
offset: Offset(0, 2), |
||||
blurRadius: 4, |
||||
spreadRadius: 0, |
||||
) |
||||
], |
||||
borderRadius: BorderRadius.circular(8), |
||||
), |
||||
child: Row( |
||||
crossAxisAlignment: CrossAxisAlignment.center, |
||||
children: [ |
||||
checkView(1), |
||||
Expanded(child:Column( |
||||
crossAxisAlignment: CrossAxisAlignment.start, |
||||
children: [ |
||||
Text( |
||||
"百年川椒重庆老火锅(汉街店)", |
||||
style: TextStyle( |
||||
fontSize: 14.sp, |
||||
fontWeight: MyFontWeight.bold, |
||||
color: Color(0xFF0D0D0D), |
||||
), |
||||
), |
||||
Padding(padding:EdgeInsets.only(top:8.h,bottom:14.h), |
||||
child:Text( |
||||
"订单编号:22766655444555666", |
||||
style: TextStyle( |
||||
fontSize: 12.sp, |
||||
fontWeight: MyFontWeight.medium, |
||||
color: Color(0xFF353535), |
||||
), |
||||
)), |
||||
Text( |
||||
"下单时间:2020.01.20 10:50:22", |
||||
style: TextStyle( |
||||
fontSize: 10.sp, |
||||
fontWeight: MyFontWeight.regular, |
||||
color: Color(0xFF0D0D0D), |
||||
), |
||||
), |
||||
], |
||||
)), |
||||
Text.rich( |
||||
TextSpan( |
||||
children: [ |
||||
TextSpan( |
||||
text: "58.2", |
||||
style: TextStyle( |
||||
color: Color(0xFF000000), |
||||
fontSize: 16.sp, |
||||
fontWeight: MyFontWeight.bold, |
||||
), |
||||
), |
||||
TextSpan( |
||||
text: "元", |
||||
style: TextStyle( |
||||
color: Color(0xFF4D4D4D), |
||||
fontSize: 14.sp, |
||||
fontWeight: MyFontWeight.medium, |
||||
), |
||||
), |
||||
], |
||||
), |
||||
), |
||||
], |
||||
), |
||||
); |
||||
} |
||||
|
||||
Widget checkView(var index) { |
||||
return Container( |
||||
padding: EdgeInsets.only(right:15.w, left:12.w), |
||||
alignment: Alignment.center, |
||||
child: Image.asset( |
||||
checkIndex != index |
||||
? "assets/image/icon_radio_unselected.webp" |
||||
: "assets/image/icon_radio_selected.webp", |
||||
width: 15.w, |
||||
height: 15.h, |
||||
), |
||||
); |
||||
} |
||||
|
||||
Widget invoicesOrderItemSm() { |
||||
return Container( |
||||
padding: EdgeInsets.only(top: 12, bottom: 12, left: 16), |
||||
margin: EdgeInsets.symmetric(horizontal: 16, vertical: 6), |
||||
decoration: BoxDecoration( |
||||
color: Colors.white, |
||||
boxShadow: [ |
||||
BoxShadow( |
||||
color: Color(0x0F06152E), |
||||
offset: Offset(0, 2), |
||||
blurRadius: 4, |
||||
spreadRadius: 0, |
||||
) |
||||
], |
||||
borderRadius: BorderRadius.circular(8), |
||||
), |
||||
child: Column( |
||||
crossAxisAlignment: CrossAxisAlignment.start, |
||||
children: [ |
||||
Shimmer.fromColors( |
||||
baseColor: Color(0XFFD8D8D8), |
||||
highlightColor: Color(0XFFD8D8D8), |
||||
child: Container( |
||||
margin: EdgeInsets.only(bottom: 16), |
||||
decoration: BoxDecoration( |
||||
color: Color(0XFFD8D8D8), |
||||
borderRadius: BorderRadius.circular(2), |
||||
), |
||||
width: 149, |
||||
height: 20, |
||||
), |
||||
), |
||||
Row( |
||||
children: [ |
||||
Shimmer.fromColors( |
||||
baseColor: Color(0XFFD8D8D8), |
||||
highlightColor: Color(0XFFD8D8D8), |
||||
child: Container( |
||||
margin: EdgeInsets.only(right: 10), |
||||
decoration: BoxDecoration( |
||||
color: Color(0XFFD8D8D8), |
||||
borderRadius: BorderRadius.circular(2), |
||||
), |
||||
width: 42, |
||||
height: 20, |
||||
), |
||||
), |
||||
Shimmer.fromColors( |
||||
baseColor: Color(0XFFD8D8D8), |
||||
highlightColor: Color(0XFFD8D8D8), |
||||
child: Container( |
||||
decoration: BoxDecoration( |
||||
color: Color(0XFFD8D8D8), |
||||
borderRadius: BorderRadius.circular(2), |
||||
), |
||||
width: 60, |
||||
height: 20, |
||||
), |
||||
), |
||||
], |
||||
) |
||||
], |
||||
), |
||||
); |
||||
} |
||||
|
||||
Widget noNetwork() { |
||||
return Container( |
||||
color: Colors.white, |
||||
width: double.infinity, |
||||
child: Column( |
||||
mainAxisAlignment: MainAxisAlignment.center, |
||||
children: [ |
||||
Text( |
||||
networkError.substring(0, networkError.indexOf(",")), |
||||
style: TextStyle( |
||||
fontSize: 14, |
||||
color: Color(0xFF0D0D0D), |
||||
fontWeight: MyFontWeight.bold, |
||||
), |
||||
), |
||||
Padding( |
||||
padding: EdgeInsets.symmetric(vertical: 10), |
||||
child: Text( |
||||
"请检查网络设置或稍后重试", |
||||
style: TextStyle( |
||||
fontSize: 12, |
||||
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, vertical: 3), |
||||
child: Text( |
||||
"重试", |
||||
style: TextStyle( |
||||
fontSize: 14, |
||||
color: Colors.white, |
||||
fontWeight: MyFontWeight.regular, |
||||
), |
||||
), |
||||
), |
||||
), |
||||
], |
||||
), |
||||
); |
||||
} |
||||
} |
Loading…
Reference in new issue