diff --git a/assets/image/2x/invoice_history.webp b/assets/image/2x/invoice_history.webp new file mode 100644 index 00000000..da5b9a2e Binary files /dev/null and b/assets/image/2x/invoice_history.webp differ diff --git a/assets/image/2x/invoice_title.webp b/assets/image/2x/invoice_title.webp new file mode 100644 index 00000000..ac4de899 Binary files /dev/null and b/assets/image/2x/invoice_title.webp differ diff --git a/assets/image/3x/invoice_history.webp b/assets/image/3x/invoice_history.webp new file mode 100644 index 00000000..237560e2 Binary files /dev/null and b/assets/image/3x/invoice_history.webp differ diff --git a/assets/image/3x/invoice_title.webp b/assets/image/3x/invoice_title.webp new file mode 100644 index 00000000..67719dc4 Binary files /dev/null and b/assets/image/3x/invoice_title.webp differ diff --git a/assets/image/invoice_history.webp b/assets/image/invoice_history.webp new file mode 100644 index 00000000..ad1ea941 Binary files /dev/null and b/assets/image/invoice_history.webp differ diff --git a/assets/image/invoice_title.webp b/assets/image/invoice_title.webp new file mode 100644 index 00000000..be46cf69 Binary files /dev/null and b/assets/image/invoice_title.webp differ diff --git a/lib/main.dart b/lib/main.dart index 9c99f38d..5bcceb91 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -169,6 +169,7 @@ import 'mine/personal_page.dart'; import 'order/exchange_write_off_page.dart'; import 'mine/release_page.dart'; import 'mine/roll_center_page.dart'; +import 'order/invoices_manage/invoices_manage_page.dart'; void main() async { if (Platform.isAndroid) { @@ -577,4 +578,6 @@ Map routers = { ServicePurchaseRecord(arguments:arguments), '/router/set_goods_specs_value': (context, {arguments}) => SetGoodsSpecsValue(arguments:arguments), + '/router/invoices_manage_page': (context, {arguments}) => + InvoicesManagePage(), }; diff --git a/lib/order/invoices_manage/invoices_manage_page.dart b/lib/order/invoices_manage/invoices_manage_page.dart new file mode 100644 index 00000000..c2091892 --- /dev/null +++ b/lib/order/invoices_manage/invoices_manage_page.dart @@ -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 createState() { + return _InvoicesManagePage(); + } +} + +class _InvoicesManagePage extends State { + 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, + ), + ), + ), + ), + ], + ), + ); + } +} diff --git a/lib/order/order_history_page.dart b/lib/order/order_history_page.dart index 452c9df0..93ea283e 100644 --- a/lib/order/order_history_page.dart +++ b/lib/order/order_history_page.dart @@ -485,7 +485,7 @@ class _OrderHistoryList extends State orderInfo.orderStatus, orderInfo.payStatus, orderInfo.sendStatus, - orderInfo.isTakeOut) + orderInfo.isTakeOut,) : "", style: TextStyle( fontSize: 14.sp, @@ -632,6 +632,7 @@ class _OrderHistoryList extends State ? StatusUtils.statusBtn( context, orderInfo.payStatus, + orderInfo.payChannel, orderInfo.orderStatus, orderInfo.isTakeOut, orderInfo.sendStatus, diff --git a/lib/utils/status_utils.dart b/lib/utils/status_utils.dart index a414556b..e42eee0e 100644 --- a/lib/utils/status_utils.dart +++ b/lib/utils/status_utils.dart @@ -89,6 +89,7 @@ class StatusUtils { static List statusBtn( context, payStatus, + payChannel, orderStatus, isTakeOut, sendStatus, @@ -257,6 +258,35 @@ class StatusUtils { click(0); }, ), + SizedBox( + width: 10.w, + ), + if(payChannel == 0 || payChannel == 1 || payChannel == 2) + Container( + width: 72.w, + height: 24.h, + child: TextButton( + onPressed: () { + Navigator.of(context).pushNamed('/router/invoices_manage_page'); + }, + style: ButtonStyle( + padding: MaterialStateProperty.all(EdgeInsets.zero), + side: MaterialStateProperty.all( + BorderSide( + color: Color(0xff32A060), + width: 0.5, + ), + ), + ), + child: Text( + "开发票", + style: TextStyle( + color: Color(0xff32A060), + fontSize: 12.sp, + ), + ), + ), + ), ]; } }