diff --git a/lib/business_system/goods/goods_search_page.dart b/lib/business_system/goods/goods_search_page.dart index 353c12bb..b7c58659 100644 --- a/lib/business_system/goods/goods_search_page.dart +++ b/lib/business_system/goods/goods_search_page.dart @@ -46,7 +46,8 @@ class _GoodsSearchPage extends State int _pageIndex = 1; BusinessApiService businessService; List adminProductVoList = []; - bool _shimmer =true; + String networkError = ""; + int networkStatus = 0; @override void didChangeMetrics() { @@ -91,7 +92,6 @@ class _GoodsSearchPage extends State status: S.current.zhengzaijiazai, maskType: EasyLoadingMaskType.black); await queryGoodsList(); - _shimmer = false; EasyLoading.dismiss(); if (!mounted) return; if (refreshController.isRefresh) refreshController.refreshCompleted(); @@ -116,8 +116,9 @@ class _GoodsSearchPage extends State "pageSize": 10, "status": widget.arguments["onSaleStatus"], }).catchError((error) { - SmartDialog.showToast(AppUtils.dioErrorTypeToString(error.type), - alignment: Alignment.center); + networkError = AppUtils.dioErrorTypeToString(error.type); + networkStatus = -1; + setState(() {}); refreshController.refreshFailed(); refreshController.loadFailed(); }); @@ -129,6 +130,7 @@ class _GoodsSearchPage extends State refreshController.loadNoData(); else refreshController.loadComplete(); + networkStatus = 1; } else { SmartDialog.showToast(baseData.msg, alignment: Alignment.center); } @@ -136,31 +138,32 @@ class _GoodsSearchPage extends State ///商品下架 queryGoodsUpdate(productId) async { - try{ + try { EasyLoading.show( status: S.current.zhengzaijiazai, maskType: EasyLoadingMaskType.black); - if (businessService == null) { - businessService = BusinessApiService(Dio(), - context: context, - token: BusinessInstance.instance.businessToken, - tenant: BusinessInstance.instance.businessTenant, - storeId: widget.arguments["storeId"]); - } - BaseData baseData = - await businessService.goodsUpdate({ - "productId": productId, - "sell": widget.arguments["onSaleStatus"] == "1"?false:true, - }).catchError((error) { - }); - if (baseData != null && baseData.isSuccess) { - _pageIndex = 1; - adminProductVoList.clear(); - await _onRefresh(isShowLoad: false); - SmartDialog.showToast(widget.arguments["onSaleStatus"] == "1"?"商品下架成功":"商品上架成功", alignment: Alignment.center); - } else { - SmartDialog.showToast(baseData.msg, alignment: Alignment.center); - }}finally{ + if (businessService == null) { + businessService = BusinessApiService(Dio(), + context: context, + token: BusinessInstance.instance.businessToken, + tenant: BusinessInstance.instance.businessTenant, + storeId: widget.arguments["storeId"]); + } + BaseData baseData = await businessService.goodsUpdate({ + "productId": productId, + "sell": widget.arguments["onSaleStatus"] == "1" ? false : true, + }).catchError((error) {}); + if (baseData != null && baseData.isSuccess) { + _pageIndex = 1; + adminProductVoList.clear(); + await _onRefresh(isShowLoad: false); + SmartDialog.showToast( + widget.arguments["onSaleStatus"] == "1" ? "商品下架成功" : "商品上架成功", + alignment: Alignment.center); + } else { + SmartDialog.showToast(baseData.msg, alignment: Alignment.center); + } + } finally { EasyLoading.dismiss(); } } @@ -184,8 +187,7 @@ class _GoodsSearchPage extends State Container( color: Colors.white, margin: EdgeInsets.only(bottom: 16.h), - child: - Container( + child: Container( height: 40.h, margin: EdgeInsets.fromLTRB(18.w, 17.h, 18.w, 10.h), alignment: Alignment.center, @@ -208,10 +210,9 @@ class _GoodsSearchPage extends State decoration: InputDecoration( hintText: "请输入搜索内容", hintStyle: TextStyle( - fontSize: 15.sp, - color: Color(0xFF808080), - fontWeight: MyFontWeight.regular - ), + fontSize: 15.sp, + color: Color(0xFF808080), + fontWeight: MyFontWeight.regular), isCollapsed: true, prefixIcon: Padding( padding: EdgeInsets.only(left: 5.w, right: 5.w), @@ -228,63 +229,68 @@ class _GoodsSearchPage extends State ), ), Expanded( - child: Container( - child: SmartRefresher( - controller: refreshController, - enablePullDown: true, - enablePullUp: true, - physics: BouncingScrollPhysics(), - header: MyHeader( - color: Color(0xFF30415B), - ), - footer: CustomFooter( - builder: (context, mode) { - return MyFooter(mode); - }, - ), - onRefresh: () { - _pageIndex = 1; - adminProductVoList.clear(); - _onRefresh(isShowLoad: false); - }, - onLoading: () { - _pageIndex++; - _onRefresh(isShowLoad: false); - }, - child: (_shimmer)?ListView.builder( - padding: EdgeInsets.zero, - itemCount: 10, - scrollDirection: Axis.vertical, - shrinkWrap: true, - physics: NeverScrollableScrollPhysics(), - itemBuilder: (context, position) { - return searchGoodsItemSm(); - }, - ): - ((adminProductVoList == null || - adminProductVoList.length == 0) - ? NoDataView( - src: "assets/image/bs_no data_logo.webp", - isShowBtn: false, - text: "未搜索到相关数据", - fontSize: 16.sp, - margin: EdgeInsets.all(20.h), - ) - : Container( - margin: EdgeInsets.only(bottom:20.h), - child: ListView.builder( - padding: EdgeInsets.zero, - itemCount: adminProductVoList?.length ?? 0, - scrollDirection: Axis.vertical, - shrinkWrap: true, - physics: NeverScrollableScrollPhysics(), - itemBuilder: (context, position) { - return searchGoodsItem(adminProductVoList[position]); - }, + child: networkStatus == -1 + ? noNetwork() + : Container( + child: SmartRefresher( + controller: refreshController, + enablePullDown: true, + enablePullUp: true, + physics: BouncingScrollPhysics(), + header: MyHeader( + color: Color(0xFF30415B), + ), + footer: CustomFooter( + builder: (context, mode) { + return MyFooter(mode); + }, + ), + onRefresh: () { + _pageIndex = 1; + adminProductVoList.clear(); + _onRefresh(isShowLoad: false); + }, + onLoading: () { + _pageIndex++; + _onRefresh(isShowLoad: false); + }, + child: networkStatus == 0 + ? ListView.builder( + padding: EdgeInsets.zero, + itemCount: 10, + scrollDirection: Axis.vertical, + shrinkWrap: true, + physics: NeverScrollableScrollPhysics(), + itemBuilder: (context, position) { + return searchGoodsItemSm(); + }, + ) + : ((adminProductVoList == null || + adminProductVoList.length == 0) + ? NoDataView( + src: "assets/image/bs_no data_logo.webp", + isShowBtn: false, + text: "未搜索到相关数据", + fontSize: 16.sp, + margin: EdgeInsets.all(20.h), + ) + : Container( + margin: EdgeInsets.only(bottom: 20.h), + child: ListView.builder( + padding: EdgeInsets.zero, + itemCount: + adminProductVoList?.length ?? 0, + scrollDirection: Axis.vertical, + shrinkWrap: true, + physics: NeverScrollableScrollPhysics(), + itemBuilder: (context, position) { + return searchGoodsItem( + adminProductVoList[position]); + }, + ), + )), + ), ), - )), - ), - ), ) ], ), @@ -390,31 +396,30 @@ class _GoodsSearchPage extends State ), )), GestureDetector( - behavior: HitTestBehavior.opaque, - onTap: (){ - queryGoodsUpdate(adminProductVoList.id ?? ""); - }, - child:Container( - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.circular(33), - border: Border.all( - color: Color(0xFF30415B), - width: 1, + behavior: HitTestBehavior.opaque, + onTap: () { + queryGoodsUpdate(adminProductVoList.id ?? ""); + }, + child: Container( + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(33), + border: Border.all( + color: Color(0xFF30415B), + width: 1, + ), ), - ), - padding: - EdgeInsets.symmetric(vertical: 2.h, horizontal: 12.w), - child: Text( - widget.arguments["onSaleStatus"] == "1"?"下架":"上架", - style: TextStyle( - fontSize: 12.sp, - fontWeight: MyFontWeight.regular, - color: Color(0xFF30415B), + padding: EdgeInsets.symmetric( + vertical: 2.h, horizontal: 12.w), + child: Text( + widget.arguments["onSaleStatus"] == "1" ? "下架" : "上架", + style: TextStyle( + fontSize: 12.sp, + fontWeight: MyFontWeight.regular, + color: Color(0xFF30415B), + ), ), - ), - ) - ) + )) ], ) ], @@ -440,7 +445,7 @@ class _GoodsSearchPage extends State ), margin: EdgeInsets.only(bottom: 12.h, left: 16.w, right: 16.w), padding: - EdgeInsets.only(left: 12.w, top: 12.h, bottom: 12.h, right: 24.w), + EdgeInsets.only(left: 12.w, top: 12.h, bottom: 12.h, right: 24.w), child: Row( children: [ Shimmer.fromColors( @@ -460,86 +465,136 @@ class _GoodsSearchPage extends State ), Expanded( child: Column( - crossAxisAlignment: CrossAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Padding( + padding: EdgeInsets.only(bottom: 11.h, top: 2.h), + child: Shimmer.fromColors( + baseColor: Color(0XFFD8D8D8), + highlightColor: Color(0XFFD8D8D8), + child: Container( + decoration: BoxDecoration( + color: Color(0XFFD8D8D8), + borderRadius: BorderRadius.circular(2), + ), + width: 124.w, + height: 20.h, + ), + ), + ), + Row( children: [ - Padding( - padding: EdgeInsets.only(bottom: 11.h, top: 2.h), - child: Shimmer.fromColors( - baseColor: Color(0XFFD8D8D8), - highlightColor: Color(0XFFD8D8D8), - child: Container( - decoration: BoxDecoration( - color: Color(0XFFD8D8D8), - borderRadius: BorderRadius.circular(2), - ), - width: 124.w, - height: 20.h, + Shimmer.fromColors( + baseColor: Color(0XFFD8D8D8), + highlightColor: Color(0XFFD8D8D8), + child: Container( + decoration: BoxDecoration( + color: Color(0XFFD8D8D8), + borderRadius: BorderRadius.circular(2), ), + width: 43.w, + height: 18.h, ), ), - Row( - children: [ - Shimmer.fromColors( - baseColor: Color(0XFFD8D8D8), - highlightColor: Color(0XFFD8D8D8), - child: Container( - decoration: BoxDecoration( - color: Color(0XFFD8D8D8), - borderRadius: BorderRadius.circular(2), - ), - width: 43.w, - height: 18.h, - ), - ), - SizedBox( - width: 8.w, - ), - Shimmer.fromColors( - baseColor: Color(0XFFD8D8D8), - highlightColor: Color(0XFFD8D8D8), - child: Container( - decoration: BoxDecoration( - color: Color(0XFFD8D8D8), - borderRadius: BorderRadius.circular(2), - ), - width: 43.w, - height: 18.h, - ), + SizedBox( + width: 8.w, + ), + Shimmer.fromColors( + baseColor: Color(0XFFD8D8D8), + highlightColor: Color(0XFFD8D8D8), + child: Container( + decoration: BoxDecoration( + color: Color(0XFFD8D8D8), + borderRadius: BorderRadius.circular(2), ), - ], + width: 43.w, + height: 18.h, + ), ), - SizedBox(height: 7.h,), - Row( - children: [ - Shimmer.fromColors( - baseColor: Color(0XFFD8D8D8), - highlightColor: Color(0XFFD8D8D8), - child: Container( - decoration: BoxDecoration( - color: Color(0XFFD8D8D8), - borderRadius: BorderRadius.circular(2), - ), - width: 28.w, - height: 20.h, - ), + ], + ), + SizedBox( + height: 7.h, + ), + Row( + children: [ + Shimmer.fromColors( + baseColor: Color(0XFFD8D8D8), + highlightColor: Color(0XFFD8D8D8), + child: Container( + decoration: BoxDecoration( + color: Color(0XFFD8D8D8), + borderRadius: BorderRadius.circular(2), ), - Spacer(), - 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, - ), + width: 28.w, + height: 20.h, + ), + ), + Spacer(), + 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, + ), + ), ], - )), + ) + ], + )), + ], + ), + ); + } + + Widget noNetwork() { + return Container( + color: Colors.white, + width: double.infinity, + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Text( + networkError.substring(0, 4), + 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), + )), + ) ], ), ); diff --git a/lib/business_system/goods/off_shelf/off_shelf_page.dart b/lib/business_system/goods/off_shelf/off_shelf_page.dart index a3cd5c3f..03b16391 100644 --- a/lib/business_system/goods/off_shelf/off_shelf_page.dart +++ b/lib/business_system/goods/off_shelf/off_shelf_page.dart @@ -39,7 +39,8 @@ class _OffShelfPage extends State { int _pageIndex = 1; BusinessApiService businessService; List adminProductVoList = []; - bool _shimmer = true; + String networkError = ""; + int networkStatus = 0; @override void dispose() { @@ -59,7 +60,6 @@ class _OffShelfPage extends State { status: S.current.zhengzaijiazai, maskType: EasyLoadingMaskType.black); await queryGoodsList(); - _shimmer = false; EasyLoading.dismiss(); if (!mounted) return; if (_refreshController.isRefresh) _refreshController.refreshCompleted(); @@ -84,8 +84,9 @@ class _OffShelfPage extends State { "pageSize": 10, "status": "0" }).catchError((error) { - SmartDialog.showToast(AppUtils.dioErrorTypeToString(error.type), - alignment: Alignment.center); + networkError = AppUtils.dioErrorTypeToString(error.type); + networkStatus = -1; + setState(() {}); _refreshController.refreshFailed(); _refreshController.loadFailed(); }); @@ -98,6 +99,7 @@ class _OffShelfPage extends State { _refreshController.loadNoData(); else _refreshController.loadComplete(); + networkStatus = 1; } else { SmartDialog.showToast(baseData.msg, alignment: Alignment.center); } @@ -198,7 +200,7 @@ class _OffShelfPage extends State { ), ), Expanded( - child: Container( + child: networkStatus == -1?noNetwork():Container( child: SmartRefresher( controller: _refreshController, enablePullDown: true, @@ -223,7 +225,7 @@ class _OffShelfPage extends State { }, child: Container( color: Colors.white, - child: (_shimmer)?ListView.builder( + child: networkStatus == 0 ?ListView.builder( itemCount:10, physics: BouncingScrollPhysics(), shrinkWrap: true, @@ -675,4 +677,51 @@ class _OffShelfPage extends State { ), ); } + + Widget noNetwork() { + return Container( + color: Colors.white, + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Text( + networkError.substring(0,4), + 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), + )), + ) + ], + ), + ); + } } diff --git a/lib/business_system/goods/on_sale/batch_shelf.dart b/lib/business_system/goods/on_sale/batch_shelf.dart index f28728ea..e7ad3c79 100644 --- a/lib/business_system/goods/on_sale/batch_shelf.dart +++ b/lib/business_system/goods/on_sale/batch_shelf.dart @@ -41,7 +41,8 @@ class _BatchShelf extends State { int _loadCount = 0; int _pageIndex = 1; int groupIndex = -1; - bool _shimmer = true; + String networkError = ""; + int networkStatus = 0; @override void initState() { @@ -75,7 +76,6 @@ class _BatchShelf extends State { _loadCount += 1; if (_loadCount == 2) { _loadCount = 0; - _shimmer = false; EasyLoading.dismiss(); if (!mounted) return; if (_refreshController.isRefresh) _refreshController.refreshCompleted(); @@ -94,10 +94,6 @@ class _BatchShelf extends State { "size": 100, "sort": "sort" }).catchError((error) { - SmartDialog.showToast(AppUtils.dioErrorTypeToString(error.type), - alignment: Alignment.center); - _refreshController.refreshFailed(); - _refreshController.loadFailed(); }); if (!mounted) return; if (baseData != null && baseData.isSuccess) { @@ -126,8 +122,8 @@ class _BatchShelf extends State { "pageSize": 10, "status": "1" }).catchError((error) { - SmartDialog.showToast(AppUtils.dioErrorTypeToString(error.type), - alignment: Alignment.center); + networkError = AppUtils.dioErrorTypeToString(error.type); + networkStatus = -1; _refreshController.refreshFailed(); _refreshController.loadFailed(); }); @@ -140,6 +136,7 @@ class _BatchShelf extends State { } else { _refreshController.loadComplete(); } + networkStatus = 1; } else { SmartDialog.showToast(baseData.msg, alignment: Alignment.center); } @@ -226,7 +223,7 @@ class _BatchShelf extends State { ), ), ), - body: Row( + body: networkStatus == -1 ? noNetwork() : Row( mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start, children: [ @@ -235,7 +232,7 @@ class _BatchShelf extends State { height: double.infinity, padding: EdgeInsets.only(bottom: 70.h), color: Color(0xFFFAFAFA), - child: (_shimmer) + child:networkStatus == 0 ? ListView.builder( itemCount: 10, physics: BouncingScrollPhysics(), @@ -293,7 +290,7 @@ class _BatchShelf extends State { }, child: Container( color: Colors.white, - child: (_shimmer) + child: networkStatus == 0 ? ListView.builder( itemCount: 10, physics: BouncingScrollPhysics(), @@ -570,4 +567,52 @@ class _BatchShelf extends State { ), ); } + + Widget noNetwork() { + return Container( + color: Colors.white, + width: double.infinity, + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Text( + networkError.substring(0,4), + 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), + )), + ) + ], + ), + ); + } } diff --git a/lib/business_system/goods/on_sale/goods_assort.dart b/lib/business_system/goods/on_sale/goods_assort.dart index b3f37032..2a445db6 100644 --- a/lib/business_system/goods/on_sale/goods_assort.dart +++ b/lib/business_system/goods/on_sale/goods_assort.dart @@ -36,7 +36,8 @@ class _GoodsAssort extends State { final RefreshController refreshController = RefreshController(); BusinessApiService businessService; ProductGroupList productGroupList; - bool _shimmer = true; + String networkError = ""; + int networkStatus = 0; @override void initState() { @@ -50,7 +51,6 @@ class _GoodsAssort extends State { status: S.current.zhengzaijiazai, maskType: EasyLoadingMaskType.black); await queryProductGroupList(); - _shimmer = false; EasyLoading.dismiss(); if (refreshController.isRefresh) refreshController.refreshCompleted(); if (mounted) @@ -74,13 +74,15 @@ class _GoodsAssort extends State { "size": 100, "sort": "sort" }).catchError((error) { - SmartDialog.showToast(AppUtils.dioErrorTypeToString(error.type), - alignment: Alignment.center); + networkError = AppUtils.dioErrorTypeToString(error.type); + networkStatus = -1; + setState(() {}); refreshController.refreshFailed(); refreshController.loadFailed(); }); if (baseData != null && baseData.isSuccess) { productGroupList = baseData.data; + networkStatus = 1; } else { SmartDialog.showToast(baseData.msg, alignment: Alignment.center); } @@ -117,7 +119,7 @@ class _GoodsAssort extends State { leadingColor: Colors.black, brightness: Brightness.dark, ), - body: Container( + body: networkStatus == -1?noNetwork():Container( margin: EdgeInsets.only(top: 24.h, left: 16.w, right: 16.w), child: Column( children: [ @@ -141,7 +143,7 @@ class _GoodsAssort extends State { physics: BouncingScrollPhysics(), scrollController: ScrollController(), child: Container( - child: (_shimmer)?ListView.builder( + child: networkStatus == 0 ?ListView.builder( itemCount: 10, physics: BouncingScrollPhysics(), shrinkWrap: true, @@ -435,4 +437,52 @@ class _GoodsAssort extends State { }, ); } + + Widget noNetwork() { + return Container( + color: Colors.white, + width: double.infinity, + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Text( + networkError.substring(0,4), + 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), + )), + ) + ], + ), + ); + } } diff --git a/lib/business_system/goods/on_sale/goods_sort.dart b/lib/business_system/goods/on_sale/goods_sort.dart index 4fbd5545..fd76e256 100644 --- a/lib/business_system/goods/on_sale/goods_sort.dart +++ b/lib/business_system/goods/on_sale/goods_sort.dart @@ -42,7 +42,8 @@ class _GoodsSort extends State { int _loadCount = 0; int _pageIndex = 1; int groupIndex = -1; - bool _shimmer = true; + String networkError = ""; + int networkStatus = 0; @override void initState() { @@ -80,7 +81,6 @@ class _GoodsSort extends State { _loadCount += 1; if (_loadCount == 2) { _loadCount = 0; - _shimmer = false; EasyLoading.dismiss(); if (!mounted) return; if (_refreshController.isRefresh) _refreshController.refreshCompleted(); @@ -99,10 +99,6 @@ class _GoodsSort extends State { "size": 100, "sort": "sort" }).catchError((error) { - SmartDialog.showToast(AppUtils.dioErrorTypeToString(error.type), - alignment: Alignment.center); - _refreshController.refreshFailed(); - _refreshController.loadFailed(); }); if (!mounted) return; if (baseData != null && baseData.isSuccess) { @@ -131,8 +127,8 @@ class _GoodsSort extends State { "pageSize": 10, "status": "1" }).catchError((error) { - SmartDialog.showToast(AppUtils.dioErrorTypeToString(error.type), - alignment: Alignment.center); + networkStatus = -1; + networkError = AppUtils.dioErrorTypeToString(error.type); _refreshController.refreshFailed(); _refreshController.loadFailed(); }); @@ -145,6 +141,7 @@ class _GoodsSort extends State { } else { _refreshController.loadComplete(); } + networkStatus = 1; } else { SmartDialog.showToast(baseData.msg, alignment: Alignment.center); } @@ -200,7 +197,7 @@ class _GoodsSort extends State { leadingColor: Colors.black, brightness: Brightness.dark, ), - body: Row( + body: networkStatus == -1 ? noNetwork() : Row( mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start, children: [ @@ -209,7 +206,7 @@ class _GoodsSort extends State { height: double.infinity, padding: EdgeInsets.only(bottom: 70.h), color: Color(0xFFFAFAFA), - child: (_shimmer) + child: networkStatus == 0 ? ListView.builder( itemCount: 10, physics: BouncingScrollPhysics(), @@ -267,7 +264,7 @@ class _GoodsSort extends State { }, child: Container( color: Colors.white, - child: (_shimmer) + child: networkStatus == 0 ? ListView.builder( itemCount: 10, physics: BouncingScrollPhysics(), @@ -582,4 +579,52 @@ class _GoodsSort extends State { ), ); } + + Widget noNetwork() { + return Container( + color: Colors.white, + width: double.infinity, + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Text( + networkError.substring(0,4), + 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), + )), + ) + ], + ), + ); + } } diff --git a/lib/business_system/goods/on_sale/on_sale_page.dart b/lib/business_system/goods/on_sale/on_sale_page.dart index 2a4b2a0d..8d02b450 100644 --- a/lib/business_system/goods/on_sale/on_sale_page.dart +++ b/lib/business_system/goods/on_sale/on_sale_page.dart @@ -42,7 +42,8 @@ class _OnSalePage extends State { int _loadCount = 0; int _pageIndex = 1; int groupIndex = -1; - bool _shimmer = true; + String networkError = ""; + int networkStatus = 0; @override void dispose() { @@ -78,7 +79,6 @@ class _OnSalePage extends State { _loadCount += 1; if (_loadCount == 2) { _loadCount = 0; - _shimmer = false; EasyLoading.dismiss(); if (!mounted) return; if (_refreshController.isRefresh) _refreshController.refreshCompleted(); @@ -97,10 +97,6 @@ class _OnSalePage extends State { "size": 100, "sort": "sort" }).catchError((error) { - SmartDialog.showToast(AppUtils.dioErrorTypeToString(error.type), - alignment: Alignment.center); - _refreshController.refreshFailed(); - _refreshController.loadFailed(); }); if (!mounted) return; if (baseData != null && baseData.isSuccess) { @@ -129,8 +125,8 @@ class _OnSalePage extends State { "pageSize": 10, "status": "1" }).catchError((error) { - SmartDialog.showToast(AppUtils.dioErrorTypeToString(error.type), - alignment: Alignment.center); + networkError = AppUtils.dioErrorTypeToString(error.type); + networkStatus = -1; _refreshController.refreshFailed(); _refreshController.loadFailed(); }); @@ -144,6 +140,7 @@ class _OnSalePage extends State { } else { _refreshController.loadComplete(); } + networkStatus = 1; } else { SmartDialog.showToast(baseData.msg, alignment: Alignment.center); } @@ -207,7 +204,8 @@ class _OnSalePage extends State { width: double.infinity, ), Expanded( - child: Container( + child: networkStatus == -1 ? noNetwork() + :Container( child: Row( mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start, @@ -217,7 +215,7 @@ class _OnSalePage extends State { height: double.infinity, padding: EdgeInsets.only(bottom: 70.h), color: Color(0xFFFAFAFA), - child: (_shimmer) + child: networkStatus == 0 ? ListView.builder( itemCount: 10, physics: BouncingScrollPhysics(), @@ -276,7 +274,7 @@ class _OnSalePage extends State { }, child: Container( color: Colors.white, - child: (_shimmer) + child: networkStatus == 0 ? ListView.builder( itemCount: 10, physics: BouncingScrollPhysics(), @@ -761,4 +759,52 @@ class _OnSalePage extends State { ), ); } + + Widget noNetwork() { + return Container( + color: Colors.white, + width: double.infinity, + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Text( + networkError.substring(0,4), + 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), + )), + ) + ], + ), + ); + } } diff --git a/lib/business_system/home/flow_page.dart b/lib/business_system/home/flow_page.dart index 7678373a..391ab5a0 100644 --- a/lib/business_system/home/flow_page.dart +++ b/lib/business_system/home/flow_page.dart @@ -39,7 +39,8 @@ class _FlowPage extends State { List dayFlowList = []; int _loadCount = 0; String _datetime; - bool _shimmer = true; + String networkError = ""; + int networkStatus = 0; @override void initState() { @@ -70,7 +71,6 @@ class _FlowPage extends State { _loadCount += 1; if (_loadCount == 1) { _loadCount = 0; - _shimmer = false; EasyLoading.dismiss(); if (refreshController.isRefresh) refreshController.refreshCompleted(); if (mounted) setState(() {}); @@ -86,8 +86,8 @@ class _FlowPage extends State { try { BaseData> baseData = await businessService.dayFlow(yearMonth, isMonth).catchError((error) { - SmartDialog.showToast(AppUtils.dioErrorTypeToString(error.type), - alignment: Alignment.center); + networkStatus = -1; + networkError = AppUtils.dioErrorTypeToString(error.type); }); if (baseData != null && baseData.isSuccess) { if (isMonth == "0") { @@ -97,6 +97,7 @@ class _FlowPage extends State { .firstWhere((element) => element.localDate == yearMonth) .detailList = baseData.data; } + networkStatus = 1; } } finally { if (isSing) { @@ -119,7 +120,7 @@ class _FlowPage extends State { leadingColor: Colors.black, brightness: Brightness.dark, ), - body: SmartRefresher( + body: networkStatus == -1 ? noNetwork():SmartRefresher( controller: refreshController, enablePullDown: true, enablePullUp: false, @@ -168,7 +169,7 @@ class _FlowPage extends State { SizedBox( height: 16.h, ), - if(!_shimmer) + if(networkStatus == 1) (dayFlowList == null || dayFlowList.length == 0) ? NoDataView( src: "assets/image/bs_no data_logo.webp", @@ -190,7 +191,7 @@ class _FlowPage extends State { ); }, ), - if(_shimmer) + if(networkStatus == 0) ListView.builder( padding: EdgeInsets.zero, itemCount: 10, @@ -436,4 +437,52 @@ class _FlowPage extends State { queryDayFlow(_datetime + "-01", "0"); } } + + Widget noNetwork() { + return Container( + color: Colors.white, + width: double.infinity, + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Text( + networkError.substring(0,4), + 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), + )), + ) + ], + ), + ); + } } diff --git a/lib/business_system/home/overview/trade_goods.dart b/lib/business_system/home/overview/trade_goods.dart index c30f96b9..2ee1c981 100644 --- a/lib/business_system/home/overview/trade_goods.dart +++ b/lib/business_system/home/overview/trade_goods.dart @@ -50,7 +50,8 @@ class _TradeGoods extends State { BusinessApiService businessService; List singleSalesList = []; List goodsTypeSalesList = []; - bool _shimmer = true; + String networkError = ""; + int networkStatus = 0; @override void dispose() { @@ -176,7 +177,6 @@ class _TradeGoods extends State { _loadCount += 1; if (_loadCount == 2) { _loadCount = 0; - _shimmer = false; EasyLoading.dismiss(); if (_refreshController.isRefresh) _refreshController.refreshCompleted(); if (mounted) setState(() {}); @@ -199,11 +199,12 @@ class _TradeGoods extends State { "searchType": 2, "type": 1 }).catchError((error) { - SmartDialog.showToast(AppUtils.dioErrorTypeToString(error.type), - alignment: Alignment.center); + networkError = AppUtils.dioErrorTypeToString(error.type); + networkStatus = -1; }); if (baseData != null && baseData.isSuccess) { goodsTypeSalesList = baseData.data; + networkStatus = 1; } } finally { if (isSing) { @@ -273,7 +274,7 @@ class _TradeGoods extends State { onRefresh:(){ _onRefresh(isLoading: false); }, - child: SingleChildScrollView( + child: networkStatus == -1 ? noNetwork() : SingleChildScrollView( physics: NeverScrollableScrollPhysics(), child: Column( crossAxisAlignment: CrossAxisAlignment.start, @@ -768,7 +769,7 @@ class _TradeGoods extends State { ], ), ), - if(!_shimmer) + if(networkStatus == 1) (goodsTypeSalesList == null || goodsTypeSalesList.length == 0) ? NoDataView( src: "assets/image/bs_no data_logo.webp", @@ -794,7 +795,7 @@ class _TradeGoods extends State { }, ), ), - if(_shimmer) + if(networkStatus == 0) ListView.builder( padding: EdgeInsets.zero, itemCount: 9, @@ -1098,4 +1099,51 @@ class _TradeGoods extends State { ), ); } + + Widget noNetwork() { + return Container( + color: Colors.white, + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Text( + networkError.substring(0,4), + 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), + )), + ) + ], + ), + ); + } } diff --git a/lib/business_system/mine/business_mine_page.dart b/lib/business_system/mine/business_mine_page.dart index d0312cfb..a73a9d90 100644 --- a/lib/business_system/mine/business_mine_page.dart +++ b/lib/business_system/mine/business_mine_page.dart @@ -34,6 +34,7 @@ class _BusinessMinePage extends State BusinessApiService businessService; List records = []; double visiblePercentage; + int networkStatus = 0; @override void initState() { @@ -63,6 +64,7 @@ class _BusinessMinePage extends State .catchError((error) { SmartDialog.showToast(AppUtils.dioErrorTypeToString(error.type), alignment: Alignment.center); + networkStatus = -1; refreshController.refreshFailed(); refreshController.loadFailed(); }); @@ -70,6 +72,7 @@ class _BusinessMinePage extends State if (baseData != null && baseData.isSuccess) { records = baseData.data.records ?? []; refreshController.refreshCompleted(); + networkStatus = 1; // EasyLoading.dismiss(); } else { SmartDialog.showToast(baseData.msg, alignment: Alignment.center); @@ -262,7 +265,11 @@ class _BusinessMinePage extends State GestureDetector( behavior: HitTestBehavior.opaque, onTap: () { - if (widget.businessLoginInfo.storeList.length > 1) { + if(networkStatus == -1){ + queryStoreList(); + return; + } + else if (widget.businessLoginInfo.storeList.length > 1) { Navigator.of(context).pushNamed('/router/select_shop', arguments: {"routeSource": "门店设置", "records": records}); } else { diff --git a/lib/business_system/order/business_order_detail.dart b/lib/business_system/order/business_order_detail.dart index 0eaf5eda..0e46f8cc 100644 --- a/lib/business_system/order/business_order_detail.dart +++ b/lib/business_system/order/business_order_detail.dart @@ -33,7 +33,8 @@ class _BusinessOrderDetail extends State { final RefreshController refreshController = RefreshController(); BusinessApiService businessService; BusinessOrderDetailInfo orderDetailInfo; - bool _shimmer = true; + String networkError = ""; + int networkStatus = 0; @override void initState() { @@ -62,16 +63,14 @@ class _BusinessOrderDetail extends State { BaseData baseData = await businessService.getAdminOrderDetail({ "id": widget.arguments["id"], }).catchError((error) { - SmartDialog.showToast(AppUtils.dioErrorTypeToString(error.type), - alignment: Alignment.center); + networkError = AppUtils.dioErrorTypeToString(error.type); + networkStatus = -1; }); if (baseData != null && baseData.isSuccess) { orderDetailInfo = baseData.data; - } else { - SmartDialog.showToast(baseData?.msg ?? "", alignment: Alignment.center); + networkStatus = 1; } } finally { - _shimmer = false; EasyLoading.dismiss(); if (refreshController.isRefresh) refreshController.refreshCompleted(); setState(() {}); @@ -89,7 +88,7 @@ class _BusinessOrderDetail extends State { leadingColor: Colors.black, brightness: Brightness.dark, ), - body: SmartRefresher( + body: networkStatus == -1 ? noNetwork():SmartRefresher( controller: refreshController, enablePullDown: true, enablePullUp: false, @@ -109,7 +108,7 @@ class _BusinessOrderDetail extends State { child: Container( margin: EdgeInsets.only(top: 16.h, left: 16.w, right: 16.w), child: Column( - children: [goodsInfo(), (_shimmer)?orderInfoSm():orderInfo()], + children: [goodsInfo(), (networkStatus == 0)?orderInfoSm():orderInfo()], ), ), ), @@ -165,7 +164,7 @@ class _BusinessOrderDetail extends State { SizedBox( height: 12.h, ), - (_shimmer)?ListView.builder( + networkStatus == 0?ListView.builder( padding: EdgeInsets.zero, itemCount: 3, scrollDirection: Axis.vertical, @@ -795,4 +794,52 @@ class _BusinessOrderDetail extends State { } } } + + Widget noNetwork() { + return Container( + color: Colors.white, + width: double.infinity, + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Text( + networkError.substring(0,4), + 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: () { + queryOrderDetail(); + }, + 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), + )), + ) + ], + ), + ); + } } diff --git a/lib/business_system/order/order_list.dart b/lib/business_system/order/order_list.dart index 2e6f3b88..c3664894 100644 --- a/lib/business_system/order/order_list.dart +++ b/lib/business_system/order/order_list.dart @@ -42,7 +42,8 @@ class _OrderList extends State { BusinessApiService businessService; List adminOrderDTOList = []; int _pageIndex = 1; - bool _shimmer = true; + String networkError = ""; + int networkStatus = 0; @override void dispose() { @@ -62,7 +63,6 @@ class _OrderList extends State { status: S.current.zhengzaijiazai, maskType: EasyLoadingMaskType.black); await queryOrderList(isRefreshData: false); - _shimmer = false; EasyLoading.dismiss(); if (!mounted) return; if (_refreshController.isRefresh) _refreshController.refreshCompleted(); @@ -103,8 +103,9 @@ class _OrderList extends State { "showCancelOrder": 1, "orderType": "" }).catchError((error) { - SmartDialog.showToast(AppUtils.dioErrorTypeToString(error.type), - alignment: Alignment.center); + networkError = AppUtils.dioErrorTypeToString(error.type); + networkStatus = -1; + setState(() {}); _refreshController.refreshFailed(); _refreshController.loadFailed(); }); @@ -124,6 +125,7 @@ class _OrderList extends State { break; } } + networkStatus = 1; } else { SmartDialog.showToast(baseData.msg, alignment: Alignment.center); } @@ -154,53 +156,56 @@ class _OrderList extends State { _pageIndex++; _onRefresh(isShowLoad: false); }, - child: (_shimmer) - ? ListView.builder( - padding: EdgeInsets.zero, - itemCount: 10, - scrollDirection: Axis.vertical, - shrinkWrap: true, - physics: BouncingScrollPhysics(), - itemBuilder: (context, position) { - return orderItemSm(); - }, - ) - : ((adminOrderDTOList == null || adminOrderDTOList.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), + child: networkStatus == -1 + ? noNetwork() + : ((networkStatus==0) + ? ListView.builder( + padding: EdgeInsets.zero, + itemCount: 10, + scrollDirection: Axis.vertical, + shrinkWrap: true, + physics: BouncingScrollPhysics(), + itemBuilder: (context, position) { + return orderItemSm(); + }, ) - : Padding( - padding: EdgeInsets.only(top: 16.h), - child: ListView.builder( - itemCount: adminOrderDTOList?.length ?? 0, - physics: BouncingScrollPhysics(), - shrinkWrap: true, - itemBuilder: (context, position) { - return GestureDetector( - behavior: HitTestBehavior.opaque, - onTap: () { - if (widget.isKeyBoardShow) { - FocusScope.of(context).requestFocus(FocusNode()); - return; - } else { - Navigator.of(context).pushNamed( - '/router/business_order_detail', - arguments: { - "id": adminOrderDTOList[position].id, - "storeId": widget.storeId - }); - } + : ((adminOrderDTOList == null || adminOrderDTOList.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: adminOrderDTOList?.length ?? 0, + physics: BouncingScrollPhysics(), + shrinkWrap: true, + itemBuilder: (context, position) { + return GestureDetector( + behavior: HitTestBehavior.opaque, + onTap: () { + if (widget.isKeyBoardShow) { + FocusScope.of(context) + .requestFocus(FocusNode()); + return; + } else { + Navigator.of(context).pushNamed( + '/router/business_order_detail', + arguments: { + "id": adminOrderDTOList[position].id, + "storeId": widget.storeId + }); + } + }, + child: orderItem(adminOrderDTOList[position]), + ); }, - child: orderItem(adminOrderDTOList[position]), - ); - }, - ), - )), + ), + ))), ); } @@ -347,7 +352,8 @@ class _OrderList extends State { "userName": adminOrderDtoList?.name ?? "", "ticketStatus": adminOrderDtoList?.ticketStatus, }).then((value) async { - queryOrderList(queryId: adminOrderDtoList.orderCode); + queryOrderList( + queryId: adminOrderDtoList.orderCode); }); }, child: Container( @@ -372,7 +378,7 @@ class _OrderList extends State { ), ), if (adminOrderDtoList.payStatus == 1 && - adminOrderDtoList.refundStatus == 0) + adminOrderDtoList.refundStatus == 0 && adminOrderDtoList.enableRefundApprover == false) GestureDetector( behavior: HitTestBehavior.opaque, onTap: () { @@ -410,6 +416,15 @@ class _OrderList extends State { ), ), ], + ), + if(adminOrderDtoList.payStatus == 1 && + adminOrderDtoList.refundStatus == 0 && adminOrderDtoList.enableRefundApprover == true) + Text( + "备注:暂无退款权限,请前往企业微信联系退款审核人员进行审批", + style: TextStyle( + fontSize: 12.sp, + color: Colors.red, + fontWeight: MyFontWeight.regular), ) ], ), @@ -694,4 +709,52 @@ class _OrderList extends State { ), ); } + + Widget noNetwork() { + return Container( + color: Colors.white, + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Text( + // "无法连接到网络", + networkError.substring(0,4), + 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), + )), + ) + ], + ), + ); + } } diff --git a/lib/retrofit/data/business_order_list.dart b/lib/retrofit/data/business_order_list.dart index 136119b2..bc571a33 100644 --- a/lib/retrofit/data/business_order_list.dart +++ b/lib/retrofit/data/business_order_list.dart @@ -88,7 +88,8 @@ class AdminOrderDtoList { AdminOrderDtoList({ String id, String orderCode, - String storeName, + String storeName, + bool enableRefundApprover, num productCount, num orderStatus, String orderSum, @@ -133,6 +134,7 @@ class AdminOrderDtoList { _id = id; _orderCode = orderCode; _storeName = storeName; + _enableRefundApprover = enableRefundApprover; _productCount = productCount; _orderStatus = orderStatus; _orderSum = orderSum; @@ -180,6 +182,7 @@ class AdminOrderDtoList { _id = json['id']; _orderCode = json['orderCode']; _storeName = json['storeName']; + _enableRefundApprover = json['enableRefundApprover']; _productCount = json['productCount']; _orderStatus = json['orderStatus']; _orderSum = json['orderSum']; @@ -235,6 +238,7 @@ class AdminOrderDtoList { String _id; String _orderCode; String _storeName; + bool _enableRefundApprover; num _productCount; num _orderStatus; String _orderSum; @@ -279,6 +283,7 @@ class AdminOrderDtoList { AdminOrderDtoList copyWith({ String id, String orderCode, String storeName, + bool enableRefundApprover, num productCount, num orderStatus, String orderSum, @@ -323,6 +328,7 @@ AdminOrderDtoList copyWith({ String id, }) => AdminOrderDtoList( id: id ?? _id, orderCode: orderCode ?? _orderCode, storeName: storeName ?? _storeName, + enableRefundApprover: enableRefundApprover ?? _enableRefundApprover, productCount: productCount ?? _productCount, orderStatus: orderStatus ?? _orderStatus, orderSum: orderSum ?? _orderSum, @@ -368,6 +374,7 @@ AdminOrderDtoList copyWith({ String id, String get id => _id; String get orderCode => _orderCode; String get storeName => _storeName; + bool get enableRefundApprover => _enableRefundApprover; num get productCount => _productCount; num get orderStatus => _orderStatus; String get orderSum => _orderSum; @@ -415,6 +422,7 @@ AdminOrderDtoList copyWith({ String id, map['id'] = _id; map['orderCode'] = _orderCode; map['storeName'] = _storeName; + map['enableRefundApprover'] = _enableRefundApprover; map['productCount'] = _productCount; map['orderStatus'] = _orderStatus; map['orderSum'] = _orderSum;